diff --git a/src/App.vue b/src/App.vue index 005e3c7..4bd9a17 100644 --- a/src/App.vue +++ b/src/App.vue @@ -107,6 +107,15 @@ export default { }, 500); } } + + //原先商品团购 + if(options?.query.couponsId) { + setTimeout(() => { + uni.reLaunch({ + url: 'pages/common/groupbuy/index?id=' + options?.query.couponsId + }); + }, 500); + } } logger.info(`App Launch options ${env}: { companyId: `, getCompanyId() + ', storeId: ' + getRegisterStoreId() + ' }'); diff --git a/src/pages/common/groupbuy/detail.vue b/src/pages/common/groupbuy/detail.vue index ed36326..1d28948 100644 --- a/src/pages/common/groupbuy/detail.vue +++ b/src/pages/common/groupbuy/detail.vue @@ -174,12 +174,18 @@ onLoad(async (e: any) => { if(isLogin()) { await uni.showLoading(); groupBuyBean.value = await getGroupBuyDetail(e.id); - groupBuyBean.value.goods.price = groupBuyBean.value.price; - bannerList.value = JSON.parse(groupBuyBean.value.content).filter((item: any) => item.type === 2).map((item: any) => item.images); - countdown(); - await fetchRecommendList(); - await fetchBuyRecordList(); + // setCompanyId('1512403904150138881'); + // groupBuyBean.value = await getGroupBuyDetail('1740922051118063618'); + if(groupBuyBean.value) { + groupBuyBean.value.goods.price = groupBuyBean.value.price; + bannerList.value = JSON.parse(groupBuyBean.value.content).filter((item: any) => item.type === 2).map((item: any) => item.images); + countdown(); + await fetchRecommendList(); + await fetchBuyRecordList(); + } uni.hideLoading(); + } else { + goPath('/pages/common/login/index'); } }); diff --git a/src/store/modules/user/index.ts b/src/store/modules/user/index.ts index 87ecc61..835f013 100644 --- a/src/store/modules/user/index.ts +++ b/src/store/modules/user/index.ts @@ -95,7 +95,7 @@ const useUserStore = defineStore('user', { getApp().globalData?.logger.info('login result: ', res); setToken(res.token); setSessionKey(res.sessionKey); - setOpenId(res.maOpenId) + setOpenId(res.maOpenId); await this.setUserInfo(res.user); // } resolve(res); @@ -148,6 +148,7 @@ const useUserStore = defineStore('user', { if(this.userInfo) { this.userInfo.userDiscount = this.getUserDiscount; await setCompanyId(this.userInfo.companyId); + getApp().globalData!.companyId = this.userInfo.companyId; } else { await clearToken(); } @@ -157,6 +158,7 @@ const useUserStore = defineStore('user', { setCompanyInfo(partial: Partial) { this.companyInfo = partial as any; + getApp().globalData!.companyId = this.companyInfo.id; }, setDeliveryAddress(partial: Partial) { diff --git a/src/utils/auth/index.ts b/src/utils/auth/index.ts index 710539e..0d7c0e4 100644 --- a/src/utils/auth/index.ts +++ b/src/utils/auth/index.ts @@ -41,6 +41,7 @@ function getCompanyId() { function setCompanyId(companyId: string) { uni.setStorageSync(CompanyIdKey, companyId); + getApp().globalData!.companyId = companyId; } function getReferrerUserId() {