123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- <template>
- <view class="center">
- <view class="empty-box"><u-empty v-if="orderList.length === 0 && loadingType == 'nomore'"></u-empty></view>
- <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
- <!-- 空白页 -->
-
- <!-- 订单列表 -->
- <view v-for="(item, index) in orderList" :key="index" class="order-item flex" @click="nav(item)">
- <view class="title-box flex_item">
- <view class="title-avatar"><image :src="item.avatar"></image></view>
- <view class="list_tpl">
- <view class="title">
- <text>{{ item.email || item.phone }}</text>
- </view>
- <view class="time">
- <text>{{ item.time }}</text>
- </view>
- </view>
- </view>
- </view>
- <u-loadmore v-if="orderList.length != 0" :status="loadingType" />
- </scroll-view>
- </view>
- </template>
- <script>
- import { spread } from '@/api/finance.js';
- export default {
- data() {
- return {
- orderList: [{}],
- loadingType: 'loadmore', //页面加载即时刷新
- page: 1, //默认展示一行
- limit: 10 //一行展示10条数据
- };
- },
- onLoad(options) {
- this.loadData(); //onload只是在第一次进入页面会刷新数据,从二级页面回来不会重新加载数据
- },
- onShow() {
- //onShow没有参数
- this.loadData(); //onshow在每次打开页面都会加载数据,可以用于数据在需要刷新的环境下
- },
- methods: {
- async loadData() {
-
- if (this.loadingType == 'nomore' || this.loadingType == 'loading') {
- return;
- }
- this.loadingType = 'loading';
- spread({
- limit: this.limit,
- page: this.page
- }).then(({ data }) => {
- this.all = data.total;
- this.orderList = data.list;
- if (data.length != this.limit) {
- this.loadingType = 'nomore';
- } else {
- this.page++;
- this.loadingType = 'loadmore';
- }
- });
- },
- nav(e){
- uni.navigateTo({
- url:'/pages/user/rake?uid=' + e.uid
- })
- }
- }
- };
- </script>
- <style lang="scss">
- .list-scroll-content {
- height: auto;
- }
- .order-item {
- padding: 20rpx 30rpx;
- line-height: 1.5;
- .title-box {
- width: 100%;
- .title-avatar {
- width: 100rpx;
- height: 100rpx;
- margin-right: 25rpx;
- border-radius: 100%;
- image {
- width: 100%;
- height: 100%;
- border-radius: 100%;
- }
- }
- .list_tpl {
- width: 85%;
- .title {
- font-size: $font-lg;
- color: $font-color-base;
- overflow: hidden; //超出的文本隐藏
- text-overflow: ellipsis; //溢出用省略号显示
- white-space: nowrap;
- }
- .time {
- font-size: $font-base;
- color: $font-color-light;
- }
- }
- }
- .money {
- color: #db1935;
- font-size: $font-lg;
- }
- }
- .content {
- height: 100%;
- .empty-content {
- background-color: #ffffff;
- }
- }
- .empty-box {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- width: 100%;
- height: 100%;
- }
- </style>
|