myWalletJ.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="content">
  3. <scroll-view class="list" scroll-y @scrolltolower="loadData">
  4. <!-- 空白页 -->
  5. <empty v-if="dataList.length === 0"></empty>
  6. <view class="item flex" v-for="(item,index) in dataList" :key="index">
  7. <view class="item-left">
  8. <view class="title">{{ item.title}}</view>
  9. <view class="time">{{ item.add_time }}</view>
  10. <view class="main">
  11. {{ item.mark }}元
  12. </view>
  13. </view>
  14. <view class="item-right">
  15. <view class="price">{{ item.number }}</view>
  16. <view class="dj">已解冻</view>
  17. </view>
  18. </view>
  19. <uni-load-more :status="loadingType"></uni-load-more>
  20. </scroll-view>
  21. </view>
  22. </template>
  23. <script>
  24. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  25. import empty from '@/components/empty';
  26. import { getCommissionInfo} from '@/api/user.js';
  27. export default {
  28. components: {
  29. empty,
  30. uniLoadMore,
  31. },
  32. data() {
  33. return {
  34. page: 1,
  35. limit: 10,
  36. loadingType: 'More',
  37. dataList: [],
  38. }
  39. },
  40. onShow() {
  41. this.loadData();
  42. },
  43. methods: {
  44. async loadData() {
  45. if (this.loadingType === 'loading') {
  46. return;
  47. }
  48. if (this.loadingType === 'noMore'){
  49. return;
  50. }
  51. this.loadingType = 'loading';
  52. getCommissionInfo({
  53. page: this.page,
  54. limit: this.limit
  55. },3)
  56. .then(({ data }) => {
  57. console.log('获取佣金明细',data);
  58. if (data.length > 0) {
  59. this.dataList = this.dataList.concat(data[0].list);
  60. console.log(this.dataList,"dataList");
  61. this.page++;
  62. }
  63. if (this.limit == data.length) {
  64. //判断是否还有数据, 有改为 more, 没有改为noMore
  65. this.loadingType = 'more';
  66. return;
  67. } else {
  68. //判断是否还有数据, 有改为 more, 没有改为noMore
  69. this.loadingType = 'noMore';
  70. }
  71. uni.hideLoading();
  72. this.$set(this.dataList, 'loaded', true);
  73. })
  74. }
  75. }
  76. }
  77. </script>
  78. <style lang="scss">
  79. page {
  80. height: 100%;
  81. background: #F8F6F6;
  82. }
  83. .list {
  84. width: 100%;
  85. margin-top: 20rpx;
  86. background: #FFFFFF;
  87. .item {
  88. padding: 38rpx 46rpx 27rpx 50rpx;
  89. width: 100%;
  90. justify-content: space-between;
  91. align-items: center;
  92. .item-left {
  93. text-align: left;
  94. .title {
  95. font-size: 30rpx;
  96. font-family: PingFang SC;
  97. font-weight: bold;
  98. color: #666666;
  99. }
  100. .time {
  101. margin-top: 5rpx;
  102. font-size: 26rpx;
  103. font-family: PingFang SC;
  104. font-weight: 500;
  105. color: #AEAEAE;
  106. }
  107. .main {
  108. margin-top: 5rpx;
  109. font-size: 26rpx;
  110. font-family: PingFang SC;
  111. font-weight: 500;
  112. color: #AEAEAE;
  113. }
  114. }
  115. .item-right {
  116. text-align: right;
  117. .price {
  118. font-size: 36rpx;
  119. font-family: PingFang SC;
  120. font-weight: bold;
  121. color: #FF0000;
  122. }
  123. .dj {
  124. font-size: 24rpx;
  125. font-family: PingFang SC;
  126. font-weight: 500;
  127. color: #666666;
  128. }
  129. }
  130. }
  131. }
  132. </style>