This commit is contained in:
2026-09-29 17:56:03 +08:00
parent ffbe3480a8
commit a427aca5c3
19 changed files with 219 additions and 221 deletions
@@ -1,4 +1,4 @@
import { overseasApiRequest } from '@/api/overseasHttp'
import { apiRequest } from '@/api/http'
export interface PageResult<T> {
records: T[]
@@ -133,7 +133,7 @@ export interface DeliveryTransferPayload {
}
export function listDeliveryOrders(params: DeliveryQuery) {
return overseasApiRequest<PageResult<DeliveryRow>>({
return apiRequest<PageResult<DeliveryRow>>({
method: 'GET',
url: '/merchant/v1/last-leg/delivery-orders',
params,
@@ -141,7 +141,7 @@ export function listDeliveryOrders(params: DeliveryQuery) {
}
export function getDeliveryOrder(deliveryNo: string) {
return overseasApiRequest<DeliveryOrderDetailResponse>({
return apiRequest<DeliveryOrderDetailResponse>({
method: 'GET',
url: `/merchant/v1/last-leg/delivery-orders/${encodeURIComponent(deliveryNo)}`,
params: { page: 1, size: 200 },
@@ -154,7 +154,7 @@ export function getDeliveryOrder(deliveryNo: string) {
export function createDeliveryOrder(payload: DeliveryTransferPayload) {
const { dispatchNo, ...request } = payload
return overseasApiRequest<DeliveryTransferResult>({
return apiRequest<DeliveryTransferResult>({
method: 'POST',
url: '/merchant/v1/last-leg/delivery-orders',
params: { dispatchNo },
@@ -1,4 +1,4 @@
import { overseasApiRequest } from '@/api/overseasHttp'
import { apiRequest } from '@/api/http'
export interface PageResult<T> { records: T[]; page: number; size: number; total: number; pages: number }
export interface InboundPlanQuery {
@@ -66,10 +66,10 @@ export interface InboundPlanDetail {
}
export async function listInboundPlans(params: InboundPlanQuery) {
const result = await overseasApiRequest<PageResult<InboundPlanSummary>>({ method: 'GET', url: '/merchant/v1/last-leg/inbound-plans', params })
const result = await apiRequest<PageResult<InboundPlanSummary>>({ method: 'GET', url: '/merchant/v1/last-leg/inbound-plans', params })
return { ...result, page: Number(result.page), size: Number(result.size), total: Number(result.total), pages: Number(result.pages) }
}
export function getInboundPlan(planNo: string) {
return overseasApiRequest<InboundPlanDetail>({ method: 'GET', url: `/merchant/v1/last-leg/inbound-plans/${encodeURIComponent(planNo)}` })
return apiRequest<InboundPlanDetail>({ method: 'GET', url: `/merchant/v1/last-leg/inbound-plans/${encodeURIComponent(planNo)}` })
}
@@ -24,9 +24,9 @@ test('uses only authenticated merchant delivery endpoints without customer scope
assert.match(apiSource, /method: 'POST'[\s\S]*url: '\/merchant\/v1\/last-leg\/delivery-orders'/)
assert.match(apiSource, /const \{ dispatchNo, \.\.\.request \} = payload/)
assert.match(apiSource, /params: \{ dispatchNo \}/)
assert.match(apiSource, /overseasApiRequest<DeliveryOrderDetailResponse>/)
assert.match(apiSource, /apiRequest<DeliveryOrderDetailResponse>/)
assert.match(apiSource, /\.then\(\(\{ order, skus, fees \}\) => \(\{[\s\S]*\.\.\.order,[\s\S]*fees,[\s\S]*items: skus/)
assert.match(apiSource, /overseasApiRequest<DeliveryTransferResult>/)
assert.match(apiSource, /apiRequest<DeliveryTransferResult>/)
assert.doesNotMatch(apiSource, /customerId|tenantId|Record<string, unknown>|mock|fallback/i)
})
@@ -6,7 +6,7 @@ import { overseasWarehouseLabel } from './inboundPlanDisplay.ts'
const api = readFileSync(new URL('./api/inboundPlans.ts', import.meta.url), 'utf8')
const routes = readFileSync(new URL('./routes.ts', import.meta.url), 'utf8')
const view = readFileSync(new URL('./views/InboundOrdersView.vue', import.meta.url), 'utf8')
const overseasHttp = readFileSync(new URL('../../api/overseasHttp.ts', import.meta.url), 'utf8')
const overseasHttp = readFileSync(new URL('../../api/http.ts', import.meta.url), 'utf8')
test('activates the customer-scoped overseas inbound list and detail', () => {
assert.match(routes, /path: 'orders\/inbound'[\s\S]*?release: 'active'[\s\S]*?permission: 'merchant:warehouse:inbound:list'/)
@@ -48,9 +48,9 @@ test('renders a dash when either formal receiving warehouse field is absent', ()
})
test('preserves overseas API diagnostic metadata without rendering it as a business identifier', () => {
assert.match(overseasHttp, /response\.data\.traceId/)
assert.match(overseasHttp, /response\.data\.requestId/)
assert.match(overseasHttp, /body\.traceId, body\.requestId/)
assert.match(overseasHttp, /envelope\.traceId/)
assert.match(overseasHttp, /envelope\.requestId/)
assert.match(overseasHttp, /body\.traceId/)
assert.doesNotMatch(view, /requestId|traceId/)
})