walletList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="content">
  3. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  4. <!-- 空白页 -->
  5. <empty v-if="navList[0].loaded === true && navList[0].orderList.length === 0"></empty>
  6. <!-- 订单列表 -->
  7. <view class="momBox" v-for="(list, index) in navList[0].orderList" :key="index">
  8. <view class="topMon">
  9. <view>
  10. <text class="mon">{{list.time}}</text>
  11. <!-- <text class="font-size-sm margin-l-10">月</text> -->
  12. <image class="iconRight margin-l-10" src="../../../static/icon/dom.png" mode="widthFix"></image>
  13. </view>
  14. <!-- <view class="textSm font-color-gray">
  15. <text>支出:{{list.out}}</text>
  16. <text class="margin-l-20">支出:{{list.get}}</text>
  17. </view> -->
  18. </view>
  19. <view v-for="(item,index) in list.list" class="order-item flex">
  20. <view class="title-box">
  21. <view class="title">
  22. <text>{{ item.title }}</text>
  23. </view>
  24. <view class="time">
  25. <text>{{ item.add_time }}</text>
  26. </view>
  27. </view>
  28. <view class="money">
  29. <text>{{ (item.pm == 0 ? '-' : '+') + item.number }}</text>
  30. </view>
  31. </view>
  32. </view>
  33. <uni-load-more :status="navList[0].loadingType"></uni-load-more>
  34. </scroll-view>
  35. </view>
  36. </template>
  37. <script>
  38. import {
  39. spreadCommission,
  40. } from '@/api/wallet.js';
  41. export default {
  42. data() {
  43. return {
  44. // 头部图高度
  45. maxheight: '',
  46. tabCurrentIndex: 0,
  47. navList: [{
  48. state: 0,
  49. text: '全部',
  50. loadingType: 'more',
  51. orderList: [],
  52. page: 1, //当前页数
  53. limit: 10 //每次信息条数
  54. }, ],
  55. money: ''
  56. };
  57. },
  58. onLoad(options) {
  59. this.loadData();
  60. },
  61. methods: {
  62. // 页面跳转
  63. navto(e) {
  64. uni.navigateTo({
  65. url: e
  66. });
  67. },
  68. //获取收入支出信息
  69. async loadData(source) {
  70. //这里是将订单挂载到tab列表下
  71. let index = this.tabCurrentIndex;
  72. let navItem = this.navList[index];
  73. let state = navItem.state;
  74. if (source === 'tabChange' && navItem.loaded === true) {
  75. //tab切换只有第一次需要加载数据
  76. return;
  77. }
  78. if (navItem.loadingType === 'loading') {
  79. //防止重复加载
  80. return;
  81. }
  82. // 修改当前对象状态为加载中
  83. navItem.loadingType = 'loading';
  84. spreadCommission({
  85. page: navItem.page,
  86. limit: navItem.limit
  87. },
  88. state
  89. )
  90. .then(({
  91. data
  92. }) => {
  93. if (data.length > 0) {
  94. navItem.orderList = navItem.orderList.concat(data);
  95. console.log(navItem.orderList);
  96. navItem.page++;
  97. }
  98. if (navItem.limit == data.length) {
  99. //判断是否还有数据, 有改为 more, 没有改为noMore
  100. navItem.loadingType = 'more';
  101. return;
  102. } else {
  103. //判断是否还有数据, 有改为 more, 没有改为noMore
  104. navItem.loadingType = 'noMore';
  105. }
  106. uni.hideLoading();
  107. this.$set(navItem, 'loaded', true);
  108. })
  109. .catch(e => {
  110. console.log(e);
  111. });
  112. }
  113. }
  114. };
  115. </script>
  116. <style lang="scss">
  117. page {
  118. height: 100%;
  119. }
  120. .money-box {
  121. padding-top: var(--status-bar-height);
  122. text-align: center;
  123. color: $font-color-dark;
  124. font-weight: bold;
  125. .text {
  126. padding-top: 85rpx;
  127. font-size: 24rpx;
  128. }
  129. .money {
  130. font-size: 60rpx;
  131. }
  132. }
  133. // 列表
  134. .order-item {
  135. padding: 20rpx 30rpx;
  136. line-height: 1.5;
  137. border-bottom: 1px solid $page-color-light;
  138. margin-left: 20rpx;
  139. .title-box {
  140. .title {
  141. font-size: $font-lg;
  142. color: $font-color-base;
  143. }
  144. .time {
  145. font-size: $font-base;
  146. color: $font-color-light;
  147. }
  148. }
  149. .money {
  150. font-size: $font-lg;
  151. }
  152. }
  153. .list-scroll-content {
  154. height: 100%;
  155. padding-top: 30rpx;
  156. .momBox{
  157. background-color: #FFFFFF;
  158. margin: $page-row-spacing;
  159. margin-top: 0rpx;
  160. border-radius: 20rpx;
  161. overflow: hidden;
  162. .topMon{
  163. padding: 30rpx 20rpx;
  164. border-bottom: 1px solid $page-color-light;
  165. .iconRight{
  166. width: 22rpx;
  167. }
  168. .mon{
  169. font-size: 36rpx;
  170. font-weight: 400;
  171. }
  172. .textSm{
  173. color: $font-color-light;
  174. font-size: 22rpx;
  175. }
  176. }
  177. }
  178. }
  179. .content {
  180. height: 100%;
  181. }
  182. </style>