From fa1f5f1f2df5a853c508322259dfa3ed09f40255 Mon Sep 17 00:00:00 2001 From: Timi Date: Thu, 13 Aug 2026 14:46:29 +0800 Subject: [PATCH] fix customer detail to point account transition --- src/pages/customer/CustomerDetail.vue | 6 +++++- src/pages/point/PointAccount.vue | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/pages/customer/CustomerDetail.vue b/src/pages/customer/CustomerDetail.vue index 67abb99..c8d06c7 100644 --- a/src/pages/customer/CustomerDetail.vue +++ b/src/pages/customer/CustomerDetail.vue @@ -408,7 +408,11 @@ async function toPointAccount(): Promise { } await router.push({ name: "PointAccount", - query: { customerId: customer.value.id, storeId: customer.value.storeId || "" } + query: { + customerId: customer.value.id, + storeId: customer.value.storeId || "", + transitionDepth: String(Number(route.meta.depth ?? 0) + 1) + } }); } diff --git a/src/pages/point/PointAccount.vue b/src/pages/point/PointAccount.vue index fe20ed8..2d788cd 100644 --- a/src/pages/point/PointAccount.vue +++ b/src/pages/point/PointAccount.vue @@ -292,11 +292,23 @@ async function toLedger(): Promise { query: { customerId: selectedCustomerId.value, accountId: account.value?.id || "", - storeId: selectedStoreId.value + storeId: selectedStoreId.value, + transitionDepth: String(getCurrentRouteDepth() + 1) } }); } +function getCurrentRouteDepth(): number { + const transitionDepth = Array.isArray(route.query.transitionDepth) + ? route.query.transitionDepth[0] + : route.query.transitionDepth; + const depth = Number(transitionDepth); + if (transitionDepth && Number.isInteger(depth) && 0 <= depth && depth <= 20) { + return depth; + } + return Number(route.meta.depth ?? 0); +} + async function toAdjust(): Promise { if (!selectedCustomerId.value) { return;