Compare commits
2 Commits
df374c4b35
...
4da8fbfdc8
| Author | SHA1 | Date |
|---|---|---|
|
|
4da8fbfdc8 | |
|
|
d609e563ff |
|
|
@ -2,6 +2,7 @@ import InternationalPhoneInput from '@/components/InternationalPhoneInput';
|
|||
import { ORDER_STATUS_ENUM } from '@/constants';
|
||||
import {
|
||||
logisticscontrollerCreateshipment,
|
||||
logisticscontrollerGetShipmentFee,
|
||||
logisticscontrollerDelshipment,
|
||||
logisticscontrollerGetpaymentmethods,
|
||||
logisticscontrollerGetratelist,
|
||||
|
|
@ -58,6 +59,7 @@ import {
|
|||
Button,
|
||||
Card,
|
||||
Col,
|
||||
Descriptions,
|
||||
Divider,
|
||||
Drawer,
|
||||
Dropdown,
|
||||
|
|
@ -69,6 +71,7 @@ import {
|
|||
Tabs,
|
||||
TabsProps,
|
||||
} from 'antd';
|
||||
import Item from 'antd/es/list/Item';
|
||||
import dayjs from 'dayjs';
|
||||
import React, { useMemo, useRef, useState } from 'react';
|
||||
|
||||
|
|
@ -1025,6 +1028,7 @@ const Shipping: React.FC<{
|
|||
const [options, setOptions] = useState<any[]>([]);
|
||||
const formRef = useRef<ProFormInstance>();
|
||||
|
||||
const [shipmentFee, setShipmentFee] = useState<number>(0);
|
||||
const [rates, setRates] = useState<API.RateDTO[]>([]);
|
||||
const [ratesLoading, setRatesLoading] = useState(false);
|
||||
const { message } = App.useApp();
|
||||
|
|
@ -1118,11 +1122,11 @@ const Shipping: React.FC<{
|
|||
{
|
||||
measurements: {
|
||||
weight: {
|
||||
unit: 'lb',
|
||||
unit: 'KGS',
|
||||
value: 1,
|
||||
},
|
||||
cuboid: {
|
||||
unit: 'in',
|
||||
unit: 'CM',
|
||||
l: 6,
|
||||
w: 4,
|
||||
h: 4,
|
||||
|
|
@ -1133,6 +1137,7 @@ const Shipping: React.FC<{
|
|||
],
|
||||
},
|
||||
},
|
||||
|
||||
};
|
||||
}}
|
||||
onFinish={async ({ customer_note, notes, items, details, ...data }) => {
|
||||
|
|
@ -1653,11 +1658,9 @@ const Shipping: React.FC<{
|
|||
label="单位"
|
||||
name={['measurements', 'cuboid', 'unit']}
|
||||
valueEnum={{
|
||||
mm: '毫米',
|
||||
cm: '厘米',
|
||||
m: '米',
|
||||
in: '英寸',
|
||||
ft: '英尺',
|
||||
CM: '厘米',
|
||||
IN: '英寸',
|
||||
FT: '英尺',
|
||||
}}
|
||||
placeholder="请输入单位"
|
||||
rules={[{ required: true, message: '请输入单位' }]}
|
||||
|
|
@ -1673,7 +1676,7 @@ const Shipping: React.FC<{
|
|||
<ProFormSelect
|
||||
label="单位"
|
||||
name={['measurements', 'weight', 'unit']}
|
||||
valueEnum={{ kg: '千克', lb: '磅', g: '克', oz: '盎司' }}
|
||||
valueEnum={{ KGS: '千克', LBS: '磅', OZS: '盎司' }}
|
||||
placeholder="请输入单位"
|
||||
rules={[{ required: true, message: '请输入单位' }]}
|
||||
/>
|
||||
|
|
@ -1730,6 +1733,52 @@ const Shipping: React.FC<{
|
|||
}
|
||||
}}
|
||||
</ProFormDependency>
|
||||
<Button
|
||||
loading={ratesLoading}
|
||||
onClick={async () => {
|
||||
try {
|
||||
console.log('test', formRef.current?.getFieldsValue());
|
||||
const { customer_note, notes, items, details, ...data } = formRef.current?.getFieldsValue();
|
||||
const originEmail = details.origin.email_addresses;
|
||||
const destinationEmail = details.destination.email_addresses;
|
||||
details.origin.email_addresses =
|
||||
details.origin.email_addresses.split(',');
|
||||
details.destination.email_addresses =
|
||||
details.destination.email_addresses.split(',');
|
||||
details.destination.phone_number.number =
|
||||
details.destination.phone_number.phone;
|
||||
details.origin.phone_number.number = details.origin.phone_number.phone;
|
||||
const res =
|
||||
await logisticscontrollerGetShipmentFee(
|
||||
{
|
||||
details,
|
||||
...data
|
||||
},
|
||||
);
|
||||
console.log('res', res.data);
|
||||
if (!res?.success) throw new Error(res?.errMsg);
|
||||
const fee = res.data;
|
||||
setShipmentFee(fee);
|
||||
details.origin.email_addresses = originEmail;
|
||||
details.destination.email_addresses = destinationEmail;
|
||||
formRef.current?.setFieldValue("details", {
|
||||
...details,
|
||||
shipmentFee: fee
|
||||
});
|
||||
} catch (error) {
|
||||
message.error(error?.message || '获取运费失败');
|
||||
}
|
||||
}}
|
||||
>
|
||||
获取运费
|
||||
</Button>
|
||||
<ProFormText
|
||||
readonly
|
||||
name={["details", "shipmentFee"]}
|
||||
fieldProps={{
|
||||
value: (shipmentFee / 100.0).toFixed(2)
|
||||
}}
|
||||
/>
|
||||
</ModalForm>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,6 +21,22 @@ export async function logisticscontrollerCreateshipment(
|
|||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /logistics/getShipmentFee */
|
||||
export async function logisticscontrollerGetShipmentFee(
|
||||
body: API.ShipmentBookDTO,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.BooleanRes>(`/logistics/getShipmentFee`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/** 此处后端没有提供注释 POST /logistics/getShipmentLabel/${param0} */
|
||||
export async function logisticscontrollerGetShipmentLabel(
|
||||
shipmentId: number
|
||||
|
|
|
|||
|
|
@ -1021,6 +1021,7 @@ declare namespace API {
|
|||
packaging_type?: 'pallet' | 'package' | 'courier-pak' | 'envelope';
|
||||
packaging_properties?: PackagingPackage[];
|
||||
reference_codes?: any;
|
||||
shipmentFee: number;
|
||||
};
|
||||
|
||||
type SiteConfig = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue