Compare commits
2 Commits
0356c77bad
...
081b87df7b
| Author | SHA1 | Date |
|---|---|---|
|
|
081b87df7b | |
|
|
00ee8d8656 |
|
|
@ -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": {
|
||||
|
|
|
|||
|
|
@ -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>[] = [
|
||||
{
|
||||
|
|
@ -38,17 +40,21 @@ const ListPage: React.FC = () => {
|
|||
}));
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '订单号',
|
||||
dataIndex: 'externalOrderId',
|
||||
},
|
||||
{
|
||||
title: '快递单号',
|
||||
dataIndex: 'primary_tracking_number',
|
||||
dataIndex: 'return_tracking_number',
|
||||
render(_, record) {
|
||||
return (
|
||||
<>
|
||||
{record.unique_id}
|
||||
{record.return_tracking_number}
|
||||
<CopyOutlined
|
||||
onClick={async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(record.unique_id);
|
||||
await navigator.clipboard.writeText(record.return_tracking_number);
|
||||
message.success('复制成功!');
|
||||
} catch (err) {
|
||||
message.error('复制失败!');
|
||||
|
|
@ -82,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> */}
|
||||
<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 />
|
||||
</>
|
||||
);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue