feat:跳转权益中心处理

This commit is contained in:
zoujing
2026-09-20 16:27:38 +08:00
parent a4c29569bf
commit 348b3d80ac
2 changed files with 9 additions and 1 deletions

View File

@@ -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",

View File

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