From dbaf4c09df6d91dd74c84c04dad7c8399c551375 Mon Sep 17 00:00:00 2001 From: ouyangxq <775153912@qq.com> Date: Fri, 7 Aug 2026 17:15:06 +0800 Subject: [PATCH] 1 --- src/modules/inbounds/core/api.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/modules/inbounds/core/api.ts b/src/modules/inbounds/core/api.ts index 9ef76349..97d5fea3 100644 --- a/src/modules/inbounds/core/api.ts +++ b/src/modules/inbounds/core/api.ts @@ -1,4 +1,4 @@ -import { http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http' +import { ApiResponseError, http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http' import type { InboundFileSummary, InboundInternalNote, @@ -126,3 +126,24 @@ export async function getPlatformInbound(tenantId: string, inboundId: string) { ) return normalizeDetail(unwrapApiResponse(response)) } + +export async function downloadInboundCartonLabels(tenantId: string, inboundId: string, cartonIndexes?: number[]) { + const response = await http.post( + `${basePath}/${encodeURIComponent(inboundId)}/carton-label-pdf`, + null, + { + params: { + tenantId, + ...(cartonIndexes?.length ? { cartonIndex: cartonIndexes } : {}), + }, + responseType: 'blob', + timeout: 60_000, + }, + ) + if (response.type.includes('json')) { + const error = JSON.parse(await response.text()) as Partial> + throw new ApiResponseError(error.message || '箱唛生成失败', error.code || 'UNKNOWN', undefined, + error.data, error.requestId, error.traceId) + } + return response +}