CouponView.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <view class="mask" :class="!maskState ? 'none' : maskState ? 'show' : ''">
  3. <view class="shadow-bg"></view>
  4. <view class="mask-content" @click.stop.prevent="stopPrevent">
  5. <view class="dont-use"><text @click="dontUse">不使用优惠券</text></view>
  6. <!-- 优惠券页面,仿mt -->
  7. <view class="coupon-item" v-for="(item, index) in discountList" :key="index" @click="selCoupon(item)">
  8. <view class="con">
  9. <view class="left">
  10. <text class="title">{{ item.name }}</text>
  11. <text class="time">有效期至{{ $_utils.formatDate(item.endTime, 'yyyy-MM-dd') }}</text>
  12. </view>
  13. <view class="right">
  14. <text class="price">{{ item.reducePrice }}</text>
  15. <text v-if="item.minPrice==='不限金额'||Number(item.minPrice)===0">无门槛使用</text>
  16. <text v-else>满{{item.minPrice}}元可用</text>
  17. </view>
  18. <view class="circle l"></view>
  19. <view class="circle r"></view>
  20. </view>
  21. <text class="tips">
  22. {{ item.applyRange === 10 ? '全店商品通用' : item.applyRange === 20 ? '指定分类商品可用' : item.applyRange === 30 ? '指定品牌商品可用' : '' }}
  23. </text>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. props: {
  31. maskState: {
  32. type: Boolean,
  33. default: false
  34. },
  35. discountList: {
  36. type: Array,
  37. default: () => {
  38. return [];
  39. }
  40. }
  41. },
  42. onLoad() {
  43. this.discountList()
  44. },
  45. data() {
  46. return {}
  47. },
  48. methods: {
  49. stopPrevent() {},
  50. //不使用优惠
  51. dontUse() {
  52. this.$emit('dontUse');
  53. },
  54. // 选择优惠券
  55. selCoupon(row) {
  56. this.$emit('selCoupon', row);
  57. }
  58. }
  59. };
  60. </script>
  61. <style lang="scss">
  62. /* 优惠券面板 */
  63. .mask {
  64. position: fixed;
  65. left: 0;
  66. top: 100%;
  67. // bottom: 0;
  68. width: 100%;
  69. // background: rgba(0, 0, 0, 0);
  70. z-index: 9995;
  71. height: 100vh;
  72. transition: 0.3s;
  73. .shadow-bg {
  74. background: rgba(0, 0, 0, 0.4);
  75. position: absolute;
  76. top: 0;
  77. left: 0;
  78. width: 100%;
  79. height: 100vh;
  80. }
  81. .mask-content {
  82. position: absolute;
  83. bottom: 0;
  84. left: 0;
  85. width: 100%;
  86. min-height: 30vh;
  87. max-height: 70vh;
  88. background: #f3f3f3;
  89. z-index: 9995;
  90. // transform: translateY(100%);
  91. transition: 0.3s;
  92. overflow-y: scroll;
  93. .dont-use {
  94. text-align: right;
  95. color: #666;
  96. font-size: 24upx;
  97. padding: 20upx 30upx;
  98. }
  99. }
  100. &.none {
  101. top: 100%;
  102. .shadow-bg {
  103. display: none;
  104. }
  105. .mask-content {
  106. transform: translateY(100%);
  107. }
  108. }
  109. &.show {
  110. top: 0;
  111. .shadow-bg {
  112. display: block;
  113. }
  114. .mask-content {
  115. transform: translateY(0);
  116. }
  117. }
  118. }
  119. /* 优惠券列表 */
  120. .coupon-item {
  121. display: flex;
  122. flex-direction: column;
  123. margin: 20upx 24upx;
  124. background: #fff;
  125. .con {
  126. display: flex;
  127. align-items: center;
  128. position: relative;
  129. height: 120upx;
  130. padding: 0 30upx;
  131. &:after {
  132. position: absolute;
  133. left: 0;
  134. bottom: 0;
  135. content: '';
  136. width: 100%;
  137. height: 0;
  138. border-bottom: 1px dashed #f3f3f3;
  139. transform: scaleY(50%);
  140. }
  141. }
  142. .left {
  143. display: flex;
  144. flex-direction: column;
  145. justify-content: center;
  146. flex: 1;
  147. overflow: hidden;
  148. height: 100upx;
  149. }
  150. .title {
  151. font-size: 32upx;
  152. color: $font-color-dark;
  153. margin-bottom: 10upx;
  154. }
  155. .time {
  156. font-size: 24upx;
  157. color: $font-color-light;
  158. }
  159. .right {
  160. display: flex;
  161. flex-direction: column;
  162. justify-content: center;
  163. align-items: center;
  164. font-size: 26upx;
  165. color: $font-color-base;
  166. height: 100upx;
  167. }
  168. .price {
  169. font-size: 44upx;
  170. color: $price-color;
  171. &:before {
  172. content: '¥';
  173. font-size: 34upx;
  174. }
  175. }
  176. .tips {
  177. font-size: 24upx;
  178. color: $font-color-light;
  179. line-height: 60upx;
  180. padding-left: 30upx;
  181. }
  182. .circle {
  183. position: absolute;
  184. left: -6upx;
  185. bottom: -10upx;
  186. z-index: 10;
  187. width: 20upx;
  188. height: 20upx;
  189. background: #f3f3f3;
  190. border-radius: 100px;
  191. &.r {
  192. left: auto;
  193. right: -6upx;
  194. }
  195. }
  196. }
  197. </style>