From 87a56274d598af9842b593ec972f517161f60707 Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期日, 19 一月 2025 18:44:27 +0800
Subject: [PATCH] 1.v6-屏蔽微信登录

---
 store/index.js |  124 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 121 insertions(+), 3 deletions(-)

diff --git a/store/index.js b/store/index.js
index 71274a5..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,8 +33,16 @@
 			'delivery': 0,
 			'order': 0,
 			'shopnum': 0,
+			'coupon': 0,
+			'cache_topay':0,
 		},
-		defaultaddress: {}
+		cache: {
+			coupon: {},
+			goods:[],
+			cache_coupon_select_cancel:0
+		},
+		defaultaddress: {},
+		addressDesc:'',
 	},
 	mutations: {
 
@@ -53,15 +62,23 @@
 			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
@@ -119,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,
@@ -161,6 +199,7 @@
 		}) {
 			//把权限获取到
 			// console.log('getCurrentInfo,getCurrentInfo')
+			
 			const currentInfo = await http.request('get', '/api/current/user', {})
 			if (currentInfo && currentInfo.code == 0) {
 				// state.cMenu = cMenu
@@ -177,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,
@@ -267,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'
 					})
@@ -332,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
@@ -352,7 +470,7 @@
 						console.log("启用结果2:", ret);
 					});
 					// #endif
-				 
+
 					uni.reLaunch({
 						url: '/pages/home/supplier-home'
 					})

--
Gitblit v1.9.3