多租户商城-商户小程序端
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.

181 lines
4.1 KiB

2 years ago
  1. <!-- 优惠券列表 -->
  2. <template>
  3. <view class="container">
  4. <global-loading />
  5. <view class="list">
  6. <view
  7. class="item"
  8. v-for="(item, index) in list"
  9. v-if="item.state === 0"
  10. >
  11. <view class="info-box">
  12. <view class="discoun" v-if="item.couponType == 1"><text style="font-size: 28rpx"></text>{{item.reduceMoney}}</view>
  13. <view class="discoun" v-if="item.couponType == 2">{{item.reduceMoney}}</view>
  14. <view class="info-date">{{getDate(item.startTime)}}-{{getDate(item.endTime)}}</view>
  15. <view class="info-condition" v-if="item.couponType == 1">{{item.fullMoney}}元减{{item.reduceMoney}}</view>
  16. <view class="info-condition" v-if="item.couponType == 2">{{item.reduceMoney}}折优惠</view>
  17. <view class="use-btn" @click="useTap(item)">立即使用</view>
  18. </view>
  19. </view>
  20. <view v-if="ifEmpty" class="emptyOrder-box flex-items-plus flex-column">
  21. <image class="emptyOrder-img" src="https://ceres.zkthink.com/static/img/bgnull.png"></image>
  22. <label class="font-color-999 fs26 mar-top-30">你还没有优惠券哦</label>
  23. </view>
  24. </view>
  25. <!-- 触底 -->
  26. <view class="reachBottom" v-if="topLeft > 400 && list.length > 0">
  27. <image class="reach-icon" src="https://ceres.zkthink.com/static/img/reachBottom.png" mode="widthFix"></image>
  28. <text class="reach-text">这里到底了哦~~</text>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. const NET = require('../../utils/request')
  34. const API = require('../../config/api')
  35. export default {
  36. data() {
  37. return {
  38. list:[],
  39. // page:1,
  40. // pageSize:20,
  41. total:0,
  42. availableList: [],
  43. // loadingType:0,
  44. topLeft: 0,
  45. ifEmpty: false
  46. }
  47. },
  48. onShow() {
  49. this.getFindCouponList()
  50. },
  51. onPageScroll(e) {
  52. this.topLeft = e.scrollTop
  53. },
  54. methods: {
  55. getFindCouponList(){
  56. // uni.showLoading({
  57. // mask: true,
  58. // title: '加载中...',
  59. // })
  60. NET.request(API.FindCouponList,"GET").then(res => {
  61. uni.hideLoading()
  62. this.list = res.data
  63. if (this.list.length === 0) {
  64. this.ifEmpty = true
  65. }
  66. this.list.forEach((item => {
  67. if (item.state === 0) {
  68. this.availableList.push(item)
  69. }
  70. }))
  71. }).catch(res => {
  72. uni.hideLoading()
  73. })
  74. },
  75. getDate(time) {
  76. if (!time) return '';
  77. return time.split(' ')[0].split('-').join('.');
  78. },
  79. useTap(item){
  80. uni.navigateTo({
  81. url: `../../pages_category_page1/goodsModule/couponShopList?activityId=${item.activityId}&shopCouponId=${item.shopCouponId}`
  82. })
  83. }
  84. }
  85. }
  86. </script>
  87. <style lang="scss" scoped>
  88. .emptyOrder-box{
  89. margin: 70upx auto 0 auto;
  90. .emptyOrder-img{
  91. margin-top: 45%;
  92. width: 113upx;
  93. height: 98upx;
  94. }
  95. }
  96. .list {
  97. display: flex;
  98. flex-wrap: wrap;
  99. }
  100. .item {
  101. width: 50%;
  102. height: 291rpx;
  103. background: url("https://ceres.zkthink.com/static/images/couponsIcon.png") no-repeat center top;
  104. border-radius: 10rpx;
  105. margin-top: 20rpx;
  106. display: flex;
  107. flex-direction: row;
  108. position: relative;
  109. background-size: contain;
  110. padding: 0 56rpx;
  111. margin-bottom: 30rpx;
  112. }
  113. .discoun {
  114. display: flex;
  115. flex-direction: row;
  116. align-items: baseline;
  117. font-size: 40rpx;
  118. color: #C5AA7B;
  119. margin: 0 auto;
  120. padding-top: 50rpx;
  121. }
  122. .discoun text {
  123. display: inline-block;
  124. }
  125. .info-box {
  126. width: 100%;
  127. display: flex;
  128. flex-direction: column;
  129. align-items: flex-start;
  130. }
  131. .info-condition {
  132. font-size: 20rpx;
  133. font-weight: 400;
  134. color: #999999;
  135. margin: 0 auto;
  136. }
  137. .info-date {
  138. font-size: 20rpx;
  139. font-family: PingFang SC;
  140. font-weight: 400;
  141. color: #999999;
  142. margin: 0 auto;
  143. }
  144. .use-btn {
  145. height: 48rpx;
  146. border: 2rpx solid #C5AA7B;
  147. line-height: 48rpx;
  148. text-align: center;
  149. font-size: 24rpx;
  150. font-weight: 500;
  151. background-color: #C5AA7B;
  152. color: #FFFFFF;
  153. margin: 50rpx auto 0 auto;
  154. padding: 0 5rpx;
  155. }
  156. // 触底样式
  157. .reachBottom{
  158. margin-top: 30rpx;
  159. display: flex;
  160. flex-direction: column;
  161. align-items: center;
  162. .reach-icon{
  163. width: 150rpx;
  164. height: 150rpx;
  165. }
  166. .reach-text{
  167. margin: 20rpx 0;
  168. color: #CCCCCC;
  169. }
  170. }
  171. </style>