From 3c0caed110ffbca70e7cf79aa82196f5fccfe821 Mon Sep 17 00:00:00 2001 From: ShenQiLun <97694732@qq.com> Date: Mon, 29 Jun 2026 11:30:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=88=87=E6=8D=A2=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E6=97=B6=E6=B8=85=E7=A9=BA=E5=BE=85=E5=85=A5=E5=BA=93=E5=95=86?= =?UTF-8?q?=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/upload/upload.vue | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue index a53ee13..c590675 100644 --- a/pages/upload/upload.vue +++ b/pages/upload/upload.vue @@ -1297,6 +1297,23 @@ export default { // 页面显示时处理连拍返回的照片 onShow() { + // 检查账号是否切换,切换账号则清空待入库 + var savedTokenFingerprint = uni.getStorageSync('pendingTokenFingerprint') || '' + var currentToken = uni.getStorageSync('token') || '' + var currentFingerprint = currentToken.substring(currentToken.length - 20) // token尾20字符作为指纹 + if (savedTokenFingerprint && savedTokenFingerprint !== currentFingerprint) { + // 切换了账号,清空待入库 + uni.removeStorageSync('pendingProductList') + uni.removeStorageSync('pendingTokenFingerprint') + uni.removeStorageSync('reuseWaveNo') + uni.removeStorageSync('reuseWaveId') + uni.removeStorageSync('reuseOrderId') + uni.removeStorageSync('reuseCarId') + uni.removeStorageSync('reuseCarCode') + this.pendingProductList = [] + this.pendingCount = 0 + } + // 恢复待入库商品列表 var savedList = uni.getStorageSync('pendingProductList') || [] if (savedList.length > 0) { @@ -2248,6 +2265,8 @@ export default { this.pendingProductList.push(entry) this.pendingCount = this.pendingProductList.length uni.setStorageSync('pendingProductList', this.pendingProductList) + var token = uni.getStorageSync('token') || '' + uni.setStorageSync('pendingTokenFingerprint', token.substring(token.length - 20)) // 创建/追加波次 await this.appendWaveItem(warehouseData, productId, this.stock ?? '1', salePrice) if (this.pendingCount >= 200) { @@ -2411,6 +2430,8 @@ export default { this.pendingProductList.push(entry) this.pendingCount = this.pendingProductList.length uni.setStorageSync('pendingProductList', this.pendingProductList) + var token = uni.getStorageSync('token') || '' + uni.setStorageSync('pendingTokenFingerprint', token.substring(token.length - 20)) // 创建/追加波次 await this.appendWaveItem(this.noIsbnWarehouseData, productId, this.noIsbnStock ?? '1', salePrice) if (this.pendingCount >= 200) { @@ -2712,6 +2733,7 @@ export default { this.noIsbnProductList = [] this.noIsbnMarketData = { onSale: 0, old: 0, new: 0, sold: 0 } uni.removeStorageSync('pendingProductList') + uni.removeStorageSync('pendingTokenFingerprint') uni.removeStorageSync('reuseWaveNo') uni.removeStorageSync('reuseWaveId') uni.removeStorageSync('reuseOrderId')