From a4f335f9604e9e6b82a7f71e97fe923f9ec368b1 Mon Sep 17 00:00:00 2001
From: liuyihe <2513762445@qq.com>
Date: Tue, 22 Sep 2026 17:27:56 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../warehouse-transfer/warehouse-transfer.vue | 16 +++++++++-------
tests/warehouse-transfer-api.test.mjs | 6 ++++--
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/pages/warehouse-transfer/warehouse-transfer.vue b/src/pages/warehouse-transfer/warehouse-transfer.vue
index 98b8c8b..75857a1 100644
--- a/src/pages/warehouse-transfer/warehouse-transfer.vue
+++ b/src/pages/warehouse-transfer/warehouse-transfer.vue
@@ -12,7 +12,7 @@
@@ -45,7 +45,7 @@
- {{ pallet.palletNo }}{{ pallet.fbaWarehouseCode || selected.fbaWarehouseCode || '目的仓待定' }}
+ {{ pallet.palletNo }}{{ destinationLabel(pallet, selected) }}
已绑定实物托盘 {{ pallet.palletNo }}
@@ -67,8 +67,8 @@
操作失败{{ error.message || error }}requestId:{{ error.requestId }}
提交成功测量与托盘打托已完成
- 新托盘标签{{ completedDestination ? `FBA 目的仓 ${completedDestination}` : '目的仓待定' }} · 逐托打开 PDF 后打印并粘贴
- {{ pallet.palletNo }}{{ pallet.cartonCount }} 箱 · {{ pallet.fbaWarehouseCode || completedDestination || '目的仓待定' }}
+ 新托盘标签{{ completedDestinationLabel }} · 逐托打开 PDF 后打印并粘贴
+ {{ pallet.palletNo }}{{ pallet.cartonCount }} 箱 · {{ destinationLabel(pallet, { destinationType: completedDestinationType }) }}
@@ -93,8 +93,9 @@ const restoredPallet = (value, index) => ({
export default {
components: { PortalHeader, ScanTargetInput },
- data() { return { user: session.currentUser, candidates: [], selected: null, pallets: [newPallet()], activePalletKey: '', photoFileIds: [], photoUrls: {}, photoNames: [], completedPallets: [], completedTransferNo: '', completedDestination: '', loading: false, detailLoading: false, submitting: false, uploadingPhoto: false, openingLabel: false, error: null, success: false, pendingKey: '' } },
+ data() { return { user: session.currentUser, candidates: [], selected: null, pallets: [newPallet()], activePalletKey: '', photoFileIds: [], photoUrls: {}, photoNames: [], completedPallets: [], completedTransferNo: '', completedDestination: '', completedDestinationType: '', loading: false, detailLoading: false, submitting: false, uploadingPhoto: false, openingLabel: false, error: null, success: false, pendingKey: '' } },
computed: {
+ completedDestinationLabel() { return this.destinationLabel({ fbaWarehouseCode: this.completedDestination, destinationType: this.completedDestinationType }) },
totalCartons() { return this.pallets.reduce((sum, pallet) => sum + Math.max(0, Number(pallet.cartonCount) || 0), 0) },
cartonDifference() { return this.totalCartons - Number(this.selected?.packageCount || 0) },
totalVolume() { return this.pallets.reduce((sum, pallet) => sum + this.rawPalletVolume(pallet), 0).toFixed(3) },
@@ -119,6 +120,7 @@ export default {
onHide() { this.stopScanner() },
beforeUnmount() { this.stopScanner() },
methods: {
+ destinationLabel(value, fallback = {}) { const code = String(value?.fbaWarehouseCode || fallback?.fbaWarehouseCode || '').trim(); if (code) return code; const type = value?.destinationType || fallback?.destinationType; return type === 'PRIVATE' ? '私人仓' : '目的仓待定' },
startScanner() { this.stopScanner(); this._stopScanner = startScanBroadcast({ onScan: (value) => this.handlePalletScan(value), onError: (error) => { this.error = error } }) },
stopScanner() { if (this._stopScanner) this._stopScanner(); this._stopScanner = null },
handlePalletScan(value) { const pallet = this.pallets.find((item) => item.key === this.activePalletKey && item.generated && !item.bound); if (!pallet) return; pallet.bindCode = String(value || '').trim(); this.bindPallet(pallet) },
@@ -152,7 +154,7 @@ export default {
async loadCandidates() { this.loading = true; this.error = null; try { this.candidates = await listWarehouseTransferCandidates() } catch (e) { this.error = e } finally { this.loading = false } },
async select(item) {
if (this.detailLoading || this.submitting) return
- this.detailLoading = true; this.error = null; this.success = false; this.completedPallets = []; this.completedTransferNo = ''; this.completedDestination = ''
+ this.detailLoading = true; this.error = null; this.success = false; this.completedPallets = []; this.completedTransferNo = ''; this.completedDestination = ''; this.completedDestinationType = ''
try { this.selected = await getWarehouseTransferDetail(item.transferNo); this.pendingKey = ''; this.pallets = this.selected.pallets?.length ? this.selected.pallets.map(restoredPallet) : [newPallet()]; await this.restorePhotos(item.transferNo, this.selected.measurementPhotos) }
catch (e) { this.selected = null; this.error = e }
finally { this.detailLoading = false }
@@ -195,7 +197,7 @@ export default {
try {
if (!this.pendingKey) this.pendingKey = `pda-transfer-${this.selected.transferNo}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`
const payload = { idempotencyKey: this.pendingKey, photoFileIds: [...this.photoFileIds] }
- const transferNo = this.selected.transferNo; const result = await palletizeWarehouseTransfer(transferNo, payload); this.completedTransferNo = transferNo; this.completedDestination = result?.fbaWarehouseCode || this.selected.fbaWarehouseCode || ''; this.completedPallets = (result?.pallets || []).filter((pallet) => pallet?.palletNo); this.success = true; this.selected = null; this.pendingKey = ''; this.pallets = [newPallet()]; this.photoFileIds = []; this.photoUrls = {}; this.photoNames = []; await this.loadCandidates()
+ const transferNo = this.selected.transferNo; const result = await palletizeWarehouseTransfer(transferNo, payload); this.completedTransferNo = transferNo; this.completedDestination = result?.fbaWarehouseCode || this.selected.fbaWarehouseCode || ''; this.completedDestinationType = result?.destinationType || this.selected.destinationType || ''; this.completedPallets = (result?.pallets || []).filter((pallet) => pallet?.palletNo); this.success = true; this.selected = null; this.pendingKey = ''; this.pallets = [newPallet()]; this.photoFileIds = []; this.photoUrls = {}; this.photoNames = []; await this.loadCandidates()
} catch (e) { this.error = e } finally { this.submitting = false }
},
async printPallet(pallet) { if (!pallet?.labelDownloadPath) { this.error = new Error('服务端未返回托盘标签下载地址,请刷新后重试'); return }; await this.openLabelPdf(() => downloadWarehouseTransferPalletLabel(pallet.labelDownloadPath)) },
diff --git a/tests/warehouse-transfer-api.test.mjs b/tests/warehouse-transfer-api.test.mjs
index 4e3f0d1..49937be 100644
--- a/tests/warehouse-transfer-api.test.mjs
+++ b/tests/warehouse-transfer-api.test.mjs
@@ -79,8 +79,10 @@ test('warehouse transfer restores uploaded photos and exposes honest pallet labe
assert.match(page, /completedPallets = \(result\?\.pallets \|\| \[\]\)/)
assert.match(page, /downloadWarehouseTransferPalletLabel/)
assert.match(page, /pallet\.labelDownloadPath/)
- assert.match(page, /pallet\.fbaWarehouseCode \|\| completedDestination \|\| '目的仓待定'/)
- assert.match(page, /目的仓待定/)
+ assert.match(page, /destinationLabel\(pallet, \{ destinationType: completedDestinationType \}\)/)
+ assert.match(page, /type === 'PRIVATE' \? '私人仓' : '目的仓待定'/)
+ assert.match(page, /completedDestinationType = result\?\.destinationType \|\| this\.selected\.destinationType/)
+ assert.doesNotMatch(page, /privateDestinationAddress/)
assert.match(page, /uni\.openDocument\(\{ filePath, fileType: 'pdf', showMenu: true/)
assert.doesNotMatch(page, /批量打印|printAllPallets/)
})