shareAlert.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template name="alert">
  2. <view class="alert spec" :class="specClass">
  3. <!-- 运费弹窗说明 -->
  4. <view class="freight-alert" @click.stop="hideConfirm">
  5. <view class="content clearfix">
  6. <view class="text-content">
  7. <view class="text-t">分享码</view>
  8. <view class="text-c">{{shareCode}} <text class="clipboard" @click.stop="clipboard(shareCode)">复制</text></view>
  9. <view class="text-h1">有效期为72小时,分享后对方需要输入分享码才能查看订单。</view>
  10. </view>
  11. <view class="text-btn">
  12. <!-- #ifdef MP-WEIXIN -->
  13. <button class="btn" open-type="share" @click="btnConfirm(shareCode)">去分享</button>
  14. <!-- #endif -->
  15. <view class="btn-none" @click.stop="hideConfirm(shareCode)">取消</view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. const thorui = require("@/components/clipboard/clipboard.thorui.js")
  23. export default{
  24. name:'alert',
  25. props:{
  26. shopOrderID:{
  27. type:Number
  28. }
  29. },
  30. data() {
  31. return{
  32. shareCode:'',
  33. }
  34. },
  35. created() {
  36. this.getShareCode(this.shopOrderID)
  37. },
  38. onLoad(){
  39. },
  40. methods:{
  41. getShareCode(data){
  42. this.ShopService.ShopOrderShareCode({shopOrderId:data}).then(response =>{
  43. this.shareCode = response.data
  44. this.$parent.shareCode = this.shareCode;
  45. }).catch(error =>{
  46. this.$parent.isShareModal = false;
  47. this.$util.modal('提示',error.msg,'确定','',false,() =>{})
  48. })
  49. },
  50. clipboard(data) {
  51. thorui.getClipboardData(data, (res) => {
  52. if (res) {
  53. this.$util.msg("复制成功",2000,true,'success');
  54. } else {
  55. this.$util.msg("复制失败",2000,true,'none');
  56. }
  57. })
  58. },
  59. hideConfirm(){
  60. this.$parent.isShareModal = false
  61. },
  62. btnConfirm(code){//点击事件
  63. this.$emit('btnConfirm')
  64. }
  65. },
  66. onShow(){
  67. }
  68. }
  69. </script>
  70. <style lang="scss">
  71. /*弹窗*/
  72. .model-warp.none{
  73. display: none;
  74. }
  75. .model-warp.show{
  76. display: block;
  77. }
  78. .freight-alert{
  79. width: 100%;
  80. height: 100%;
  81. background: rgba(0,0,0,.5);
  82. position: fixed;
  83. top: 0;
  84. left: 0;
  85. z-index: 8888;
  86. transition: all 0.4s;
  87. &.none{
  88. display: none;
  89. }
  90. &.show{
  91. display: block;
  92. }
  93. .content{
  94. width: 580rpx;
  95. height: 630rpx;
  96. position: absolute;
  97. background: url(https://static-b.caimei365.com/app/wisa/img/icon/dd_pop.png) no-repeat;
  98. background-size: cover;
  99. left: 0;
  100. right: 0;
  101. bottom: 0;
  102. top: 0;
  103. margin: auto;
  104. padding:0 24rpx 20rpx 24rpx;
  105. box-sizing: border-box;
  106. border-radius: 12rpx;
  107. .text-content{
  108. width: 100%;
  109. height: auto;
  110. margin-top: 210rpx;
  111. .text-t{
  112. font-size: $font-size-28;
  113. color: $text-color;
  114. text-align: center;
  115. line-height: 44rpx;
  116. }
  117. .text-c{
  118. font-size: $font-size-44;
  119. color: #16E17C;
  120. text-align: center;
  121. line-height: 80rpx;
  122. position: relative;
  123. .clipboard{
  124. width: 84rpx;
  125. height: 36rpx;
  126. background: #EFEFEF;
  127. text-align: center;
  128. font-size: $font-size-24;
  129. color: #999999;
  130. border-radius: 4rpx;
  131. line-height: 36rpx;
  132. display: inline-block;
  133. position: absolute;
  134. top: 29%;
  135. right: 18%;
  136. }
  137. }
  138. .text-h1{
  139. line-height: 40rpx;
  140. font-size: $font-size-28;
  141. color: $text-color;
  142. text-align: justify;
  143. }
  144. }
  145. .text-btn{
  146. width: 100%;
  147. height: auto;
  148. margin-top: 40rpx;
  149. .btn{
  150. width: 80%;
  151. height: 70rpx;
  152. margin: 0 auto;
  153. background: $btn-confirm;
  154. line-height: 70rpx;
  155. font-size: $font-size-28;
  156. text-align: center;
  157. color: #FFFFFF;
  158. border-radius: 35rpx;
  159. padding: 0;
  160. }
  161. .btn-none{
  162. width: 100%;
  163. height: 70rpx;
  164. float: left;
  165. line-height: 70rpx;
  166. font-size: $font-size-28;
  167. text-align: center;
  168. color: #666666;
  169. padding: 0;
  170. }
  171. }
  172. }
  173. }
  174. </style>