This commit is contained in:
2026-09-06 15:53:50 +08:00
19 changed files with 134 additions and 31 deletions
@@ -43,6 +43,7 @@ export interface SavePalletPayload {
export interface UpdatePalletPayload extends SavePalletPayload {
version: number
}
export interface PalletSummaryDto { totalCount: number; idleCount: number; occupiedCount: number; scrappedCount: number }
export async function listReceivingOverseasWarehouses() {
const records: ReceivingOverseasWarehouseDto[] = (await listSharedReceivingOverseasWarehouseOptions()).map((warehouse) => ({
@@ -63,6 +64,11 @@ export async function listPallets(warehouseId: string | undefined, query: { page
)
return normalizeOverseasPage(unwrapApiResponse(response))
}
export async function getPalletSummary(warehouseId: string, query: { keyword?: string; palletType?: string }) {
const path = warehouseId ? `/platform/v1/warehouse-admin/${encodeURIComponent(warehouseId)}/pallets/summary` : '/platform/v1/warehouse-admin/pallets/summary'
const response = await overseasHttp.get<ApiEnvelope<PalletSummaryDto>, ApiEnvelope<PalletSummaryDto>>(path, { params: { page: 1, size: 1, ...query } })
const value = unwrapApiResponse(response); return { totalCount: Number(value.totalCount), idleCount: Number(value.idleCount), occupiedCount: Number(value.occupiedCount), scrappedCount: Number(value.scrappedCount) }
}
export async function getPallet(warehouseId: string, palletId: string) {
const response = await overseasHttp.get<ApiEnvelope<PalletDto>, ApiEnvelope<PalletDto>>(
@@ -29,7 +29,7 @@ describe('relabel overseas API', () => {
it('uses the real create and status endpoints', async () => {
vi.mocked(overseasHttp.post).mockResolvedValue({ code: '200', data: {} })
vi.mocked(overseasHttp.put).mockResolvedValue({ code: '200', data: {} })
const payload = { customerOrderNo: 'CO-1', overseasWarehouseId: '9', labelDeadline: '2026-08-20T10:00:00', contactName: 'A', contactPhone: '1', idempotencyKey: 'k', items: [{ skuCode: 'SKU', productNameZh: 'P', totalPackageCount: 1, notifiedPackageCount: 1, shipmentNo: 'S', newSkuCode: 'SKU-2' }] }
const payload = { customerOrderNo: 'CO-1', overseasWarehouseId: '9', labelDeadline: '2026-08-20T10:00:00', contactName: 'A', contactPhone: '1', chargeAmount: 20, idempotencyKey: 'k', items: [{ skuCode: 'SKU', productNameZh: 'P', totalPackageCount: 1, notifiedPackageCount: 1, shipmentNo: 'S', newSkuCode: 'SKU-2' }] }
await createRelabelOrder('10001', payload)
await changeRelabelOrderStatus('RL/1', 'PROCESSING', 'ok')
expect(overseasHttp.post).toHaveBeenCalledWith('/platform/v1/last-leg/relabel-applications', payload, { params: { customerId: '10001' } })
@@ -34,6 +34,7 @@ export interface CreateRelabelPayload {
labelDeadline: string
contactName: string
contactPhone: string
chargeAmount: number
remark?: string
idempotencyKey: string
items: CreateRelabelItemPayload[]
@@ -63,6 +64,10 @@ export interface RelabelSummaryDto {
totalPackageCount?: number | null
notifiedPackageCount?: number | null
skuCodes?: string | null
chargeAmount?: number | string | null
chargeCurrency?: string | null
walletStatus?: string | null
walletErrorMessage?: string | null
createdAt?: string | null
}