cm-share-popup.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template name="sharealert">
  2. <view class="alert spec" :class="specClass">
  3. <view class="model-warp">
  4. <view class="content">
  5. <view class="text-content">
  6. <view class="title">分享订单</view>
  7. <view class="share">您的分享码:<text class="txt">{{shareCode}}</text></view>
  8. <view class="text" v-if="shareType == 1">
  9. <text>有效期为72小时。订单分享后客户可无需登录直接线上支付订单,也支持客户使用账号密码登录或直接输入分享码的方式查看订单。</text>
  10. </view>
  11. <view class="text" v-if="shareType == 2">
  12. <text>有效期为72小时。订单分享后若对方无法直接登录小程序查看订单,请提供该分享码给对方,通过输入分享码查看。</text>
  13. </view>
  14. </view>
  15. <view class="alert-btn">
  16. <view class="btn btn-cancel" @click="hideConfirm">取消</view>
  17. <!-- #ifdef MP-WEIXIN -->
  18. <button class="btn btn-confirm" open-type="share" @click="btnConfirm(shareCode)">去分享</button>
  19. <!-- #endif -->
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default{
  27. name:'sharealert',
  28. props:{
  29. shopOrderId:{
  30. type:Number
  31. },
  32. shareType:{
  33. type:Number
  34. }
  35. },
  36. data() {
  37. return{
  38. shareCode:'',
  39. }
  40. },
  41. created() {
  42. this.getShareCode(this.shopOrderId)
  43. },
  44. methods:{
  45. //获取订单分享码
  46. async getShareCode(shopOrderId){
  47. try{
  48. const res = await this.OrderService.QueryOrderShareCode({shopOrderId:shopOrderId})
  49. this.shareCode = res.data
  50. this.$parent.shareCode = this.shareCode;
  51. }catch(error){
  52. this.$parent.isShareModal = false;
  53. this.$util.msg(error.msg, 2000)
  54. }
  55. },
  56. hideConfirm(){
  57. this.$parent.isShareModal = false
  58. },
  59. btnConfirm(code){//点击事件
  60. this.$emit('btnConfirm')
  61. }
  62. }
  63. }
  64. </script>
  65. <style lang="scss">
  66. /*弹窗*/
  67. .model-warp.none{
  68. display: none;
  69. }
  70. .model-warp.show{
  71. display: block;
  72. }
  73. .model-warp{
  74. width: 100%;
  75. height: 100%;
  76. background: rgba(0,0,0,0.3);
  77. position: fixed;
  78. top: 0;
  79. left: 0;
  80. z-index: 10000;
  81. transition: all 0.4s;
  82. &.none{
  83. display: none;
  84. }
  85. &.show{
  86. display: block;
  87. }
  88. .content{
  89. width: 518rpx;
  90. height: 428rpx;
  91. position: absolute;
  92. background: $bg-color;
  93. left: 0;
  94. right: 0;
  95. bottom: 0;
  96. top: 0;
  97. margin: auto;
  98. border-radius: 14rpx;
  99. .text-content{
  100. width: 448rpx;
  101. height: 284rpx;
  102. padding: 20rpx 35rpx;
  103. float: left;
  104. .title{
  105. line-height: 40rpx;
  106. font-size: $font-size-28;
  107. color: $text-color;
  108. text-align: center;
  109. font-weight: bold;
  110. margin-bottom: 36rpx;
  111. }
  112. .share{
  113. line-height: 36rpx;
  114. font-size: $font-size-26;
  115. color: $text-color;
  116. text-align: justify;
  117. margin-top: 22rpx;
  118. font-weight: normal;
  119. .txt{
  120. margin-left: 10rpx;
  121. color: #FF2A2A;
  122. }
  123. }
  124. .text{
  125. line-height: 36rpx;
  126. font-size: $font-size-26;
  127. color: $text-color;
  128. text-align: justify;
  129. margin-top: 22rpx;
  130. }
  131. }
  132. .alert-btn{
  133. width: 80%;
  134. height: 70rpx;
  135. display: flex;
  136. margin: 0 auto;
  137. .btn{
  138. flex: 1;
  139. line-height: 70rpx;
  140. font-size: $font-size-28;
  141. text-align: center;
  142. color: #FFFFFF;
  143. border-radius: 35rpx;
  144. padding: 0;
  145. margin: 0 15rpx;
  146. &.btn-cancel{
  147. background: $btn-cancel;
  148. }
  149. &.btn-confirm{
  150. background: $btn-confirm;
  151. }
  152. }
  153. }
  154. }
  155. }
  156. </style>