myCoupon.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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. <view class="noData" v-if="list.length === 0">
  48. <img lazy-load :lazy-load-margin="0" src="../../static/images/noData.png" />
  49. 暂无数据
  50. </view>
  51. </scroll-view>
  52. </view>
  53. </template>
  54. <script>
  55. export default {
  56. data() {
  57. return {
  58. // 分段器当前激活索引
  59. activeCurrent: 0,
  60. // 分段器数组
  61. headerList: ['全部', '代金券', '折扣券'],
  62. list: [
  63. // {
  64. // id: 1,
  65. // type: '折扣券',
  66. // count: 5,
  67. // name: '7.5折折扣卷',
  68. // time: '2023.09.01',
  69. // msg: '7.5折',
  70. // info: '满200可用'
  71. // },
  72. // {
  73. // id: 2,
  74. // type: '代金券',
  75. // count: 2,
  76. // name: '20元代金券',
  77. // time: '2023.10.01',
  78. // msg: '¥10',
  79. // info: '无门槛'
  80. // },
  81. // {
  82. // id: 1,
  83. // type: '折扣券',
  84. // count: 5,
  85. // name: '7.5折折扣卷',
  86. // time: '2023.09.01',
  87. // msg: '7.5折',
  88. // info: '满200可用'
  89. // },
  90. // {
  91. // id: 2,
  92. // type: '代金券',
  93. // count: 2,
  94. // name: '20元代金券',
  95. // time: '2023.10.01',
  96. // msg: '¥10',
  97. // info: '无门槛'
  98. // },
  99. // {
  100. // id: 1,
  101. // type: '折扣券',
  102. // count: 5,
  103. // name: '7.5折折扣卷',
  104. // time: '2023.09.01',
  105. // msg: '7.5折',
  106. // info: '满200可用'
  107. // },
  108. // {
  109. // id: 2,
  110. // type: '代金券',
  111. // count: 2,
  112. // name: '20元代金券',
  113. // time: '2023.10.01',
  114. // msg: '¥10',
  115. // info: '无门槛'
  116. // }
  117. ]
  118. }
  119. },
  120. methods: {
  121. // 切换分段器回调
  122. onClickItem(e) {
  123. if (this.current !== e.currentIndex) {
  124. this.current = e.currentIndex
  125. }
  126. },
  127. // 列表下拉到底部回调
  128. handlePull() {
  129. console.log(111)
  130. },
  131. // 跳转页面回调
  132. handleGoPage(url) {
  133. uni.navigateTo({
  134. url
  135. })
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .container {
  142. height: 100vh;
  143. background-color: #f2f3f5;
  144. overflow: hidden;
  145. .segmented {
  146. box-sizing: border-box;
  147. padding-bottom: 28rpx;
  148. height: 100rpx;
  149. background-color: #fff;
  150. .segmented_box {
  151. width: 50%;
  152. }
  153. }
  154. .banner {
  155. position: relative;
  156. padding: 0 20rpx;
  157. height: 158rpx;
  158. img {
  159. margin-top: 31rpx;
  160. width: 710rpx;
  161. height: 95rpx;
  162. }
  163. .banner_title {
  164. position: absolute;
  165. top: 42rpx;
  166. left: 55rpx;
  167. color: #fff;
  168. font-size: 50rpx;
  169. font-weight: bold;
  170. }
  171. .banner_msg {
  172. position: absolute;
  173. top: 46rpx;
  174. left: 280rpx;
  175. display: flex;
  176. flex-direction: column;
  177. justify-content: space-between;
  178. padding-left: 15rpx;
  179. height: 61rpx;
  180. color: #fff;
  181. font-size: 20rpx;
  182. border-left: 1rpx dotted #fff;
  183. .msg_top {
  184. margin-top: -5rpx;
  185. }
  186. }
  187. .banner_btn {
  188. position: absolute;
  189. top: 46rpx;
  190. left: 556rpx;
  191. display: flex;
  192. justify-content: center;
  193. align-items: center;
  194. width: 133rpx;
  195. height: 61rpx;
  196. color: #000;
  197. font-size: 28rpx;
  198. border-radius: 12rpx;
  199. background: linear-gradient(90deg, #ffeb3b 0%, #ffb300 100%);
  200. }
  201. }
  202. .body {
  203. box-sizing: border-box;
  204. padding: 0 30rpx 20rpx;
  205. height: calc(100vh - 258rpx);
  206. .body_box {
  207. position: relative;
  208. margin-bottom: 20rpx;
  209. height: 218rpx;
  210. border-radius: 15rpx;
  211. background-color: #fff;
  212. img {
  213. width: 135rpx;
  214. height: 36rpx;
  215. }
  216. .box_title {
  217. position: absolute;
  218. top: 0;
  219. left: 16rpx;
  220. display: flex;
  221. align-items: center;
  222. color: #fff;
  223. .title_type {
  224. font-size: 24rpx;
  225. font-weight: bold;
  226. }
  227. .title_num {
  228. margin-left: 5rpx;
  229. margin-top: 10rpx;
  230. font-size: 16rpx;
  231. }
  232. }
  233. .box_info {
  234. display: flex;
  235. padding: 0 30rpx 0 25rpx;
  236. .info_left {
  237. flex: 4;
  238. .left_top {
  239. margin: 12rpx 0;
  240. font-size: 36rpx;
  241. }
  242. .left_bottom {
  243. display: flex;
  244. color: #808080;
  245. font-size: 24rpx;
  246. .tag {
  247. margin-right: 32rpx;
  248. }
  249. }
  250. }
  251. .info_right {
  252. flex: 1;
  253. color: #ff5733;
  254. .right_top {
  255. margin: 10rpx 0;
  256. text-align: end;
  257. font-size: 36rpx;
  258. }
  259. .right_bottom {
  260. text-align: end;
  261. font-size: 20rpx;
  262. }
  263. .color {
  264. color: #a6a6a6;
  265. }
  266. }
  267. }
  268. .box_btn {
  269. display: flex;
  270. justify-content: center;
  271. align-items: center;
  272. margin-right: 30rpx;
  273. margin-top: 11rpx;
  274. margin-left: auto;
  275. width: 98rpx;
  276. height: 40rpx;
  277. color: #fff;
  278. font-size: 24rpx;
  279. border-radius: 6rpx;
  280. background-color: #096562;
  281. }
  282. }
  283. .noData {
  284. display: flex;
  285. flex-direction: column;
  286. justify-content: center;
  287. align-items: center;
  288. padding-bottom: 20rpx;
  289. img {
  290. margin-top: 75rpx;
  291. width: 600rpx;
  292. height: 600rpx;
  293. }
  294. }
  295. }
  296. }
  297. </style>