From fa4bf6fe6158fda97cf480420c8916ae2a869ac9 Mon Sep 17 00:00:00 2001 From: liu <2302563948@qq.com> Date: Wed, 12 Aug 2026 09:20:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/components/XinTable/index.tsx | 2 +- web/domain/iStoreOrder.ts | 1 + web/pages/order/store.tsx | 199 +++++++++++++++++------------- 3 files changed, 117 insertions(+), 85 deletions(-) diff --git a/web/components/XinTable/index.tsx b/web/components/XinTable/index.tsx index 0d0fc10..53fccd7 100644 --- a/web/components/XinTable/index.tsx +++ b/web/components/XinTable/index.tsx @@ -138,7 +138,7 @@ export default function XinTable = any>(props: Xin // 暴露方法到 tableRef useImperativeHandle(tableRef, (): XinTableInstance => ({ - reload: async () => { await handleRequest(); }, + reload: async () => { await handleRequest(requestParams); }, reset: async () => { searchRef.resetFields(); setRequestParams({ page: 1, pageSize: 10 }); diff --git a/web/domain/iStoreOrder.ts b/web/domain/iStoreOrder.ts index 78c68b1..3e98d6e 100644 --- a/web/domain/iStoreOrder.ts +++ b/web/domain/iStoreOrder.ts @@ -35,6 +35,7 @@ export interface IStoreOrderItemUpdate { cost_price: number; quantity: number; weight: number; + remark: string; } /** 门店订单 */ diff --git a/web/pages/order/store.tsx b/web/pages/order/store.tsx index 2e3ef43..ab48ae1 100644 --- a/web/pages/order/store.tsx +++ b/web/pages/order/store.tsx @@ -42,7 +42,7 @@ import { getSupplierOptions } from '@/api/customer/supplier.ts'; import type IStore from '@/domain/iStore.ts'; import type ISupplier from '@/domain/iSupplier.ts'; import AuthButton from '@/components/AuthButton'; -import { EditOutlined, SyncOutlined, UnorderedListOutlined } from '@ant-design/icons'; +import { EditOutlined, SettingOutlined, SyncOutlined, UnorderedListOutlined } from '@ant-design/icons'; import TextArea from "antd/es/input/TextArea"; const { Title, Text } = Typography; @@ -57,16 +57,10 @@ const ITEM_EDITABLE_STATUS = [0, 1, 2, 3]; * 状态流转合法路径:待接单→已接单/已取消;采购中→配送中/已完成;配送中→已完成 * (已接单→采购中 通过「生成采购单」完成,不在流转按钮内) */ -const NEXT_STATUS: Record = { - 0: [ - { status: 1, label: '接单' }, - { status: 9, label: '取消订单', danger: true }, - ], - 2: [ - { status: 3, label: '开始配送' }, - { status: 4, label: '完成订单' }, - ], - 3: [{ status: 4, label: '完成订单' }], +const NEXT_STATUS: Record = { + 0: { status: 1, label: '接单' }, + 2: { status: 3, label: '开始配送' }, + 3: { status: 4, label: '完成订单' }, }; /** 批量流转可选目标状态(弹窗单选,后端全量校验,任一不允许则整批中止) */ @@ -201,6 +195,7 @@ const StoreOrderPage: React.FC = () => { cost_price: Number(item.cost_price ?? 0), quantity: Number(item.quantity ?? 0), weight: Number(item.weight ?? 0), + remark: item.remark ?? '', }); setItemEditOpen(true); }; @@ -254,28 +249,6 @@ const StoreOrderPage: React.FC = () => { valueType: 'text', hideInForm: true }, - { - title: '商品信息', - dataIndex: 'items', - hideInForm: true, - hideInSearch: true, - width: 300, - render: (_, record) => { - return ( - - { record.items && record.items.length > 0 && record.items.map(item => ( -
- -
-
{item.product_name}
-
{ item.price } ¥ × { item.quantity }
-
-
- ))} -
- ) - } - }, { title: '基本信息', dataIndex: 'order_no', @@ -285,15 +258,42 @@ const StoreOrderPage: React.FC = () => { render: (_, record) => { return ( -
- 订货门店: - {record.store?.name ?? `门店#${record.store_id}`} -
订单号: {record.order_no}
订货时间:{record.created_at}
+
+ 订单状态: + + {STORE_ORDER_STATUS_MAP[record.status ?? 0]?.text} + +
+
+ ) + } + }, + { + title: '商品信息', + dataIndex: 'items', + hideInForm: true, + hideInSearch: true, + width: 550, + render: (_, record) => { + return ( + + { record.items && record.items.length > 0 && record.items.map(item => ( +
+ +
+
{item.product_name}
+
{item.product_spec} {item.unit}
+
+ { item.price } ¥ × { item.quantity } +
+
+
+ ))}
) } @@ -319,6 +319,10 @@ const StoreOrderPage: React.FC = () => { width: 300, render: (_, record) => ( +
+ 订货门店: + {record.store?.name ?? `门店#${record.store_id}`} +
联系人:{ record.store?.contact ?? '-' }
联系电话:{ record.store?.phone ?? '-' }
门店地址:{ record.store?.address ?? '-' }
@@ -365,16 +369,16 @@ const StoreOrderPage: React.FC = () => { render: (_, record) => (
- 附加总金额: - {record.added_amount} ¥ + 商品总金额: + {record.product_amount} ¥
- 商品总金额: - {record.product_amount} ¥ + 附加总金额: + {record.added_amount} ¥
订单总金额: - {record.total_amount} ¥ + {record.total_amount} ¥
) @@ -385,17 +389,13 @@ const StoreOrderPage: React.FC = () => { valueType: 'select', hideInForm: true, align: 'center', + hideInTable: true, fieldProps: { options: Object.entries(STORE_ORDER_STATUS_MAP).map(([value, item]) => ({ value: Number(value), label: item.text, })), - }, - render: (_, record) => ( - - {STORE_ORDER_STATUS_MAP[record.status ?? 0]?.text} - - ) + } }, { title: '采购单ID', @@ -412,37 +412,49 @@ const StoreOrderPage: React.FC = () => { { title: '操作栏', dataIndex: 'operate', - align: 'center', hideInForm: true, hideInSearch: true, + width: 180, render: (_, record) => ( - - - { - (NEXT_STATUS[record.status ?? -1] ?? []).map((action) => ( - - handleStatusChange(record.id!, action.status)} - > - - - - )) - } - { - CONTAINER_EDITABLE_STATUS.includes(record.status ?? -1) ? ( - - - - ) : null - } + + + )} + { record.status === 0 && ( + + handleStatusChange(record.id!, 9)} + > + + + + )} ) } @@ -497,20 +509,39 @@ const StoreOrderPage: React.FC = () => { size={1000} loading={detailLoading} footer={ - detail && NEXT_STATUS[detail.status ?? -1] ? ( - - {NEXT_STATUS[detail.status!].map((action) => ( - + detail ? ( + + {CONTAINER_EDITABLE_STATUS.includes(detail.status ?? -1) && ( + + + + )} + { NEXT_STATUS[detail.status!] && ( + handleStatusChange(detail.id!, action.status)} + title={`确认将订单状态更新为「${NEXT_STATUS[detail.status!].label}」?`} + onConfirm={() => handleStatusChange(detail.id!, NEXT_STATUS[detail.status!].status)} > - - ))} + )} + { detail.status === 0 && ( + + handleStatusChange(detail.id!, 9)} + > + + + + )} ) : null }