coupon-exchange.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  1. <template>
  2. <view class="container clearfix">
  3. <view class="coupon-content">
  4. <view class="coupon-input">
  5. <input class="input" type="text" v-model="params.redemptionCode" maxlength="16" placeholder="请输入16位兑换码"/>
  6. </view>
  7. <view class="coupon-main">
  8. <view class="coupon-button" @click="exchangeConfirm">立即兑换</view>
  9. <view class="coupon-text">
  10. <view class="coupon-h1">注意事项:</view>
  11. <view class="coupon-h2">1. 兑换码获取:可通过采美线下发放或者销售顾问线上发放</view>
  12. <view class="coupon-h2 indet">获得优惠券兑换码,兑换码由16位数字和字母组成。</view>
  13. <view class="coupon-h2">2. 兑换码使用:在当前页面输入兑换码即可兑换相应优惠券</view>
  14. <view class="coupon-h2 indet">一个兑换码只能兑换一张优惠券,不可重复使用。</view>
  15. <view class="coupon-h2">3. 输入兑换码时请区分字母大小写。</view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="coupon-content-model" v-if="isCouponModel">
  20. <view class="coupon-alert-content">
  21. <view class="coupon">
  22. <view class="coupon-list">
  23. <view class="list-cell-tags">{{ coupon.couponType | TypeFormat }}</text></view>
  24. <view class="list-cell-le">
  25. <view class="coupon-maxMoney">
  26. <text class="small">¥</text>
  27. {{ coupon.couponAmount }}
  28. </view>
  29. <view class="coupon-minMoney">
  30. <text class="txt">满{{ coupon.touchPrice }}可用</text>
  31. </view>
  32. </view>
  33. <view class="list-cell-ri">
  34. <view class="list-cell-top">
  35. <text v-if="coupon.couponType == 0">
  36. {{ coupon.productType && coupon.productType == 1 ? '全商城商品通用' : '仅可购买指定商品' }}
  37. </text>
  38. <text v-if="coupon.couponType == 1">
  39. {{ coupon.categoryType == 1 ? '仅限购买产品类商品' : '仅限购买仪器类商品' }}
  40. </text>
  41. <text v-if="coupon.couponType == 3">仅限购买店铺【{{ coupon.shopName }}】的商品</text>
  42. <text v-if="coupon.couponType == 4 || coupon.couponType == 2">全商城商品通用</text>
  43. </view>
  44. <view class="list-cell-time">有效期:{{ coupon.startDate }} - {{ coupon.endDate }}</view>
  45. </view>
  46. </view>
  47. <view class="coupon-btn" @click.stop="handleClickCancel">立即收下</view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import { mapState,mapMutations} from 'vuex';
  55. export default {
  56. components:{
  57. },
  58. data() {
  59. return {
  60. params:{
  61. userId:0,
  62. redemptionCode:'',
  63. source:2,
  64. },
  65. coupon:{},
  66. isCouponModel:false
  67. }
  68. },
  69. onLoad() {
  70. },
  71. filters: {
  72. TypeFormat:function(value) {
  73. switch (value) {
  74. case 0:
  75. return '活动券';
  76. break;
  77. case 1:
  78. return '品类券';
  79. break;
  80. case 2:
  81. return '用户专享券';
  82. break;
  83. case 3:
  84. return '店铺券';
  85. break;
  86. case 4:
  87. return '新用户券';
  88. break;
  89. }
  90. }
  91. },
  92. computed: {
  93. ...mapState(['hasLogin','userInfo','identity','isActivity'])
  94. },
  95. methods: {
  96. exchangeConfirm(){// 立即兑换
  97. if( this.params.redemptionCode == ''){
  98. this.$util.msg('请输入位兑换码',2000)
  99. return
  100. }
  101. this.ExchangeCoupon(this.params)
  102. },
  103. ExchangeCoupon(param){// 兑换优惠券
  104. this.ProductService.ExchangeCoupon(param).then(response =>{
  105. this.coupon = response.data
  106. this.isCouponModel = true
  107. })
  108. .catch(error =>{
  109. this.$util.msg(error.msg,2000);
  110. })
  111. },
  112. handleClickCancel(){// 关闭弹窗并跳转个人优惠券中心
  113. this.isCouponModel = false
  114. this.$api.navigateTo('/pages/user/coupon/coupon')
  115. }
  116. },
  117. onShow(){
  118. this.$api.getComStorage('userInfo').then((resolve) =>{
  119. this.params.userId = resolve.userId ? resolve.userId : 0;
  120. }).catch(error =>{
  121. console.log('暂无用户信息~')
  122. })
  123. }
  124. }
  125. </script>
  126. <style lang="scss">
  127. .container{
  128. width: 100%;
  129. height: auto;
  130. .coupon-content{
  131. width: 100%;
  132. height: auto;
  133. box-sizing: border-box;
  134. padding: 0 40rpx;
  135. padding-top: 60rpx;
  136. .coupon-input{
  137. width: 100%;
  138. height: auto;
  139. margin-bottom: 88rpx;
  140. .input{
  141. width: 100%;
  142. height: 66rpx;
  143. box-sizing: border-box;
  144. border: 1px solid #e2e2e2;
  145. line-height: 66rpx;
  146. padding: 0 20rpx;
  147. font-size: $font-size-26;
  148. color: #333333;
  149. border-radius: 2rpx;
  150. }
  151. }
  152. .coupon-main{
  153. width: 100%;
  154. height: auto;
  155. box-sizing: border-box;
  156. .coupon-button{
  157. width: 600rpx;
  158. height: 90rpx;
  159. margin: 0 auto;
  160. border-radius: 50rpx;
  161. line-height: 90rpx;
  162. text-align: center;
  163. background: $btn-confirm;
  164. color: #FFFFFF;
  165. font-size: $font-size-30;
  166. }
  167. .coupon-text{
  168. width: 100%;
  169. box-sizing: border-box;
  170. padding: 0 20rpx;
  171. margin-top: 40rpx;
  172. line-height: 44rpx;
  173. text-align: justify;
  174. font-size: $font-size-24;
  175. .coupon-h1{
  176. color: #333333;
  177. }
  178. .coupon-h2{
  179. color: #999999;
  180. &.indet{
  181. text-indent: 28rpx;
  182. }
  183. }
  184. }
  185. }
  186. }
  187. }
  188. .coupon-content-model{
  189. width: 100%;
  190. height: 100%;
  191. background: rgba(0,0,0,.5);
  192. position: fixed;
  193. top: 0;
  194. left: 0;
  195. z-index: 8888;
  196. transition: all 0.4s;
  197. .coupon-alert-content{
  198. width: 600rpx;
  199. height: 612rpx;
  200. position: absolute;
  201. top: 0;
  202. left: 0;
  203. bottom: 0;
  204. right: 0;
  205. margin: auto;
  206. box-sizing: border-box;
  207. padding-top: 92rpx;
  208. .coupon{
  209. width: 600rpx;
  210. height: 522rpx;
  211. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbg@2x.png);
  212. background-size: cover;
  213. box-sizing: border-box;
  214. padding: 230rpx 40rpx 0 40rpx;
  215. .coupon-list{
  216. width: 100%;
  217. height: 147rpx;
  218. margin-bottom: 32rpx;
  219. box-sizing: border-box;
  220. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-bg@2x.png);
  221. background-size: cover;
  222. position: relative;
  223. .list-cell-tags{
  224. display: inline-block;
  225. padding: 0 10rpx;
  226. height: 32rpx;
  227. line-height: 32rpx;
  228. background-color: #f94b4b;
  229. color: #FFFFFF;
  230. font-size: 18rpx;
  231. border-radius: 16rpx 0 16rpx 0;
  232. text-align: center;
  233. position: absolute;
  234. top: 0;
  235. left: 0;
  236. }
  237. .list-cell-le{
  238. width: 154rpx;
  239. height: 100%;
  240. box-sizing: border-box;
  241. padding: 30rpx 0;
  242. float: left;
  243. .coupon-maxMoney{
  244. width: 100%;
  245. height: 54rpx;
  246. line-height: 54rpx;
  247. font-size: 42rpx;
  248. color: #f94b4b;
  249. text-align: center;
  250. margin-top: 10rpx;
  251. .small{
  252. font-size: $font-size-20;
  253. }
  254. }
  255. .coupon-minMoney{
  256. width: 100%;
  257. height: 28rpx;
  258. float: left;
  259. box-sizing: border-box;
  260. padding-left: 24rpx;
  261. .txt{
  262. display: block;
  263. height: 28rpx;
  264. line-height: 28rpx;
  265. font-size: 16rpx;
  266. color: #f94b4b;
  267. text-align: center;
  268. padding: 0 5rpx;
  269. background-color: #fff1eb;
  270. border-radius: 4rpx;
  271. float: left;
  272. }
  273. }
  274. }
  275. .list-cell-ri{
  276. width: 366rpx;
  277. height: 100%;
  278. box-sizing: border-box;
  279. padding:30rpx 20rpx;
  280. float: left;
  281. .list-cell-top{
  282. width: 100%;
  283. height: 64rpx;
  284. line-height: 64rpx;
  285. font-size: $font-size-26;
  286. color: #333333;
  287. float: left;
  288. text-overflow:ellipsis;
  289. display: -webkit-box;
  290. word-break: break-all;
  291. -webkit-box-orient: vertical;
  292. -webkit-line-clamp: 1;
  293. overflow: hidden;
  294. }
  295. .list-cell-time{
  296. width: 100%;
  297. height: 28rpx;
  298. line-height: 28rpx;
  299. text-align: left;
  300. font-size: $font-size-20;
  301. color: #999999;
  302. }
  303. }
  304. }
  305. .coupon-btn{
  306. width: 100%;
  307. height: 78rpx;
  308. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-alertbtnbg@2x.png);
  309. background-size: cover;
  310. line-height: 78rpx;
  311. text-align: center;
  312. color: #FFFFFF;
  313. font-size: $font-size-36;
  314. }
  315. }
  316. }
  317. }
  318. </style>