fix:改用kongfz_shop_name作为账号标识,退出登录后重新登录保留待入库
This commit is contained in:
parent
70b8bce69d
commit
0bb82e5861
@ -1297,21 +1297,12 @@ export default {
|
|||||||
|
|
||||||
// 页面显示时处理连拍返回的照片
|
// 页面显示时处理连拍返回的照片
|
||||||
onShow() {
|
onShow() {
|
||||||
// 检查账号是否切换,切换账号则清空待入库
|
// 检查孔夫子账号是否切换,切换账号则清空待入库
|
||||||
var savedTokenFingerprint = uni.getStorageSync('pendingTokenFingerprint') || ''
|
var savedAccount = uni.getStorageSync('pendingAccount') || ''
|
||||||
var currentToken = uni.getStorageSync('token') || ''
|
var currentAccount = uni.getStorageSync('kongfz_shop_name') || ''
|
||||||
var currentFingerprint = currentToken.substring(currentToken.length - 20) // token尾20字符作为指纹
|
if (savedAccount && savedAccount !== currentAccount) {
|
||||||
if (savedTokenFingerprint && savedTokenFingerprint !== currentFingerprint) {
|
// 切换了孔夫子账号,清空待入库
|
||||||
// 切换了账号,清空待入库
|
this.clearPendingData()
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 恢复待入库商品列表
|
// 恢复待入库商品列表
|
||||||
@ -2265,8 +2256,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 fingerprint = token.substring(token.length - 20)
|
var shopName = uni.getStorageSync('kongfz_shop_name') || ''
|
||||||
uni.setStorageSync('pendingTokenFingerprint', fingerprint)
|
uni.setStorageSync('pendingAccount', shopName)
|
||||||
// 创建/追加波次
|
// 创建/追加波次
|
||||||
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) {
|
||||||
@ -2430,8 +2421,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 fingerprint = token.substring(token.length - 20)
|
var shopName = uni.getStorageSync('kongfz_shop_name') || ''
|
||||||
uni.setStorageSync('pendingTokenFingerprint', fingerprint)
|
uni.setStorageSync('pendingAccount', shopName)
|
||||||
// 创建/追加波次
|
// 创建/追加波次
|
||||||
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) {
|
||||||
@ -2591,6 +2582,19 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 清空待入库相关数据
|
||||||
|
clearPendingData() {
|
||||||
|
uni.removeStorageSync('pendingProductList')
|
||||||
|
uni.removeStorageSync('pendingAccount')
|
||||||
|
uni.removeStorageSync('reuseWaveNo')
|
||||||
|
uni.removeStorageSync('reuseWaveId')
|
||||||
|
uni.removeStorageSync('reuseOrderId')
|
||||||
|
uni.removeStorageSync('reuseCarId')
|
||||||
|
uni.removeStorageSync('reuseCarCode')
|
||||||
|
this.pendingProductList = []
|
||||||
|
this.pendingCount = 0
|
||||||
|
},
|
||||||
|
|
||||||
// 带自动重试的请求封装(网络抖动时自动重试2次)
|
// 带自动重试的请求封装(网络抖动时自动重试2次)
|
||||||
requestWithRetry(options, maxRetries) {
|
requestWithRetry(options, maxRetries) {
|
||||||
if (maxRetries === undefined) maxRetries = 2
|
if (maxRetries === undefined) maxRetries = 2
|
||||||
@ -2733,7 +2737,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('pendingAccount')
|
||||||
uni.removeStorageSync('reuseWaveNo')
|
uni.removeStorageSync('reuseWaveNo')
|
||||||
uni.removeStorageSync('reuseWaveId')
|
uni.removeStorageSync('reuseWaveId')
|
||||||
uni.removeStorageSync('reuseOrderId')
|
uni.removeStorageSync('reuseOrderId')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user