coupon.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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" @click="handleOpenCouponDetail">
  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. handleOpenCouponDetail() {
  121. uni.navigateTo({
  122. url: 'couponDetail'
  123. });
  124. }
  125. }
  126. };
  127. </script>
  128. <style lang="scss" scoped>
  129. .page-wrap {
  130. padding: 82.42rpx 0 96.15rpx;
  131. }
  132. .tabs-panel {
  133. position: fixed;
  134. left: 0;
  135. top: 0;
  136. right: 0;
  137. height: 82.42rpx;
  138. background: #fff;
  139. display: flex;
  140. padding: 0 41.21rpx;
  141. z-index: 1;
  142. &::before,
  143. &::after {
  144. content: '';
  145. position: absolute;
  146. left: 0;
  147. right: 0;
  148. height: 1rpx;
  149. background: #e0e0e0;
  150. }
  151. &::before {
  152. top: 0;
  153. }
  154. &::after {
  155. bottom: 0;
  156. }
  157. .item {
  158. padding: 0 9.62rpx;
  159. text-align: center;
  160. font-size: 27.47rpx;
  161. color: #999;
  162. line-height: 82.42rpx;
  163. position: relative;
  164. & + .item {
  165. margin-left: 27.47rpx;
  166. }
  167. }
  168. .active {
  169. color: #00bcd2;
  170. &::after {
  171. content: '';
  172. position: absolute;
  173. left: 0%;
  174. right: 0%;
  175. bottom: 0%;
  176. height: 5.49rpx;
  177. background: #00bcd2;
  178. z-index: 1;
  179. }
  180. }
  181. }
  182. .coupon-panel {
  183. .item {
  184. width: 708.79rpx;
  185. height: 192.31rpx;
  186. border-radius: 8.24rpx;
  187. position: relative;
  188. overflow: hidden;
  189. padding: 27.47rpx 233.52rpx 27.47rpx 41.21rpx;
  190. box-sizing: border-box;
  191. margin: 13.74rpx auto;
  192. &:before {
  193. content: '';
  194. position: absolute;
  195. left: 0;
  196. top: 0;
  197. width: 100%;
  198. height: 100%;
  199. background: #fff;
  200. -webkit-mask-image: radial-gradient(circle at 13.74rpx 50%, transparent 13.74rpx, red 13.74rpx);
  201. -webkit-mask-position: -13.74rpx;
  202. z-index: -1;
  203. }
  204. &::after {
  205. content: '';
  206. position: absolute;
  207. right: -27.47rpx;
  208. top: 0;
  209. height: 100%;
  210. width: 239.01rpx;
  211. background: #fe6e6d;
  212. -webkit-mask-image: radial-gradient(circle at 5rpx, transparent 6rpx, red 6rpx);
  213. -webkit-mask-position: -6rpx;
  214. -webkit-mask-size: 100% 19rpx;
  215. z-index: -1;
  216. }
  217. &.disabled::after {
  218. background: #ccc;
  219. }
  220. }
  221. .name {
  222. font-size: 30.22rpx;
  223. height: 68.68rpx;
  224. display: flex;
  225. align-items: center;
  226. margin-top: -14rpx;
  227. .text {
  228. flex: 1;
  229. width: 0;
  230. white-space: nowrap;
  231. overflow: hidden;
  232. text-overflow: ellipsis;
  233. }
  234. .price {
  235. line-height: 1;
  236. margin: -14rpx 10rpx 0 0;
  237. }
  238. }
  239. .desc {
  240. font-size: 24.73rpx;
  241. color: #999;
  242. white-space: nowrap;
  243. overflow: hidden;
  244. text-overflow: ellipsis;
  245. line-height: 1.3;
  246. }
  247. .side {
  248. position: absolute;
  249. right: 0;
  250. top: 0;
  251. height: 100%;
  252. width: 211.54rpx;
  253. display: flex;
  254. flex-direction: column;
  255. align-items: center;
  256. font-size: 21.98rpx;
  257. color: #fff;
  258. padding-top: 27.47rpx;
  259. }
  260. .price {
  261. font-size: 68.68rpx;
  262. &:before {
  263. content: '¥';
  264. font-size: 38.46rpx;
  265. }
  266. }
  267. .state-1 {
  268. width: 182.69rpx;
  269. height: 120.88rpx;
  270. margin-top: 13.74rpx;
  271. }
  272. .state-2 {
  273. width: 189.56rpx;
  274. height: 130.49rpx;
  275. margin-top: 8.24rpx;
  276. }
  277. }
  278. .foot-btn {
  279. position: fixed;
  280. left: 0;
  281. bottom: 0;
  282. width: 100%;
  283. height: 96.15rpx;
  284. background: #fff;
  285. font-size: 30.22rpx;
  286. color: #00bcd2;
  287. line-height: 96.15rpx;
  288. border: none;
  289. border-radius: 0;
  290. &:before {
  291. content: '';
  292. position: absolute;
  293. top: 0;
  294. left: 0;
  295. right: 0;
  296. height: 1rpx;
  297. background: #e0e0e0;
  298. }
  299. &::after {
  300. display: none;
  301. }
  302. }
  303. </style>