comment 8.1

This commit is contained in:
2020-08-01 16:36:48 +08:00
parent 865e2a741a
commit 854976c8f0
18 changed files with 356 additions and 120 deletions

View File

@@ -16,7 +16,7 @@
<view class="order-name">美甲人姓名{{ item.manicure_name }}</view>
<view class="order-date">时间{{ item.manicure_time | dateFormat }}</view>
</view>
<u-loadmore :status="loadStatus" bgColor="#ECECEC" margin-bottom="20"></u-loadmore>
<u-loadmore :status="loadStatus" bgColor="#ECECEC" margin-bottom="20" v-if="orderList.length>=pageSize"></u-loadmore>
</view>
</scroll-view>
</swiper-item>
@@ -32,6 +32,7 @@
export default {
data() {
return {
pageSize: 1,
list: [{
name: '我的订单'
}, {
@@ -42,18 +43,16 @@ export default {
page: 1,
orderList: [],
loadStatus: 'loadmore',
timer: true,
}
},
onPullDownRefresh() {
this.getManicureList({ load: 'reload' });
},
onShow() {
this.current = 0;
this.swiperCurrent = 0;
this.getManicureList().then(order => {
// console.log(order);
this.orderList = this.orderList.concat(order);
// console.log(this.orderList);
});
this.getManicureList({ load: 'reload' });
},
filters: {
dateFormat(value) {
@@ -66,27 +65,33 @@ export default {
}
},
methods: {
async getManicureList() {
let res = await this.$u.api.getManicureList({
async getManicureList({ load }) {
const res = await this.$u.api.getManicureList({
page: this.page
})
uni.stopPullDownRefresh();
this.timer = true;
if (res.errCode == 0) {
return res.data.list;
if(load == 'reload') this.orderList = res.data.list;
else if(load == 'loadmore') this.orderList.push(...res.data.list);
}
return res.data.list.length;
},
// 加载更多
reachBottom() {
// 修改当前的 loadStatus
if(!this.timer) return false;
this.loadStatus = "loading";
this.page++;
this.getManicureList().then(order => {
if (!order.length) {
// 如果没有数据page-1
this.getManicureList({ load: 'loadmore' }).then(length => {
if(length == 0) {
this.page--;
this.loadStatus = "nomore";
this.loadStatus = 'nomore';
} else {
this.orderList = this.orderList.concat(order);
this.loadStatus = 'loading';
}
}).catch(() => {
this.loadStatus = "nomore";
this.page--;
})
},
tabsChange(index) {