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="text-content">
  6. <view class="title">分享订单</view>
  7. <view class="share">您的分享码:<text class="txt">{{shareCode}}</text></view>
  8. <view class="text">
  9. <text>有效期为24小时。分享订单后后请将该分享码也一并告知被分享者,被分享者需要输入该分享码才能查看本订单。</text>
  10. </view>
  11. </view>
  12. <view class="alert-btn">
  13. <view class="btn btn-cancel" @click="hideConfirm">取消</view>
  14. <!-- #ifdef MP-WEIXIN -->
  15. <button class="btn btn-confirm" open-type="share" @click="btnConfirm(shareCode)">去分享</button>
  16. <!-- #endif -->
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default{
  24. name:'sharealert',
  25. props:{
  26. orderID:{
  27. type:Number
  28. }
  29. },
  30. data() {
  31. return{
  32. shareCode:'',
  33. }
  34. },
  35. created() {
  36. this.getShareCode(this.orderID)
  37. },
  38. methods:{
  39. getShareCode(res){
  40. this.$api.get('/order/share',{orderID:res},
  41. response => {
  42. if(response.code === '1'){
  43. // console.log( response.data)
  44. this.shareCode = response.data
  45. this.$parent.shareCode = this.shareCode;
  46. }else{
  47. this.$parent.isShareModal = false;
  48. this.$util.modal('提示',response.msg,false,() =>{
  49. this.$api.switchTabTo('/pages/tabBar/home/home');
  50. })
  51. }
  52. }
  53. )
  54. },
  55. hideConfirm(){
  56. this.$parent.isShareModal = false
  57. },
  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: 418rpx;
  91. position: absolute;
  92. background: $bg-color;
  93. left: 0;
  94. right: 0;
  95. bottom: 0;
  96. top: 0;
  97. margin: auto;
  98. .text-content{
  99. width: 448rpx;
  100. height: 264rpx;
  101. padding: 35rpx;
  102. float: left;
  103. .title{
  104. line-height: 40rpx;
  105. font-size: $font-size-28;
  106. color: $text-color;
  107. text-align: center;
  108. font-weight: bold;
  109. margin-bottom: 36rpx;
  110. }
  111. .share{
  112. line-height: 36rpx;
  113. font-size: $font-size-26;
  114. color: $text-color;
  115. text-align: justify;
  116. margin-top: 22rpx;
  117. font-weight: normal;
  118. .txt{
  119. margin-left: 10rpx;
  120. color: #FF2A2A;
  121. }
  122. }
  123. .text{
  124. line-height: 36rpx;
  125. font-size: $font-size-26;
  126. color: $text-color;
  127. text-align: justify;
  128. margin-top: 22rpx;
  129. }
  130. }
  131. .alert-btn{
  132. width: 100%;
  133. height: 88rpx;
  134. display: flex;
  135. .btn{
  136. flex: 1;
  137. line-height: 88rpx;
  138. font-size: $font-size-28;
  139. text-align: center;
  140. color: #FFFFFF;
  141. border-radius: 0;
  142. padding: 0;
  143. &.btn-cancel{
  144. background: $btn-cancel;
  145. }
  146. &.btn-confirm{
  147. background: $btn-confirm;
  148. }
  149. }
  150. }
  151. }
  152. }
  153. </style>