订单信息

This commit is contained in:
liu
2026-08-11 18:35:54 +08:00
parent cba0e7d1bb
commit 5a3995d6ba
6 changed files with 194 additions and 45 deletions
+22 -8
View File
@@ -7,7 +7,8 @@ export interface IStoreOrderItem {
product_name?: string;
product_spec?: string;
price?: string;
quantity?: string;
image?: string;
quantity?: number;
weight?: string;
amount?: string;
remark?: string;
@@ -18,12 +19,24 @@ export default interface IStoreOrder {
id?: number;
order_no?: string;
store_id?: number;
store?: { id: number; name: string };
purchase_id?: number;
statement_id?: number;
store?: {
id: number;
name: string;
address: string;
contact: string;
phone: string;
};
order_date?: string;
total_quantity?: string;
total_quantity?: number;
total_weight?: string;
total_amount?: string;
/** 0待汇总 1已汇总 2配送中 3已完成 9已取消 */
product_amount: string;
added_amount: string;
box_num: number;
tray_num: number;
/** 0待接单 1已接单 2采购中 3配送中 4已完成 9已取消 */
status?: number;
remark?: string;
items?: IStoreOrderItem[];
@@ -31,10 +44,11 @@ export default interface IStoreOrder {
}
export const STORE_ORDER_STATUS_MAP: Record<number, { text: string; color: string }> = {
0: { text: '待汇总', color: 'default' },
1: { text: '已汇总', color: 'processing' },
2: { text: '配送中', color: 'warning' },
3: { text: '已完成', color: 'success' },
0: { text: '待接单', color: 'default' },
1: { text: '已接单', color: 'processing' },
2: { text: '采购中', color: 'warning' },
3: { text: '配送中', color: 'success' },
4: { text: '已完成', color: 'success' },
9: { text: '已取消', color: 'error' },
};
+116 -20
View File
@@ -9,6 +9,7 @@ import {
Table,
Tag,
Typography,
Image,
} from 'antd';
import type { TableProps } from 'antd';
import XinTable from '@/components/XinTable';
@@ -84,16 +85,61 @@ const StoreOrderPage: React.FC = () => {
const columns: XinTableColumn<IStoreOrder>[] = [
{
title: '订单号',
hideInTable: true,
dataIndex: 'order_no',
valueType: 'text',
hideInForm: true
},
{
title: '商品信息',
dataIndex: 'items',
hideInForm: true,
render: (_, record) => <Text copyable={{ text: record.order_no }}>{record.order_no}</Text>,
hideInSearch: true,
width: 300,
render: (_, record) => {
return (
<Space orientation={'vertical'} className={'max-h-30 w-60 overflow-y-auto pr-6'}>
{ record.items && record.items.length > 0 && record.items.map(item => (
<div className={'flex'}>
<Image src={item.image} width={40} height={40} ></Image>
<div className={'ml-2.5'}>
<div>{item.product_name}</div>
<div>{ item.price } × { item.quantity }</div>
</div>
</div>
))}
</Space>
)
}
},
{
title: '基本信息',
dataIndex: 'order_no',
hideInForm: true,
hideInSearch: true,
width: 300,
render: (_, record) => {
return (
<Space orientation={'vertical'}>
<div>
<Text type={'secondary'}></Text>
<Tag color="blue">{record.store?.name ?? `门店#${record.store_id}`}</Tag>
</div>
<div>
<Text type={'secondary'}></Text>
<Text copyable={{ text: record.order_no }}>{record.order_no}</Text>
</div>
<div><Text type={'secondary'}></Text>{record.created_at}</div>
</Space>
)
}
},
{
title: '门店',
dataIndex: 'store_id',
valueType: 'select',
hideInForm: true,
hideInTable: true,
fieldProps: {
options: stores.map((s) => ({ label: s.name, value: s.id })),
showSearch: true,
@@ -101,53 +147,103 @@ const StoreOrderPage: React.FC = () => {
},
render: (_, record) => record.store?.name ?? '-',
},
{
title: '门店信息',
dataIndex: 'store_id',
hideInForm: true,
hideInSearch: true,
width: 300,
render: (_, record) => (
<Space orientation={'vertical'}>
<div><Text type={'secondary'}></Text>{ record.store?.contact ?? '-' }</div>
<div><Text type={'secondary'}></Text>{ record.store?.phone ?? '-' }</div>
<div><Text type={'secondary'}></Text>{ record.store?.address ?? '-' }</div>
</Space>
),
},
{
title: '订货日期',
dataIndex: 'order_date',
valueType: 'dateRange',
hideInForm: true,
hideInTable: true,
align: 'center',
render: (_, record) => record.order_date,
},
{
title: '订货总量',
dataIndex: 'total_quantity',
title: '订单信息',
hideInForm: true,
dataIndex: 'status',
hideInSearch: true,
align: 'right',
width: 200,
render: (_, record) => (
<Space orientation={'vertical'}>
<div>
<Text type={'secondary'}></Text>
{record.total_quantity}
</div>
<div>
<Text type={'secondary'}></Text>
{record.box_num}
</div>
<div>
<Text type={'secondary'}></Text>
{record.tray_num}
</div>
</Space>
)
},
{
title: '订单金额',
dataIndex: 'total_amount',
title: '附加信息',
hideInForm: true,
dataIndex: 'box_num',
hideInSearch: true,
align: 'right',
render: (_, record) => <Text strong>¥{record.total_amount}</Text>,
width: 200,
render: (_, record) => (
<Space orientation={'vertical'}>
<div>
<Text type={'secondary'}></Text>
{record.added_amount}
</div>
<div>
<Text type={'secondary'}></Text>
{record.product_amount}
</div>
<div>
<Text type={'secondary'}></Text>
{record.total_amount}
</div>
</Space>
)
},
{
title: '状态',
title: '订单状态',
dataIndex: 'status',
valueType: 'select',
hideInForm: true,
align: 'center',
fieldProps: {
options: Object.entries(STORE_ORDER_STATUS_MAP).map(([value, item]) => ({
value: Number(value),
label: item.text,
})),
},
render: (_, record) => {
const item = STORE_ORDER_STATUS_MAP[record.status ?? 0];
return <Tag color={item?.color}>{item?.text}</Tag>;
},
align: 'center',
render: (_, record) => (
<Tag color={STORE_ORDER_STATUS_MAP[record.status ?? 0]?.color}>
{STORE_ORDER_STATUS_MAP[record.status ?? 0]?.text}
</Tag>
)
},
{
title: '备注',
dataIndex: 'remark',
title: '采购单ID',
dataIndex: 'purchase_id',
valueType: 'digit',
hideInForm: true,
},
{
title: '账单ID',
dataIndex: 'statement_id',
valueType: 'digit',
hideInForm: true,
hideInSearch: true,
ellipsis: true,
render: (_, record) => record.remark || '-',
},
];