diff --git a/pages/work/order/order-review.vue b/pages/work/order/order-review.vue index 35410d9..9ebdde4 100644 --- a/pages/work/order/order-review.vue +++ b/pages/work/order/order-review.vue @@ -1223,6 +1223,11 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; const matchedOrder = this.findOrderByProductBarcode(text); if (matchedOrder) { this.goPickGoodsDetail(matchedOrder); + return; + } + // 商品条码未匹配时,尝试用车号/运单号查询后端(支持扫拣货车进入下一个波次) + if (this.printStationId || this.printMode === 'noPrint') { + this.requestScanOrder(text); } else { uni.showToast({ title: '未找到匹配的商品', icon: 'none' }); this.speakVoice('无记录'); @@ -2611,10 +2616,39 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; data: { waveGroups } }); console.log('[autoPrint] 自动打印发送成功'); + // 同步更新订单列表中的打印状态 + this.updateOrderPrintStatus(item); } catch (error) { console.warn('[autoPrint] 自动打印失败:', error?.message || error); } }, + updateOrderPrintStatus(item) { + if (!item || !Array.isArray(this.orderList) || !this.orderList.length) return; + if (this.listType === 'single') { + const itemId = String(item.id || item.orderId || item.recordId || ''); + if (!itemId) return; + this.orderList = this.orderList.map(o => { + const oId = String(o.id || o.orderId || ''); + if (oId === itemId) { + return { ...o, isPrinted: true }; + } + return o; + }); + } else if (this.listType === 'group') { + // 团单模式:减少对应波次的未打印数量 + const waveNo = String(item.waveNo || item.wave_no || ''); + const itemId = String(item.id || item.orderId || item.recordId || ''); + this.orderList = this.orderList.map(o => { + const oId = String(o.id || o.orderId || ''); + const oWaveNo = String(o.waveNo || ''); + if (oId === itemId || (waveNo && oWaveNo === waveNo)) { + const currentUnprinted = Number(o.unprintedCount || 0); + return { ...o, unprintedCount: Math.max(0, currentUnprinted - 1) }; + } + return o; + }); + } + }, async handlePrintOrder(item) { if (!item) { uni.showToast({ title: '打印数据无效', icon: 'none' }); @@ -2656,6 +2690,9 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue'; throw new Error(sendResponse?.message || sendResponse?.msg || '打印发送失败'); } + // 同步更新订单列表中的打印状态 + this.updateOrderPrintStatus(item); + uni.hideLoading(); uni.showToast({ title: '打印已发送', icon: 'success' }); } catch (error) {