1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
| import { Button, Tag } from 'antd';
| import type { ProColumns } from '@ant-design/pro-components';
| import { ORDER_STATUS_META, type OrderRecord } from './types';
|
| export const createOrderColumns = (options: {
| onProcess: (record: OrderRecord) => void;
| }): ProColumns<OrderRecord>[] => [
| {
| title: '订单号',
| dataIndex: 'id',
| width: 160,
| render: (_value, record) => <code className="order-id">{record.id}</code>,
| fieldProps: { placeholder: '请输入订单号' },
| },
| {
| title: '客户',
| dataIndex: 'customer',
| width: 240,
| render: (_value, record) => (
| <div className="order-customer">
| <strong>{record.customer}</strong>
| <span>{record.contact}</span>
| </div>
| ),
| fieldProps: { placeholder: '请输入客户名称' },
| },
| {
| title: '订单金额',
| dataIndex: 'amount',
| width: 120,
| align: 'right',
| search: false,
| render: (_value, record) => (
| <strong className="order-amount">¥{record.amount.toLocaleString()}</strong>
| ),
| },
| {
| title: '来源渠道',
| dataIndex: 'channel',
| width: 110,
| search: false,
| render: (_value, record) => (
| <Tag bordered={false} color="geekblue">
| {record.channel}
| </Tag>
| ),
| },
| {
| title: '状态',
| dataIndex: 'status',
| width: 110,
| valueEnum: {
| pending: { text: '待付款' },
| processing: { text: '处理中' },
| completed: { text: '已完成' },
| cancelled: { text: '已取消' },
| },
| render: (_value, record) => (
| <Tag color={ORDER_STATUS_META[record.status].color} bordered={false}>
| {ORDER_STATUS_META[record.status].label}
| </Tag>
| ),
| },
| {
| title: '创建时间',
| dataIndex: 'createdAt',
| width: 170,
| search: false,
| },
| {
| title: '操作',
| key: 'action',
| valueType: 'option',
| width: 100,
| render: (_value, record) =>
| record.status === 'completed' ? (
| <span className="text-muted">已完成</span>
| ) : (
| <Button type="link" size="small" onClick={() => options.onProcess(record)}>
| 处理
| </Button>
| ),
| },
| ];
|
|