备份.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view>
  3. <view class='coupon-list-window' :class='coupon.coupon==true?"on":""'>
  4. <view class='title'>优惠券<text class='iconfont icon-guanbi' @click='close'></text></view>
  5. <view class='coupon-list' v-if="coupon.list.length">
  6. <view class='item acea-row row-center-wrapper' v-for="(item,index) in coupon.list" @click="getCouponUser(index,item)"
  7. :key='index'>
  8. <view class='money'>
  9. <div>
  10. ¥<span class="num">{{ item.coupon_price }}</span>
  11. </div>
  12. <div class="pic-num">满{{ item.use_min_price }}元可用</div>
  13. </view>
  14. <view class='text'>
  15. <view class='condition line1'>
  16. <span class="line-title" v-if="item.type === 0">通用劵</span>
  17. <span class="line-title" v-else-if="item.type === 1">品类券</span>
  18. <span class="line-title" v-else>商品券</span>
  19. <span>{{ item.title }}</span>
  20. </view>
  21. <view class='data acea-row row-between-wrapper'>
  22. <view>{{ item.start_time ? item.start_time + "-" : ""}}{{ item.end_time }}</view>
  23. <view class="iconfont icon-xuanzhong1 font-color-red" v-if="checked.id === item.id"></view>
  24. <view v-else class="iconfont icon-weixuanzhong"></view v-else>
  25. <!-- <view class='bnt gray' v-if="item.is_use">{{item.use_title || '已领取'}}</view>
  26. <view class='bnt bg-color' v-else>{{coupon.statusTile || '立即领取'}}</view> -->
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <!-- 无优惠券 -->
  32. <view class='pictrue' v-else>
  33. <image src='/static/images/noCoupon.png'></image>
  34. </view>
  35. </view>
  36. <view class='mask' catchtouchmove="true" :hidden='coupon.coupon==false' @click='close'></view>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. setCouponReceive
  42. } from '@/api/api.js';
  43. export default {
  44. props: {
  45. //打开状态 0=领取优惠券,1=使用优惠券
  46. openType: {
  47. type: Number,
  48. default: 0,
  49. },
  50. coupon: {
  51. type: Object,
  52. default: function() {
  53. return {};
  54. }
  55. },
  56. checked:{
  57. type: Object,
  58. default: function() {
  59. return {};
  60. }
  61. },
  62. },
  63. data() {
  64. return {
  65. };
  66. },
  67. methods: {
  68. close: function() {
  69. this.$emit('ChangCouponsClone');
  70. },
  71. getCouponUser: function(index, item) {
  72. let that = this;
  73. let list = that.coupon.list;
  74. that.$emit('ChangCoupons', item);
  75. // if (list[index].is_use == true && this.openType == 0) return true;
  76. // switch (this.openType) {
  77. // case 0:
  78. // //领取优惠券
  79. // setCouponReceive(id).then(res => {
  80. // that.$emit('ChangCouponsUseState', index);
  81. // that.$util.Tips({
  82. // title: "领取成功"
  83. // });
  84. // that.$emit('ChangCoupons', list[index]);
  85. // })
  86. // break;
  87. // case 1:
  88. // that.$emit('ChangCoupons', index);
  89. // break;
  90. // }
  91. }
  92. }
  93. }
  94. </script>
  95. <style scoped lang="scss">
  96. .coupon-list-window {
  97. position: fixed;
  98. bottom: 0;
  99. left: 0;
  100. width: 100%;
  101. background-color: #f5f5f5;
  102. border-radius: 16rpx 16rpx 0 0;
  103. z-index: 555;
  104. transform: translate3d(0, 100%, 0);
  105. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  106. }
  107. .coupon-list-window.on {
  108. transform: translate3d(0, 0, 0);
  109. }
  110. .coupon-list-window .title {
  111. height: 124rpx;
  112. width: 100%;
  113. text-align: center;
  114. line-height: 124rpx;
  115. font-size: 32rpx;
  116. font-weight: bold;
  117. position: relative;
  118. }
  119. .coupon-list-window .title .iconfont {
  120. position: absolute;
  121. right: 30rpx;
  122. top: 50%;
  123. transform: translateY(-50%);
  124. font-size: 35rpx;
  125. color: #8a8a8a;
  126. font-weight: normal;
  127. }
  128. .coupon-list-window .coupon-list {
  129. margin: 0 0 50rpx 0;
  130. height: 550rpx;
  131. overflow: auto;
  132. }
  133. .coupon-list-window .pictrue {
  134. width: 414rpx;
  135. height: 336rpx;
  136. margin: 0 auto 50rpx auto;
  137. }
  138. .coupon-list-window .pictrue image {
  139. width: 100%;
  140. height: 100%;
  141. }
  142. .coupon-list .item .money{
  143. display: flex;
  144. flex-direction: column;
  145. justify-content: center;
  146. .pic-num{
  147. color: #ffffff;
  148. font-size: 24rpx;
  149. }
  150. }
  151. .condition .line-title{
  152. width: 90rpx;
  153. padding: 0 10rpx;
  154. box-sizing: border-box;
  155. background: rgba(255, 247, 247, 1);
  156. border: 1px solid rgba(232, 51, 35, 1);
  157. opacity: 1;
  158. border-radius: 22rpx;
  159. font-size: 20rpx;
  160. color: #e83323;
  161. margin-right: 12rpx;
  162. }
  163. </style>