订单软删除
This commit is contained in:
@@ -61,3 +61,11 @@ export async function syncOrderItem(itemId: number) {
|
||||
method: 'put',
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除订单(软删除,仅已取消订单允许) */
|
||||
export async function deleteStoreOrder(id: number) {
|
||||
return createAxios({
|
||||
url: `/order/store/${id}`,
|
||||
method: 'delete',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
batchUpdateOrderStatus,
|
||||
updateOrderItem,
|
||||
syncOrderItem,
|
||||
deleteStoreOrder,
|
||||
} from '@/api/order/store.ts';
|
||||
import { generatePurchase } from '@/api/purchase/order.ts';
|
||||
import { getStoreOptions } from '@/api/customer/store.ts';
|
||||
@@ -42,7 +43,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, SettingOutlined, SyncOutlined, UnorderedListOutlined } from '@ant-design/icons';
|
||||
import { DeleteOutlined, EditOutlined, SettingOutlined, SyncOutlined, UnorderedListOutlined } from '@ant-design/icons';
|
||||
import TextArea from "antd/es/input/TextArea";
|
||||
|
||||
const { Title, Text } = Typography;
|
||||
@@ -224,6 +225,14 @@ const StoreOrderPage: React.FC = () => {
|
||||
await tableRef.current?.reload();
|
||||
};
|
||||
|
||||
/** 删除订单(软删除,仅已取消订单可删;删除后后台/小程序端均不可见) */
|
||||
const handleDelete = async (id: number) => {
|
||||
await deleteStoreOrder(id);
|
||||
message.success('订单已删除');
|
||||
setDetailOpen(false);
|
||||
await tableRef.current?.reload();
|
||||
};
|
||||
|
||||
// 弹窗内实时预览:附加金额 = 框×单价 + 托盘×单价;订单总金额 = 商品金额 + 附加金额
|
||||
const watchBoxNum = Number(Form.useWatch('box_num', containerForm) ?? 0);
|
||||
const watchTrayNum = Number(Form.useWatch('tray_num', containerForm) ?? 0);
|
||||
@@ -338,7 +347,7 @@ const StoreOrderPage: React.FC = () => {
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '订单信息',
|
||||
title: '附加信息',
|
||||
hideInForm: true,
|
||||
dataIndex: 'status',
|
||||
hideInSearch: true,
|
||||
@@ -361,7 +370,7 @@ const StoreOrderPage: React.FC = () => {
|
||||
)
|
||||
},
|
||||
{
|
||||
title: '附加信息',
|
||||
title: '订单金额',
|
||||
hideInForm: true,
|
||||
dataIndex: 'box_num',
|
||||
hideInSearch: true,
|
||||
@@ -455,6 +464,17 @@ const StoreOrderPage: React.FC = () => {
|
||||
</Popconfirm>
|
||||
</AuthButton>
|
||||
)}
|
||||
{ record.status === 9 && (
|
||||
<AuthButton auth="order.store.delete">
|
||||
<Popconfirm
|
||||
title="确认删除该订单吗?"
|
||||
description="仅已取消订单可删除,删除后后台与小程序端均不可见"
|
||||
onConfirm={() => handleDelete(record.id!)}
|
||||
>
|
||||
<Button icon={<DeleteOutlined />} color='danger' variant="solid" />
|
||||
</Popconfirm>
|
||||
</AuthButton>
|
||||
)}
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
@@ -542,6 +562,19 @@ const StoreOrderPage: React.FC = () => {
|
||||
</Popconfirm>
|
||||
</AuthButton>
|
||||
)}
|
||||
{ detail.status === 9 && (
|
||||
<AuthButton auth="order.store.delete">
|
||||
<Popconfirm
|
||||
title="确认删除该订单吗?"
|
||||
description="仅已取消订单可删除,删除后后台与小程序端均不可见"
|
||||
onConfirm={() => handleDelete(detail.id!)}
|
||||
>
|
||||
<Button icon={<DeleteOutlined />} color='danger' variant="solid">
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</AuthButton>
|
||||
)}
|
||||
</Space>
|
||||
) : null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user