coupon.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <view class="page-wrap">
  3. <view class="tabs-panel">
  4. <view :class="{ item: true, active: tabActive === item.value }" v-for="(item, index) in tabList" :key="index" @click="tabActive = item.value">
  5. {{ item.label }}
  6. </view>
  7. </view>
  8. <!-- 未使用 -->
  9. <view v-if="tabActive === 1" class="coupon-panel">
  10. <view class="item">
  11. <view class="name">三八女神节特惠券【通用】</view>
  12. <view class="desc">使用范围:所有产品品类可用</view>
  13. <view class="desc">使用条件:满100元可用</view>
  14. <view class="desc">有效日期:至 2023-03-31</view>
  15. <view class="side">
  16. <view class="price">38</view>
  17. 满100元可用
  18. </view>
  19. </view>
  20. <view class="item">
  21. <view class="name">100元财税代金券</view>
  22. <view class="desc">使用范围:指定产品品类可用</view>
  23. <view class="desc">使用条件:无限制</view>
  24. <view class="desc">有效日期:无限制</view>
  25. <view class="side">
  26. <view class="price">100</view>
  27. 使用无限制
  28. </view>
  29. </view>
  30. <view class="item">
  31. <view class="name">六一童心特惠券</view>
  32. <view class="desc">使用范围:所有产品品类可用</view>
  33. <view class="desc">使用条件:满100元可用</view>
  34. <view class="desc">有效日期:至 2023-03-31</view>
  35. <view class="side">
  36. <view class="price">61</view>
  37. 满100元可用
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 已使用 -->
  42. <view v-if="tabActive === 2" class="coupon-panel">
  43. <view class="item disabled">
  44. <view class="name">
  45. <view class="price">38</view>
  46. <view class="text">三八女神节特惠券</view>
  47. </view>
  48. <view class="desc">使用范围:所有产品品类可用</view>
  49. <view class="desc">使用条件:满100元可用</view>
  50. <view class="desc">有效日期:至 2023-03-31</view>
  51. <view class="side">
  52. <image class="state-1" src="../../static/img_coupon_state_1.png"></image>
  53. </view>
  54. </view>
  55. <view class="item disabled">
  56. <view class="name">
  57. <view class="price">100</view>
  58. <view class="text">财税代金券</view>
  59. </view>
  60. <view class="desc">使用范围:所有产品品类可用</view>
  61. <view class="desc">使用条件:满100元可用</view>
  62. <view class="desc">有效日期:至 2023-03-31</view>
  63. <view class="side">
  64. <image class="state-1" src="../../static/img_coupon_state_1.png"></image>
  65. </view>
  66. </view>
  67. </view>
  68. <!-- 已使用 -->
  69. <view v-if="tabActive === 3" class="coupon-panel">
  70. <view class="item disabled">
  71. <view class="name">
  72. <view class="price">38</view>
  73. <view class="text">三八女神节特惠券</view>
  74. </view>
  75. <view class="desc">使用范围:所有产品品类可用</view>
  76. <view class="desc">使用条件:满100元可用</view>
  77. <view class="desc">有效日期:至 2023-03-31</view>
  78. <view class="side">
  79. <image class="state-2" src="../../static/img_coupon_state_2.png"></image>
  80. </view>
  81. </view>
  82. <view class="item disabled">
  83. <view class="name">
  84. <view class="price">100</view>
  85. <view class="text">财税代金券</view>
  86. </view>
  87. <view class="desc">使用范围:所有产品品类可用</view>
  88. <view class="desc">使用条件:满100元可用</view>
  89. <view class="desc">有效日期:至 2023-03-31</view>
  90. <view class="side">
  91. <image class="state-2" src="../../static/img_coupon_state_2.png"></image>
  92. </view>
  93. </view>
  94. </view>
  95. <button class="foot-btn">去领券中心看看</button>
  96. </view>
  97. </template>
  98. <script>
  99. export default {
  100. data() {
  101. return {
  102. tabActive: 1,
  103. tabList: [
  104. {
  105. label: '未使用',
  106. value: 1
  107. },
  108. {
  109. label: '已使用',
  110. value: 2
  111. },
  112. {
  113. label: '已失效',
  114. value: 3
  115. }
  116. ]
  117. };
  118. },
  119. methods: {}
  120. };
  121. </script>
  122. <style lang="scss" scoped>
  123. .page-wrap {
  124. padding: 82.42rpx 0 96.15rpx;
  125. }
  126. .tabs-panel {
  127. position: fixed;
  128. left: 0;
  129. top: 0;
  130. right: 0;
  131. height: 82.42rpx;
  132. background: #fff;
  133. display: flex;
  134. padding: 0 41.21rpx;
  135. z-index: 1;
  136. &::before,
  137. &::after {
  138. content: '';
  139. position: absolute;
  140. left: 0;
  141. right: 0;
  142. height: 1rpx;
  143. background: #e0e0e0;
  144. }
  145. &::before {
  146. top: 0;
  147. }
  148. &::after {
  149. bottom: 0;
  150. }
  151. .item {
  152. padding: 0 9.62rpx;
  153. text-align: center;
  154. font-size: 27.47rpx;
  155. color: #999;
  156. line-height: 82.42rpx;
  157. position: relative;
  158. & + .item {
  159. margin-left: 27.47rpx;
  160. }
  161. }
  162. .active {
  163. color: #00bcd2;
  164. &::after {
  165. content: '';
  166. position: absolute;
  167. left: 0%;
  168. right: 0%;
  169. bottom: 0%;
  170. height: 5.49rpx;
  171. background: #00bcd2;
  172. z-index: 1;
  173. }
  174. }
  175. }
  176. .coupon-panel {
  177. .item {
  178. width: 708.79rpx;
  179. height: 192.31rpx;
  180. border-radius: 8.24rpx;
  181. position: relative;
  182. overflow: hidden;
  183. padding: 27.47rpx 233.52rpx 27.47rpx 41.21rpx;
  184. box-sizing: border-box;
  185. margin: 13.74rpx auto;
  186. &:before {
  187. content: '';
  188. position: absolute;
  189. left: 0;
  190. top: 0;
  191. width: 100%;
  192. height: 100%;
  193. background: #fff;
  194. -webkit-mask-image: radial-gradient(circle at 13.74rpx 50%, transparent 13.74rpx, red 13.74rpx);
  195. -webkit-mask-position: -13.74rpx;
  196. z-index: -1;
  197. }
  198. &::after {
  199. content: '';
  200. position: absolute;
  201. right: -27.47rpx;
  202. top: 0;
  203. height: 100%;
  204. width: 239.01rpx;
  205. background: #fe6e6d;
  206. -webkit-mask-image: radial-gradient(circle at 5rpx, transparent 6rpx, red 6rpx);
  207. -webkit-mask-position: -6rpx;
  208. -webkit-mask-size: 100% 19rpx;
  209. z-index: -1;
  210. }
  211. &.disabled::after {
  212. background: #ccc;
  213. }
  214. }
  215. .name {
  216. font-size: 30.22rpx;
  217. height: 68.68rpx;
  218. display: flex;
  219. align-items: center;
  220. margin-top: -14rpx;
  221. .text {
  222. flex: 1;
  223. width: 0;
  224. white-space: nowrap;
  225. overflow: hidden;
  226. text-overflow: ellipsis;
  227. }
  228. .price {
  229. line-height: 1;
  230. margin: -14rpx 10rpx 0 0;
  231. }
  232. }
  233. .desc {
  234. font-size: 24.73rpx;
  235. color: #999;
  236. white-space: nowrap;
  237. overflow: hidden;
  238. text-overflow: ellipsis;
  239. line-height: 1.3;
  240. }
  241. .side {
  242. position: absolute;
  243. right: 0;
  244. top: 0;
  245. height: 100%;
  246. width: 211.54rpx;
  247. display: flex;
  248. flex-direction: column;
  249. align-items: center;
  250. font-size: 21.98rpx;
  251. color: #fff;
  252. padding-top: 27.47rpx;
  253. }
  254. .price {
  255. font-size: 68.68rpx;
  256. &:before {
  257. content: '¥';
  258. font-size: 38.46rpx;
  259. }
  260. }
  261. .state-1 {
  262. width: 182.69rpx;
  263. height: 120.88rpx;
  264. margin-top: 13.74rpx;
  265. }
  266. .state-2 {
  267. width: 189.56rpx;
  268. height: 130.49rpx;
  269. margin-top: 8.24rpx;
  270. }
  271. }
  272. .foot-btn {
  273. position: fixed;
  274. left: 0;
  275. bottom: 0;
  276. width: 100%;
  277. height: 96.15rpx;
  278. background: #fff;
  279. font-size: 30.22rpx;
  280. color: #00bcd2;
  281. line-height: 96.15rpx;
  282. border: none;
  283. border-radius: 0;
  284. &:before {
  285. content: '';
  286. position: absolute;
  287. top: 0;
  288. left: 0;
  289. right: 0;
  290. height: 1rpx;
  291. background: #e0e0e0;
  292. }
  293. &::after {
  294. display: none;
  295. }
  296. }
  297. </style>