myCoupon.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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" @click="handleGoPage('/pages/couponCenter/couponCenter')">去逛逛</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. handleGoPage(url) {
  129. uni.navigateTo({
  130. url
  131. })
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .container {
  138. height: 100vh;
  139. background-color: #f2f3f5;
  140. overflow: hidden;
  141. .segmented {
  142. box-sizing: border-box;
  143. padding-bottom: 28rpx;
  144. height: 100rpx;
  145. background-color: #fff;
  146. .segmented_box {
  147. width: 50%;
  148. }
  149. }
  150. .banner {
  151. position: relative;
  152. padding: 0 20rpx;
  153. height: 158rpx;
  154. img {
  155. margin-top: 31rpx;
  156. width: 710rpx;
  157. height: 95rpx;
  158. }
  159. .banner_title {
  160. position: absolute;
  161. top: 42rpx;
  162. left: 55rpx;
  163. color: #fff;
  164. font-size: 50rpx;
  165. font-weight: bold;
  166. }
  167. .banner_msg {
  168. position: absolute;
  169. top: 46rpx;
  170. left: 280rpx;
  171. display: flex;
  172. flex-direction: column;
  173. justify-content: space-between;
  174. padding-left: 15rpx;
  175. height: 61rpx;
  176. color: #fff;
  177. font-size: 20rpx;
  178. border-left: 1rpx dotted #fff;
  179. .msg_top {
  180. margin-top: -5rpx;
  181. }
  182. }
  183. .banner_btn {
  184. position: absolute;
  185. top: 46rpx;
  186. left: 556rpx;
  187. display: flex;
  188. justify-content: center;
  189. align-items: center;
  190. width: 133rpx;
  191. height: 61rpx;
  192. color: #000;
  193. font-size: 28rpx;
  194. border-radius: 12rpx;
  195. background: linear-gradient(90deg, #ffeb3b 0%, #ffb300 100%);
  196. }
  197. }
  198. .body {
  199. box-sizing: border-box;
  200. padding: 0 30rpx 20rpx;
  201. height: calc(100vh - 258rpx);
  202. .body_box {
  203. position: relative;
  204. margin-bottom: 20rpx;
  205. height: 218rpx;
  206. border-radius: 15rpx;
  207. background-color: #fff;
  208. img {
  209. width: 135rpx;
  210. height: 36rpx;
  211. }
  212. .box_title {
  213. position: absolute;
  214. top: 0;
  215. left: 16rpx;
  216. display: flex;
  217. align-items: center;
  218. color: #fff;
  219. .title_type {
  220. font-size: 24rpx;
  221. font-weight: bold;
  222. }
  223. .title_num {
  224. margin-left: 5rpx;
  225. margin-top: 10rpx;
  226. font-size: 16rpx;
  227. }
  228. }
  229. .box_info {
  230. display: flex;
  231. padding: 0 30rpx 0 25rpx;
  232. .info_left {
  233. flex: 4;
  234. .left_top {
  235. margin: 12rpx 0;
  236. font-size: 36rpx;
  237. }
  238. .left_bottom {
  239. display: flex;
  240. color: #808080;
  241. font-size: 24rpx;
  242. .tag {
  243. margin-right: 32rpx;
  244. }
  245. }
  246. }
  247. .info_right {
  248. flex: 1;
  249. color: #ff5733;
  250. .right_top {
  251. margin: 10rpx 0;
  252. text-align: end;
  253. font-size: 36rpx;
  254. }
  255. .right_bottom {
  256. text-align: end;
  257. font-size: 20rpx;
  258. }
  259. .color {
  260. color: #a6a6a6;
  261. }
  262. }
  263. }
  264. .box_btn {
  265. display: flex;
  266. justify-content: center;
  267. align-items: center;
  268. margin-right: 30rpx;
  269. margin-top: 11rpx;
  270. margin-left: auto;
  271. width: 98rpx;
  272. height: 40rpx;
  273. color: #fff;
  274. font-size: 24rpx;
  275. border-radius: 6rpx;
  276. background-color: #096562;
  277. }
  278. }
  279. }
  280. }
  281. </style>