diff --git a/src/constant/index.js b/src/constant/index.js index 7a98896..fc13a5f 100644 --- a/src/constant/index.js +++ b/src/constant/index.js @@ -107,6 +107,12 @@ export const TABS = [ { key: "mine", label: "我的", icon: "user" }, ]; +/** + * 入口固定值:二维码里的 id 等于它时不打开商家详情,只切到权益 Tab。 + * 后端在 scene / query / 普通链接里传这个字符串即可(大小写不敏感)。 + */ +export const ENTRY_BENEFIT_ONLY = "benefits"; + /** 页面路径常量 */ export const ROUTES = { HOME: "/pages/index/index", diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index e77d2cf..930c8a5 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -7,7 +7,7 @@ */ import { nextTick, onMounted, ref } from "vue"; import { onLoad, onShow } from "@dcloudio/uni-app"; -import { TABS } from "@/constant"; +import { ENTRY_BENEFIT_ONLY, TABS } from "@/constant"; import { consumePendingMerchant, consumePendingTab, @@ -48,12 +48,14 @@ let shellReady = false; /** * 扫码进店:先切权益 Tab 再打开商家详情。 * 顺序不能反 —— 先切 Tab,「详情返回」才会落在权益页而不是主页。 + * 入口 id 为固定值 ENTRY_BENEFIT_ONLY 时只切 Tab,不再打开详情。 */ const runEntry = () => { if (!shellReady) return; const id = consumePendingMerchant(); if (!id) return; goTab("benefit"); + if (id.toLowerCase() === ENTRY_BENEFIT_ONLY) return; nextTick(() => setTimeout(() => goDetail(id), 0)); };