couponCenter.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="container">
  3. <!-- 优惠券列表区域 -->
  4. <view class="body">
  5. <!-- 每一张优惠券区域 -->
  6. <view class="body_item" v-for="item in list" :key="item.id">
  7. <img src="../../static/my/couponTitle.png" />
  8. <view class="item_type" v-if="item.type === 1">折扣卷</view>
  9. <view class="item_type" v-if="item.type === 2">代金卷</view>
  10. <view class="item_box">
  11. <view class="box_left">
  12. <view class="left_title">{{ item.name }}</view>
  13. <view class="left_time">{{ item.time }} 可领取</view>
  14. <view class="left_tags">
  15. <view class="tag" v-for="(ele, index) in item.tags" :key="index" @click="handleClickTag(ele)">
  16. {{ ele }}
  17. <img v-if="ele === '指定民宿'" src="../../static/index/right2.png" />
  18. </view>
  19. </view>
  20. </view>
  21. <view class="box_right">
  22. <view class="right_info">
  23. <view class="info_top">{{ item.info }}</view>
  24. <view class="info_bottom">满200可用</view>
  25. <view class="info_btn" v-if="item.isFull">立即领取</view>
  26. <view class="info_btn2" v-else>已领取</view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="noData" v-if="list.length === 0">
  33. <img lazy-load :lazy-load-margin="0" src="../../static/images/noData.png" />
  34. 暂无数据
  35. </view>
  36. <!-- 指定民宿弹窗区域 -->
  37. <uni-popup ref="popup" type="center" :is-mask-click="false">
  38. <view class="popup_body">
  39. <view class="popup_header">
  40. <img src="../../static/my/popup_title.png" />
  41. <view class="header_title">指定民宿</view>
  42. <img src="../../static/my/popup_title.png" />
  43. </view>
  44. <view class="popup_center">民宿名称,民宿名称,民宿名称</view>
  45. <view class="popup_btn" @click="handleClose">我知道了</view>
  46. </view>
  47. </uni-popup>
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. // 优惠券列表数据
  55. list: [
  56. // {
  57. // id: 1,
  58. // name: '7.5折折扣卷',
  59. // type: 1,
  60. // info: '7.5折',
  61. // isFull: false,
  62. // time: '2023.09.01 12:00 - 2023.10.01 12:00',
  63. // tags: ['可通用', '全民宿']
  64. // },
  65. // {
  66. // id: 2,
  67. // name: '20元代金券',
  68. // type: 2,
  69. // info: '¥20',
  70. // isFull: true,
  71. // time: '2023.09.01 12:00 - 2023.10.01 12:00',
  72. // tags: ['可通用', '指定民宿']
  73. // },
  74. // {
  75. // id: 3,
  76. // name: '7.5折折扣卷',
  77. // type: 1,
  78. // info: '7.5折',
  79. // isFull: false,
  80. // time: '2023.09.01 12:00 - 2023.10.01 12:00',
  81. // tags: ['可通用', '全民宿']
  82. // }
  83. ]
  84. }
  85. },
  86. methods: {
  87. // 点击指定民宿tag回调
  88. handleClickTag(ele) {
  89. if (ele === '指定民宿') {
  90. this.$refs.popup.open()
  91. }
  92. },
  93. // 点击弹窗我知道了按钮回调
  94. handleClose() {
  95. this.$refs.popup.close()
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss" scoped>
  101. .container {
  102. box-sizing: border-box;
  103. padding: 20rpx 30rpx;
  104. height: 100vh;
  105. overflow-y: auto;
  106. background-color: #f2f3f5;
  107. .body {
  108. .body_item {
  109. position: relative;
  110. margin-bottom: 20rpx;
  111. padding-bottom: 22rpx;
  112. width: 690rpx;
  113. border-radius: 15rpx;
  114. background-color: #fff;
  115. img {
  116. width: 100rpx;
  117. height: 36rpx;
  118. }
  119. .item_type {
  120. position: absolute;
  121. top: 0;
  122. left: 14rpx;
  123. font-size: 24rpx;
  124. font-weight: bold;
  125. color: #fff;
  126. }
  127. .item_box {
  128. padding: 0 25rpx;
  129. display: flex;
  130. .box_left {
  131. flex: 6;
  132. overflow: hidden;
  133. .left_title {
  134. margin: 12rpx 0;
  135. font-size: 36rpx;
  136. font-weight: bold;
  137. overflow: hidden;
  138. text-overflow: ellipsis;
  139. white-space: nowrap;
  140. }
  141. .left_time {
  142. display: flex;
  143. flex-wrap: wrap;
  144. color: #808080;
  145. font-size: 20rpx;
  146. }
  147. .left_tags {
  148. display: flex;
  149. align-items: center;
  150. margin-top: 20rpx;
  151. color: #808080;
  152. font-size: 20rpx;
  153. .tag {
  154. display: flex;
  155. align-items: center;
  156. margin-right: 44rpx;
  157. img {
  158. margin-top: 4rpx;
  159. margin-left: 4rpx;
  160. width: 28rpx;
  161. height: 28rpx;
  162. }
  163. }
  164. }
  165. }
  166. .box_right {
  167. flex: 2;
  168. display: flex;
  169. .right_info {
  170. flex: 1;
  171. display: flex;
  172. flex-direction: column;
  173. align-items: flex-end;
  174. width: 100rpx;
  175. color: #ff5733;
  176. .info_top {
  177. margin-top: 10rpx;
  178. font-size: 36rpx;
  179. }
  180. .info_bottom {
  181. margin-top: 10rpx;
  182. font-size: 20rpx;
  183. }
  184. .info_btn {
  185. display: flex;
  186. justify-content: center;
  187. align-items: center;
  188. margin-top: 25rpx;
  189. width: 122rpx;
  190. height: 48rpx;
  191. color: #fff;
  192. font-size: 24rpx;
  193. border-radius: 6rpx;
  194. background-color: #096562;
  195. }
  196. .info_btn2 {
  197. display: flex;
  198. justify-content: center;
  199. align-items: center;
  200. margin-top: 25rpx;
  201. width: 122rpx;
  202. height: 48rpx;
  203. color: #fff;
  204. font-size: 24rpx;
  205. border-radius: 6rpx;
  206. background-color: #cccccc;
  207. }
  208. }
  209. }
  210. }
  211. }
  212. }
  213. .noData {
  214. display: flex;
  215. flex-direction: column;
  216. justify-content: center;
  217. align-items: center;
  218. padding-bottom: 20rpx;
  219. img {
  220. margin-top: 220rpx;
  221. width: 600rpx;
  222. height: 600rpx;
  223. }
  224. }
  225. .popup_body {
  226. display: flex;
  227. flex-direction: column;
  228. align-items: center;
  229. width: 481rpx;
  230. height: 404rpx;
  231. border-radius: 22.5rpx;
  232. background-color: #fff;
  233. .popup_header {
  234. display: flex;
  235. justify-content: center;
  236. align-items: center;
  237. height: 123rpx;
  238. font-size: 34rpx;
  239. font-weight: bold;
  240. color: #0f194d;
  241. img {
  242. width: 16rpx;
  243. height: 16rpx;
  244. }
  245. .header_title {
  246. margin: 0 10rpx;
  247. }
  248. }
  249. .popup_center {
  250. height: 135rpx;
  251. color: rgba(15, 25, 77, 0.6);
  252. font-size: 28rpx;
  253. font-weight: bold;
  254. }
  255. .popup_btn {
  256. display: flex;
  257. justify-content: center;
  258. align-items: center;
  259. width: 396rpx;
  260. height: 76rpx;
  261. color: #fff;
  262. font-size: 26rpx;
  263. border-radius: 43rpx;
  264. background: linear-gradient(90deg, #0bc196 0%, #096562 100%);
  265. }
  266. }
  267. }
  268. </style>