consumptionRecords.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <view class="container">
  3. <view class="tabs">
  4. <view :class="['tab', tabActive == 1 ? 'active' : '']" @click="tabClick(1)">一番赏</view>
  5. <view :class="['tab', tabActive == 2 ? 'active' : '']" style="margin-left: 20rpx" @click="tabClick(2)">快递</view>
  6. </view>
  7. <view class="list">
  8. <view class="item" v-for="(item, index) in list">
  9. <view class="tag">已付款</view>
  10. <image v-if="item.order.orderType == 1" class="icon" :src="item.icon" mode="aspectFill"></image>
  11. <image
  12. v-else
  13. class="icon"
  14. :src="'https://file.rongcyl.cn/festatic/bkm/imgv2/consumptionRecords/expressDelivery.png'"
  15. mode="aspectFill"
  16. ></image>
  17. <view class="info">
  18. <view class="row title">
  19. <span v-if="item.order.orderType == 1">{{ item.name }}</span>
  20. <span v-else>下单发货</span>
  21. </view>
  22. <view class="row" style="justify-content: space-between; font-size: 24rpx">
  23. <span class="textColor5">¥{{ item.order.goodsPrice }}</span>
  24. <span class="textColor3">
  25. <span class="textColor5">{{ item.num }}</span>
  26. 件商品
  27. </span>
  28. </view>
  29. <view class="row" style="justify-content: space-between">
  30. <span style="font-size: 24rpx">{{ item.order.payTime }}</span>
  31. <span>
  32. 实付金额:
  33. <span class="textColor5">{{ item.order.actualPrice }}</span>
  34. </span>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <uni-load-more
  40. v-if="list.length > 0"
  41. :status="loadMore"
  42. @clickLoadMore="load"
  43. :contentText="contentText"
  44. ></uni-load-more>
  45. <noData v-else />
  46. </view>
  47. </template>
  48. <script>
  49. import noData from '@/component/noData.vue'
  50. import { orderListApi } from '@/api/consumptionRecords.js'
  51. export default {
  52. components: {
  53. noData,
  54. },
  55. data() {
  56. return {
  57. tabActive: 1,
  58. list: [],
  59. loadMore: 'more',
  60. contentText: {
  61. contentdown: '点击加载更多',
  62. },
  63. params: {
  64. limit: 10,
  65. page: 1,
  66. orderType: 1,
  67. },
  68. }
  69. },
  70. onShow() {
  71. this.getList()
  72. },
  73. methods: {
  74. tabClick(index) {
  75. this.tabActive = index
  76. this.params.orderType = index
  77. this.list = []
  78. this.getList()
  79. },
  80. load() {
  81. if (this.loadMore == 'more') {
  82. this.params.page += 1
  83. this.getList()
  84. }
  85. },
  86. getList() {
  87. orderListApi(this.params).then(res => {
  88. console.log(res, '消费记录')
  89. this.list.push(...res.data.list)
  90. // 判断是否还有更多数据
  91. let listNum = this.params.limit * this.params.page
  92. let total = res.data.total
  93. if (total > listNum) {
  94. this.loadMore = 'more'
  95. } else {
  96. this.loadMore = 'noMore'
  97. }
  98. })
  99. },
  100. },
  101. }
  102. </script>
  103. <style scoped lang="scss">
  104. .container {
  105. padding: 20rpx;
  106. }
  107. .tabs {
  108. display: flex;
  109. .tab {
  110. width: 136rpx;
  111. height: 48rpx;
  112. font-size: 28rpx;
  113. background: #fff;
  114. border-radius: 8rpx;
  115. line-height: 48rpx;
  116. text-align: center;
  117. }
  118. .active {
  119. background: #fea200;
  120. color: #fff;
  121. }
  122. }
  123. .list {
  124. padding: 20rpx 0;
  125. .item {
  126. background: #fff;
  127. border-radius: 8rpx;
  128. display: flex;
  129. padding: 20rpx;
  130. margin-bottom: 20rpx;
  131. font-size: 28rpx;
  132. align-items: center;
  133. position: relative;
  134. .tag {
  135. background: #def2e4;
  136. color: #00c537;
  137. font-size: 32rpx;
  138. padding: 4rpx 10rpx;
  139. border-radius: 0 0 0 20rpx;
  140. position: absolute;
  141. right: 0;
  142. top: 0;
  143. }
  144. .icon {
  145. width: 150rpx;
  146. height: 150rpx;
  147. border-radius: 8rpx;
  148. }
  149. .info {
  150. display: flex;
  151. flex-direction: column;
  152. justify-content: flex-end;
  153. align-items: center;
  154. padding-left: 20rpx;
  155. flex: 1;
  156. .row {
  157. width: 100%;
  158. margin-top: 20rpx;
  159. display: flex;
  160. }
  161. }
  162. }
  163. }
  164. </style>