From cf39d2380d1c00469f2f133e07cfb7eb0d7a04ac Mon Sep 17 00:00:00 2001 From: liufumingren Date: Tue, 9 Jun 2026 14:12:18 +0800 Subject: [PATCH] 1 --- src/views/order/orderreview/index.vue | 34 +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/views/order/orderreview/index.vue b/src/views/order/orderreview/index.vue index 71a6ada8..2a4ae006 100644 --- a/src/views/order/orderreview/index.vue +++ b/src/views/order/orderreview/index.vue @@ -48,7 +48,7 @@ v-if="!hasSelectedIntercept" size="small" type="warning" - :disabled="!lastPrintWaveGroups" + :disabled="!activeOrderId" :loading="reprintLoading" @click="handleReprint" > @@ -439,12 +439,11 @@ async function handlePanelSelect(order: any) { const isPrintFirst = !recheckWorkflowMode.value || recheckWorkflowMode.value === 'print_first' if (isPrintFirst && !isReviewed && !isIntercept && Number.isFinite(orderId) && orderId > 0) { const printStatus = String((order as any)?.print_status ?? '').trim() - if (printStatus !== 'fin' && !skipAutoPrintOnce.value) { + if (printStatus !== 'fin') { const waveIds = isWave ? ((order as any)?.order_ids as Array | undefined) : undefined await autoPrintForOrder(orderId, waveIds) } } - skipAutoPrintOnce.value = false } /** 播放提示音:type=success(短促高音), warning(低沉长音) */ @@ -1056,7 +1055,6 @@ const autoPrintingRef = ref(false) const reprintLoading = ref(false) const lastPrintWaveGroups = ref(null) const lastPrintOrderId = ref(null) -const skipAutoPrintOnce = ref(false) async function autoPrintForOrder(orderId: number, waveOrderIds?: Array) { if (autoPrintingRef.value) return @@ -1112,9 +1110,9 @@ async function autoPrintForOrder(orderId: number, waveOrderIds?: Array | undefined) : undefined + const queryIds = (waveIds && waveIds.length) ? waveIds : [currentId] + const res: any = await getOrderPrintData({ order_ids: queryIds }) + if (res?.code !== undefined && res?.code !== null && res?.code !== 1 && res?.code !== 200 && res?.code !== 0) { + throw new Error(res?.message || '获取打印数据失败') + } + const payload = unwrapWavePlatformPrintPayload(res) + let waveGroups: unknown[] | null | undefined = payload.waveGroups + if (!Array.isArray(waveGroups) || !waveGroups.length) { + const innerData = res?.data + waveGroups = Array.isArray(innerData?.list) ? innerData.list : undefined + } + if (!Array.isArray(waveGroups) || !waveGroups.length) { + ElMessage.warning('未获取到可打印数据') + return + } const warehouseId = Number(userStore.user?.warehouse_id ?? userStore.user?.store_id ?? 0) - const requestCode = `recheck-reprint-${warehouseId}-${orderId}-${Date.now()}` + const requestCode = `recheck-reprint-${warehouseId}-${currentId}-${Date.now()}` const printRes: any = await stationApi.sendPrint({ type: 'express', printStationId: stationId, @@ -1491,7 +1506,6 @@ async function handleConfirm() { return status !== 'fin' }) if (nextUnreviewed) { - skipAutoPrintOnce.value = true handlePanelSelect(nextUnreviewed) } else { // 清除当前订单的扫描状态