From 37a962d27a819c35895d59a0bbe59cd452dd353c Mon Sep 17 00:00:00 2001 From: zm2000 <18386612143@163.com> Date: Sun, 12 Jul 2026 16:05:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A7=B0=E9=87=8D=E3=80=81?= =?UTF-8?q?=E5=A4=8D=E6=A0=B8=E5=8F=91=E8=B4=A7=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/work/order/order-review.vue | 29 ++++++++-- pages/work/order/weighing.vue | 88 ++++++++++++++++++------------- 2 files changed, 75 insertions(+), 42 deletions(-) diff --git a/pages/work/order/order-review.vue b/pages/work/order/order-review.vue index 035ba37..35410d9 100644 --- a/pages/work/order/order-review.vue +++ b/pages/work/order/order-review.vue @@ -53,8 +53,8 @@ @goodsItemClick="handleGoodsItemClick" /> - - 请搜索或扫码选择订单进行复核 + + {{ isDprefixedWave ? '请扫描商品条码进行复核' : '请搜索或扫码选择订单进行复核' }} @@ -1960,7 +1960,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; this.listExpanded = false; // D前缀波次:自动标记所有商品为已扫,跳过逐件扫描 - if (this.isDprefixedWave && this.detailGoodsList.length > 0) { + // 已复核订单不再触发自动复核/打印,仅展示只读详情 + if (this.isDprefixedWave && this.detailGoodsList.length > 0 && !item.isReviewed) { this.detailGoodsList = this.detailGoodsList.map(g => ({ ...g, scannedQty: g.planQty @@ -1987,7 +1988,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; this.showDetailView = false; this.detailGoodsList = []; // 从详情返回后刷新列表 - if (this.keyword) { + // D波次:keyword 是商品条码,scanOrder 不支持,依赖本地已更新的 orderList + if (this.keyword && !this.isDprefixedWave) { this.requestScanOrder(this.keyword, true); } }, @@ -2033,9 +2035,26 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; } } // 刷新订单列表数据 - if (this.keyword) { + // 非D波次:keyword 是运单号/波次号,可用 scanOrder 刷新 + // D波次:keyword 是商品条码,scanOrder 不支持,依赖本地更新 + if (this.keyword && !this.isDprefixedWave) { this.requestScanOrder(this.keyword, true); } + // 标记当前已复核(本地更新,即使 requestScanOrder 不刷新也能保持正确状态) + const currentId = String(this.detailInfo?.orderId || this.detailInfo?.recordId || ''); + if (currentId) { + const id = Number(currentId); + if (id > 0 && !this.reviewedOrderIds.includes(id)) { + this.reviewedOrderIds = [...this.reviewedOrderIds, id]; + } + this.orderList = this.orderList.map(item => { + const itemId = Number(item.id || item.orderId || 0); + if (itemId === id) { + return { ...item, isReviewed: true, unreviewedCount: 0 }; + } + return item; + }); + } this.speakVoice('发货成功'); return true; } catch (error) { diff --git a/pages/work/order/weighing.vue b/pages/work/order/weighing.vue index b0a61f3..4a93356 100644 --- a/pages/work/order/weighing.vue +++ b/pages/work/order/weighing.vue @@ -144,6 +144,44 @@ import voice from '@/core/utils/voice'; speakVoice(text) { voice.speak(text, { minInterval: 800 }); }, + async fetchOrderDetail(code) { + try { + const toOrderRes = await this.$http('common.toOrder', { waybill_code: code }, '', false); + if (toOrderRes && toOrderRes.flag !== 'failure') { + const rawOrderId = Number(toOrderRes.order_id); + if (rawOrderId > 0) { + this.orderInfo.order_id = rawOrderId; + } + this.waves = Array.isArray(toOrderRes.waves) ? toOrderRes.waves : []; + + // 调用 order.detail 获取订单详情 + try { + const detailRes = await this.$http('order.detail', { order_id: this.orderInfo.order_id, tableType: 'dispatch' }, '', false); + if (detailRes && detailRes.flag !== 'failure') { + const detailData = detailRes.data || {}; + this.orderDetail = detailData.detail || null; + this.orderItems = detailData.items || []; + this.expresses = detailData.expresses || []; + + // 从订单详情中更新商品净重 + if (detailData.detail && detailData.detail.items_weight !== undefined && detailData.detail.items_weight !== null) { + this.netWeight = detailData.detail.items_weight; + } + // 从运单信息中更新称重重量 + const firstExpress = (detailData.expresses || [])[0]; + if (firstExpress && firstExpress.weighing_weight !== undefined && firstExpress.weighing_weight !== null) { + // 接口返回 kg,页面显示 g,乘以 1000 转换 + this.manualWeight = String(Math.round(firstExpress.weighing_weight * 1000)); + } + } + } catch (e) { + console.error('获取订单详情失败', e); + } + } + } catch (e) { + console.error('获取波次信息失败', e); + } + }, async fetchOrderInfo(code) { uni.showLoading({ title: '查询中...' }); try { @@ -205,49 +243,25 @@ import voice from '@/core/utils/voice'; this.manualWeight = waveItem?.items_weight ? String(waveItem.items_weight) : ''; } - // 调用 index.toOrder 获取订单ID及所属波次信息 - try { - const toOrderRes = await this.$http('common.toOrder', { waybill_code: code }, '', false); - if (toOrderRes && toOrderRes.flag !== 'failure') { - const rawOrderId = Number(toOrderRes.order_id); - if (rawOrderId > 0) { - this.orderInfo.order_id = rawOrderId; - } - this.waves = Array.isArray(toOrderRes.waves) ? toOrderRes.waves : []; - - // 调用 order.detail 获取订单详情 - try { - const detailRes = await this.$http('order.detail', { order_id: this.orderInfo.order_id }, '', false); - if (detailRes && detailRes.flag !== 'failure') { - const detailData = detailRes.data || {}; - this.orderDetail = detailData.detail || null; - this.orderItems = detailData.items || []; - this.expresses = detailData.expresses || []; - - // 从订单详情中更新商品净重 - if (detailData.detail && detailData.detail.items_weight !== undefined && detailData.detail.items_weight !== null) { - this.netWeight = detailData.detail.items_weight; - } - // 从运单信息中更新称重重量 - const firstExpress = (detailData.expresses || [])[0]; - if (firstExpress && firstExpress.weighing_weight !== undefined && firstExpress.weighing_weight !== null) { - // 接口返回 kg,页面显示 g,乘以 1000 转换 - this.manualWeight = String(Math.round(firstExpress.weighing_weight * 1000)); - } - } - } catch (e) { - console.error('获取订单详情失败', e); - } - } - } catch (e) { - console.error('获取波次信息失败', e); - } + // 调用 index.toOrder 获取订单ID及所属波次信息(已提取到 fetchOrderDetail 方法) + await this.fetchOrderDetail(code); this.showOrderInfo = true; // 自动聚焦称重重量输入框 this.$nextTick(() => { this.weightFocused = true; }); + } else if (res && res.message === '接口错误: 未找到对应订单') { + // 未找到对应订单时跳过未复核检测,继续查询 + this.orderInfo = { + order_id: 0, + waybill_code: code + }; + this.showOrderInfo = true; + await this.fetchOrderDetail(code); + this.$nextTick(() => { + this.weightFocused = true; + }); } else { uni.showToast({ title: res.msg || '查询失败', icon: 'none' }); this.speakVoice('无记录');