forked from yoone/WEB
1
0
Fork 0

Compare commits

..

No commits in common. "4d3abcd13f7c86edfdb04bc90cfcd3def94d6553" and "4da8fbfdc83bfbe6327df6446a5b12988acd1afb" have entirely different histories.

3 changed files with 194 additions and 231 deletions

View File

@ -1,6 +1,4 @@
import { logisticscontrollerGetlist, logisticscontrollerGetShipmentLabel,
logisticscontrollerDeleteShipment
} from '@/servers/api/logistics';
import { logisticscontrollerGetlist, logisticscontrollerGetShipmentLabel } from '@/servers/api/logistics';
import { stockcontrollerGetallstockpoints } from '@/servers/api/stock';
import { formatShipmentState } from '@/utils/format';
import { printPDF } from '@/utils/util';
@ -11,7 +9,7 @@ import {
ProColumns,
ProTable,
} from '@ant-design/pro-components';
import { App, Button, Divider } from 'antd';
import { App, Button } from 'antd';
import { useRef, useState } from 'react';
const ListPage: React.FC = () => {
@ -79,28 +77,16 @@ const ListPage: React.FC = () => {
hideInSearch: true,
render(_, record) {
return (
<>
<Button
type="primary"
onClick={async () => {
const { data } = await logisticscontrollerGetShipmentLabel(record.id);
const content = data.content;
printPDF([content]);
}}
>
Label
</Button>
<Divider type="vertical" />
<Button
type="primary"
onClick={async () => {
const { data } = await logisticscontrollerDeleteShipment(record.id);
console.log('data', data);// todo 刷新页面
}}
>
Cancel
</Button>
</>
<Button
type="primary"
onClick={async () => {
const { data } = await logisticscontrollerGetShipmentLabel(record.id);
const content = data.content;
printPDF([content]);
}}
>
Label
</Button>
);
},
},

View File

@ -1,5 +1,4 @@
import InternationalPhoneInput from '@/components/InternationalPhoneInput';
import { HistoryOrder } from '@/pages/Statistics/Order';
import { ORDER_STATUS_ENUM } from '@/constants';
import {
logisticscontrollerCreateshipment,
@ -311,14 +310,6 @@ const ListPage: React.FC = () => {
: 'block',
},
},
{
key: 'history',
label:
<HistoryOrder
email={record.customer_email}
tableRef={actionRef}
/>,
},
{
key: 'note',
label: <OrderNote id={record.id as number} />,
@ -523,29 +514,29 @@ const Detail: React.FC<{
)
? []
: [
<Divider type="vertical" />,
<Button
type="primary"
onClick={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerSyncorderbyid({
siteId: record.siteId as string,
orderId: record.externalOrderId as string,
});
if (!success) {
throw new Error(errMsg);
<Divider type="vertical" />,
<Button
type="primary"
onClick={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerSyncorderbyid({
siteId: record.siteId as string,
orderId: record.externalOrderId as string,
});
if (!success) {
throw new Error(errMsg);
}
message.success('同步成功');
tableRef.current?.reload();
} catch (error) {
message.error(error?.message || '同步失败');
}
message.success('同步成功');
tableRef.current?.reload();
} catch (error) {
message.error(error?.message || '同步失败');
}
}}
>
</Button>,
]),
}}
>
</Button>,
]),
// ...(['processing', 'pending_reshipment'].includes(record.orderStatus)
// ? [
// <Divider type="vertical" />,
@ -564,136 +555,136 @@ const Detail: React.FC<{
'pending_refund',
].includes(record.orderStatus)
? [
<Divider type="vertical" />,
<Popconfirm
title="转至售后"
description="确认转至售后?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerChangestatus(
{
id: record.id,
},
{
status: 'after_sale_pending',
},
);
if (!success) {
throw new Error(errMsg);
<Divider type="vertical" />,
<Popconfirm
title="转至售后"
description="确认转至售后?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerChangestatus(
{
id: record.id,
},
{
status: 'after_sale_pending',
},
);
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
]
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
]
: []),
...(record.orderStatus === 'after_sale_pending'
? [
<Divider type="vertical" />,
<Popconfirm
title="转至取消"
description="确认转至取消?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerCancelorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至退款"
description="确认转至退款?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerRefundorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
退
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至完成"
description="确认转至完成?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerCompletedorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至待补发"
description="确认转至待补发?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerChangestatus(
{
<Divider type="vertical" />,
<Popconfirm
title="转至取消"
description="确认转至取消?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerCancelorder({
id: record.id,
},
{
status: 'pending_reshipment',
},
);
if (!success) {
throw new Error(errMsg);
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
]
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至退款"
description="确认转至退款?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerRefundorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
退
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至完成"
description="确认转至完成?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerCompletedorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至待补发"
description="确认转至待补发?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerChangestatus(
{
id: record.id,
},
{
status: 'pending_reshipment',
},
);
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
]
: []),
]}
>
@ -925,31 +916,31 @@ const Detail: React.FC<{
}
actions={
v.state === 'waiting-for-scheduling' ||
v.state === 'waiting-for-transit'
v.state === 'waiting-for-transit'
? [
<Popconfirm
title="取消运单"
description="确认取消运单?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await logisticscontrollerDelshipment({
id: v.id,
});
if (!success) {
throw new Error(errMsg);
<Popconfirm
title="取消运单"
description="确认取消运单?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await logisticscontrollerDelshipment({
id: v.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
initRequest();
} catch (error: any) {
message.error(error.message);
}
tableRef.current?.reload();
initRequest();
} catch (error: any) {
message.error(error.message);
}
}}
>
<DeleteFilled />
</Popconfirm>,
]
}}
>
<DeleteFilled />
</Popconfirm>,
]
: []
}
>
@ -1263,16 +1254,16 @@ const Shipping: React.FC<{
<ProFormList
label="发货产品"
name="sales"
// rules={[
// {
// required: true,
// message: '至少需要一个商品',
// validator: (_, value) =>
// value && value.length > 0
// ? Promise.resolve()
// : Promise.reject('至少需要一个商品'),
// },
// ]}
// rules={[
// {
// required: true,
// message: '至少需要一个商品',
// validator: (_, value) =>
// value && value.length > 0
// ? Promise.resolve()
// : Promise.reject('至少需要一个商品'),
// },
// ]}
>
<ProForm.Group>
<ProFormSelect
@ -1286,7 +1277,7 @@ const Shipping: React.FC<{
return (
data?.map((item) => {
return {
label: `${item.name} - ${item.nameCn}`,
label: `${item.name} - ${item.nameCn}`,
value: item?.sku,
};
}) || options
@ -1694,7 +1685,7 @@ const Shipping: React.FC<{
name="description"
placeholder="请输入描述"
width="lg"
// rules={[{ required: true, message: '请输入描述' }]}
// rules={[{ required: true, message: '请输入描述' }]}
/>
</ProForm.Group>
</ProFormList>
@ -1855,7 +1846,7 @@ const CreateOrder: React.FC<{
return (
data?.map((item) => {
return {
label: `${item.name} - ${item.nameCn}`,
label: `${item.name} - ${item.nameCn}`,
value: item?.sku,
};
}) || options

View File

@ -48,20 +48,6 @@ 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 */
export async function logisticscontrollerCreateshippingaddress(