From 65eb8ef59430cfbb12592b3a15af511de35e86ea Mon Sep 17 00:00:00 2001 From: liu <2302563948@qq.com> Date: Thu, 27 Aug 2026 18:57:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=8D=95=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/pages/purchase/order.tsx | 39 +++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/web/pages/purchase/order.tsx b/web/pages/purchase/order.tsx index 1a93710..3bbfc19 100644 --- a/web/pages/purchase/order.tsx +++ b/web/pages/purchase/order.tsx @@ -86,6 +86,7 @@ const PurchaseOrderPage: React.FC = () => { // 详情抽屉 const [detailOpen, setDetailOpen] = useState(false); + const [detailSize, setDetailSize] = useState(1200); const [detail, setDetail] = useState(null); const [detailLoading, setDetailLoading] = useState(false); const [completing, setCompleting] = useState(false); @@ -480,18 +481,20 @@ const PurchaseOrderPage: React.FC = () => { } }; + /** 明细矩阵列:品名/供应商/单价/包规/单位/成本 + 每门店一列(数量)+ 合计 + 操作 */ const buildItemColumns = (): TableProps['columns'] => { const fixed: NonNullable['columns']> = [ - { title: '品名', dataIndex: 'product_name', width: 120, align: 'center' }, + { title: '品名', dataIndex: 'product_name', width: 160, align: 'center', fixed: 'left', ellipsis: true }, { title: '供应商', dataIndex: 'supplier', width: 110, align: 'center', + fixed: 'left', render: (_, row) => row.supplier?.name ?? '-', }, - { title: '市场', dataIndex: 'market', width: 90, align: 'center', render: (v) => v || '-' }, + { title: '市场', fixed: 'left', dataIndex: 'market', width: 90, align: 'center', render: (v) => v || '-' }, { title: '单价', key: 'retail_price', @@ -508,6 +511,13 @@ const PurchaseOrderPage: React.FC = () => { { title: '包规', dataIndex: 'product_spec', align: 'center', width: 90, render: (v) => v || '-' }, { title: '单位', dataIndex: 'unit', width: 70, align: 'center', render: (v) => v || '-' }, { title: '成本', dataIndex: 'cost_price', width: 90, align: 'center', render: (v) => `¥${Number(v).toFixed(2)}` }, + { + title: '合计数量', + key: 'total_quantity', + width: 90, + align: 'center', + render: (_, row) => {row.quantity}, + }, ]; const storeColumns = (detail?.stores ?? []).map((store) => ({ @@ -526,13 +536,6 @@ const PurchaseOrderPage: React.FC = () => { })); const tail: NonNullable['columns']> = [ - { - title: '合计数量', - key: 'total_quantity', - width: 90, - align: 'center', - render: (_, row) => {row.quantity}, - }, { title: '操作', key: 'action', @@ -579,15 +582,16 @@ const PurchaseOrderPage: React.FC = () => { 成本统计(按门店) + + {totalQuantity} + {storeTotals.map((amount, index) => ( - + ¥{amount.toFixed(2)} ))} - - {totalQuantity} - - + + ¥{totalAmount.toFixed(2)} @@ -992,7 +996,10 @@ const PurchaseOrderPage: React.FC = () => { title={detail ? `采购单 ${detail.purchase.purchase_no}` : '采购单详情'} open={detailOpen} onClose={() => setDetailOpen(false)} - size={1200} + size={detailSize} + resizable={{ + onResize: (newSize) => setDetailSize(newSize), + }} loading={detailLoading} > {detail && ( @@ -1195,7 +1202,7 @@ const PurchaseOrderPage: React.FC = () => { columns={buildItemColumns()} dataSource={detail.items} pagination={false} - scroll={{ x: 'max-content' }} + scroll={{ x: 1200, y: 800 }} summary={renderSummary} />