From e65a432f5c9fc11d15d53ae0e16e5f4b7d62400a Mon Sep 17 00:00:00 2001
From: wsj <593216709@qq.com>
Date: Sat, 17 Oct 2026 20:53:17 +0800
Subject: [PATCH] feat: api

---
 src/pages/business/orders/columns.tsx |   84 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/src/pages/business/orders/columns.tsx b/src/pages/business/orders/columns.tsx
new file mode 100644
index 0000000..dbbc670
--- /dev/null
+++ b/src/pages/business/orders/columns.tsx
@@ -0,0 +1,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>
+      ),
+  },
+];

--
Gitblit v1.9.3