app-coupon-center.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view class="app-coupon-center">
  3. <view class="app-coupon-item"
  4. v-for="(item, index) in list"
  5. :key="index"
  6. @click="jump(item)"
  7. >
  8. <view class="app-top dir-left-nowrap main-between" :class="{'app-unexpired': item.is_receive === '0', 'app-received': item.is_receive > '0'}">
  9. <view class="app-text dir-left-nowrap main-left">
  10. <view class="app-price">
  11. <text class="app-symbol">¥</text>
  12. <text class="app-number">{{item.sub_price}}</text>
  13. </view>
  14. <view class="app-amount dir-top-nowrap main-left">
  15. <text>优惠券</text>
  16. <text>满{{item.min_price}}使用</text>
  17. </view>
  18. </view>
  19. <view class="app-button">
  20. <app-button type="important"
  21. height="56"
  22. background="#ffffff"
  23. round
  24. :color="`${item.is_receive === '0' ? '#ff4544' : item.is_receive > '0' ? '#999999' : ''}`"
  25. fontSize="28"
  26. @click="use(item.id)"
  27. >{{item.is_receive === '0' ? '立即领取' : item.is_receive > '0' ? '已领取' : ''}}</app-button>
  28. </view>
  29. </view>
  30. <view class="app-bottom dir-top-nowrap main-between">
  31. <text class="app-time">
  32. 有效时间: {{item.begin_time}} - {{item.end_time}}
  33. </text>
  34. <text class="app-range">
  35. 适用范围: {{setRange(item.appoint_type)}}
  36. </text>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import jump from '../../../core/jump.js';
  43. export default {
  44. name: 'app-coupon-center',
  45. props: {
  46. list: {
  47. type: Array,
  48. default: function() {
  49. return [
  50. {
  51. appoint_type: "",
  52. begin_time: "",
  53. cat: [],
  54. couponGoods: [],
  55. created_at: "",
  56. deleted_at: "",
  57. desc: "",
  58. discount: "",
  59. end_time: "",
  60. expire_day: "",
  61. expire_type: "",
  62. goods: [],
  63. id: "",
  64. is_delete: "",
  65. is_member: "",
  66. is_receive: "",
  67. mall_id: "",
  68. min_price: "",
  69. name: "",
  70. pic_url: "",
  71. rule: "",
  72. sort: "",
  73. sub_price: "",
  74. total_count: "",
  75. type: "",
  76. updated_at: "",
  77. }
  78. ]
  79. }
  80. }
  81. },
  82. methods: {
  83. setRange: function(appoint_type) {
  84. if (appoint_type === '1') {
  85. return '限品类';
  86. } else if (appoint_type === '2') {
  87. return '限商品';
  88. } else if (appoint_type === '3') {
  89. return '全场通用';
  90. }
  91. },
  92. jump(item) {
  93. jump({
  94. open_type: 'navigate',
  95. url: `/pages/coupon/details/details?id=${item.id}`
  96. });
  97. },
  98. use(id) {
  99. console.log(id);
  100. }
  101. }
  102. }
  103. </script>
  104. <style scoped lang="scss">
  105. .app-coupon-center {
  106. width: #{750rpx};
  107. overflow: hidden;
  108. .app-coupon-item {
  109. margin: #{20rpx} #{24rpx} #{0} #{24rpx};
  110. width: #{702rpx};
  111. height: #{160+112rpx};
  112. .app-top {
  113. width: #{702rpx};
  114. height: #{160rpx};
  115. background-size: 100% 100%;
  116. background-repeat: no-repeat;
  117. .app-button {
  118. width: #{160+24rpx};
  119. padding-right: #{24rpx};
  120. padding-top: #{48rpx};
  121. /deep/ button {
  122. padding: 0 #{10rpx} !important;
  123. }
  124. }
  125. .app-text {
  126. width: #{702-160-24rpx};
  127. height: #{160rpx};
  128. margin-left: #{24rpx};
  129. .app-price {
  130. padding-top: #{52rpx};
  131. color: #ffffff;
  132. .app-symbol {
  133. font-size: #{36rpx};
  134. }
  135. .app-number {
  136. font-size: #{72rpx};
  137. }
  138. }
  139. .app-amount {
  140. padding-top: #{50rpx};
  141. color: #ffffff;
  142. font-size: #{28rpx};
  143. margin-left: #{20rpx};
  144. }
  145. }
  146. }
  147. .app-unexpired {
  148. background-image: url("../../../static/image/icon/unexpired-coupon.png");
  149. }
  150. .app-received {
  151. background-image: url("../../../static/image/icon/received-coupon.png");
  152. }
  153. .app-bottom {
  154. width: #{702rpx};
  155. height: #{112rpx};
  156. border-left: #{1rpx} solid #cfcfcf;
  157. border-bottom: #{1rpx} solid #cfcfcf;
  158. border-right: #{1rpx} solid #cfcfcf;
  159. border-bottom-left-radius: #{16rpx};
  160. border-bottom-right-radius: #{16rpx};
  161. text {
  162. font-size: #{24rpx};
  163. color: #666666;
  164. margin-left: #{24rpx};
  165. }
  166. .app-time {
  167. margin-top: #{24rpx};
  168. }
  169. .app-range {
  170. margin-bottom: #{32rpx};
  171. }
  172. }
  173. }
  174. }
  175. </style>