|
|
@ -221,61 +221,64 @@ export default { |
|
|
|
this.goodsList = [] |
|
|
|
this.problemList = [] |
|
|
|
this.unrecyclableList = [] |
|
|
|
|
|
|
|
// 遍历主订单的 commonOrderList |
|
|
|
// 直接遍历 orderCheckList |
|
|
|
if (orderData.orderCheckList && orderData.orderCheckList.length > 0) { |
|
|
|
orderData.orderCheckList.forEach(mainOrder => { |
|
|
|
// 如果有子订单列表,遍历子订单 |
|
|
|
if (mainOrder.commonOrderList && mainOrder.commonOrderList.length > 0) { |
|
|
|
mainOrder.commonOrderList.forEach(subOrder => { |
|
|
|
this.categorizeOrderItem(subOrder, mainOrder) |
|
|
|
orderData.orderCheckList.forEach(item => { |
|
|
|
// 合格 |
|
|
|
if (Number(item.qualifiedNum) > 0) { |
|
|
|
this.goodsList.push({ |
|
|
|
img: item.image || '/static/default-goods.png', |
|
|
|
name: item.title || '未知品类', |
|
|
|
desc: item.pinName ? `${item.pinName}` : '', |
|
|
|
price: item.price || 0, |
|
|
|
count: item.qualifiedNum, |
|
|
|
total: (item.price || 0) * item.qualifiedNum, |
|
|
|
detail: true, |
|
|
|
testingInstructions: item.testingInstructions || '', |
|
|
|
testingImages: item.testingImages || '', |
|
|
|
testingTime: item.testingTime || '', |
|
|
|
problemDesc: '' |
|
|
|
}) |
|
|
|
} |
|
|
|
// 质量问题 |
|
|
|
if (Number(item.noQualifiedNum) > 0) { |
|
|
|
this.problemList.push({ |
|
|
|
img: item.image || '/static/default-goods.png', |
|
|
|
name: item.title || '未知品类', |
|
|
|
desc: item.pinName ? `${item.pinName}` : '', |
|
|
|
price: item.price || 0, |
|
|
|
count: item.noQualifiedNum, |
|
|
|
total: 0, |
|
|
|
detail: true, |
|
|
|
testingInstructions: item.testingInstructions || '', |
|
|
|
testingImages: item.testingImages || '', |
|
|
|
testingTime: item.testingTime || '', |
|
|
|
problemDesc: item.testingInstructions || '' |
|
|
|
}) |
|
|
|
} |
|
|
|
// 不可回收 |
|
|
|
if (Number(item.unrecyclable) > 0) { |
|
|
|
this.unrecyclableList.push({ |
|
|
|
img: item.image || '/static/default-goods.png', |
|
|
|
name: item.title || '未知品类', |
|
|
|
desc: item.pinName ? `${item.pinName}` : '', |
|
|
|
price: item.price || 0, |
|
|
|
count: item.unrecyclable, |
|
|
|
total: 0, |
|
|
|
detail: true, |
|
|
|
testingInstructions: item.testingInstructions || '', |
|
|
|
testingImages: item.testingImages || '', |
|
|
|
testingTime: item.testingTime || '', |
|
|
|
problemDesc: item.testingInstructions || '' |
|
|
|
}) |
|
|
|
} else { |
|
|
|
// 如果没有子订单,直接处理主订单项 |
|
|
|
this.categorizeOrderItem(mainOrder) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 设置显示状态 |
|
|
|
this.showQualified = this.goodsList.length > 0 |
|
|
|
this.showProblem = this.problemList.length > 0 |
|
|
|
this.showUnrecyclable = this.unrecyclableList.length > 0 |
|
|
|
}, |
|
|
|
|
|
|
|
categorizeOrderItem(orderItem, parentOrder = null) { |
|
|
|
const status = Number(orderItem.testingStatus) |
|
|
|
const parentData = parentOrder || orderItem |
|
|
|
|
|
|
|
// 根据 testingStatus 分类:0-质检合格,1-质量问题 |
|
|
|
if (status === 0) { |
|
|
|
// 质检合格 |
|
|
|
this.goodsList.push(this.mapOrderToGoods(orderItem, parentData)) |
|
|
|
} else if (status === 1) { |
|
|
|
// 质量问题 |
|
|
|
this.problemList.push(this.mapOrderToGoods(orderItem, parentData, true)) |
|
|
|
} |
|
|
|
else{ |
|
|
|
this.unrecyclableList.push(this.mapOrderToGoods(orderItem, parentData, true)) |
|
|
|
} |
|
|
|
// 移除 testingStatus = 2 (不可回收) 的处理 |
|
|
|
}, |
|
|
|
|
|
|
|
mapOrderToGoods(orderItem, parentData, isProblem = false) { |
|
|
|
return { |
|
|
|
img: parentData.image || '/static/default-goods.png', |
|
|
|
name: parentData.title || '未知品类', |
|
|
|
desc: parentData.pinName ? `${parentData.pinName}` :'', |
|
|
|
price: parentData.price/ orderItem.num || 0, |
|
|
|
count: orderItem.num || 1, |
|
|
|
total: parentData.price, |
|
|
|
detail: true, |
|
|
|
testingInstructions: orderItem.testingInstructions || '', |
|
|
|
testingImages: orderItem.testingImages || '', |
|
|
|
testingTime: orderItem.testingTime || '', |
|
|
|
problemDesc: isProblem ? (orderItem.testingInstructions || '') : '' |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
async onRefresh() { |
|
|
|
// 模拟刷新数据 |
|
|
|