Fix: 获取运费增加正确提示 #12
|
|
@ -1787,11 +1787,30 @@ const Shipping: React.FC<{
|
||||||
const res =
|
const res =
|
||||||
await logisticscontrollerGetShipmentFee(
|
await logisticscontrollerGetShipmentFee(
|
||||||
{
|
{
|
||||||
details,
|
stockPointId: data.stockPointId,
|
||||||
...data
|
|
||||||
|
sender: details.origin.contact_name,
|
||||||
|
startPhone: details.origin.phone_number,
|
||||||
|
startPostalCode: details.origin.address.postal_code.replace(/\s/g, ''),
|
||||||
|
pickupAddress: details.origin.address.address_line_1,
|
||||||
|
shipperCountryCode: details.origin.address.country,
|
||||||
|
receiver: details.destination.contact_name,
|
||||||
|
city: details.destination.address.city,
|
||||||
|
province: details.destination.address.region,
|
||||||
|
country: details.destination.address.country,
|
||||||
|
postalCode: details.destination.address.postal_code.replace(/\s/g, ''),
|
||||||
|
deliveryAddress: details.destination.address.address_line_1,
|
||||||
|
receiverPhone: details.destination.phone_number.number,
|
||||||
|
receiverEmail: details.destination.email_addresses,
|
||||||
|
length: details.packaging_properties.packages[0].measurements.cuboid.l,
|
||||||
|
width: details.packaging_properties.packages[0].measurements.cuboid.w,
|
||||||
|
height: details.packaging_properties.packages[0].measurements.cuboid.h,
|
||||||
|
dimensionUom: details.packaging_properties.packages[0].measurements.cuboid.unit,
|
||||||
|
weight: details.packaging_properties.packages[0].measurements.weight.value,
|
||||||
|
weightUom: details.packaging_properties.packages[0].measurements.weight.unit,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
if (!res?.success) throw new Error(res?.errMsg);
|
if (!res?.success) throw new Error(res?.message);
|
||||||
const fee = res.data;
|
const fee = res.data;
|
||||||
setShipmentFee(fee);
|
setShipmentFee(fee);
|
||||||
details.origin.email_addresses = originEmail;
|
details.origin.email_addresses = originEmail;
|
||||||
|
|
@ -1800,6 +1819,7 @@ const Shipping: React.FC<{
|
||||||
...details,
|
...details,
|
||||||
shipmentFee: fee
|
shipmentFee: fee
|
||||||
});
|
});
|
||||||
|
message.success('获取运费成功');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error(error?.message || '获取运费失败');
|
message.error(error?.message || '获取运费失败');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -525,6 +525,7 @@ const DetailForm: React.FC<{
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
}> = ({ tableRef, values }) => {
|
}> = ({ tableRef, values }) => {
|
||||||
|
const detailsActionRef = useRef<ActionType>();
|
||||||
const { message } = App.useApp();
|
const { message } = App.useApp();
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const initialValues = {
|
const initialValues = {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ export async function logisticscontrollerCreateshipment(
|
||||||
|
|
||||||
/** 此处后端没有提供注释 POST /logistics/getShipmentFee */
|
/** 此处后端没有提供注释 POST /logistics/getShipmentFee */
|
||||||
export async function logisticscontrollerGetShipmentFee(
|
export async function logisticscontrollerGetShipmentFee(
|
||||||
body: API.ShipmentBookDTO,
|
body: API.ShipmentFeeBookDTO,
|
||||||
options?: { [key: string]: any },
|
options?: { [key: string]: any },
|
||||||
) {
|
) {
|
||||||
return request<API.BooleanRes>(`/logistics/getShipmentFee`, {
|
return request<API.BooleanRes>(`/logistics/getShipmentFee`, {
|
||||||
|
|
|
||||||
|
|
@ -993,6 +993,32 @@ declare namespace API {
|
||||||
orderIds?: number[];
|
orderIds?: number[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ShipmentFeeBookDTO = {
|
||||||
|
// 发货点,传id到后端解析
|
||||||
|
stockPointId: number;
|
||||||
|
|
||||||
|
sender: string;
|
||||||
|
startPhone: string;
|
||||||
|
startPostalCode: string;
|
||||||
|
pickupAddress: string;
|
||||||
|
// pickupWarehouse: number; // 此处用 stockPointId 到后端解析
|
||||||
|
shipperCountryCode: string;
|
||||||
|
receiver: string;
|
||||||
|
city: string;
|
||||||
|
province: string;
|
||||||
|
country: string;
|
||||||
|
postalCode: string;
|
||||||
|
deliveryAddress: string;
|
||||||
|
receiverPhone: string;
|
||||||
|
receiverEmail: string;
|
||||||
|
length: number;
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
dimensionUom: string;
|
||||||
|
weight: number;
|
||||||
|
weightUom: string;
|
||||||
|
};
|
||||||
|
|
||||||
type ShipmentSkuDTO = {
|
type ShipmentSkuDTO = {
|
||||||
sales?: OrderSale[];
|
sales?: OrderSale[];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue