shareAlert.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template name="sharealert">
  2. <view class="alert spec" :class="specClass">
  3. <view class="model-warp">
  4. <view class="content">
  5. <view class="title-image">
  6. <image :src="staticUrl + 'icon_share_modal@2x.png'" mode=""></image>
  7. </view>
  8. <view class="text-content">
  9. <view class="share">您的分享码:<text class="txt">{{shareCode}}</text></view>
  10. <view class="text">
  11. <text>有效期为24小时。需要输入该分享码才能查看本订单</text>
  12. </view>
  13. </view>
  14. <view class="alert-btn">
  15. <view class="btn btn-cancel" @click="hideConfirm">取消</view>
  16. <!-- #ifdef MP-WEIXIN -->
  17. <button class="btn btn-confirm" open-type="share" @click="btnConfirm(shareCode)">去分享</button>
  18. <!-- #endif -->
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default{
  26. name:'sharealert',
  27. props:{
  28. orderId:{
  29. type:Number
  30. }
  31. },
  32. data() {
  33. return{
  34. shareCode:'',
  35. staticUrl: this.global.staticUrl,
  36. }
  37. },
  38. created() {
  39. console.log(this.orderId, '分享弹窗shopOrderId')
  40. this.getShareCode(this.orderId)
  41. },
  42. methods:{
  43. getShareCode(res){
  44. this.OrderService.QueryOrderShareCode({shopOrderId:res}).then(response =>{
  45. this.shareCode = response.data
  46. this.$parent.shareCode = this.shareCode
  47. }).catch(error =>{
  48. this.$parent.isShareModal = false
  49. this.$util.modal('提示',error.msg,'确定','',false,() =>{})
  50. })
  51. },
  52. hideConfirm(){
  53. this.$parent.isShareModal = false
  54. },
  55. btnConfirm(code){//点击事件
  56. this.$emit('btnConfirm')
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss">
  62. /*弹窗*/
  63. .model-warp.none{
  64. display: none;
  65. }
  66. .model-warp.show{
  67. display: block;
  68. }
  69. .model-warp{
  70. width: 100%;
  71. height: 100%;
  72. background: rgba(0,0,0,0.3);
  73. position: fixed;
  74. top: 0;
  75. left: 0;
  76. z-index: 10000;
  77. transition: all 0.4s;
  78. &.none{
  79. display: none;
  80. }
  81. &.show{
  82. display: block;
  83. }
  84. .content{
  85. width: 580rpx;
  86. height: 540rpx;
  87. position: absolute;
  88. background: $bg-color;
  89. left: 0;
  90. right: 0;
  91. bottom: 0;
  92. top: 0;
  93. margin: auto;
  94. border-radius: 24rpx;
  95. .title-image{
  96. width: 580rpx;
  97. height: 210rpx;
  98. image{
  99. width: 580rpx;
  100. height: 210rpx;
  101. display: block;
  102. }
  103. }
  104. .text-content{
  105. width: 580rpx;
  106. height: auto;
  107. padding: 20rpx 35rpx;
  108. box-sizing: border-box;
  109. .share{
  110. line-height: 36rpx;
  111. font-size: $font-size-26;
  112. color: $text-color;
  113. text-align: justify;
  114. margin-top: 22rpx;
  115. font-weight: normal;
  116. .txt{
  117. margin-left: 10rpx;
  118. color: #FF2A2A;
  119. }
  120. }
  121. .text{
  122. line-height: 36rpx;
  123. font-size: $font-size-26;
  124. color: $text-color;
  125. text-align: justify;
  126. margin-top: 22rpx;
  127. }
  128. }
  129. .alert-btn{
  130. width: 80%;
  131. height: 70rpx;
  132. display: flex;
  133. margin: 15rpx auto;
  134. .btn{
  135. flex: 1;
  136. line-height: 70rpx;
  137. font-size: $font-size-28;
  138. text-align: center;
  139. color: #FFFFFF;
  140. border-radius: 35rpx;
  141. padding: 0;
  142. margin: 0 15rpx;
  143. &.btn-cancel{
  144. background: $btn-cancel;
  145. }
  146. &.btn-confirm{
  147. background: $btn-confirm;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. </style>