couponCenter.vue 5.6 KB

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