fix:待入库商品持久化到localStorage,切换页面后恢复

This commit is contained in:
ShenQiLun 2026-06-29 11:24:50 +08:00
parent c51163793c
commit 4b62361f37

View File

@ -1297,6 +1297,13 @@ export default {
// //
onShow() { onShow() {
//
var savedList = uni.getStorageSync('pendingProductList') || []
if (savedList.length > 0) {
this.pendingProductList = savedList
this.pendingCount = savedList.length
}
if (this.capturedPhotoList && this.capturedPhotoList.length > 0) { if (this.capturedPhotoList && this.capturedPhotoList.length > 0) {
var photos = this.capturedPhotoList var photos = this.capturedPhotoList
var targetTab = this.capturedPhotoTab || 'no-isbn' var targetTab = this.capturedPhotoTab || 'no-isbn'
@ -2240,6 +2247,7 @@ 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)
// / // /
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) {
@ -2402,6 +2410,7 @@ 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)
// / // /
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) {
@ -2702,6 +2711,7 @@ export default {
this.marketData = { onSale: 0, old: 0, new: 0, sold: 0 } this.marketData = { onSale: 0, old: 0, new: 0, sold: 0 }
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('reuseWaveNo') uni.removeStorageSync('reuseWaveNo')
uni.removeStorageSync('reuseWaveId') uni.removeStorageSync('reuseWaveId')
uni.removeStorageSync('reuseOrderId') uni.removeStorageSync('reuseOrderId')