This commit is contained in:
2026-08-06 19:03:13 +08:00
parent 7034a40aa8
commit 8695eee8c8
28 changed files with 1100 additions and 162 deletions
@@ -2,6 +2,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'
import { http } from '@/shared/api/http'
import {
approvePlatformUnifiedOrder,
addPlatformUnifiedOrderNote,
assignPlatformUnifiedOrderCarrier,
getPlatformUnifiedOrder,
listPlatformUnifiedOrders,
@@ -81,4 +82,10 @@ describe('unified orders API contract', () => {
expect(http.put).toHaveBeenCalledWith('/platform/v1/orders/first-leg/90001/carrier', { carrierId: '30001' }, { params: { tenantId: '208' } })
expect(http.post).toHaveBeenCalledWith('/platform/v1/orders/first-leg/90001/approve', undefined, { params: { tenantId: '208' } })
})
it('writes platform internal notes through the unified order boundary', async () => {
vi.mocked(http.post).mockResolvedValue({ data: '91001' })
await expect(addPlatformUnifiedOrderNote('208', '90001', '已确认船期')).resolves.toBe('91001')
expect(http.post).toHaveBeenCalledWith('/platform/v1/orders/90001/internal-notes', { content: '已确认船期' }, { params: { tenantId: '208' } })
})
})
@@ -89,6 +89,43 @@ export interface UnifiedOrderResource {
transport: UnifiedOrderTransportSummary | null
createdAt: string | null
updatedAt: string | null
/** Optional fields returned by newer first-leg/inbound projections. */
expectedArrivalAt?: string | null
feeReviewStatus?: string | null
holdCargo?: boolean | null
holdReason?: string | null
companyName?: string | null
businessType?: string | null
pickupMethod?: string | null
pickupAt?: string | null
pickupContactPhone?: string | null
pickupAddress?: string | null
pickupPostalCode?: string | null
pickupContactEmail?: string | null
taxMode?: string | null
fullContainer?: boolean | null
customsInspection?: boolean | null
totalPalletCount?: number | null
chargeableVolumeCbm?: number | null
volumetricWeightKg?: number | null
totalNetWeightKg?: number | null
location?: string | null
destinationType?: string | null
destinationAddress?: string | null
destinationPostalCode?: string | null
destinationContact?: string | null
destinationContactPhone?: string | null
measurementCompletedAt?: string | null
inboundCompletedAt?: string | null
associatedFiles?: string[] | null
markFiles?: string[] | null
pcOrderFiles?: string[] | null
expressCompany?: string | null
expressTrackingNo?: string | null
remark?: string | null
customerRemark?: string | null
internalRemark?: string | null
createdBy?: string | null
}
export interface UnifiedOrderTimelineEvent {
@@ -289,6 +326,14 @@ export function approvePlatformUnifiedOrder(tenantId: string, orderId: string) {
).then(unwrapApiResponse)
}
export function addPlatformUnifiedOrderNote(tenantId: string, orderId: string, content: string) {
return http.post<ApiEnvelope<number | string>, ApiEnvelope<number | string>>(
`${unifiedOrdersApiPath}/${orderId}/internal-notes`,
{ content },
{ params: { tenantId } },
).then(unwrapApiResponse)
}
export function unifiedOrderStatusLabel(status: UnifiedOrderMainStatus) {
return unifiedOrderStatusOptions.find((item) => item.value === status)?.label || status
}