优化
This commit is contained in:
@@ -41,12 +41,12 @@
|
||||
<view class="last-scan-icon">{{ lastScanResult.type === 'success' ? '✓' : '!' }}</view>
|
||||
<view class="last-scan-content">
|
||||
<text class="last-scan-label">最近扫码 · {{ lastScanResult.title }}</text>
|
||||
<text class="last-scan-sku">{{ lastScanResult.sku }}</text>
|
||||
<text class="last-scan-box-code">{{ lastScanResult.boxCode }}</text>
|
||||
<text class="last-scan-detail">{{ lastScanResult.detail }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="scanHistory.length > 1" class="scan-history">
|
||||
<text v-for="entry in scanHistory.slice(1, 3)" :key="entry.id" class="scan-history-item">{{ entry.sku }} · {{ entry.title }}</text>
|
||||
<text v-for="entry in scanHistory.slice(1, 3)" :key="entry.id" class="scan-history-item">{{ entry.boxCode }} · {{ entry.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -479,6 +479,14 @@
|
||||
return false
|
||||
},
|
||||
methods: {
|
||||
normalizeScanHistory(entries) {
|
||||
if (!Array.isArray(entries)) return []
|
||||
return entries.map((entry) => {
|
||||
const normalized = { ...entry, boxCode: entry.boxCode ?? entry.sku ?? '' }
|
||||
delete normalized.sku
|
||||
return normalized
|
||||
})
|
||||
},
|
||||
draftIdentity() {
|
||||
const operatorId = session.currentUser?.id || session.currentUser?.userId || session.currentUser?.accountId
|
||||
return { operatorId, taskId: this.remoteTaskId || this.currentBox.taskId || this.currentBox.inboundId, containerNo: this.currentBox.boxNo, warehouseId: this.currentBox.warehouseId || session.currentUser?.warehouseId || session.currentUser?.warehouse }
|
||||
@@ -492,7 +500,7 @@
|
||||
this.scannedBoxCodes = { ...(restored.scannedBoxCodes || {}) }
|
||||
this.boxDrafts = restored.boxDrafts || {}
|
||||
this.completedBoxes = restored.completedBoxes || {}
|
||||
this.scanHistory = restored.scanHistory || []
|
||||
this.scanHistory = this.normalizeScanHistory(restored.scanHistory)
|
||||
return true
|
||||
},
|
||||
handleOverlayChange(name, event) {
|
||||
@@ -555,7 +563,7 @@
|
||||
this.itemStates = { ...draft.itemStates }
|
||||
this.partialQuantities = { ...draft.partialQuantities }
|
||||
this.scannedBoxCodes = { ...(draft.scannedBoxCodes || {}) }
|
||||
this.scanHistory = draft.scanHistory.map((entry) => ({ ...entry }))
|
||||
this.scanHistory = this.normalizeScanHistory(draft.scanHistory)
|
||||
} else {
|
||||
this.itemStates = createItemStates(this.currentBox.items)
|
||||
this.partialQuantities = {}
|
||||
@@ -687,6 +695,7 @@
|
||||
const firstItem = this.currentBox.items[0]
|
||||
this.currentBox.orderNo = firstItem.orderNo || firstItem.inboundCode || this.currentBox.orderNo
|
||||
this.currentBox.inboundId = firstItem.inboundId || this.currentBox.inboundId
|
||||
this.currentBox.tenantId = firstItem.tenantId || this.currentBox.tenantId
|
||||
this.itemStates = createItemStates(this.currentBox.items)
|
||||
this.partialQuantities = {}
|
||||
this.scannedBoxCodes = {}
|
||||
@@ -812,8 +821,8 @@
|
||||
this.showToast(item ? `已确认拣出 ${item.qty} 箱` : '已确认拣出', 'success')
|
||||
this.persistSession()
|
||||
},
|
||||
recordScanResult(type, title, sku, detail) {
|
||||
const entry = { id: `${Date.now()}-${this.scanHistory.length}-${sku}`, type, title, sku, detail }
|
||||
recordScanResult(type, title, boxCode, detail) {
|
||||
const entry = { id: `${Date.now()}-${this.scanHistory.length}-${boxCode}`, type, title, boxCode, detail }
|
||||
this.scanHistory = [entry, ...this.scanHistory].slice(0, 3)
|
||||
},
|
||||
undoItem(id) {
|
||||
|
||||
Reference in New Issue
Block a user