From 0e5eee4f7e0447cf4bc2439b5ee6faa9f72bc520 Mon Sep 17 00:00:00 2001 From: Lj <1095098147@qq.com> Date: Wed, 2 Jul 2025 21:35:00 +0800 Subject: [PATCH] =?UTF-8?q?'=E5=AE=8C=E5=96=84=E6=9F=A5=E7=9C=8B=E5=9B=9E?= =?UTF-8?q?=E6=94=B6=E8=B4=A8=E6=A3=80=E9=A1=B5=E9=9D=A2=E9=80=BB=E8=BE=91?= =?UTF-8?q?'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/subcomponent/inspection-report.vue | 93 ++++++++++++++++---------------- 1 file changed, 48 insertions(+), 45 deletions(-) diff --git a/pages/subcomponent/inspection-report.vue b/pages/subcomponent/inspection-report.vue index d281e21..1023afa 100644 --- a/pages/subcomponent/inspection-report.vue +++ b/pages/subcomponent/inspection-report.vue @@ -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() { // 模拟刷新数据