merge(dev_jacy): ticket center status Chinese labels

This commit is contained in:
2026-08-06 00:23:41 +08:00
2 changed files with 61 additions and 4 deletions
+37 -4
View File
@@ -10,11 +10,18 @@ import {
Select,
Space,
Table,
Tag,
Typography,
message,
} from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { TICKET_TYPE_LABELS, type TicketTypeDto } from '@dukang/shared-types';
import {
TICKET_STATUS_LABELS,
TICKET_TYPE_LABELS,
ticketStatusLabel,
type TicketStatusDto,
type TicketTypeDto,
} from '@dukang/shared-types';
import { request } from '../lib/api';
import { fmtTime } from '../lib/constants';
import { useAdminList } from '../lib/useAdminList';
@@ -31,6 +38,21 @@ type Row = {
createdAt: string;
};
const STATUS_COLOR: Partial<Record<TicketStatusDto, string>> = {
PENDING: 'orange',
OPEN: 'blue',
COLLABORATING: 'cyan',
RESOLVED: 'green',
REJECTED: 'red',
COMPLETED: 'green',
CLOSED: 'default',
};
const STATUS_OPTIONS = (Object.keys(TICKET_STATUS_LABELS) as TicketStatusDto[]).map((value) => ({
value,
label: TICKET_STATUS_LABELS[value],
}));
export default function TicketsPage() {
const [filters, setFilters] = useState<Record<string, string>>({});
const { data, loading, page, pageSize, setPage, setPageSize, reload } = useAdminList<Row>(
@@ -101,7 +123,14 @@ export default function TicketsPage() {
width: 110,
render: (t: TicketTypeDto) => TICKET_TYPE_LABELS[t] ?? t,
},
{ title: '状态', dataIndex: 'status', width: 90 },
{
title: '状态',
dataIndex: 'status',
width: 100,
render: (s: string) => (
<Tag color={STATUS_COLOR[s as TicketStatusDto] ?? 'default'}>{ticketStatusLabel(s)}</Tag>
),
},
{ title: '关联', width: 140, render: (_, r) => `${r.refType}#${r.refId}` },
{ title: '备注', dataIndex: 'remark', ellipsis: true },
{ title: '时间', dataIndex: 'createdAt', width: 160, render: fmtTime },
@@ -165,7 +194,7 @@ export default function TicketsPage() {
/>
</Form.Item>
<Form.Item name="status" label="状态">
<Input allowClear placeholder="PENDING" />
<Select allowClear style={{ width: 140 }} placeholder="全部" options={STATUS_OPTIONS} />
</Form.Item>
<Button type="primary" htmlType="submit">
@@ -212,7 +241,11 @@ export default function TicketsPage() {
<Descriptions.Item label="类型">
{TICKET_TYPE_LABELS[detail.ticketType] ?? detail.ticketType}
</Descriptions.Item>
<Descriptions.Item label="状态">{String(detail.status)}</Descriptions.Item>
<Descriptions.Item label="状态">
<Tag color={STATUS_COLOR[detail.status as TicketStatusDto] ?? 'default'}>
{ticketStatusLabel(detail.status)}
</Tag>
</Descriptions.Item>
<Descriptions.Item label="关联">
{String(detail.refType)} #{String(detail.refId)}
</Descriptions.Item>
+24
View File
@@ -27,6 +27,30 @@ export const TICKET_TYPE_LABELS: Record<TicketTypeDto, string> = {
PACKAGE_DISPUTE: '套餐异议',
};
/** 售后工单状态(common_ticket.status */
export type TicketStatusDto =
| 'PENDING'
| 'OPEN'
| 'COLLABORATING'
| 'RESOLVED'
| 'REJECTED'
| 'COMPLETED'
| 'CLOSED';
export const TICKET_STATUS_LABELS: Record<TicketStatusDto, string> = {
PENDING: '待处理',
OPEN: '处理中',
COLLABORATING: '协同中',
RESOLVED: '已解决',
REJECTED: '已驳回',
COMPLETED: '已完成',
CLOSED: '已关闭',
};
export function ticketStatusLabel(status: string): string {
return TICKET_STATUS_LABELS[status as TicketStatusDto] ?? status;
}
export interface TicketDto {
id: string;
ticketNo: string;