fix(distribution-admin): 全面优化全站表格列宽、单号防折行、平台与状态中文化体验

This commit is contained in:
yml2213
2026-09-09 19:57:06 +08:00
parent 1c16f26ae0
commit 423672e47b
10 changed files with 292 additions and 57 deletions
+41 -9
View File
@@ -47,6 +47,7 @@ const ORDER_STATUS_MAP: Record<string, { label: string; color: string }> = {
completed: { label: '已完成', color: 'success' },
refunded: { label: '已退款', color: 'purple' },
cancelled: { label: '已取消', color: 'default' },
closed: { label: '已关闭', color: 'default' },
}
const SETTLEMENT_STATUS_MAP: Record<string, { label: string; color: string }> = {
@@ -56,6 +57,8 @@ const SETTLEMENT_STATUS_MAP: Record<string, { label: string; color: string }> =
settling: { label: '结算中', color: 'processing' },
disputed: { label: '争议冻结', color: 'magenta' },
failed: { label: '结算异常', color: 'error' },
arbitrated: { label: '已仲裁结算', color: 'purple' },
closed: { label: '已关闭', color: 'default' },
}
function formatGameName(gameName?: string): string {
@@ -71,9 +74,31 @@ function formatGameName(gameName?: string): string {
) {
return '三角洲'
}
if (lower.includes('honor') || gameName.includes('王者')) {
return '王者荣耀'
}
if (lower.includes('genshin') || gameName.includes('原神')) {
return '原神'
}
if (lower.includes('cs') || lower.includes('csgo')) {
return 'CS2'
}
return gameName
}
function formatLoginPlatform(platform?: string): string {
if (!platform) return ''
const lower = platform.toLowerCase().trim()
if (lower === 'qq') return 'QQ'
if (lower === 'wechat' || lower === 'wx') return '微信'
if (lower === 'steam') return 'Steam'
if (lower === 'epic') return 'Epic'
if (lower === 'wegame') return 'WeGame'
if (lower === 'mobile') return '手游端'
if (lower === 'pc') return 'PC端'
return platform
}
export default function Dashboard() {
const member = useMember()
const [sites, setSites] = useState<Site[]>([])
@@ -270,26 +295,31 @@ export default function Dashboard() {
rowKey="date"
dataSource={analytics?.trend_days ?? []}
pagination={false}
scroll={{ x: 720 }}
columns={[
{ title: '日期', dataIndex: 'date', width: 140, render: (v: string) => <strong>{v}</strong> },
{ title: '日期', dataIndex: 'date', width: 130, render: (v: string) => <strong>{v}</strong> },
{
title: '收号数量',
dataIndex: 'received_count',
width: 120,
render: (v: number) => <Tag color={v > 0 ? 'blue' : 'default'}>{v} 个</Tag>,
},
{
title: '成交订单',
dataIndex: 'order_count',
width: 120,
render: (v: number) => <Tag color={v > 0 ? 'purple' : 'default'}>{v} 单</Tag>,
},
{
title: '成交 GMV',
dataIndex: 'gmv_cent',
width: 160,
render: (v: number) => <span style={{ color: '#cf1322', fontWeight: 'bold' }}>{formatMoney(v)}</span>,
},
{
title: '预计分成收益',
dataIndex: 'profit_cent',
width: 160,
render: (v: number) => <span style={{ color: '#52c41a', fontWeight: 'bold' }}>{formatMoney(v)}</span>,
},
]}
@@ -306,14 +336,14 @@ export default function Dashboard() {
rowKey="order_id"
dataSource={recentOrders}
pagination={false}
scroll={{ x: 1050 }}
scroll={{ x: 1100 }}
columns={[
{
title: '订单与商品编号',
width: 260,
width: 280,
render: (_: unknown, row: DistributionOrder) => (
<div style={{ whiteSpace: 'nowrap' }}>
<div style={{ display: 'flex', alignItems: 'center', whiteSpace: 'nowrap', marginBottom: 4 }}>
<div style={{ whiteSpace: 'nowrap', display: 'flex', flexDirection: 'column', gap: 4 }}>
<div style={{ display: 'inline-flex', alignItems: 'center', whiteSpace: 'nowrap' }}>
<Tag
color="default"
style={{
@@ -330,10 +360,11 @@ export default function Dashboard() {
<Typography.Text
copyable={{ text: row.order_no, tooltips: ['复制订单号', '已复制'] }}
strong
className="mono-code"
style={{
fontSize: 13,
fontFamily: 'monospace',
whiteSpace: 'nowrap',
wordBreak: 'keep-all',
display: 'inline-flex',
alignItems: 'center',
}}
@@ -342,7 +373,7 @@ export default function Dashboard() {
</Typography.Text>
</div>
{row.listing_no ? (
<div style={{ display: 'flex', alignItems: 'center', whiteSpace: 'nowrap' }}>
<div style={{ display: 'inline-flex', alignItems: 'center', whiteSpace: 'nowrap' }}>
<Tag
color="blue"
style={{
@@ -358,12 +389,13 @@ export default function Dashboard() {
</Tag>
<Typography.Text
copyable={{ text: row.listing_no, tooltips: ['复制商品编号', '已复制'] }}
className="mono-code"
style={{
fontSize: 13,
color: '#1677ff',
fontWeight: 600,
fontFamily: 'monospace',
whiteSpace: 'nowrap',
wordBreak: 'keep-all',
display: 'inline-flex',
alignItems: 'center',
}}
@@ -390,7 +422,7 @@ export default function Dashboard() {
<Space size={4} style={{ marginTop: 4 }} wrap>
{row.game_name && <Tag color="blue">{formatGameName(row.game_name)}</Tag>}
{row.server_region && <Tag>{row.server_region}</Tag>}
{row.login_platform && <Tag color="cyan">{row.login_platform}</Tag>}
{row.login_platform && <Tag color="cyan">{formatLoginPlatform(row.login_platform)}</Tag>}
</Space>
</div>
),