forked from yoone/WEB
1
0
Fork 0

取消订单响应,取消物流二次确认

This commit is contained in:
黄珑 2025-08-11 15:13:27 +08:00
parent 00ee8d8656
commit 081b87df7b
2 changed files with 38 additions and 4 deletions

View File

@ -26,6 +26,7 @@
"file-saver": "^2.0.5",
"print-js": "^1.6.0",
"react-phone-input-2": "^2.15.1",
"react-toastify": "^11.0.5",
"xlsx": "^0.18.5"
},
"devDependencies": {

View File

@ -5,19 +5,21 @@ import { stockcontrollerGetallstockpoints } from '@/servers/api/stock';
import { formatShipmentState } from '@/utils/format';
import { printPDF } from '@/utils/util';
import { CopyOutlined } from '@ant-design/icons';
import { ToastContainer, toast } from 'react-toastify';
import {
ActionType,
PageContainer,
ProColumns,
ProTable,
} from '@ant-design/pro-components';
import { App, Button, Divider } from 'antd';
import { App, Button, Divider, Popconfirm } from 'antd';
import { useRef, useState } from 'react';
const ListPage: React.FC = () => {
const actionRef = useRef<ActionType>();
const { message } = App.useApp();
const [selectedRows, setSelectedRows] = useState([]);
const [isLoading, setIsLoading] = useState(false);
const columns: ProColumns<API.Service>[] = [
{
@ -86,24 +88,55 @@ const ListPage: React.FC = () => {
<>
<Button
type="primary"
disabled={isLoading}
onClick={async () => {
setIsLoading(true);
const { data } = await logisticscontrollerGetShipmentLabel(record.id);
const content = data.content;
printPDF([content]);
setIsLoading(false);
}}
>
Label
</Button>
<Divider type="vertical" />
<Button
{/* <Divider type="vertical" /> */}
{/* <Button
type="primary"
disabled={isLoading}
onClick={async () => {
setIsLoading(true);
const { data } = await logisticscontrollerDeleteShipment(record.id);
console.log('data', data);// todo 刷新页面
setIsLoading(false);
}}
>
Cancel
</Button>
</Button> */}
<Popconfirm
disabled={isLoading}
title="删除"
description="确认删除?"
onConfirm={async () => {
try {
setIsLoading(true);
const { success, message: errMsg } =
await logisticscontrollerDeleteShipment(record.id);
if (!success) {
throw new Error(errMsg);
}
setIsLoading(false);
actionRef.current?.reload();
} catch (error: any) {
setIsLoading(false);
message.error(error.message);
}
}}
>
<Button type="primary" danger>
Cancel
</Button>
</Popconfirm>
<ToastContainer />
</>
);
},