diff --git a/src/pages/Logistics/List/index.tsx b/src/pages/Logistics/List/index.tsx index 9fc33f9..aa5c509 100644 --- a/src/pages/Logistics/List/index.tsx +++ b/src/pages/Logistics/List/index.tsx @@ -1,8 +1,9 @@ import { logisticscontrollerGetlist, logisticscontrollerGetShipmentLabel, - logisticscontrollerDeleteShipment + logisticscontrollerDeleteShipment, + logisticscontrollerGetShipmentState } from '@/servers/api/logistics'; import { stockcontrollerGetallstockpoints } from '@/servers/api/stock'; -import { formatShipmentState } from '@/utils/format'; +import { formatUniuniShipmentState } from '@/utils/format'; import { printPDF } from '@/utils/util'; import { CopyOutlined } from '@ant-design/icons'; import { ToastContainer, toast } from 'react-toastify'; @@ -70,7 +71,7 @@ const ListPage: React.FC = () => { dataIndex: 'state', hideInSearch: true, render(_, record) { - return formatShipmentState(record.state); + return formatUniuniShipmentState(record.state); }, }, { @@ -99,19 +100,21 @@ const ListPage: React.FC = () => { > Label - {/* */} - {/* */} + 刷新状态 + + { }} > diff --git a/src/servers/api/logistics.ts b/src/servers/api/logistics.ts index b31782d..6e058e8 100644 --- a/src/servers/api/logistics.ts +++ b/src/servers/api/logistics.ts @@ -48,6 +48,19 @@ export async function logisticscontrollerGetShipmentLabel( } }); } + +/** 此处后端没有提供注释 POST /logistics/updateState/${param0}**/ +export async function logisticscontrollerGetShipmentState( + shipmentId: number +) { + return request(`/logistics/updateState/${shipmentId}`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + } + }) +} + /** 此处后端没有提供注释 DEL /logistics/deleteShipment/${param0} */ export async function logisticscontrollerDeleteShipment( shipmentId: number diff --git a/src/servers/api/typings.d.ts b/src/servers/api/typings.d.ts index 6a53eaf..18baf0f 100644 --- a/src/servers/api/typings.d.ts +++ b/src/servers/api/typings.d.ts @@ -163,6 +163,10 @@ declare namespace API { orderId: number; }; + type logisticscontrollerDeleteshipmentParams = { + id: number; + }; + type logisticscontrollerDelshipmentParams = { id: string; }; @@ -1015,13 +1019,13 @@ declare namespace API { }; type ShippingDetailsDTO = { + shipmentFee?: number; origin?: Location; destination?: Destination; expected_ship_date?: Date; packaging_type?: 'pallet' | 'package' | 'courier-pak' | 'envelope'; packaging_properties?: PackagingPackage[]; reference_codes?: any; - shipmentFee: number; }; type SiteConfig = { diff --git a/src/utils/format.ts b/src/utils/format.ts index 869159e..af4f65e 100644 --- a/src/utils/format.ts +++ b/src/utils/format.ts @@ -55,13 +55,51 @@ export function formatShipmentState(state: string) { return '丢失'; case 'cancelled': return '取消'; - case '190': // ORDER_RECEIVED - return '订单待发送'; - case '202': // IN_TRANSIT - return '在途中'; - case '203': // DELIVERED - return '订单已送达'; default: return ''; } } + +export function formatUniuniShipmentState(state: string) { + const UNIUNI_STATUS_ENUM = { + '190': 'ORDER_RECEIVED', + '192': 'CUSTOM_HOLD', + '195': 'GATEWAY_TRANSIT_OUT', + '198': 'CUSTOM_RELEASE_DIRECT', + '199': 'GATEWAY_TRANSIT', + '200': 'PARCEL_SCANNED', + '202': 'IN_TRANSIT', + '203': 'DELIVERED', + '204': 'TRANSSHIPMENT', + '206': 'WRONG_ADDRESS_FROM_TRANSIT', + '207': 'PARCEL_LOST', + '209': 'OTHER_EXCEPTION', + '211': 'RETURN_OFFICE_FROM_TRANSIT', + '212': 'WRONG_ADDRESS_FROM_RECEIVE', + '213': 'STORAGE_30_DAYS_FROM_OFFICE', + '214': 'STORAGE_30_DAYS_AFTER_SCAN', + '215': 'PARCEL_ABANDONED', + '216': 'SELF_PICK_UP', + '217': 'TRANSSHIPMENT_COMPLETE', + '218': 'SCANNED_PARCEL_MISSING', + '219': 'WRONG_ROUTE_PARCEL', + '220': 'SECOND_DELIVERY', + '221': 'RETURNED_PARCEL_SCANNED', + '222': 'REJECTED_PARCEL_FROM_TRANSIT', + '223': 'CHANGED_ORDER_RESENT', + '224': 'RESENT_ORDER_VOIDED', + '225': 'FORWARDED_3RDPARTY', + '226': 'STORAGE_3RDPARTY_SERVICE_POINT', + '228': 'SECOND_DELIVERED', + '229': 'DROP_OFF_SERVICE_POINTS', + '230': 'RETURN TO SENDER WAREHOUSE', + '231': 'FAILED_DELIVERY_RETRY1', + '232': 'FAILED_DELIVERY_RETRY2', + '255': 'Gateway_To_Gateway_Transit' + } + if (state in UNIUNI_STATUS_ENUM) { + return UNIUNI_STATUS_ENUM[state]; + } else { + return '未知状态'; + } +}