loadmore 7.27

This commit is contained in:
2020-07-27 17:59:47 +08:00
parent 100f31c6f9
commit 6eabd3a575
17 changed files with 421 additions and 58 deletions

View File

@@ -55,6 +55,13 @@ export default {
this.page = 0;
// again 重新请求列表 不然往列表里添加
value == 6 ? this.getAfterSaleList({ reload: 'again' }): this.getOrderList({ reload: 'again' });
if(value == 6) {
this.getAfterSaleList({ reload: 'again' });
} else if(value == 4) {
this.goodsTryOrderList({ reload: 'again' });
} else {
this.getOrderList({ reload: 'again' });
}
},
},
onLoad(option) {
@@ -113,6 +120,17 @@ export default {
}
return res;
},
async goodsTryOrderList({ reload = '' } = {}) {
const res = await this.$u.api.goodsTryOrderList({
page: this.page,
})
this.timer = true;
if(res.errCode == 0) {
if(reload) this.orderList = res.data;
else this.orderList.push(...res.data);
}
return res;
},
reachBottom() {
// 大于15条才会加载更多
if(this.orderList.length < 15) return false;
@@ -122,6 +140,7 @@ export default {
this.page++;
let promise;
if(this.current == 6) promise = this.getAfterSaleList();
else if(this.current == 4) promise = this.goodsTryOrderList();
else promise = this.getOrderList();
promise.then(res => {
this.loadStatus.splice(this.current, 1, "nomore");