Fix: 增加删除运单按钮
This commit is contained in:
parent
cb596ada87
commit
0356c77bad
|
|
@ -1,4 +1,6 @@
|
||||||
import { logisticscontrollerGetlist, logisticscontrollerGetShipmentLabel } from '@/servers/api/logistics';
|
import { logisticscontrollerGetlist, logisticscontrollerGetShipmentLabel,
|
||||||
|
logisticscontrollerDeleteShipment
|
||||||
|
} from '@/servers/api/logistics';
|
||||||
import { stockcontrollerGetallstockpoints } from '@/servers/api/stock';
|
import { stockcontrollerGetallstockpoints } from '@/servers/api/stock';
|
||||||
import { formatShipmentState } from '@/utils/format';
|
import { formatShipmentState } from '@/utils/format';
|
||||||
import { printPDF } from '@/utils/util';
|
import { printPDF } from '@/utils/util';
|
||||||
|
|
@ -9,7 +11,7 @@ import {
|
||||||
ProColumns,
|
ProColumns,
|
||||||
ProTable,
|
ProTable,
|
||||||
} from '@ant-design/pro-components';
|
} from '@ant-design/pro-components';
|
||||||
import { App, Button } from 'antd';
|
import { App, Button, Divider } from 'antd';
|
||||||
import { useRef, useState } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
|
|
||||||
const ListPage: React.FC = () => {
|
const ListPage: React.FC = () => {
|
||||||
|
|
@ -77,6 +79,7 @@ const ListPage: React.FC = () => {
|
||||||
hideInSearch: true,
|
hideInSearch: true,
|
||||||
render(_, record) {
|
render(_, record) {
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
|
|
@ -87,6 +90,17 @@ const ListPage: React.FC = () => {
|
||||||
>
|
>
|
||||||
Label
|
Label
|
||||||
</Button>
|
</Button>
|
||||||
|
<Divider type="vertical" />
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={async () => {
|
||||||
|
const { data } = await logisticscontrollerDeleteShipment(record.id);
|
||||||
|
console.log('data', data);// todo 刷新页面
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Cancel
|
||||||
|
</Button>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import {
|
||||||
logisticscontrollerGetpaymentmethods,
|
logisticscontrollerGetpaymentmethods,
|
||||||
logisticscontrollerGetratelist,
|
logisticscontrollerGetratelist,
|
||||||
logisticscontrollerGetshippingaddresslist,
|
logisticscontrollerGetshippingaddresslist,
|
||||||
|
logisticscontrollerGetShipmentLabel,
|
||||||
} from '@/servers/api/logistics';
|
} from '@/servers/api/logistics';
|
||||||
import {
|
import {
|
||||||
ordercontrollerCancelorder,
|
ordercontrollerCancelorder,
|
||||||
|
|
@ -75,6 +76,7 @@ import {
|
||||||
import Item from 'antd/es/list/Item';
|
import Item from 'antd/es/list/Item';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import React, { useMemo, useRef, useState } from 'react';
|
import React, { useMemo, useRef, useState } from 'react';
|
||||||
|
import { printPDF } from '@/utils/util';
|
||||||
|
|
||||||
const ListPage: React.FC = () => {
|
const ListPage: React.FC = () => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
|
|
@ -1158,7 +1160,7 @@ const Shipping: React.FC<{
|
||||||
details.destination.phone_number.phone;
|
details.destination.phone_number.phone;
|
||||||
details.origin.phone_number.number = details.origin.phone_number.phone;
|
details.origin.phone_number.number = details.origin.phone_number.phone;
|
||||||
try {
|
try {
|
||||||
const { success, message: errMsg } =
|
const { success, message: errMsg, ...resShipment } =
|
||||||
await logisticscontrollerCreateshipment(
|
await logisticscontrollerCreateshipment(
|
||||||
{ orderId: id },
|
{ orderId: id },
|
||||||
{
|
{
|
||||||
|
|
@ -1183,6 +1185,12 @@ const Shipping: React.FC<{
|
||||||
phone_number: details.origin.phone_number,
|
phone_number: details.origin.phone_number,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// todo, 直接打印label
|
||||||
|
// const { resLabel } = await logisticscontrollerGetShipmentLabel(resShipment.data.shipmentId);
|
||||||
|
// console.log('res', resShipment.data.shipmentId, resLabel);
|
||||||
|
// const labelContent = resLabel.content;
|
||||||
|
// printPDF([labelContent]);
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error(error?.message || '创建失败');
|
message.error(error?.message || '创建失败');
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,20 @@ export async function logisticscontrollerGetShipmentLabel(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/** 此处后端没有提供注释 DEL /logistics/deleteShipment/${param0} */
|
||||||
|
export async function logisticscontrollerDeleteShipment(
|
||||||
|
shipmentId: number
|
||||||
|
) {
|
||||||
|
return request<API.BooleanRes>(`/logistics/deleteShipment/${shipmentId}`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 此处后端没有提供注释 POST /logistics/createShippingAddress */
|
/** 此处后端没有提供注释 POST /logistics/createShippingAddress */
|
||||||
export async function logisticscontrollerCreateshippingaddress(
|
export async function logisticscontrollerCreateshippingaddress(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue