增加店铺员工id

This commit is contained in:
YeMingfei666 2024-10-09 17:30:58 +08:00
parent 1f499a3bd6
commit b5eb099c75
1 changed files with 22 additions and 0 deletions

View File

@ -23,6 +23,7 @@ const model = {
uni.setStorageSync('shopName',res.shopName) uni.setStorageSync('shopName',res.shopName)
uni.setStorageSync('logo',res.logo) uni.setStorageSync('logo',res.logo)
uni.setStorageSync('loginType',res.loginType) uni.setStorageSync('loginType',res.loginType)
uni.setStorageSync('shopUserId',res.user.user.id)
}, },
// 退出清空所有的缓存数据。 (不包含 环境相关) // 退出清空所有的缓存数据。 (不包含 环境相关)
cleanByLogout: () => { cleanByLogout: () => {
@ -79,6 +80,27 @@ const model = {
return appCache.shopId return appCache.shopId
} }
}, },
// 获取和放置店铺员工id
shopUserId: (val, isDelete = false) => {
if (isDelete) {
appCache.shopUserId = ""
return uni.removeStorageSync('shopUserId')
}
if (val) {
// 有值,为放置
appCache.shopUserId = val
uni.setStorageSync('shopUserId', val)
} else {
// 否则为获取
if (!appCache.shopUserId) {
//缓存取不到,获取应用本地信息
appCache.shopUserId = uni.getStorageSync('shopUserId')
}
return appCache.shopUserId
}
},
// 获取和放置useType就餐类型 // 获取和放置useType就餐类型
useType: (val, isDelete = false) => { useType: (val, isDelete = false) => {
if (isDelete) { if (isDelete) {