处理暂停日期

This commit is contained in:
huangdeliang
2021-03-29 19:42:00 +08:00
parent 6fe95722e2
commit 8f94c50d22
6 changed files with 116 additions and 55 deletions

View File

@ -166,14 +166,13 @@ export default {
fetchOrderList() {
this.loading = true;
listOrder({ cusId: this.data.id }).then((res) => {
this.orderList = res.rows.reduce((arr, cur) => {
this.orderList = res.rows.reduce((arr, cur, idx) => {
const tarOrder = arr.find((ord) => ord.startTime === cur.startTime);
if (tarOrder) {
if (!tarOrder.children) {
const firstObj = JSON.parse(JSON.stringify(tarOrder));
tarOrder.children = [{ ...firstObj, type: "main" }];
}
tarOrder.amount += cur.afterSaleCommissOrder == 0 ? cur.amount : 0;
tarOrder.orderId += cur.orderId;
tarOrder.type = "virtual";
tarOrder.children.push({ ...cur, type: "main" });
@ -181,6 +180,13 @@ export default {
cur.type = "main";
arr.push(cur);
}
if (idx === res.rows.length - 1 && arr.children) {
arr.forEach((obj) => {
obj.amount = arr.children.reduce((a, c) => {
return a + c.afterSaleCommissOrder === 0 ? c.amount : 0;
}, 0);
});
}
return arr;
}, []);
// console.log(this.orderList);