From 08f5cc93ca004286488e5e542bd4e85f380065af Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Mon, 22 Apr 2024 14:07:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E7=9C=81=E5=85=AC?= =?UTF-8?q?=E5=8F=B8=E5=8F=91=E8=B5=B7=E4=BA=BA=E6=B7=BB=E5=8A=A0=E9=97=A8?= =?UTF-8?q?=E5=BA=97=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=20=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E7=9C=81=E5=85=AC=E5=8F=B8=E5=8F=91=E8=B5=B7=E4=BA=BA?= =?UTF-8?q?=E6=97=A0=E9=9C=80=E7=99=BB=E5=BD=95=E7=9B=B4=E6=8E=A5=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=BB=91=E5=AE=9A=E7=9A=84=E7=9C=81=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E9=97=A8=E5=BA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/store.js | 16 +++++++++- pages/agent/centerV2.vue | 64 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 78 insertions(+), 2 deletions(-) diff --git a/api/store.js b/api/store.js index 3a65020..5fe2fb9 100644 --- a/api/store.js +++ b/api/store.js @@ -549,7 +549,21 @@ export function priceRuleApi(id) { noAuth: true }); } -// 酒道馆登录 +// 商户登录 export function storeLogin(data) { return request.get("store/merchant/login", data); } +// 模拟登录 +export function storeLoginSimulation(merId) { + return request.get(`store/merchant/simulation_login/${merId}`); +} + + + + + + + + + + diff --git a/pages/agent/centerV2.vue b/pages/agent/centerV2.vue index b1be6f3..cdb0737 100644 --- a/pages/agent/centerV2.vue +++ b/pages/agent/centerV2.vue @@ -113,6 +113,7 @@ import {mapGetters} from "vuex"; import authorize from '@/components/Authorize'; import {roleAndCorrelationRole,inviteSupplierJoinQrCode} from "@/api/agent"; +import {storeLoginSimulation} from "@/api/store"; export default { name: 'business', @@ -124,6 +125,7 @@ export default { // 类型:1=总部发起人,2=省公司发起人,3=省合伙人(外勤),4=省合伙人(内勤),5=区县运营商,6=区县合伙人,7=餐厅,8=配送商,9=总部外勤,10=总部内勤 let menuList = []; let agentType = this.agent_info.agent_type || 0; + let merId = this.agent_info.mer_id || 0; // 推广二维码 if(['1','2','3','5','6','9','11'].includes(String(agentType))){ menuList.push({ @@ -160,7 +162,15 @@ export default { icon: 'icon-wodetuandui', }); } - + // 省公司发起人 管理省公司门店 + if(['2'].includes(String(agentType)) && merId > 0){ + menuList.push({ + title: '门店管理', + type: 'store_management', + url: '/pages/admin/business/index', + icon: 'icon-dianpu1', + }); + } @@ -472,6 +482,18 @@ export default { url: menu.url + '?agent_id=' + params.agent_id }) break; + // 门店管理 + case 'store_management': + // 清除商户登录信息 + _this.$store.commit("SHOP_LOGIN", { + 'token': null, + 'time': null, + 'shop_mer_id': null, + }); + _this.storeManagement(); + break; + + } }, // 推广二维码 - 二维码类型弹框显示 @@ -508,6 +530,46 @@ export default { qrCodeClose(){ this.$refs.qrCodePopup.close(); }, + // 管理门店 - 模拟登录 + storeManagement(){ + let _this = this; + let merId = this.agent_info.mer_id || 0; + uni.showLoading({title: '登录中...', mask: true}) + storeLoginSimulation(merId).then(res => { + if (res.status == 200) { + let data = res.data || {}; + // 记录登录状态 + _this.$store.commit("SHOP_LOGIN", { + 'token': data.token, + 'time': data.exp, + 'shop_mer_id': data.mer_id, + }); + // 记录登录历史 + let merchantType = data.merchant_type || 0; + let loginHistory = this.$Cache.get('MER_LOGIN_HISTORY_' + merchantType) || {}; + if(typeof loginHistory === 'string') loginHistory = JSON.parse(loginHistory) || {}; + loginHistory[data.mer_id] = data; + _this.$Cache.set('MER_LOGIN_HISTORY_' + merchantType, JSON.stringify(loginHistory)) + // 进入商户 || 酒道馆 管理端 + // merchant_type:0=普通商户,1=酒道馆,2=供应商,3=烟酒店,4=超市,5=省公司门店 + // is_sys:0=商户管理,1=平台管理,2=酒道馆管理,3=烟酒店管理,4=超市,5=省公司门店 + let is_sys = 0; + if(merchantType == 1) is_sys = 2; + else if(merchantType == 3) is_sys = 3; + else if(merchantType == 4) is_sys = 4; + else if(merchantType == 5) is_sys = 5; + uni.navigateTo({ + url: '/pages/admin/business/index?is_sys=' + is_sys + }) + } + uni.hideLoading(); + }).catch(err => { + uni.hideLoading(); + this.$util.Tips({ title: err }); + }); + } + +