s-coupon-list.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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="
  7. data.status == 'expired' || data.status == 'used' ? 'disabled-bg-color' : 'info-bg-color'
  8. "
  9. >{{ data.type_text }}</view
  10. >
  11. <view class="title ss-m-x-30 ss-p-t-18">
  12. <view class="ss-flex ss-row-between">
  13. <view
  14. class="value-text ss-flex-1 ss-m-r-10"
  15. :class="
  16. data.status == 'expired' || data.status == 'used' ? 'disabled-color' : 'info-color'
  17. "
  18. >{{ data.name }}</view
  19. >
  20. <view>
  21. <view
  22. class="ss-flex ss-col-bottom"
  23. :class="
  24. data.status != 'expired' && data.status != 'used' ? 'price-text' : 'disabled-color'
  25. "
  26. >
  27. <view class="value-reduce ss-m-b-10" v-if="data.type === 'reduce'">¥</view>
  28. <view class="value-price">{{ data.amount }}</view>
  29. <view class="value-discount ss-m-b-10 ss-m-l-4" v-if="data.type === 'discount'"
  30. >折</view
  31. >
  32. </view>
  33. </view>
  34. </view>
  35. <view class="ss-flex ss-row-between ss-m-t-16">
  36. <view
  37. class="sellby-text"
  38. :class="
  39. data.status == 'expired' || data.status == 'used'
  40. ? 'disabled-color'
  41. : 'subtitle-color'
  42. "
  43. >
  44. {{
  45. type === 'user'
  46. ? '有效期:' + data.use_start_time.substring(0, 11)
  47. : '领取时间:' + data.get_start_time.substring(0, 11)
  48. }}至
  49. {{
  50. type === 'user'
  51. ? data.use_end_time.substring(0, 11)
  52. : data.get_end_time.substring(0, 11)
  53. }}
  54. </view>
  55. <view
  56. class="value-enough"
  57. :class="
  58. data.status == 'expired' || data.status == 'used'
  59. ? 'disabled-color'
  60. : 'subtitle-color'
  61. "
  62. >满{{ data.enough }}可用</view
  63. >
  64. </view>
  65. </view>
  66. </view>
  67. <view class="desc ss-flex ss-row-between">
  68. <view>
  69. <view class="desc-title">
  70. {{ data.description }}
  71. </view>
  72. <view>
  73. <slot name="reason">
  74. </slot>
  75. </view>
  76. </view>
  77. <view>
  78. <slot></slot>
  79. </view>
  80. </view>
  81. </view>
  82. </template>
  83. <script setup>
  84. import { reactive } from 'vue';
  85. import sheep from '@/sheep';
  86. const state = reactive({
  87. stateMap: {
  88. 0: '立即领取',
  89. 1: '去使用',
  90. },
  91. });
  92. // 接受参数
  93. const props = defineProps({
  94. data: {
  95. type: Object,
  96. default: {},
  97. },
  98. disabled: {
  99. type: Boolean,
  100. default: false,
  101. },
  102. type: {
  103. type: String,
  104. default: 'coupon',
  105. },
  106. });
  107. </script>
  108. <style lang="scss" scoped>
  109. .info-bg-color {
  110. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  111. }
  112. .disabled-bg-color {
  113. background: #999;
  114. }
  115. .info-color {
  116. color: #333;
  117. }
  118. .subtitle-color {
  119. color: #666;
  120. }
  121. .disabled-color {
  122. color: #999;
  123. }
  124. .content {
  125. width: 100%;
  126. background: #fff;
  127. border-radius: 20rpx 20rpx 0 0;
  128. -webkit-mask: radial-gradient(circle at 12rpx 100%, #0000 12rpx, red 0) -12rpx;
  129. box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04);
  130. .tag {
  131. width: 100rpx;
  132. color: #fff;
  133. height: 40rpx;
  134. font-size: 24rpx;
  135. border-radius: 20rpx 0 20rpx 0;
  136. }
  137. .title {
  138. padding-bottom: 22rpx;
  139. border-bottom: 2rpx dashed #d3d3d3;
  140. .value-text {
  141. font-size: 32rpx;
  142. font-weight: 600;
  143. }
  144. .sellby-text {
  145. font-size: 24rpx;
  146. font-weight: 400;
  147. }
  148. .value-price {
  149. font-size: 64rpx;
  150. font-weight: 500;
  151. line-height: normal;
  152. font-family: OPPOSANS;
  153. }
  154. .value-reduce {
  155. line-height: normal;
  156. font-size: 32rpx;
  157. }
  158. .value-discount {
  159. line-height: normal;
  160. font-size: 28rpx;
  161. }
  162. .value-enough {
  163. font-size: 24rpx;
  164. font-weight: 400;
  165. font-family: OPPOSANS;
  166. }
  167. }
  168. }
  169. .desc {
  170. width: 100%;
  171. background: #fff;
  172. -webkit-mask: radial-gradient(circle at 12rpx 0%, #0000 12rpx, red 0) -12rpx;
  173. box-shadow: rgba(#000, 0.1);
  174. box-sizing: border-box;
  175. padding: 24rpx 30rpx;
  176. box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04);
  177. border-radius: 0 0 20rpx 20rpx;
  178. .desc-title {
  179. font-size: 24rpx;
  180. color: #999;
  181. font-weight: 400;
  182. }
  183. }
  184. .price-text {
  185. color: #ff0000;
  186. }
  187. </style>