consumptionRecords.vue 3.5 KB

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