index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view class="coupon-container">
  3. <JHeader title="我的卡券" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <view class="list">
  5. <view v-for="(item, index) in couponDataList" v-if="item.state === 0" :key="index" class="item">
  6. <view class="info-box">
  7. <view v-if="item.couponType == 1" class="discoun">
  8. <text style="font-size: 28rpx">¥</text>{{ item.reduceMoney }}
  9. </view>
  10. <view v-if="item.couponType == 2" class="discoun">{{ item.reduceMoney }}折</view>
  11. <view class="info-date">{{ getDate(item.startTime) }}-{{ getDate(item.endTime) }}</view>
  12. <view v-if="item.couponType == 1" class="info-condition">满{{ item.fullMoney }}元减{{ item.reduceMoney }}元</view>
  13. <view v-if="item.couponType == 2" class="info-condition">{{ item.reduceMoney }}折优惠</view>
  14. <view class="use-btn" @click="useTap(item)">立即使用</view>
  15. </view>
  16. </view>
  17. </view>
  18. <view style="padding-bottom: 45upx;">
  19. <LoadingMore :status="isLoading ? 'loading' : ''"></LoadingMore>
  20. <view v-if="!isLoading && !couponDataList.length">
  21. <tui-no-data :fixed="false" style="padding-top: 60upx;">你还没有优惠券哦~</tui-no-data>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import { getCouponsCouponApi } from '../../../api/anotherTFInterface'
  28. export default {
  29. name: 'Coupon',
  30. data() {
  31. return {
  32. couponDataList: [],
  33. isLoading: true
  34. }
  35. },
  36. onShow() {
  37. this.getFindCouponList()
  38. },
  39. methods: {
  40. getFindCouponList() {
  41. uni.showLoading()
  42. this.isLoading = true
  43. getCouponsCouponApi({})
  44. .then((res) => {
  45. this.couponDataList = res.data
  46. uni.hideLoading()
  47. this.isLoading = false
  48. })
  49. .catch((e) => {
  50. uni.hideLoading()
  51. this.isLoading = false
  52. })
  53. },
  54. getDate(time) {
  55. if (!time) return ''
  56. return time.split(' ')[0].split('-').join('.')
  57. },
  58. useTap(item) {
  59. uni.navigateTo({
  60. url: `/another-tf/another-serve/couponShopList/index?activityId=${item.activityId}&shopCouponId=${item.shopCouponId}`
  61. })
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="less" scoped>
  67. .coupon-container {
  68. min-height: 100vh;
  69. box-sizing: border-box;
  70. .list {
  71. display: flex;
  72. flex-wrap: wrap;
  73. }
  74. .item {
  75. width: 50%;
  76. height: 291rpx;
  77. background-color: #f8f7f6;
  78. border-radius: 10rpx;
  79. margin-top: 20rpx;
  80. display: flex;
  81. flex-direction: row;
  82. position: relative;
  83. background-size: contain;
  84. padding: 0 56rpx;
  85. margin-bottom: 30rpx;
  86. }
  87. .discoun {
  88. display: flex;
  89. flex-direction: row;
  90. align-items: baseline;
  91. font-size: 40rpx;
  92. color: #C5AA7B;
  93. margin: 0 auto;
  94. padding-top: 50rpx;
  95. }
  96. .discoun text {
  97. display: inline-block;
  98. }
  99. .info-box {
  100. width: 100%;
  101. display: flex;
  102. flex-direction: column;
  103. align-items: flex-start;
  104. }
  105. .info-condition {
  106. font-size: 20rpx;
  107. font-weight: 400;
  108. color: #999999;
  109. margin: 0 auto;
  110. }
  111. .info-date {
  112. font-size: 20rpx;
  113. font-family: PingFang SC;
  114. font-weight: 400;
  115. color: #999999;
  116. margin: 0 auto;
  117. }
  118. .use-btn {
  119. height: 48rpx;
  120. border: 2rpx solid #C5AA7B;
  121. line-height: 48rpx;
  122. text-align: center;
  123. font-size: 24rpx;
  124. font-weight: 500;
  125. background-color: #C5AA7B;
  126. color: #FFFFFF;
  127. margin: 50rpx auto 0 auto;
  128. padding: 0 5rpx;
  129. }
  130. }
  131. </style>