From 14fa7b32c49e7d381d3c2f1a89fe03fbab0f6e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E5=96=B5=E5=92=AA?= <15233722133@163.com> Date: Mon, 10 Aug 2026 15:47:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=95=86=E6=88=B7=E7=AB=AF=E6=97=A0?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8F=90=E5=87=BA=E8=BF=94=E5=9B=9E=E5=88=B0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sheep/request/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/sheep/request/index.js b/sheep/request/index.js index 166cf86..038ad4a 100644 --- a/sheep/request/index.js +++ b/sheep/request/index.js @@ -152,6 +152,32 @@ http.interceptors.response.use( if (response.data.code === 401) { return refreshToken(response.config); } + // 特殊:商户端接口返回 code=1013000009 且 msg="无权操作该门店"时,自动踢出商户端,回到用户端首页 + const appStore = $store('app'); + const isMerchant = appStore?.bizMode === 'merchant'; + const codeRaw = Number(response.data.code ?? -1); + const msg = String(response.data.msg || ''); + const isUnauthStore = + isMerchant && + codeRaw === 1013000009 && + msg.indexOf('无权操作该门店') >= 0; + if (isUnauthStore) { + try { + appStore.setBizMode('user'); + } catch (e) {} + const selectedKey = 'merchant.pickup.selectedStoreId'; + try { uni.removeStorageSync(selectedKey); } catch (e) {} + uni.showToast({ + title: msg || '无权操作该门店', + icon: 'none', + mask: true, + duration: 2000, + }); + setTimeout(() => { + uni.reLaunch({ url: '/pages/index/index' }); + }, 500); + return Promise.reject(response.data); + } // 特殊:处理分销用户绑定失败的提示 if ((response.data.code + '').includes('1011007')) { console.error(`分销用户绑定失败,原因:${response.data.msg}`);