extensionList.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="center">
  3. <view class="empty-box"><u-empty v-if="orderList.length === 0 && loadingType == 'nomore'"></u-empty></view>
  4. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  5. <!-- 空白页 -->
  6. <!-- 订单列表 -->
  7. <view v-for="(item, index) in orderList" :key="index" class="order-item flex" @click="nav(item)">
  8. <view class="title-box flex_item">
  9. <view class="title-avatar"><image :src="item.avatar"></image></view>
  10. <view class="list_tpl">
  11. <view class="title">
  12. <text>{{ item.email || item.phone }}</text>
  13. </view>
  14. <view class="time">
  15. <text>{{ item.time }}</text>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <u-loadmore v-if="orderList.length != 0" :status="loadingType" />
  21. </scroll-view>
  22. </view>
  23. </template>
  24. <script>
  25. import { spread } from '@/api/finance.js';
  26. export default {
  27. data() {
  28. return {
  29. orderList: [{}],
  30. loadingType: 'loadmore', //页面加载即时刷新
  31. page: 1, //默认展示一行
  32. limit: 10 //一行展示10条数据
  33. };
  34. },
  35. onLoad(options) {
  36. this.loadData(); //onload只是在第一次进入页面会刷新数据,从二级页面回来不会重新加载数据
  37. },
  38. onShow() {
  39. //onShow没有参数
  40. this.loadData(); //onshow在每次打开页面都会加载数据,可以用于数据在需要刷新的环境下
  41. },
  42. methods: {
  43. async loadData() {
  44. if (this.loadingType == 'nomore' || this.loadingType == 'loading') {
  45. return;
  46. }
  47. this.loadingType = 'loading';
  48. spread({
  49. limit: this.limit,
  50. page: this.page
  51. }).then(({ data }) => {
  52. this.all = data.total;
  53. this.orderList = data.list;
  54. if (data.length != this.limit) {
  55. this.loadingType = 'nomore';
  56. } else {
  57. this.page++;
  58. this.loadingType = 'loadmore';
  59. }
  60. });
  61. },
  62. nav(e){
  63. uni.navigateTo({
  64. url:'/pages/user/rake?uid=' + e.uid
  65. })
  66. }
  67. }
  68. };
  69. </script>
  70. <style lang="scss">
  71. .list-scroll-content {
  72. height: auto;
  73. }
  74. .order-item {
  75. padding: 20rpx 30rpx;
  76. line-height: 1.5;
  77. .title-box {
  78. width: 100%;
  79. .title-avatar {
  80. width: 100rpx;
  81. height: 100rpx;
  82. margin-right: 25rpx;
  83. border-radius: 100%;
  84. image {
  85. width: 100%;
  86. height: 100%;
  87. border-radius: 100%;
  88. }
  89. }
  90. .list_tpl {
  91. width: 85%;
  92. .title {
  93. font-size: $font-lg;
  94. color: $font-color-base;
  95. overflow: hidden; //超出的文本隐藏
  96. text-overflow: ellipsis; //溢出用省略号显示
  97. white-space: nowrap;
  98. }
  99. .time {
  100. font-size: $font-base;
  101. color: $font-color-light;
  102. }
  103. }
  104. }
  105. .money {
  106. color: #db1935;
  107. font-size: $font-lg;
  108. }
  109. }
  110. .content {
  111. height: 100%;
  112. .empty-content {
  113. background-color: #ffffff;
  114. }
  115. }
  116. .empty-box {
  117. position: absolute;
  118. top: 0;
  119. left: 0;
  120. right: 0;
  121. width: 100%;
  122. height: 100%;
  123. }
  124. </style>