consumptionRecords.vue 3.9 KB

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