myCoupon.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <view class="container">
  3. <!-- 分段器区域 -->
  4. <view class="segmented">
  5. <view class="segmented_box">
  6. <uni-segmented-control :current="activeCurrent" :values="headerList" style-type="text" active-color="#096562" @clickItem="onClickItem" />
  7. </view>
  8. </view>
  9. <!-- 领券中心横幅区域 -->
  10. <view class="banner">
  11. <img mode="aspectFill" src="../../static/my/banner.png" />
  12. <view class="banner_title">领券中心</view>
  13. <view class="banner_msg">
  14. <view class="msg_top">关注领券中心</view>
  15. <view>系统会不定时发放代金券</view>
  16. </view>
  17. <view class="banner_btn">去逛逛</view>
  18. </view>
  19. <!-- 代金券列表区域 -->
  20. <scroll-view class="body" scroll-y @scrolltolower="handlePull">
  21. <!-- 每一个代金券区域 -->
  22. <view class="body_box" v-for="item in list" :key="item.id">
  23. <!-- 代金券类型区域 -->
  24. <img src="../../static/my/couponTitle.png" />
  25. <view class="box_title">
  26. <view class="title_type">{{ item.type }}</view>
  27. <view class="title_num">x{{ item.count }}张</view>
  28. </view>
  29. <!-- 代金券信息区域 -->
  30. <view class="box_info">
  31. <view class="info_left">
  32. <view class="left_top">{{ item.name }}</view>
  33. <view class="left_bottom">
  34. <view class="tag">有限期至{{ item.time }}</view>
  35. <view class="tag">可通用</view>
  36. <view class="tag">全民宿</view>
  37. </view>
  38. </view>
  39. <view class="info_right">
  40. <view class="right_top">{{ item.msg }}</view>
  41. <view class="right_bottom" :class="{ color: item.info === '无门槛' }">{{ item.info }}</view>
  42. </view>
  43. </view>
  44. <!-- 代金券按钮区域 -->
  45. <view class="box_btn">去使用</view>
  46. </view>
  47. </scroll-view>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. // 分段器当前激活索引
  55. activeCurrent: 0,
  56. // 分段器数组
  57. headerList: ['全部', '代金券', '折扣券'],
  58. list: [
  59. {
  60. id: 1,
  61. type: '折扣券',
  62. count: 5,
  63. name: '7.5折折扣卷',
  64. time: '2023.09.01',
  65. msg: '7.5折',
  66. info: '满200可用'
  67. },
  68. {
  69. id: 2,
  70. type: '代金券',
  71. count: 2,
  72. name: '20元代金券',
  73. time: '2023.10.01',
  74. msg: '¥10',
  75. info: '无门槛'
  76. },
  77. {
  78. id: 1,
  79. type: '折扣券',
  80. count: 5,
  81. name: '7.5折折扣卷',
  82. time: '2023.09.01',
  83. msg: '7.5折',
  84. info: '满200可用'
  85. },
  86. {
  87. id: 2,
  88. type: '代金券',
  89. count: 2,
  90. name: '20元代金券',
  91. time: '2023.10.01',
  92. msg: '¥10',
  93. info: '无门槛'
  94. },
  95. {
  96. id: 1,
  97. type: '折扣券',
  98. count: 5,
  99. name: '7.5折折扣卷',
  100. time: '2023.09.01',
  101. msg: '7.5折',
  102. info: '满200可用'
  103. },
  104. {
  105. id: 2,
  106. type: '代金券',
  107. count: 2,
  108. name: '20元代金券',
  109. time: '2023.10.01',
  110. msg: '¥10',
  111. info: '无门槛'
  112. }
  113. ]
  114. }
  115. },
  116. methods: {
  117. // 切换分段器回调
  118. onClickItem(e) {
  119. if (this.current !== e.currentIndex) {
  120. this.current = e.currentIndex
  121. }
  122. },
  123. // 列表下拉到底部回调
  124. handlePull() {
  125. console.log(111)
  126. }
  127. }
  128. }
  129. </script>
  130. <style lang="scss" scoped>
  131. .container {
  132. height: 100vh;
  133. background-color: #f2f3f5;
  134. overflow: hidden;
  135. .segmented {
  136. box-sizing: border-box;
  137. padding-bottom: 28rpx;
  138. height: 100rpx;
  139. background-color: #fff;
  140. .segmented_box {
  141. width: 50%;
  142. }
  143. }
  144. .banner {
  145. position: relative;
  146. padding: 0 20rpx;
  147. height: 158rpx;
  148. img {
  149. margin-top: 31rpx;
  150. width: 710rpx;
  151. height: 95rpx;
  152. }
  153. .banner_title {
  154. position: absolute;
  155. top: 42rpx;
  156. left: 55rpx;
  157. color: #fff;
  158. font-size: 50rpx;
  159. font-weight: bold;
  160. }
  161. .banner_msg {
  162. position: absolute;
  163. top: 46rpx;
  164. left: 280rpx;
  165. display: flex;
  166. flex-direction: column;
  167. justify-content: space-between;
  168. padding-left: 15rpx;
  169. height: 61rpx;
  170. color: #fff;
  171. font-size: 20rpx;
  172. border-left: 1rpx dotted #fff;
  173. .msg_top {
  174. margin-top: -5rpx;
  175. }
  176. }
  177. .banner_btn {
  178. position: absolute;
  179. top: 46rpx;
  180. left: 556rpx;
  181. display: flex;
  182. justify-content: center;
  183. align-items: center;
  184. width: 133rpx;
  185. height: 61rpx;
  186. color: #000;
  187. font-size: 28rpx;
  188. border-radius: 12rpx;
  189. background: linear-gradient(90deg, #ffeb3b 0%, #ffb300 100%);
  190. }
  191. }
  192. .body {
  193. box-sizing: border-box;
  194. padding: 0 30rpx 20rpx;
  195. height: calc(100vh - 258rpx);
  196. .body_box {
  197. position: relative;
  198. margin-bottom: 20rpx;
  199. height: 218rpx;
  200. border-radius: 15rpx;
  201. background-color: #fff;
  202. img {
  203. width: 135rpx;
  204. height: 36rpx;
  205. }
  206. .box_title {
  207. position: absolute;
  208. top: 0;
  209. left: 16rpx;
  210. display: flex;
  211. align-items: center;
  212. color: #fff;
  213. .title_type {
  214. font-size: 24rpx;
  215. font-weight: bold;
  216. }
  217. .title_num {
  218. margin-left: 5rpx;
  219. margin-top: 10rpx;
  220. font-size: 16rpx;
  221. }
  222. }
  223. .box_info {
  224. display: flex;
  225. padding: 0 30rpx 0 25rpx;
  226. .info_left {
  227. flex: 4;
  228. .left_top {
  229. margin: 12rpx 0;
  230. font-size: 36rpx;
  231. }
  232. .left_bottom {
  233. display: flex;
  234. color: #808080;
  235. font-size: 24rpx;
  236. .tag {
  237. margin-right: 32rpx;
  238. }
  239. }
  240. }
  241. .info_right {
  242. flex: 1;
  243. color: #ff5733;
  244. .right_top {
  245. margin: 10rpx 0;
  246. text-align: end;
  247. font-size: 36rpx;
  248. }
  249. .right_bottom {
  250. text-align: end;
  251. font-size: 20rpx;
  252. }
  253. .color {
  254. color: #a6a6a6;
  255. }
  256. }
  257. }
  258. .box_btn {
  259. display: flex;
  260. justify-content: center;
  261. align-items: center;
  262. margin-right: 30rpx;
  263. margin-top: 11rpx;
  264. margin-left: auto;
  265. width: 98rpx;
  266. height: 40rpx;
  267. color: #fff;
  268. font-size: 24rpx;
  269. border-radius: 6rpx;
  270. background-color: #096562;
  271. }
  272. }
  273. }
  274. }
  275. </style>