|
|
@@ -1,7 +1,7 @@
|
|
|
import { mapGetters } from 'vuex'
|
|
|
import { pageTo, getCheckLogin, isLogin } from '@/utils/util.js'
|
|
|
import { wxLoginFn } from '@/utils/auth'
|
|
|
-import { initCustom } from '@/api/custom'
|
|
|
+import { getShopUser } from '@/utils/auth'
|
|
|
import constant from '@/constant'
|
|
|
export default {
|
|
|
data() {
|
|
|
@@ -25,29 +25,12 @@ export default {
|
|
|
if (option.token) {
|
|
|
uni.setStorageSync('token', option.token)
|
|
|
}
|
|
|
+ let oldAccount = uni.getStorageSync('account')
|
|
|
if (option.account) {
|
|
|
-
|
|
|
- //切换门店,需要先确认有没生成客户id
|
|
|
- // let oldAccount = uni.getStorageSync('account')
|
|
|
- // if(oldAccount != option.account){
|
|
|
- // getShopUser(true).then(res => {
|
|
|
- // if(res.code == 1){
|
|
|
- // uni.setStorageSync('customId', res.data.custom.id)
|
|
|
- // }
|
|
|
- // })
|
|
|
- // }
|
|
|
-
|
|
|
uni.setStorageSync('account', option.account)
|
|
|
-
|
|
|
- }
|
|
|
- if (constant.source == 'mall') {
|
|
|
- if (option.shopId) {
|
|
|
- uni.setStorageSync('shopId', option.shopId)
|
|
|
- }
|
|
|
}
|
|
|
uni.setStorageSync('currentQuery', JSON.stringify(option))
|
|
|
|
|
|
- // #ifdef MP-WEIXIN
|
|
|
//线上检查小程序的登录态是否有效 checkSession
|
|
|
//checkSession开发环境无效,在真机调试有效
|
|
|
if (process.env.NODE_ENV == "production") {
|
|
|
@@ -60,27 +43,42 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
- // #endif
|
|
|
-
|
|
|
// 登录
|
|
|
if (isLogin()) {
|
|
|
- console.log(1111)
|
|
|
if (this.init) {
|
|
|
- this.init()
|
|
|
+ let self = this
|
|
|
+ //切换门店,需要先确认有没生成客户id shish 2021.5.2
|
|
|
+ if (oldAccount != option.account) {
|
|
|
+ getShopUser(true).then(res => {
|
|
|
+ if (!this.$util.isEmpty(res)) {
|
|
|
+ self.init()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.init()
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
console.log(1112)
|
|
|
wxLoginFn().then(res => {
|
|
|
if (this.init) {
|
|
|
- console.log(1113)
|
|
|
- this.init()
|
|
|
- console.log(1114)
|
|
|
+ let self = this
|
|
|
+ //切换门店,需要先确认有没生成客户id shish 2021.5.2
|
|
|
+ if (oldAccount != option.account) {
|
|
|
+ getShopUser(true).then(res => {
|
|
|
+ if (!this.$util.isEmpty(res)) {
|
|
|
+ self.init()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.init()
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
|
|
|
},
|
|
|
mounted() {
|
|
|
- if (this.mInit) {}
|
|
|
+ if (this.mInit) { }
|
|
|
}
|
|
|
}
|