增加代客下单商品列表缓存

This commit is contained in:
YeMingfei666 2024-10-24 11:06:01 +08:00
parent 3549664a0f
commit e0c008732e
1 changed files with 21 additions and 0 deletions

View File

@ -126,6 +126,27 @@ const model = {
return appCache.useType
}
},
// 缓存代客下单商品
cacheGoods: (val, isDelete = false) => {
if (isDelete) {
appCache.cacheGoods = ""
return uni.removeStorageSync('cacheGoods')
}
if (val) {
// 有值,为放置
appCache.cacheGoods = val
uni.setStorageSync('cacheGoods', val)
} else {
// 否则为获取
if (!appCache.cacheGoods) {
//缓存取不到,获取应用本地信息
appCache.cacheGoods = uni.getStorageSync('cacheGoods')
}
return appCache.cacheGoods
}
},
// 已经登录的用户记录
loggedInUser: (addUserName = null, removeUserName = null) => {
let key = "loggedInUserList"