s-coupon-list.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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
  46. class="sellby-text"
  47. :class=" isDisable ? 'disabled-color' : 'subtitle-color'"
  48. v-else
  49. >
  50. 有效期: {{ sheep.$helper.timeFormat(data.validStartTime, 'yyyy-mm-dd') }} 至
  51. {{ sheep.$helper.timeFormat(data.validEndTime, 'yyyy-mm-dd') }}
  52. </view>
  53. <view
  54. class="value-enough"
  55. :class="isDisable ? 'disabled-color' : 'subtitle-color'"
  56. >
  57. 满 {{ fen2yuan(data.usePrice) }} 可用
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <!-- TODO 非繁人:可优化,增加优惠劵的描述 -->
  63. <view class="desc ss-flex ss-row-between">
  64. <view>
  65. <view class="desc-title">{{ data.description }}</view>
  66. <view>
  67. <slot name="reason" />
  68. </view>
  69. </view>
  70. <view>
  71. <slot />
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <script setup>
  77. import { computed, reactive } from 'vue';
  78. import { fen2yuan } from '../../hooks/useGoods';
  79. import sheep from '../../index';
  80. const state = reactive({});
  81. const isDisable = computed(() => {
  82. if (props.type === 'coupon') {
  83. return false;
  84. }
  85. return props.data.status !== 1;
  86. });
  87. // 接受参数
  88. const props = defineProps({
  89. data: {
  90. type: Object,
  91. default: {},
  92. },
  93. disabled: {
  94. type: Boolean,
  95. default: false,
  96. },
  97. type: {
  98. type: String,
  99. default: 'coupon', // coupon 优惠劵模版;user 用户优惠劵
  100. },
  101. });
  102. </script>
  103. <style lang="scss" scoped>
  104. .info-bg-color {
  105. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  106. }
  107. .disabled-bg-color {
  108. background: #999;
  109. }
  110. .info-color {
  111. color: #333;
  112. }
  113. .subtitle-color {
  114. color: #666;
  115. }
  116. .disabled-color {
  117. color: #999;
  118. }
  119. .content {
  120. width: 100%;
  121. background: #fff;
  122. border-radius: 20rpx 20rpx 0 0;
  123. -webkit-mask: radial-gradient(circle at 12rpx 100%, #0000 12rpx, red 0) -12rpx;
  124. box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04);
  125. .tag {
  126. width: 100rpx;
  127. color: #fff;
  128. height: 40rpx;
  129. font-size: 24rpx;
  130. border-radius: 20rpx 0 20rpx 0;
  131. }
  132. .title {
  133. padding-bottom: 22rpx;
  134. border-bottom: 2rpx dashed #d3d3d3;
  135. .value-text {
  136. font-size: 32rpx;
  137. font-weight: 600;
  138. }
  139. .sellby-text {
  140. font-size: 24rpx;
  141. font-weight: 400;
  142. }
  143. .value-price {
  144. font-size: 64rpx;
  145. font-weight: 500;
  146. line-height: normal;
  147. font-family: OPPOSANS;
  148. }
  149. .value-reduce {
  150. line-height: normal;
  151. font-size: 32rpx;
  152. }
  153. .value-discount {
  154. line-height: normal;
  155. font-size: 28rpx;
  156. }
  157. .value-enough {
  158. font-size: 24rpx;
  159. font-weight: 400;
  160. font-family: OPPOSANS;
  161. }
  162. }
  163. }
  164. .desc {
  165. width: 100%;
  166. background: #fff;
  167. -webkit-mask: radial-gradient(circle at 12rpx 0%, #0000 12rpx, red 0) -12rpx;
  168. box-shadow: rgba(#000, 0.1);
  169. box-sizing: border-box;
  170. padding: 24rpx 30rpx;
  171. box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04);
  172. border-radius: 0 0 20rpx 20rpx;
  173. .desc-title {
  174. font-size: 24rpx;
  175. color: #999;
  176. font-weight: 400;
  177. }
  178. }
  179. .price-text {
  180. color: #ff0000;
  181. }
  182. </style>