shareAlert.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. this.getShareCode(this.orderId)
  40. },
  41. methods:{
  42. getShareCode(res){
  43. this.OrderService.QueryOrderShareCode({orderId:res}).then(response =>{
  44. this.shareCode = response.data
  45. this.$parent.shareCode = this.shareCode;
  46. }).catch(error =>{
  47. this.$parent.isShareModal = false;
  48. this.$util.modal('提示',error.msg,'确定','',false,() =>{})
  49. })
  50. },
  51. hideConfirm(){
  52. this.$parent.isShareModal = false
  53. },
  54. btnConfirm(code){//点击事件
  55. this.$emit('btnConfirm')
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss">
  61. /*弹窗*/
  62. .model-warp.none{
  63. display: none;
  64. }
  65. .model-warp.show{
  66. display: block;
  67. }
  68. .model-warp{
  69. width: 100%;
  70. height: 100%;
  71. background: rgba(0,0,0,0.3);
  72. position: fixed;
  73. top: 0;
  74. left: 0;
  75. z-index: 10000;
  76. transition: all 0.4s;
  77. &.none{
  78. display: none;
  79. }
  80. &.show{
  81. display: block;
  82. }
  83. .content{
  84. width: 580rpx;
  85. height: 540rpx;
  86. position: absolute;
  87. background: $bg-color;
  88. left: 0;
  89. right: 0;
  90. bottom: 0;
  91. top: 0;
  92. margin: auto;
  93. border-radius: 24rpx;
  94. .title-image{
  95. width: 580rpx;
  96. height: 210rpx;
  97. image{
  98. width: 580rpx;
  99. height: 210rpx;
  100. display: block;
  101. }
  102. }
  103. .text-content{
  104. width: 580rpx;
  105. height: auto;
  106. padding: 20rpx 35rpx;
  107. box-sizing: border-box;
  108. .share{
  109. line-height: 36rpx;
  110. font-size: $font-size-26;
  111. color: $text-color;
  112. text-align: justify;
  113. margin-top: 22rpx;
  114. font-weight: normal;
  115. .txt{
  116. margin-left: 10rpx;
  117. color: #FF2A2A;
  118. }
  119. }
  120. .text{
  121. line-height: 36rpx;
  122. font-size: $font-size-26;
  123. color: $text-color;
  124. text-align: justify;
  125. margin-top: 22rpx;
  126. }
  127. }
  128. .alert-btn{
  129. width: 80%;
  130. height: 70rpx;
  131. display: flex;
  132. margin: 15rpx auto;
  133. .btn{
  134. flex: 1;
  135. line-height: 70rpx;
  136. font-size: $font-size-28;
  137. text-align: center;
  138. color: #FFFFFF;
  139. border-radius: 35rpx;
  140. padding: 0;
  141. margin: 0 15rpx;
  142. &.btn-cancel{
  143. background: $btn-cancel;
  144. }
  145. &.btn-confirm{
  146. background: $btn-confirm;
  147. }
  148. }
  149. }
  150. }
  151. }
  152. </style>