feat(admin): 订单与商品详情页补齐明细与操作

This commit is contained in:
2026-11-12 17:48:52 +08:00
parent 927e6a9978
commit 766369075b
18 changed files with 3793 additions and 37 deletions
+19 -2
View File
@@ -6,6 +6,7 @@ import {
Breadcrumb,
Button,
Dropdown,
Grid,
Layout,
Menu,
Tag,
@@ -462,6 +463,15 @@ const MENU_ALIASES: Record<string, string> = {
'/distribution/qrcodes': '/distribution/qrcode-pool',
}
function resolveMenuKey(path: string) {
const alias = MENU_ALIASES[path]
if (alias) return alias
if (/^\/orders\/[^/]+$/.test(path)) return '/orders'
if (/^\/listings\/review\/[^/]+$/.test(path)) return '/listings/review'
if (/^\/listings\/[^/]+$/.test(path)) return '/listings'
return path
}
const SUPPORT_STATUS_LABELS: Record<string, string> = {
online: '在线',
busy: '忙碌',
@@ -475,6 +485,12 @@ export function AdminLayout() {
const logout = useAdminSessionStore(state => state.logout)
const { message } = App.useApp()
const [collapsed, setCollapsed] = useState(false)
const screens = Grid.useBreakpoint()
const isMobile = screens.md === false
useEffect(() => {
if (typeof screens.md === 'boolean') setCollapsed(!screens.md)
}, [screens.md])
const [openKeys, setOpenKeys] = useState<string[]>([])
const [supportStatus, setSupportStatus] = useState<'online' | 'offline' | 'busy'>(
admin?.support_status ?? 'offline'
@@ -500,7 +516,7 @@ export function AdminLayout() {
location.pathname.startsWith(basePath) && location.pathname !== basePath
? location.pathname.slice(basePath.length)
: '/'
const selectedKey = MENU_ALIASES[relativePath] ?? relativePath
const selectedKey = resolveMenuKey(relativePath)
const can = (permission?: string) => {
if (!permission) return true
@@ -564,7 +580,7 @@ export function AdminLayout() {
className="admin-sider"
theme="light"
width={240}
collapsedWidth={72}
collapsedWidth={isMobile ? 0 : 72}
collapsed={collapsed}
trigger={null}
>
@@ -588,6 +604,7 @@ export function AdminLayout() {
onClick={({ key }) => {
if (key.startsWith('/')) {
navigate(key === '/' ? basePath : `${basePath}${key}`)
if (isMobile) setCollapsed(true)
}
}}
/>