|
|
@@ -432,7 +432,7 @@ export default {
|
|
|
})
|
|
|
this.cartBadgeCount = count
|
|
|
},
|
|
|
- /** 拉取当前用户 custom.id,仅用于分享追加 inviterCustomId */
|
|
|
+ /** 拉取当前用户 custom.id,仅用于分享追加 inviterCustomId;游客也拉 shop/info 供顶栏店名 */
|
|
|
syncMyCustomId() {
|
|
|
const hdId = Number(this.hdId) || Number(uni.getStorageSync('hdId')) || 0
|
|
|
const applyShopRes = (shopRes) => {
|
|
|
@@ -455,11 +455,18 @@ export default {
|
|
|
return Promise.resolve()
|
|
|
}
|
|
|
uni.setStorageSync('account', account)
|
|
|
+ // 缓存店与当前 account 不一致时清空,避免顶栏短暂显示上一店名
|
|
|
+ const cached = uni.getStorageSync('currentShop')
|
|
|
+ if (!cached || String(cached.id) !== String(account)) {
|
|
|
+ this.shopInfo = null
|
|
|
+ }
|
|
|
return getHdInfo().then((res) => {
|
|
|
if (res.code == 1 && res.data.hd && res.data.hd.id) {
|
|
|
uni.setStorageSync('hdId', res.data.hd.id)
|
|
|
return getInfo({ hdId: res.data.hd.id }).then(applyShopRes)
|
|
|
}
|
|
|
+ // 游客无 hd:直接用 account 拉门店信息,保证顶栏 merchantName 有值
|
|
|
+ return getInfo({}).then(applyShopRes)
|
|
|
})
|
|
|
},
|
|
|
/** 在分享 path 后追加 inviterCustomId */
|