s-coupon-list.vue 4.2 KB

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