From b920f9813d247e5c18677395c58281b00bef89cc Mon Sep 17 00:00:00 2001 From: 陶杰 <1378534974@qq.com> Date: 星期三, 08 一月 2025 09:07:11 +0800 Subject: [PATCH] 1.订单支付倒计时配置 2.服务热线配置 --- store/index.js | 121 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 119 insertions(+), 2 deletions(-) diff --git a/store/index.js b/store/index.js index a97699e..146839b 100644 --- a/store/index.js +++ b/store/index.js @@ -19,6 +19,7 @@ leftWinActive: '/pages/component/view/view', activeOpen: '', menu: [], + appMenu: [], univerifyErrorMsg: '', currentInfo: {}, //个人用户信息 cache_address: {}, @@ -32,9 +33,16 @@ 'delivery': 0, 'order': 0, 'shopnum': 0, - 'coupon': 0 + 'coupon': 0, + 'cache_topay':0, }, - defaultaddress: {} + cache: { + coupon: {}, + goods:[], + cache_coupon_select_cancel:0 + }, + defaultaddress: {}, + addressDesc:'', }, mutations: { @@ -54,7 +62,9 @@ state.hasLogin = false state.openid = null state.currentInfo = {} + state.appMenu=[] storage.removeItem('token') + storage.removeItem('appMenu'); message.showToast('退出登录成功') }, @@ -63,6 +73,12 @@ }, 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 @@ -120,6 +136,27 @@ 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, @@ -162,6 +199,7 @@ }) { //把权限获取到 // console.log('getCurrentInfo,getCurrentInfo') + const currentInfo = await http.request('get', '/api/current/user', {}) if (currentInfo && currentInfo.code == 0) { // state.cMenu = cMenu @@ -178,6 +216,81 @@ //这种情况就是要跳转到登录页面 } }, + + getSwitchSubAccount: async function({commit,state},payload) { + //把权限获取到 + // console.log('getCurrentInfo,getCurrentInfo') + + const currentInfo = await http.request('get', '/api/supplierSub/getSwitchById', { + params: { + id:payload.id, + type:payload.type + } + }) + 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, @@ -268,6 +381,8 @@ storage.setItem('token', resp.data.access_token) commit("updateLogin", true) await dispatch('getCurrentInfo') + // 获取所有权限菜单 + await dispatch('getAppMenuPartner') uni.reLaunch({ url: '/pages/home/supplier-home' }) @@ -333,6 +448,8 @@ storage.setItem('token', resp.data.access_token) commit("updateLogin", true) await dispatch('getCurrentInfo') + // 获取所有供应商权限菜单 + await dispatch('getAppMenuSupplier') console.log('login,reLaunch') // #ifdef APP -- Gitblit v1.9.3