cm-coupon-chang.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template name="alert">
  2. <view class="alert spec" :class="specClass">
  3. <!-- 运费弹窗说明 -->
  4. <view class="coupon-popup">
  5. <view class="content">
  6. <view class="title">
  7. <text>兑换优惠券</text>
  8. <text class="iconfont icon-iconfontguanbi" @click.stop="hidePopup"></text>
  9. </view>
  10. <view class="text-content">
  11. <view class="coupon-input">
  12. <input class="input" type="text" v-model="params.redemptionCode" maxlength="16" placeholder="请输入16位兑换码"/>
  13. </view>
  14. <view class="coupon-main">
  15. <view class="coupon-button" @click="exchangeConfirm">立即兑换</view>
  16. <view class="coupon-text">
  17. <view class="coupon-h1">注意事项:</view>
  18. <view class="coupon-h2">1. 兑换码获取:可通过采美线下发放或者销售顾问</view>
  19. <view class="coupon-h2 indet">线上发放获得优惠券兑换码,兑换码由16位数字</view>
  20. <view class="coupon-h2 indet">和字母组成。</view>
  21. <view class="coupon-h2">2. 兑换码使用:在当前页面输入兑换码即可兑换相</view>
  22. <view class="coupon-h2 indet">应优惠券一个兑换码只能兑换一张优惠券,</view>
  23. <view class="coupon-h2 indet">不可重复使用。</view>
  24. <view class="coupon-h2">3. 输入兑换码时请区分字母大小写。</view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default{
  34. name:'alert',
  35. props:{},
  36. data() {
  37. return{
  38. params:{
  39. userId:0,
  40. redemptionCode:'',
  41. source:2,
  42. },
  43. }
  44. },
  45. created() {
  46. this.$api.getComStorage('userInfo').then((resolve) =>{
  47. this.params.userId = resolve.userId ? resolve.userId : 0
  48. }).catch(error =>{
  49. console.log('暂无用户信息~')
  50. })
  51. },
  52. onLoad(){
  53. },
  54. methods:{
  55. exchangeConfirm(){// 立即兑换
  56. if( this.params.redemptionCode == ''){
  57. this.$util.msg('请输入位兑换码',2000)
  58. return
  59. }
  60. this.ExchangeCoupon(this.params)
  61. },
  62. async ExchangeCoupon(param){// 兑换优惠券
  63. try{
  64. const res = await this.ProductService.ExchangeCoupon(param)
  65. this.$emit('changeCoupon', res.data)
  66. }catch(error){
  67. this.$util.msg(error.msg,2000)
  68. }
  69. },
  70. hidePopup(){
  71. this.$parent.isExchangePopup = false
  72. },
  73. },
  74. onShow(){
  75. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. /*弹窗*/
  80. .model-warp.none{
  81. display: none;
  82. }
  83. .model-warp.show{
  84. display: block;
  85. }
  86. .coupon-popup{
  87. width: 100%;
  88. height: 100%;
  89. background: rgba(0,0,0,.5);
  90. position: fixed;
  91. top: 0;
  92. left: 0;
  93. z-index: 8888;
  94. transition: all 0.4s;
  95. &.none{
  96. display: none;
  97. }
  98. &.show{
  99. display: block;
  100. }
  101. .content{
  102. width: 580rpx;
  103. height: 700rpx;
  104. position: absolute;
  105. background: $bg-color;
  106. left: 0;
  107. right: 0;
  108. bottom: 0;
  109. top: 0;
  110. margin: auto;
  111. padding: 20rpx 25rpx;
  112. border-radius: 12rpx;
  113. .title{
  114. width: 100%;
  115. height: 68rpx;
  116. line-height: 68rpx;
  117. font-size: $font-size-28;
  118. color: $text-color;
  119. text-align: center;
  120. margin-bottom: 32rpx;
  121. position: relative;
  122. font-weight: bold;
  123. .icon-iconfontguanbi{
  124. width: 68rpx;
  125. height: 68rpx;
  126. text-align: center;
  127. line-height: 68rpx;
  128. position: absolute;
  129. right: 0;
  130. top: 0;
  131. font-size: $font-size-36;
  132. color: #999999;
  133. }
  134. }
  135. .text-content{
  136. width: 100%;
  137. height: auto;
  138. .coupon-input{
  139. width: 100%;
  140. height: auto;
  141. margin-bottom: 48rpx;
  142. .input{
  143. width: 100%;
  144. height: 66rpx;
  145. box-sizing: border-box;
  146. border: 1px solid #e2e2e2;
  147. line-height: 66rpx;
  148. padding: 0 20rpx;
  149. font-size: $font-size-26;
  150. color: #333333;
  151. border-radius: 2rpx;
  152. }
  153. }
  154. .coupon-main{
  155. width: 100%;
  156. height: auto;
  157. box-sizing: border-box;
  158. .coupon-button{
  159. width: 520rpx;
  160. height: 84rpx;
  161. margin: 0 auto;
  162. border-radius: 50rpx;
  163. line-height: 84rpx;
  164. text-align: center;
  165. background: $btn-confirm;
  166. color: #FFFFFF;
  167. font-size: $font-size-30;
  168. }
  169. .coupon-text{
  170. width: 100%;
  171. box-sizing: border-box;
  172. padding: 0 20rpx;
  173. margin-top: 40rpx;
  174. line-height: 44rpx;
  175. text-align: justify;
  176. font-size: $font-size-24;
  177. .coupon-h1{
  178. color: #333333;
  179. }
  180. .coupon-h2{
  181. color: #999999;
  182. &.indet{
  183. text-indent: 28rpx;
  184. }
  185. }
  186. }
  187. }
  188. }
  189. .btn{
  190. width: 100%;
  191. height: 88rpx;
  192. float: left;
  193. background: $btn-confirm;
  194. line-height: 88rpx;
  195. font-size: $font-size-28;
  196. text-align: center;
  197. color: #FFFFFF;
  198. border-radius: 0;
  199. padding: 0;
  200. margin-top: 2rpx;
  201. }
  202. }
  203. }
  204. </style>