From e665c4ced75f9e5b89aced571f50886cb42e78c6 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Mon, 19 Aug 2024 22:44:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=92=8C=E9=A1=B5=E9=9D=A2=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E9=97=A8=E5=BA=97=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/app.js | 4 +-- pages/index/index.vue | 60 ++++++++++++++++++++++++------------------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/config/app.js b/config/app.js index f1f7802..0d6283a 100644 --- a/config/app.js +++ b/config/app.js @@ -2,8 +2,8 @@ let BASE_URL let WSS_URL import store from "@/store/user.js" // 环境 -// let env = "dev" -let env = "prod" +let env = "dev" +// let env = "prod" // let env = "release"; // let env = "local"; diff --git a/pages/index/index.vue b/pages/index/index.vue index dcc439a..61f3829 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -24,7 +24,7 @@ + style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" @click="navgo('/multipleShop/index/index?event=store_info')"> {{shareInfo.real_name}} { console.log('opt', opt) - if (opt.id) { - where.value.store_id = (opt.id == 'undefined' ? STORE_INFO.id : opt.id); - } else { - where.value.store_id = STORE_INFO.id - } // 店铺id if (opt.id && opt.id != 'undefined') { - where.value.store_id = opt.id; - const info = await shopDetailApi({ - store_id: where.value.store_id - }); + STORE_INFO.id = opt.id + STORE_INFO.store_name = opt.real_name + if (opt.real_name == '' || opt.real_name == undefined) { + shopDetailApi({ + store_id: opt.id + }).then(res => { + STORE_INFO.store_name=res.data.name + }) + } // 分享参数至当前用户参数 if (opt.spread_uid) { shareInfo.value.uid = opt.spread_uid; @@ -765,10 +766,11 @@ shareInfo.value.store_id = opt.id; uni.setStorageSync('SHARE_INFO', shareInfo.value); } + getAll() } else { uni.removeStorageSync('SHARE_INFO') + getLocation() } - getLocation() // #ifndef H5 // 胶囊布局信息 @@ -777,12 +779,12 @@ }) onShow(() => { - if(STORE_INFO.id){ + if (STORE_INFO.id) { getCartList(); } // 如果后台变更核销人员权限 可以及时切换 if (userStore.token && userStore.userInfo.mobile) { - userInfoApi().then(res => { + userInfoApi({store_id:STORE_INFO.id}).then(res => { const user = res.data; userStore.setUserInfo(user); if (!user.openid) loginUpdateUserApi({ @@ -820,6 +822,11 @@ const LocationShowOpen = () => { LocationShow.value = true; } + const getAll = () => { + getgoodClassList(0) + getGoodList() + getCartList(); + } //获取小程序定位 const opensettings = (a = false) => { @@ -841,10 +848,11 @@ getStoreInfo(location).then(res => { STORE_INFO.id = res.data.id STORE_INFO.store_name = res.data.store_name - getgoodClassList(0) - getGoodList() - getCartList(); - uni.setStorageSync('STORE_INFO', JSON.stringify(STORE_INFO)) + STORE_INFO.abbreviation = res.data + .abbreviation + getAll() + uni.setStorageSync('STORE_INFO', JSON + .stringify(STORE_INFO)) }) }, @@ -873,11 +881,11 @@ getStoreInfo(location).then(res => { STORE_INFO.id = res.data.id STORE_INFO.store_name = res.data.store_name - getgoodClassList(0) - getGoodList() - getCartList(); + STORE_INFO.abbreviation = res.data.abbreviation + + getAll() uni.setStorageSync('STORE_INFO', JSON.stringify(STORE_INFO)) - + }) },