优化商户功能导航与表格
This commit is contained in:
@@ -54,53 +54,39 @@ const adminSections: SidebarSection[] = [
|
||||
key: 'products',
|
||||
label: '商品管理',
|
||||
icon: <AppstoreOutlined />,
|
||||
children: [{ key: 'platform-products', label: '平台授权商品', disabled: true }],
|
||||
children: [{ key: 'merchant-products', label: '商品', path: '/merchant-products' }],
|
||||
},
|
||||
{
|
||||
key: 'shops',
|
||||
label: '店铺管理',
|
||||
label: '商户管理',
|
||||
icon: <ShopOutlined />,
|
||||
children: [
|
||||
{ key: 'shop-list', label: '店铺列表', path: '/platform-merchants' },
|
||||
{ key: 'shop-products', label: '店铺商品绑定', disabled: true },
|
||||
],
|
||||
children: [{ key: 'shop-list', label: '商户列表', path: '/platform-merchants' }],
|
||||
},
|
||||
{
|
||||
key: 'orders',
|
||||
label: '订单管理',
|
||||
icon: <OrderedListOutlined />,
|
||||
children: [
|
||||
{ key: 'auto-orders', label: '自动发货订单', disabled: true },
|
||||
{ key: 'manual-verify', label: '手动核销/反核销', disabled: true },
|
||||
{ key: 'after-sales', label: '售后订单', disabled: true },
|
||||
{ key: 'manual-orders', label: '手动处理订单', disabled: true },
|
||||
],
|
||||
children: [{ key: 'fulfillment-orders', label: '履约订单', path: '/merchant-orders' }],
|
||||
},
|
||||
{
|
||||
key: 'staff',
|
||||
label: '员工管理',
|
||||
icon: <TeamOutlined />,
|
||||
children: [
|
||||
{ key: 'staff-list', label: '员工列表', disabled: true },
|
||||
{ key: 'positions', label: '岗位列表', disabled: true },
|
||||
{ key: 'operation-logs', label: '操作日志', disabled: true },
|
||||
],
|
||||
children: [{ key: 'merchant-members', label: '成员', path: '/merchant-members' }],
|
||||
},
|
||||
{
|
||||
key: 'funds',
|
||||
label: '资金',
|
||||
icon: <WalletOutlined />,
|
||||
children: [
|
||||
{ key: 'point-details', label: '积分明细', disabled: true },
|
||||
{ key: 'recharge-requests', label: '充值申请', disabled: true },
|
||||
],
|
||||
children: [{ key: 'merchant-wallet', label: '钱包', path: '/merchant-wallet' }],
|
||||
},
|
||||
{
|
||||
key: 'open-api',
|
||||
label: '开放 API',
|
||||
icon: <ApiOutlined />,
|
||||
children: [
|
||||
{ key: 'api-keys', label: 'API 密钥', path: '/merchant-center' },
|
||||
{ key: 'api-keys', label: 'API 密钥', path: '/merchant-api-keys' },
|
||||
{ key: 'api-callbacks', label: '回调', path: '/merchant-callbacks' },
|
||||
{ key: 'api-docs', label: '对接文档', path: '/open-api' },
|
||||
{ key: 'api-debug', label: '调用调试', path: '/api-debug' },
|
||||
],
|
||||
@@ -114,17 +100,60 @@ const merchantSections: SidebarSection[] = [
|
||||
icon: <DashboardOutlined />,
|
||||
path: '/',
|
||||
},
|
||||
{
|
||||
key: 'products',
|
||||
label: '商品管理',
|
||||
icon: <AppstoreOutlined />,
|
||||
children: [{ key: 'merchant-products', label: '商品', path: '/merchant-products' }],
|
||||
},
|
||||
{
|
||||
key: 'orders',
|
||||
label: '订单管理',
|
||||
icon: <OrderedListOutlined />,
|
||||
children: [{ key: 'fulfillment-orders', label: '履约订单', path: '/merchant-orders' }],
|
||||
},
|
||||
{
|
||||
key: 'funds',
|
||||
label: '资金',
|
||||
icon: <WalletOutlined />,
|
||||
children: [{ key: 'merchant-wallet', label: '钱包', path: '/merchant-wallet' }],
|
||||
},
|
||||
{
|
||||
key: 'staff',
|
||||
label: '员工管理',
|
||||
icon: <TeamOutlined />,
|
||||
children: [{ key: 'merchant-members', label: '成员', path: '/merchant-members' }],
|
||||
},
|
||||
{
|
||||
key: 'open-api',
|
||||
label: '开放 API',
|
||||
icon: <ApiOutlined />,
|
||||
children: [{ key: 'api-keys', label: 'API 密钥', path: '/merchant-center' }],
|
||||
children: [
|
||||
{ key: 'api-keys', label: 'API 密钥', path: '/merchant-api-keys' },
|
||||
{ key: 'api-callbacks', label: '回调', path: '/merchant-callbacks' },
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
function getSelectedKey(pathname: string) {
|
||||
function getSelectedKey(pathname: string, search: string) {
|
||||
if (pathname === '/') return 'dashboard'
|
||||
if (pathname.startsWith('/merchant-center')) return 'api-keys'
|
||||
if (pathname.startsWith('/merchant-products')) return 'merchant-products'
|
||||
if (pathname.startsWith('/merchant-orders')) return 'fulfillment-orders'
|
||||
if (pathname.startsWith('/merchant-wallet')) return 'merchant-wallet'
|
||||
if (pathname.startsWith('/merchant-members')) return 'merchant-members'
|
||||
if (pathname.startsWith('/merchant-callbacks')) return 'api-callbacks'
|
||||
if (pathname.startsWith('/merchant-api-keys')) return 'api-keys'
|
||||
if (pathname.startsWith('/merchant-center')) {
|
||||
const tab = new URLSearchParams(search).get('tab')
|
||||
const tabKeys: Record<string, string> = {
|
||||
products: 'merchant-products',
|
||||
orders: 'fulfillment-orders',
|
||||
wallet: 'merchant-wallet',
|
||||
members: 'merchant-members',
|
||||
callbacks: 'api-callbacks',
|
||||
}
|
||||
return tab ? tabKeys[tab] || 'merchant-products' : 'merchant-products'
|
||||
}
|
||||
if (pathname.startsWith('/open-api')) return 'api-docs'
|
||||
if (pathname.startsWith('/api-debug')) return 'api-debug'
|
||||
if (pathname.startsWith('/platform-merchants')) return 'shop-list'
|
||||
@@ -145,7 +174,7 @@ export default function MainLayout() {
|
||||
const isDocsPage = location.pathname.startsWith('/open-api')
|
||||
|
||||
const sections = useMemo(() => (isAdmin ? adminSections : merchantSections), [isAdmin])
|
||||
const selectedKey = getSelectedKey(location.pathname)
|
||||
const selectedKey = getSelectedKey(location.pathname, location.search)
|
||||
const [openKeys, setOpenKeys] = useState<string[]>(() => getInitialOpenKeys(sections, selectedKey))
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user