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 }); + }); + } + +