s-coupon-list.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="ss-m-20" :style="{ opacity: disabled ? '0.5' : '1' }">
  3. <view class="content">
  4. <view
  5. class="tag ss-flex ss-row-center"
  6. :class="isDisable ? 'disabled-bg-color' : 'info-bg-color'"
  7. >
  8. {{ data.discountType === 1 ? '满减券' : '折扣券' }}
  9. </view>
  10. <view class="title ss-m-x-30 ss-p-t-18">
  11. <view class="ss-flex ss-row-between">
  12. <view
  13. class="value-text ss-flex-1 ss-m-r-10"
  14. :class="isDisable ? 'disabled-color' : 'info-color'"
  15. >
  16. {{ data.name }}
  17. </view>
  18. <view>
  19. <view
  20. class="ss-flex ss-col-bottom"
  21. :class="isDisable ? 'disabled-color' : 'price-text'"
  22. >
  23. <view class="value-reduce ss-m-b-10" v-if="data.discountType === 1">¥</view>
  24. <view class="value-price">
  25. {{
  26. data.discountType === 1
  27. ? fen2yuan(data.discountPrice)
  28. : data.discountPercent / 10.0
  29. }}
  30. </view>
  31. <view class="value-discount ss-m-b-10 ss-m-l-4" v-if="data.discountType === 2"
  32. >折</view
  33. >
  34. </view>
  35. </view>
  36. </view>
  37. <view class="ss-flex ss-row-between ss-m-t-16">
  38. <view
  39. class="sellby-text"
  40. :class="isDisable ? 'disabled-color' : 'subtitle-color'"
  41. v-if="data.validityType === 2"
  42. >
  43. 有效期:领取后 {{ data.fixedEndTerm }} 天内可用
  44. </view>
  45. <view class="sellby-text" :class="isDisable ? 'disabled-color' : 'subtitle-color'" v-else>
  46. 有效期: {{ sheep.$helper.timeFormat(data.validStartTime, 'yyyy-mm-dd') }} 至
  47. {{ sheep.$helper.timeFormat(data.validEndTime, 'yyyy-mm-dd') }}
  48. </view>
  49. <view class="value-enough" :class="isDisable ? 'disabled-color' : 'subtitle-color'">
  50. 满 {{ fen2yuan(data.usePrice) }} 可用
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="desc ss-flex ss-row-between">
  56. <view>
  57. <view class="desc-title">{{ data.description }}</view>
  58. <view>
  59. <slot name="reason" />
  60. </view>
  61. </view>
  62. <view>
  63. <slot />
  64. </view>
  65. </view>
  66. </view>
  67. </template>
  68. <script setup>
  69. import { computed } from 'vue';
  70. import { fen2yuan } from '../../hooks/useGoods';
  71. import sheep from '../../index';
  72. const isDisable = computed(() => {
  73. if (props.type === 'coupon') {
  74. return false;
  75. }
  76. return props.disabled;
  77. });
  78. // 接受参数
  79. const props = defineProps({
  80. data: {
  81. type: Object,
  82. default: {},
  83. },
  84. disabled: {
  85. type: Boolean,
  86. default: false,
  87. },
  88. type: {
  89. type: String,
  90. default: 'coupon', // coupon 优惠劵模版;user 用户优惠劵
  91. },
  92. });
  93. </script>
  94. <style lang="scss" scoped>
  95. .info-bg-color {
  96. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  97. }
  98. .disabled-bg-color {
  99. background: #999;
  100. }
  101. .info-color {
  102. color: #333;
  103. }
  104. .subtitle-color {
  105. color: #666;
  106. }
  107. .disabled-color {
  108. color: #999;
  109. }
  110. .content {
  111. width: 100%;
  112. background: #fff;
  113. border-radius: 20rpx 20rpx 0 0;
  114. -webkit-mask: radial-gradient(circle at 12rpx 100%, #0000 12rpx, red 0) -12rpx;
  115. box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04);
  116. .tag {
  117. width: 100rpx;
  118. color: #fff;
  119. height: 40rpx;
  120. font-size: 24rpx;
  121. border-radius: 20rpx 0 20rpx 0;
  122. }
  123. .title {
  124. padding-bottom: 22rpx;
  125. border-bottom: 2rpx dashed #d3d3d3;
  126. .value-text {
  127. font-size: 32rpx;
  128. font-weight: 600;
  129. }
  130. .sellby-text {
  131. font-size: 24rpx;
  132. font-weight: 400;
  133. }
  134. .value-price {
  135. font-size: 64rpx;
  136. font-weight: 500;
  137. line-height: normal;
  138. font-family: OPPOSANS;
  139. }
  140. .value-reduce {
  141. line-height: normal;
  142. font-size: 32rpx;
  143. }
  144. .value-discount {
  145. line-height: normal;
  146. font-size: 28rpx;
  147. }
  148. .value-enough {
  149. font-size: 24rpx;
  150. font-weight: 400;
  151. font-family: OPPOSANS;
  152. }
  153. }
  154. }
  155. .desc {
  156. width: 100%;
  157. background: #fff;
  158. -webkit-mask: radial-gradient(circle at 12rpx 0%, #0000 12rpx, red 0) -12rpx;
  159. box-shadow: rgba(#000, 0.1);
  160. box-sizing: border-box;
  161. padding: 24rpx 30rpx;
  162. box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04);
  163. border-radius: 0 0 20rpx 20rpx;
  164. .desc-title {
  165. font-size: 24rpx;
  166. color: #999;
  167. font-weight: 400;
  168. }
  169. }
  170. .price-text {
  171. color: #ff0000;
  172. }
  173. </style>