order comment 7.31

This commit is contained in:
2020-07-31 21:47:41 +08:00
parent cdd0105acb
commit ff7c6b358d
10 changed files with 310 additions and 164 deletions

View File

@@ -30,15 +30,15 @@ export default {
}, {
name: '待支付'
}, {
name: '已取消'
name: '待发货'
}, {
name: '待收货'
}, {
name: '试穿试送'
}, {
name: '待评价'
}, {
name: '售后'
}, {
name: '待评价'
}],
orderList: [],
loadStatus: ['loadmore','loadmore','loadmore','loadmore','loadmore','loadmore','loadmore'],
@@ -59,13 +59,11 @@ export default {
this.orderList = [];
}
this.page = 0;
// again 重新请求列表 不然往列表里添加
if(value == 6) {
this.getAfterSaleList({ reload: 'again' });
} else if(value == 4) {
this.goodsTryOrderList({ reload: 'again' });
// reload 重新请求列表 loadmore 往列表里添加
if(value == 4) {
this.goodsTryOrderList({ load: 'reload' });
} else {
this.getOrderList({ reload: 'again' });
this.getOrderList({ load: 'reload' });
}
},
},
@@ -75,25 +73,31 @@ export default {
this.swiperCurrent = this.current;
this.setViewHeight();
},
// 下拉刷新
onPullDownRefresh() {
this.refreshOrderList();
},
methods: {
setOrderType() {
let type;
// state_type 订单状态0:已取消 10:未付款 20:已付款 30:已发货 40:已收货
switch (this.current) {
case 1:
type = 10; // 待支付
type = 1; // 待支付
break;
case 2:
type = 0; // 已取消
type = 2; // 待发货
break;
case 3:
type = 30; // 待收货
type = 3; // 待收货
break;
case 4:
type = -1; // 试穿试送
break;
case 5:
type = 'state_noeval'; // 待评价
type = 8; // 售后
break;
case 6:
type = 4; // 待评价
break;
default:
type = -1;
@@ -103,46 +107,52 @@ export default {
},
refreshOrderList() {
this.page = 0;
if(this.current == 6) {
this.getAfterSaleList({ reload: 'again' });
} else if(this.current == 4) {
this.goodsTryOrderList({ reload: 'again' });
// if(this.current == 6) {
// this.getAfterSaleList({ load: 'reload' });
// } else
if(this.current == 4) {
this.goodsTryOrderList({ load: 'reload' });
} else {
this.getOrderList({ reload: 'again' });
this.getOrderList({ load: 'reload' });
}
},
async getOrderList({ reload = '' } = {}) {
// 普通
async getOrderList({ load = 'loadmore' } = {}) {
const type = this.setOrderType();
const res = await this.$u.api.getOrderList({
page: this.page,
type: type,
})
this.timer = true;
uni.stopPullDownRefresh(); // 结束刷新
if(res.errCode == 0) {
if(reload) this.orderList = res.data;
else this.orderList.push(...res.data);
if(load == 'reload') this.orderList = res.data;
else if(load == 'loadmore') this.orderList.push(...res.data);
}
return res;
},
async getAfterSaleList({ reload = '' } = {}) {
// 售后
async getAfterSaleList({ load = 'loadmore' } = {}) {
const res = await this.$u.api.getAfterSaleList({
page: this.page,
})
this.timer = true;
if(res.errCode == 0) {
if(reload) this.orderList = res.data;
else this.orderList.push(...res.data);
if(load == 'reload') this.orderList = res.data;
else if(load == 'loadmore') this.orderList.push(...res.data);
}
return res;
},
async goodsTryOrderList({ reload = '' } = {}) {
// 试穿
async goodsTryOrderList({ load = 'loadmore' } = {}) {
const res = await this.$u.api.goodsTryOrderList({
page: this.page,
})
uni.stopPullDownRefresh(); // 结束刷新
this.timer = true;
if(res.errCode == 0) {
if(reload) this.orderList = res.data.list;
else this.orderList.push(...res.data.list);
if(load == 'reload') this.orderList = res.data.list;
else if(load == 'loadmore') this.orderList.push(...res.data.list);
}
return res;
},
@@ -154,8 +164,9 @@ export default {
this.loadStatus.splice(this.current, 1, "loading");
this.page++;
let promise;
if(this.current == 6) promise = this.getAfterSaleList();
else if(this.current == 4) promise = this.goodsTryOrderList();
// 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");