list.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="coupon-list-container">
  3. <JHeader title="优惠券" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <template v-if="couponList && couponList.length">
  5. <view v-for="item in couponList" :key="item.couponId" class="couponItem flex-items">
  6. <view class="itemLeft" @click="go(`/another-tf/another-serve/coupon/product?id=${item.couponId}`)">
  7. <view class="topIcon"></view>
  8. <view class="bottomIcon"></view>
  9. <view class="price flex-items">
  10. <view v-if="item.discountMode === 1" class="flex-column flex-end unitBox">
  11. <view class="unit">¥</view>
  12. </view>
  13. <view class="priceValue">{{ item.reduceMoney }}{{ item.discountMode === 1 ? '' : '折' }}</view>
  14. </view>
  15. <text class="fs24 font-color-999">满{{ item.fullMoney }}元可用</text>
  16. </view>
  17. <view class="itemRight">
  18. <view class="topInfo flex-items flex-sp-between">
  19. <view @click="go(`/another-tf/another-serve/coupon/product?id=${item.couponId}`)">
  20. <view class="couponTit fs32 font-color-FFF">{{ item.activityName }}</view>
  21. <view class="couponDate fs24 font-color-999">{{ item.endTime }}到期</view>
  22. </view>
  23. <view class="exchangeBtnBox flex-column flex-end">
  24. <view v-if="item.state === 0" class="exchangeBtn fs24 font-color-FFF">
  25. 已领取
  26. </view>
  27. <ATFWXSendCoupon v-else :coupon-list="[ item ]" @success="success">
  28. <view class="exchangeBtn fs24 font-color-FFF">{{ item.ifCredit ? '立即兑换' : '立即领取' }}</view>
  29. </ATFWXSendCoupon>
  30. </view>
  31. </view>
  32. <view
  33. class="couponType fs28 font-color-FFF"
  34. @click="go(`/another-tf/another-serve/coupon/product?id=${item.couponId}`)"
  35. >
  36. {{ item.discountMode === 1 ? '满减券'
  37. : '折扣券' }}
  38. </view>
  39. </view>
  40. </view>
  41. </template>
  42. <view style="padding-bottom: 45upx;">
  43. <LoadingMore
  44. :status="!isEmpty && !couponList.length
  45. ? 'loading' : !isEmpty && couponList.length && (couponList.length >= couponTotal) ? 'no-more' : ''"
  46. >
  47. </LoadingMore>
  48. <tui-no-data v-if="isEmpty" :fixed="false" style="margin-top: 60upx;">暂无优惠券</tui-no-data>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import { getCanvasCouponsApi } from '../../../api/anotherTFInterface'
  54. export default {
  55. name: 'List',
  56. data() {
  57. return {
  58. isEmpty: false,
  59. couponList: [],
  60. couponTotal: 0,
  61. queryInfo: {
  62. page: 1,
  63. pageSize: 20
  64. }
  65. }
  66. },
  67. onLoad() {
  68. this.getCouponDataList()
  69. },
  70. methods: {
  71. getCouponDataList(isLoadmore) {
  72. uni.showLoading()
  73. getCanvasCouponsApi(this.queryInfo).then((res) => {
  74. this.couponTotal = res.data.total
  75. if (isLoadmore) {
  76. this.couponList.push(...res.data.list)
  77. } else {
  78. this.couponList = res.data.list
  79. }
  80. this.isEmpty = this.couponList.length === 0
  81. uni.hideLoading()
  82. })
  83. .catch((e) => {
  84. uni.hideLoading()
  85. })
  86. },
  87. success() {
  88. this.queryInfo.page = 1
  89. this.getCouponDataList()
  90. }
  91. },
  92. onReachBottom() {
  93. if (this.couponList.length < this.couponTotal) {
  94. ++this.queryInfo.page
  95. this.getCouponDataList(true)
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="less" scoped>
  101. .coupon-list-container {
  102. min-height: 100%;
  103. background-color: #f8f8f8;
  104. box-sizing: border-box;
  105. padding: 0 20rpx 40upx;
  106. .couponItem {
  107. background: #333333;
  108. margin-top: 40rpx;
  109. padding: 25rpx 35rpx;
  110. overflow: hidden;
  111. .itemLeft {
  112. padding-right: 10rpx;
  113. position: relative;
  114. border-right: 2rpx dashed #666666;
  115. width: 170rpx;
  116. .topIcon {
  117. position: absolute;
  118. right: -16rpx;
  119. top: -50rpx;
  120. width: 32rpx;
  121. height: 32rpx;
  122. background: #FFFFFF;
  123. border-radius: 50%;
  124. }
  125. .bottomIcon {
  126. position: absolute;
  127. right: -16rpx;
  128. bottom: -50rpx;
  129. width: 32rpx;
  130. height: 32rpx;
  131. background: #FFFFFF;
  132. border-radius: 50%;
  133. }
  134. .unitBox {
  135. height: 70rpx;
  136. }
  137. .unit {
  138. color: #FFEBC4;
  139. font-size: 36rpx;
  140. }
  141. .priceValue {
  142. font-size: 52rpx;
  143. color: #FFEBC4;
  144. }
  145. }
  146. .itemRight {
  147. padding-left: 45rpx;
  148. flex: 1;
  149. .topInfo {
  150. padding-bottom: 10rpx;
  151. border-bottom: 2rpx solid #444444;
  152. margin-bottom: 10rpx;
  153. .couponDate {
  154. width: 300rpx;
  155. }
  156. .exchangeBtnBox {
  157. width: 110rpx;
  158. height: 70rpx;
  159. text-align: center;
  160. .exchangeBtn {
  161. padding: 5rpx;
  162. border: 2rpx solid #999999;
  163. }
  164. }
  165. }
  166. }
  167. }
  168. }
  169. </style>