feat: 修改配置文件和页面逻辑,优化门店信息获取功能
This commit is contained in:
parent
d4e222e0b6
commit
e665c4ced7
|
@ -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";
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<view class="store-info">
|
||||
<view style="display: flex;font-size: 30rpx;font-weight: bold;">
|
||||
<text v-if="shareInfo.uid"
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
|
||||
style="max-width: 400rpx;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" @click="navgo('/multipleShop/index/index?event=store_info')">
|
||||
{{shareInfo.real_name}}
|
||||
</text>
|
||||
<text v-else
|
||||
|
@ -316,7 +316,8 @@
|
|||
const userStore = useUserStore();
|
||||
const STORE_INFO = reactive({
|
||||
id: '',
|
||||
store_name: ""
|
||||
store_name: "",
|
||||
abbreviation: ''
|
||||
})
|
||||
const priceKey = reactive({
|
||||
off_activity: "",
|
||||
|
@ -340,6 +341,7 @@
|
|||
uni.setStorageSync("STORE_INFO", JSON.stringify(datas));
|
||||
STORE_INFO.id = datas.id
|
||||
STORE_INFO.store_name = datas.name
|
||||
STORE_INFO.abbreviation = datas.abbreviation
|
||||
shareInfo.value.real_name = datas.name
|
||||
shareInfo.value.store_id = datas.id
|
||||
}
|
||||
|
@ -358,13 +360,10 @@
|
|||
let data = res.data;
|
||||
for (let key in data) {
|
||||
STORE_INFO[key] = data[key]
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
getgoodClassList(0);
|
||||
getGoodList();
|
||||
getCartList();
|
||||
getAll()
|
||||
}
|
||||
|
||||
|
||||
|
@ -374,6 +373,8 @@
|
|||
if (vipList.includes(userStore.userInfo.user_ship)) {
|
||||
shareStr = shareStr + '&spread_uid=' + userStore.userInfo.id + '&real_name=' + (userStore.userInfo
|
||||
.share_name)
|
||||
} else {
|
||||
shareStr = shareStr + '&real_name=' + STORE_INFO.abbreviation
|
||||
}
|
||||
let shareInfo = {
|
||||
// title: (userStore.userInfo.real_name || userStore.userInfo.nickname) + '的供销个人门店',
|
||||
|
@ -747,17 +748,17 @@
|
|||
|
||||
onLoad(async (opt) => {
|
||||
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,9 +881,9 @@
|
|||
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))
|
||||
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue