diff --git a/apps/h5-partner/src/PartnerAppRoutes.tsx b/apps/h5-partner/src/PartnerAppRoutes.tsx index 4b4f3d4..3c0f461 100644 --- a/apps/h5-partner/src/PartnerAppRoutes.tsx +++ b/apps/h5-partner/src/PartnerAppRoutes.tsx @@ -1,6 +1,6 @@ import { Navigate, Route, Routes } from 'react-router-dom'; import { usePartnerSession } from './contexts/PartnerSessionContext'; -import { isSubAccount } from './lib/partnerAccess'; +import { getPartnerNavKind, isSubAccount } from './lib/partnerAccess'; import TabLayout from './layouts/TabLayout'; import SubAccountLayout from './layouts/SubAccountLayout'; import HomePage from './pages/HomePage'; @@ -26,7 +26,6 @@ function PrimaryRoutes() { }> } /> } /> - } /> } /> } /> @@ -39,6 +38,7 @@ function PrimaryRoutes() { } /> } /> } /> + } /> } /> } /> @@ -46,16 +46,30 @@ function PrimaryRoutes() { } function SubAccountRoutes() { + const { account } = usePartnerSession(); + const navKind = getPartnerNavKind(account); + const isWarehouse = navKind === 'warehouse_staff'; + return ( - }> - } /> - } /> + }> + } /> + {isWarehouse ? ( + } /> + ) : ( + } /> + )} } /> - {/* 与主账号一致:录入门店全屏,避免 sticky 底栏被 TabBar 挡住 */} - } /> - } /> + {!isWarehouse && ( + <> + } /> + } /> + } /> + + )} + {isWarehouse && } />} + } /> ); } diff --git a/apps/h5-partner/src/contexts/PartnerSessionContext.tsx b/apps/h5-partner/src/contexts/PartnerSessionContext.tsx index 81428af..dd20eb2 100644 --- a/apps/h5-partner/src/contexts/PartnerSessionContext.tsx +++ b/apps/h5-partner/src/contexts/PartnerSessionContext.tsx @@ -50,6 +50,8 @@ function accountFromProfile(profile: PartnerSessionProfile): PartnerAccount { staffRole: profile.staffRole, permissions: profile.permissions, primaryAccountId: profile.primaryAccountId, + primaryPhone: profile.primaryPhone, + primaryName: profile.primaryName, hasWechat: profile.hasWechat, }; } diff --git a/apps/h5-partner/src/layouts/SubAccountLayout.tsx b/apps/h5-partner/src/layouts/SubAccountLayout.tsx index f1cf4f3..69a0f9e 100644 --- a/apps/h5-partner/src/layouts/SubAccountLayout.tsx +++ b/apps/h5-partner/src/layouts/SubAccountLayout.tsx @@ -1,17 +1,30 @@ import { NavLink, Outlet } from 'react-router-dom'; +import type { PartnerNavKind } from '../lib/partnerAccess'; -const TABS = [ - { to: '/stores', end: true, icon: 'store', label: '门店管理' }, - { to: '/stores/new', icon: 'add_business', label: '录入门店' }, - { to: '/me', icon: 'person', label: '我的' }, +const STORE_STAFF_TABS = [ + { to: '/', end: true, icon: 'dashboard', label: '首页' }, + { to: '/stores', icon: 'store', label: '门店管理' }, + { to: '/me', icon: 'person', label: '个人中心' }, ] as const; -export default function SubAccountLayout() { +const WAREHOUSE_STAFF_TABS = [ + { to: '/', end: true, icon: 'dashboard', label: '首页' }, + { to: '/orders', icon: 'receipt_long', label: '订单管理' }, + { to: '/me', icon: 'person', label: '个人中心' }, +] as const; + +type SubAccountLayoutProps = { + navKind: PartnerNavKind; +}; + +export default function SubAccountLayout({ navKind }: SubAccountLayoutProps) { + const tabs = navKind === 'warehouse_staff' ? WAREHOUSE_STAFF_TABS : STORE_STAFF_TABS; + return ( <>