This commit is contained in:
2026-09-23 09:06:31 +08:00
parent a4f335f960
commit f6659af42b
@@ -19,6 +19,8 @@
<view v-if="detailLoading" class="transfer-empty"><text class="empty-title">正在读取转运明细</text><text>请稍候,不要重复选择</text></view>
<template v-if="selected && !detailLoading">
<view v-if="isInventoryTransfer" class="transfer-success inventory-transfer-panel"><text class="feedback-title">库存转运 · 无需测量</text><text>该单来源于仓库现有库存,不需要重复测量或上传现场照片。请进入托盘作业,按来源托盘执行整托转运、拆托重打,或与相同目的仓合托。</text><button class="transfer-primary" @tap="openPalletOperations">进入托盘作业</button></view>
<template v-if="!isInventoryTransfer">
<view class="order-summary">
<view><text class="summary-eyebrow">当前测量任务</text><text class="summary-no">{{ selected.transferNo }}</text></view>
<view class="summary-count"><strong>{{ totalCartons }}</strong><text>实收箱</text></view>
@@ -62,6 +64,7 @@
</view>
<view v-if="validationMessage" class="transfer-validation" role="alert"><text class="validation-title">还不能提交</text><text>{{ validationMessage }}</text></view>
<view class="submit-panel"><view><text>整单测量汇总</text><strong>{{ pallets.length }} 托 · {{ totalCartons }} / {{ selected.packageCount || 0 }} 箱</strong></view><button class="transfer-primary" :disabled="submitting || !canSubmit" @tap="submit">{{ submitting ? '提交中…' : '完成测量并打托' }}</button></view>
</template>
</template>
<view v-if="error" class="transfer-error" role="alert"><text class="feedback-title">操作失败</text><text>{{ error.message || error }}</text><text v-if="error.requestId">requestId:{{ error.requestId }}</text></view>
@@ -98,9 +101,11 @@ export default {
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) },
isInventoryTransfer() { return Boolean(this.selected && this.selected.inboundCode && this.selected.inboundCode !== this.selected.transferNo) },
totalVolume() { return this.pallets.reduce((sum, pallet) => sum + this.rawPalletVolume(pallet), 0).toFixed(3) },
totalWeight() { return this.pallets.reduce((sum, pallet) => sum + Math.max(0, Number(pallet.grossWeightKg) || 0), 0).toFixed(2) },
validationMessage() {
if (this.isInventoryTransfer) return ''
if (!this.selected || !this.pallets.length) return '转运单缺少可测量的托盘'
for (let index = 0; index < this.pallets.length; index += 1) {
const pallet = this.pallets[index]
@@ -119,7 +124,8 @@ export default {
onShow() { if (requireSession()) { this.user = session.currentUser; this.startScanner(); this.loadCandidates() } },
onHide() { this.stopScanner() },
beforeUnmount() { this.stopScanner() },
methods: {
methods: {
openPalletOperations() { uni.navigateTo({ url: '/pages/pallet/pallet' }) },
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 },