fix:切换账号时清空待入库商品

This commit is contained in:
ShenQiLun 2026-06-29 11:30:33 +08:00
parent 4b62361f37
commit 3c0caed110

View File

@ -1297,6 +1297,23 @@ export default {
// //
onShow() { onShow() {
//
var savedTokenFingerprint = uni.getStorageSync('pendingTokenFingerprint') || ''
var currentToken = uni.getStorageSync('token') || ''
var currentFingerprint = currentToken.substring(currentToken.length - 20) // token20
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') || [] var savedList = uni.getStorageSync('pendingProductList') || []
if (savedList.length > 0) { if (savedList.length > 0) {
@ -2248,6 +2265,8 @@ export default {
this.pendingProductList.push(entry) this.pendingProductList.push(entry)
this.pendingCount = this.pendingProductList.length this.pendingCount = this.pendingProductList.length
uni.setStorageSync('pendingProductList', this.pendingProductList) 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) await this.appendWaveItem(warehouseData, productId, this.stock ?? '1', salePrice)
if (this.pendingCount >= 200) { if (this.pendingCount >= 200) {
@ -2411,6 +2430,8 @@ export default {
this.pendingProductList.push(entry) this.pendingProductList.push(entry)
this.pendingCount = this.pendingProductList.length this.pendingCount = this.pendingProductList.length
uni.setStorageSync('pendingProductList', this.pendingProductList) 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) await this.appendWaveItem(this.noIsbnWarehouseData, productId, this.noIsbnStock ?? '1', salePrice)
if (this.pendingCount >= 200) { if (this.pendingCount >= 200) {
@ -2712,6 +2733,7 @@ export default {
this.noIsbnProductList = [] this.noIsbnProductList = []
this.noIsbnMarketData = { onSale: 0, old: 0, new: 0, sold: 0 } this.noIsbnMarketData = { onSale: 0, old: 0, new: 0, sold: 0 }
uni.removeStorageSync('pendingProductList') uni.removeStorageSync('pendingProductList')
uni.removeStorageSync('pendingTokenFingerprint')
uni.removeStorageSync('reuseWaveNo') uni.removeStorageSync('reuseWaveNo')
uni.removeStorageSync('reuseWaveId') uni.removeStorageSync('reuseWaveId')
uni.removeStorageSync('reuseOrderId') uni.removeStorageSync('reuseOrderId')