This commit is contained in:
2026-08-17 18:00:42 +08:00
parent c7334b2cf8
commit ec3dbb3fe4
23 changed files with 407 additions and 999 deletions
@@ -5,7 +5,6 @@ import {
acceptPlatformFirstLegOrder,
addPlatformFirstLegOrderNote,
approvePlatformFirstLegOrder,
batchApprovePlatformFirstLegOrders,
cancelPlatformFirstLegOrder,
completePlatformFirstLegOrder,
getPlatformFirstLegOrder,
@@ -97,22 +96,6 @@ describe('platform first-leg order API', () => {
expect(http.post).toHaveBeenNthCalledWith(6, '/platform/v1/orders/first-leg/90001/internal-notes', { content: '已联系客户确认' }, { params: { tenantId: '10001' } })
})
it('uses the formal tenant-scoped batch approval contract and preserves long order ids', async () => {
vi.mocked(http.post).mockResolvedValue({
code: '200', message: 'success',
data: { total: 2, successCount: 1, failureCount: 1, successOrderIds: ['2089223263733518337'], failedOrders: [{ orderId: '2089223263733518338', code: 'A0409', message: '订单状态已变化' }] },
})
await expect(batchApprovePlatformFirstLegOrders('2089176869176389634', [
'2089223263733518337', '2089223263733518338',
])).resolves.toMatchObject({ total: 2, successCount: 1, failureCount: 1 })
expect(http.post).toHaveBeenCalledWith(
'/platform/v1/orders/first-leg/batch-approve',
{ orderIds: ['2089223263733518337', '2089223263733518338'] },
{ params: { tenantId: '2089176869176389634' } },
)
})
it('writes the backend express contract as names, not a guessed master-data ID', async () => {
vi.mocked(http.put).mockResolvedValue({ code: '200', message: 'success', data: null })
@@ -115,20 +115,6 @@ export interface PlatformTenantOrderStatistics {
asOf: string
}
export interface PlatformOrderBatchReviewFailure {
orderId: number | string
code: string
message: string
}
export interface PlatformOrderBatchReviewResult {
total: number
successCount: number
failureCount: number
successOrderIds: Array<number | string>
failedOrders: PlatformOrderBatchReviewFailure[]
}
type PlatformFirstLegOrderPagePayload = Omit<PlatformFirstLegOrderPageResource, 'page' | 'size' | 'total' | 'pages'> & {
page: number | string
size: number | string
@@ -190,14 +176,6 @@ export function approvePlatformFirstLegOrder(tenantId: string, orderId: string)
return postData<void>(`/platform/v1/orders/first-leg/${orderId}/approve`, undefined, { tenantId })
}
export function batchApprovePlatformFirstLegOrders(tenantId: string, orderIds: string[]) {
return postData<PlatformOrderBatchReviewResult>(
'/platform/v1/orders/first-leg/batch-approve',
{ orderIds },
{ tenantId },
)
}
export function acceptPlatformFirstLegOrder(tenantId: string, orderId: string) {
return postData<void>(`/platform/v1/orders/first-leg/${orderId}/accept`, undefined, { tenantId })
}