采购单样式修改
This commit is contained in:
@@ -86,6 +86,7 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
|
||||
// 详情抽屉
|
||||
const [detailOpen, setDetailOpen] = useState(false);
|
||||
const [detailSize, setDetailSize] = useState(1200);
|
||||
const [detail, setDetail] = useState<IPurchaseDetail | null>(null);
|
||||
const [detailLoading, setDetailLoading] = useState(false);
|
||||
const [completing, setCompleting] = useState(false);
|
||||
@@ -480,18 +481,20 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/** 明细矩阵列:品名/供应商/单价/包规/单位/成本 + 每门店一列(数量)+ 合计 + 操作 */
|
||||
const buildItemColumns = (): TableProps<IPurchaseDetailRow>['columns'] => {
|
||||
const fixed: NonNullable<TableProps<IPurchaseDetailRow>['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) => <Text strong>{row.quantity}</Text>,
|
||||
},
|
||||
];
|
||||
|
||||
const storeColumns = (detail?.stores ?? []).map((store) => ({
|
||||
@@ -526,13 +536,6 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
}));
|
||||
|
||||
const tail: NonNullable<TableProps<IPurchaseDetailRow>['columns']> = [
|
||||
{
|
||||
title: '合计数量',
|
||||
key: 'total_quantity',
|
||||
width: 90,
|
||||
align: 'center',
|
||||
render: (_, row) => <Text strong>{row.quantity}</Text>,
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
@@ -579,15 +582,16 @@ const PurchaseOrderPage: React.FC = () => {
|
||||
<Table.Summary.Cell index={0} colSpan={7} align="center">
|
||||
<Text strong>成本统计(按门店)</Text>
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell index={8} align="center">
|
||||
<Text strong>{totalQuantity}</Text>
|
||||
</Table.Summary.Cell>
|
||||
{storeTotals.map((amount, index) => (
|
||||
<Table.Summary.Cell key={stores[index].id} index={7 + index} align="center">
|
||||
<Table.Summary.Cell key={stores[index].id} index={8 + index} align="center">
|
||||
<Text strong>¥{amount.toFixed(2)}</Text>
|
||||
</Table.Summary.Cell>
|
||||
))}
|
||||
<Table.Summary.Cell index={7 + stores.length} align="center">
|
||||
<Text strong>{totalQuantity}</Text>
|
||||
</Table.Summary.Cell>
|
||||
<Table.Summary.Cell index={8 + stores.length} align="center">
|
||||
|
||||
<Table.Summary.Cell index={9 + stores.length} align="center">
|
||||
<Text strong>¥{totalAmount.toFixed(2)}</Text>
|
||||
</Table.Summary.Cell>
|
||||
</Table.Summary.Row>
|
||||
@@ -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}
|
||||
/>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user