敢为人鲜小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

287 lines
5.5 KiB

5 months ago
  1. <template>
  2. <scroll-view scroll-y="true" :style="{height: height}" @scrolltolower="loadMoreData">
  3. <!-- 导航栏 -->
  4. <navbar title="优惠券" leftClick @leftClick="$utils.navigateBack" bgColor="#E3441A" color="#fff" />
  5. <!-- 优惠券筛选 -->
  6. <view class="tabs">
  7. <uv-tabs :list="filtrationMenu" @click="hadleFiltrationMenuEvent" lineColor="#E3441A"
  8. :activeStyle="{ color : '#E3441A' }"></uv-tabs>
  9. </view>
  10. <!-- 优惠券列表 -->
  11. <view class="list">
  12. <view class="item" v-for="(item,index) in coupons" @click="select(item)" :key="index">
  13. <image src="@/pages_order/static/coupon/coupon-bg.png" mode="widthFix" class="coupon-bg"></image>
  14. <view class="item-con">
  15. <view class="price-time">
  16. <view class="price">
  17. <view class="num">
  18. <view class="icon">
  19. </view>
  20. {{ item.money }}
  21. </view>
  22. </view>
  23. <view class="date-tiao">
  24. <view class="time">
  25. {{ item.time || '不限' }}
  26. </view>
  27. <view class="tiao">
  28. {{ item.tiaojian }}
  29. </view>
  30. </view>
  31. </view>
  32. <view class="status">
  33. <view class="order-status">
  34. <image src="@/pages_order/static/coupon/status.png" mode="widthFix" class="status-img">
  35. </image>
  36. <view class="text">
  37. 已领取
  38. </view>
  39. </view>
  40. <view class="surplus">
  41. 剩余28天过期
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <uv-empty v-if="coupons.length == 0" text="空空如也" textSize="30rpx" iconSize="200rpx" icon="list"></uv-empty>
  48. </scroll-view>
  49. </template>
  50. <script>
  51. import mixinList from '@/mixins/list.js'
  52. export default {
  53. name: "couponList",
  54. mixins: [mixinList],
  55. props: {
  56. height: {
  57. default: 'auto'
  58. // default : 'calc(90vh - 180rpx)'
  59. },
  60. // 押金
  61. depositPrice: {},
  62. washPrice: { //水洗费
  63. },
  64. rentPrice: { //租金
  65. },
  66. },
  67. data() {
  68. return {
  69. mixinsListApi: 'couponPage',
  70. filtrationMenu: [{
  71. name: "全部优惠券"
  72. }, {
  73. name: "已使用优惠券"
  74. }, {
  75. name: "已过期优惠券"
  76. }],
  77. activefiltration: 0,
  78. coupons: [{
  79. id: 1,
  80. money: 20,
  81. time: "12月20日-1月20日",
  82. tiaojian: "无门槛使用",
  83. state: 0,
  84. ex: "28"
  85. }]
  86. };
  87. },
  88. methods: {
  89. select(item) {
  90. if (this.isSelect(item)) {
  91. return
  92. }
  93. this.$emit('select', item)
  94. },
  95. isSelect(item) {
  96. if (!this.depositPrice && !this.rentPrice && !this.washPrice) {
  97. return false
  98. }
  99. // 押金
  100. if (this.depositPrice &&
  101. item.useType == 0 &&
  102. this.depositPrice >= item.conditionPrice) {
  103. return false
  104. }
  105. // 租金
  106. if (this.rentPrice &&
  107. item.useType == 1 &&
  108. this.rentPrice >= item.conditionPrice) {
  109. return false
  110. }
  111. // 水洗
  112. if (this.washPrice &&
  113. item.useType == 2 &&
  114. this.washPrice >= item.conditionPrice) {
  115. return false
  116. }
  117. return true
  118. },
  119. //点击过滤菜单
  120. hadleFiltrationMenuEvent(event) {
  121. this.activefiltration = event.index
  122. }
  123. }
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. // 优惠券筛选
  128. .tabs {
  129. &::v-deep .uv-tabs__wrapper__nav {
  130. background: white;
  131. .uv-tabs__wrapper__nav__item {
  132. width: 33.33%;
  133. text-align: center;
  134. box-sizing: border-box;
  135. }
  136. }
  137. }
  138. .list {
  139. .item {
  140. color: #FDDFCD;
  141. position: relative;
  142. width: calc(100% - 40rpx);
  143. height: 220rpx;
  144. background-size: 100% 100%;
  145. margin: 20rpx;
  146. box-sizing: border-box;
  147. padding: 30rpx;
  148. .coupon-bg {
  149. width: 100%;
  150. position: absolute;
  151. left: 0rpx;
  152. top: 0rpx;
  153. }
  154. .item-con {
  155. display: flex;
  156. align-items: center;
  157. flex-wrap: wrap;
  158. position: absolute;
  159. top: 50%;
  160. left: 0rpx;
  161. transform: translateY(-50%);
  162. z-index: 99;
  163. width: 100%;
  164. .price-time {
  165. display: flex;
  166. width: 65%;
  167. .price {
  168. display: flex;
  169. align-items: center;
  170. .num {
  171. color: #FFF8E9;
  172. font-weight: 900;
  173. font-size: 70rpx;
  174. display: flex;
  175. align-items: flex-end;
  176. .icon {
  177. color: #FFF8E9;
  178. width: 30rpx;
  179. height: 30rpx;
  180. display: flex;
  181. justify-content: center;
  182. align-items: center;
  183. font-size: 20rpx;
  184. border-radius: 14rpx;
  185. margin-bottom: 14rpx;
  186. margin-right: 10rpx;
  187. }
  188. }
  189. }
  190. .date-tiao {
  191. display: flex;
  192. flex-direction: column;
  193. align-items: center;
  194. font-size: 24rpx;
  195. box-sizing: border-box;
  196. padding-left: 20rpx;
  197. .time {}
  198. .tiao {
  199. display: flex;
  200. justify-content: center;
  201. background: #FDE5BA;
  202. border-radius: 40rpx;
  203. color: #FF2E34;
  204. padding: 5rpx 20rpx;
  205. margin-top: 15rpx;
  206. }
  207. }
  208. }
  209. .status {
  210. display: flex;
  211. flex-direction: column;
  212. align-items: center;
  213. justify-content: center;
  214. width: 35%;
  215. color: #FD4231;
  216. padding-top: 30rpx;
  217. .order-status {
  218. position: relative;
  219. width: 180rpx;
  220. .status-img {
  221. position: absolute;
  222. left: 0;
  223. width: 100%;
  224. }
  225. .text {
  226. height: 90rpx;
  227. display: flex;
  228. justify-content: center;
  229. align-items: center;
  230. position: relative;
  231. z-index: 100;
  232. font-size: 34rpx;
  233. font-weight: bold;
  234. }
  235. }
  236. .surplus {
  237. font-size: 22rpx;
  238. text-align: center;
  239. margin-top: 10rpx;
  240. }
  241. }
  242. }
  243. }
  244. .del {
  245. position: absolute;
  246. top: 0;
  247. left: 0;
  248. width: 100%;
  249. height: 100%;
  250. background-color: #ffffff99;
  251. z-index: 99;
  252. }
  253. }
  254. </style>