| | |
| | | leftWinActive: '/pages/component/view/view', |
| | | activeOpen: '', |
| | | menu: [], |
| | | appMenu: [], |
| | | univerifyErrorMsg: '', |
| | | currentInfo: {}, //个人用户信息 |
| | | cache_address: {}, |
| | |
| | | 'delivery': 0, |
| | | 'order': 0, |
| | | 'shopnum': 0, |
| | | 'coupon': 0, |
| | | 'cache_topay':0, |
| | | }, |
| | | defaultaddress: {} |
| | | cache: { |
| | | coupon: {}, |
| | | goods:[], |
| | | cache_coupon_select_cancel:0 |
| | | }, |
| | | defaultaddress: {}, |
| | | addressDesc:'', |
| | | }, |
| | | mutations: { |
| | | |
| | |
| | | state.hasLogin = false |
| | | state.openid = null |
| | | state.currentInfo = {} |
| | | state.appMenu=[] |
| | | storage.removeItem('token') |
| | | storage.removeItem('appMenu'); |
| | | message.showToast('退出登录成功') |
| | | |
| | | |
| | | }, |
| | | setOpenid(state, openid) { |
| | | state.openid = openid |
| | | }, |
| | | setDefaultAddress(state, defaultaddress) { |
| | | state.defaultaddress = defaultaddress |
| | | }, |
| | | setAddressDesc(state, addressDesc) { |
| | | console.log('setAddressDesc',addressDesc) |
| | | state.addressDesc = addressDesc |
| | | storage.setItem("defaultaddress",addressDesc || "") |
| | | |
| | | }, |
| | | setTestTrue(state) { |
| | | state.testvuex = true |
| | |
| | | console.log('sign_clear', key) |
| | | state.sign[key] = 0 |
| | | }, |
| | | cache_coupon_select: async function({ |
| | | commit, |
| | | state |
| | | }, dto) { |
| | | state.cache['coupon'] = dto || {} |
| | | }, |
| | | |
| | | cache_coupon_select_cancel: async function({ |
| | | commit, |
| | | state |
| | | }, val) { |
| | | state.cache['cache_coupon_select_cancel'] = val || 0 |
| | | }, |
| | | |
| | | cache_goods_select: async function({ |
| | | commit, |
| | | state |
| | | }, goods) { |
| | | state.cache['goods'] = goods || [] |
| | | }, |
| | | |
| | | // lazy loading openid |
| | | logout: async function({ |
| | | commit, |
| | |
| | | }) { |
| | | //把权限获取到 |
| | | // console.log('getCurrentInfo,getCurrentInfo') |
| | | |
| | | const currentInfo = await http.request('get', '/api/current/user', {}) |
| | | if (currentInfo && currentInfo.code == 0) { |
| | | // state.cMenu = cMenu |
| | |
| | | //这种情况就是要跳转到登录页面 |
| | | } |
| | | }, |
| | | |
| | | getSwitchSubAccount: async function({commit,state},payload) { |
| | | //把权限获取到 |
| | | // console.log('getCurrentInfo,getCurrentInfo') |
| | | |
| | | const currentInfo = await http.request('get', '/api/supplierSub/getSwitchById', { |
| | | params: { |
| | | id:payload.id |
| | | } |
| | | }) |
| | | if (currentInfo && currentInfo.code == 0) { |
| | | |
| | | state.currentInfo = currentInfo.data || {} |
| | | state.type = currentInfo.data.type || '' |
| | | state.spacecode = currentInfo.data.spacecode || '' |
| | | |
| | | commit("updateLogin", true) |
| | | } else { |
| | | commit("updateLogin", false) |
| | | //这种情况就是要跳转到登录页面 |
| | | } |
| | | |
| | | return currentInfo; |
| | | }, |
| | | |
| | | |
| | | getAppMenu: async function({ |
| | | commit, |
| | | state |
| | | }) { |
| | | //把权限获取到 |
| | | const menu = await http.request('get', '/api/app/menu/permission/menu', {}) |
| | | storage.setItem('appMenu', []); |
| | | if (menu && menu.code == 0) { |
| | | const appMenu = menu.data || [] |
| | | storage.setItem('appMenu', appMenu); |
| | | |
| | | // commit("updateLogin", true) |
| | | } else { |
| | | // commit("updateLogin", false) |
| | | //这种情况就是要跳转到登录页面 |
| | | } |
| | | }, |
| | | |
| | | getAppMenuSupplier: async function({ |
| | | commit, |
| | | state |
| | | }) { |
| | | //把权限获取到 |
| | | const menu = await http.request('get', '/api/app/menu/supplier/permission/menu', {}) |
| | | storage.setItem('appMenu', []); |
| | | if (menu && menu.code == 0) { |
| | | const appMenu = menu.data || [] |
| | | storage.setItem('appMenu', appMenu); |
| | | } else { |
| | | |
| | | } |
| | | }, |
| | | getAppMenuPartner: async function({ |
| | | commit, |
| | | state |
| | | }) { |
| | | //把权限获取到 |
| | | const menu = await http.request('get', '/api/app/menu/partner/permission/menu', {}) |
| | | storage.setItem('appMenu', []); |
| | | if (menu && menu.code == 0) { |
| | | const appMenu = menu.data || [] |
| | | storage.setItem('appMenu', appMenu); |
| | | } else { |
| | | |
| | | } |
| | | }, |
| | | |
| | | |
| | | loginwx: async function({ |
| | | dispatch, |
| | | commit, |
| | |
| | | storage.setItem('token', resp.data.access_token) |
| | | commit("updateLogin", true) |
| | | await dispatch('getCurrentInfo') |
| | | // 获取所有权限菜单 |
| | | await dispatch('getAppMenuPartner') |
| | | uni.reLaunch({ |
| | | url: '/pages/home/supplier-home' |
| | | }) |
| | |
| | | storage.setItem('token', resp.data.access_token) |
| | | commit("updateLogin", true) |
| | | await dispatch('getCurrentInfo') |
| | | // 获取所有供应商权限菜单 |
| | | await dispatch('getAppMenuSupplier') |
| | | |
| | | console.log('login,reLaunch') |
| | | // #ifdef APP |
| | |
| | | console.log("启用结果2:", ret); |
| | | }); |
| | | // #endif |
| | | |
| | | |
| | | uni.reLaunch({ |
| | | url: '/pages/home/supplier-home' |
| | | }) |