s-coupon-list.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="ss-m-20" :style="{ opacity: disabled ? '0.4' : '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 class="desc-title">
  69. {{ data.description }}
  70. </view>
  71. <view>
  72. <slot></slot>
  73. </view>
  74. </view>
  75. </view>
  76. </template>
  77. <script setup>
  78. import { reactive } from 'vue';
  79. import sheep from '@/sheep';
  80. const state = reactive({
  81. stateMap: {
  82. 0: '立即领取',
  83. 1: '去使用',
  84. },
  85. });
  86. // 接受参数
  87. const props = defineProps({
  88. data: {
  89. type: Object,
  90. default: {},
  91. },
  92. disabled: {
  93. type: Boolean,
  94. default: false,
  95. },
  96. type: {
  97. type: String,
  98. default: 'coupon',
  99. },
  100. });
  101. </script>
  102. <style lang="scss" scoped>
  103. .info-bg-color {
  104. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  105. }
  106. .disabled-bg-color {
  107. background: #999;
  108. }
  109. .info-color {
  110. color: #333;
  111. }
  112. .subtitle-color {
  113. color: #666;
  114. }
  115. .disabled-color {
  116. color: #999;
  117. }
  118. .content {
  119. width: 100%;
  120. background: #fff;
  121. border-radius: 20rpx 20rpx 0 0;
  122. -webkit-mask: radial-gradient(circle at 12rpx 100%, #0000 12rpx, red 0) -12rpx;
  123. box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04);
  124. .tag {
  125. width: 100rpx;
  126. color: #fff;
  127. height: 40rpx;
  128. font-size: 24rpx;
  129. border-radius: 20rpx 0 20rpx 0;
  130. }
  131. .title {
  132. padding-bottom: 22rpx;
  133. border-bottom: 2rpx dashed #d3d3d3;
  134. .value-text {
  135. font-size: 32rpx;
  136. font-weight: 600;
  137. }
  138. .sellby-text {
  139. font-size: 24rpx;
  140. font-weight: 400;
  141. }
  142. .value-price {
  143. font-size: 64rpx;
  144. font-weight: 500;
  145. line-height: normal;
  146. }
  147. .value-reduce {
  148. line-height: normal;
  149. font-size: 32rpx;
  150. }
  151. .value-discount {
  152. line-height: normal;
  153. font-size: 28rpx;
  154. }
  155. .value-enough {
  156. font-size: 24rpx;
  157. font-weight: 400;
  158. }
  159. }
  160. }
  161. .desc {
  162. width: 100%;
  163. background: #fff;
  164. -webkit-mask: radial-gradient(circle at 12rpx 0%, #0000 12rpx, red 0) -12rpx;
  165. box-shadow: rgba(#000, 0.1);
  166. box-sizing: border-box;
  167. padding: 24rpx 30rpx;
  168. box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.04);
  169. border-radius: 0 0 20rpx 20rpx;
  170. .desc-title {
  171. font-size: 24rpx;
  172. color: #999;
  173. font-weight: 400;
  174. }
  175. }
  176. .price-text {
  177. color: #ff0000;
  178. }
  179. </style>