awardList.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. import {
  42. getMoneyStyle
  43. } from '@/utils/rocessor.js';
  44. export default {
  45. filters: {
  46. getMoneyStyle
  47. },
  48. data() {
  49. return {
  50. // 头部图高度
  51. maxheight: '',
  52. tabCurrentIndex: 0,
  53. navList: [{
  54. state: 3,
  55. text: '全部',
  56. loadingType: 'more',
  57. orderList: [],
  58. page: 1, //当前页数
  59. limit: 10 //每次信息条数
  60. }, ],
  61. money: ''
  62. };
  63. },
  64. onLoad(options) {},
  65. onShow() {
  66. this.loadData();
  67. },
  68. methods: {
  69. // 页面跳转
  70. navto(e) {
  71. uni.navigateTo({
  72. url: e
  73. });
  74. },
  75. //获取收入支出信息
  76. async loadData(source) {
  77. //这里是将订单挂载到tab列表下
  78. let index = this.tabCurrentIndex;
  79. let navItem = this.navList[index];
  80. let state = navItem.state;
  81. if (source === 'tabChange' && navItem.loaded === true) {
  82. //tab切换只有第一次需要加载数据
  83. return;
  84. }
  85. if (navItem.loadingType === 'loading') {
  86. //防止重复加载
  87. return;
  88. }
  89. // 修改当前对象状态为加载中
  90. navItem.loadingType = 'loading';
  91. spreadCommission({
  92. page: navItem.page,
  93. limit: navItem.limit
  94. },
  95. state
  96. )
  97. .then(({
  98. data
  99. }) => {
  100. if (data.length > 0) {
  101. navItem.orderList = navItem.orderList.concat(data);
  102. console.log(navItem.orderList);
  103. navItem.page++;
  104. }
  105. if (navItem.limit == data.length) {
  106. //判断是否还有数据, 有改为 more, 没有改为noMore
  107. navItem.loadingType = 'more';
  108. return;
  109. } else {
  110. //判断是否还有数据, 有改为 more, 没有改为noMore
  111. navItem.loadingType = 'noMore';
  112. }
  113. uni.hideLoading();
  114. this.$set(navItem, 'loaded', true);
  115. })
  116. .catch(e => {
  117. console.log(e);
  118. });
  119. }
  120. }
  121. };
  122. </script>
  123. <style lang="scss">
  124. page {
  125. height: 100%;
  126. }
  127. .money-box {
  128. padding-top: var(--status-bar-height);
  129. text-align: center;
  130. color: $font-color-dark;
  131. font-weight: bold;
  132. .text {
  133. padding-top: 85rpx;
  134. font-size: 24rpx;
  135. }
  136. .money {
  137. font-size: 60rpx;
  138. }
  139. }
  140. // 列表
  141. .order-item {
  142. padding: 20rpx 30rpx;
  143. line-height: 1.5;
  144. border-bottom: 1px solid $page-color-light;
  145. margin-left: 20rpx;
  146. .title-box {
  147. .title {
  148. font-size: $font-lg;
  149. color: $font-color-base;
  150. }
  151. .time {
  152. font-size: $font-base;
  153. color: $font-color-light;
  154. }
  155. }
  156. .money {
  157. font-size: $font-lg;
  158. }
  159. }
  160. .list-scroll-content {
  161. height: 100%;
  162. padding-top: 30rpx;
  163. .momBox{
  164. background-color: #FFFFFF;
  165. margin: $page-row-spacing;
  166. margin-top: 0rpx;
  167. border-radius: 20rpx;
  168. overflow: hidden;
  169. .topMon{
  170. padding: 30rpx 20rpx;
  171. border-bottom: 1px solid $page-color-light;
  172. .iconRight{
  173. width: 22rpx;
  174. }
  175. .mon{
  176. font-size: 36rpx;
  177. font-weight: 400;
  178. }
  179. .textSm{
  180. color: $font-color-light;
  181. font-size: 22rpx;
  182. }
  183. }
  184. }
  185. }
  186. .content {
  187. height: 100%;
  188. }
  189. </style>