myWalletDongjie.vue 2.7 KB

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