From b4403ab188a9a803c81453cf5d87049b39d09956 Mon Sep 17 00:00:00 2001 From: wujinliang <2318309077@qq.com> Date: Mon, 21 Sep 2026 19:36:37 +0800 Subject: [PATCH 1/2] 1 --- src/modules/first-leg/api/firstLeg.ts | 2 ++ .../components/InboundBillingPanel.test.mjs | 3 ++- .../components/InboundBillingPanel.vue | 3 +++ .../first-leg/store/firstLegOrders.test.mjs | 6 ++++-- src/modules/first-leg/store/firstLegOrders.ts | 21 ++++++++++++++----- .../first-leg/utils/inboundBilling.test.mjs | 7 +++++++ src/modules/first-leg/utils/inboundBilling.ts | 14 +++++++++++++ .../views/WarehouseServiceView.vue | 3 ++- .../views/warehouseTransferForm.test.mjs | 12 +++++++++++ 9 files changed, 62 insertions(+), 9 deletions(-) diff --git a/src/modules/first-leg/api/firstLeg.ts b/src/modules/first-leg/api/firstLeg.ts index 69d080b..a65d1f7 100644 --- a/src/modules/first-leg/api/firstLeg.ts +++ b/src/modules/first-leg/api/firstLeg.ts @@ -296,6 +296,8 @@ export interface MerchantFirstLegOrderRow { inboundedAt: string | null businessDate: string | null shipmentId: string | null + fulfillmentType?: 'STANDARD' | 'ONE_CLICK_DROPSHIP' | null + lxCode?: string | null createdAt: string cargoes?: Array<{ skuNo?: string | null }> } diff --git a/src/modules/first-leg/components/InboundBillingPanel.test.mjs b/src/modules/first-leg/components/InboundBillingPanel.test.mjs index d67fe10..649012a 100644 --- a/src/modules/first-leg/components/InboundBillingPanel.test.mjs +++ b/src/modules/first-leg/components/InboundBillingPanel.test.mjs @@ -42,7 +42,8 @@ test('shows the published merchant inbound, measurement details and customer con assert.match(source, /latestFee\.rateCode/) assert.match(source, /latestFee\.chargeRuleVersion/) assert.match(source, /latestFee\.carrierRateVersion/) - assert.doesNotMatch(source, /箱规规则|calculationRuleVersion/) + assert.match(source, /箱规规则/) + assert.match(source, /getCalculationRuleLabel\(row\.calculationRuleVersion\)/) }) test('stacks core information for 720 and 360 pixel layouts', () => { diff --git a/src/modules/first-leg/components/InboundBillingPanel.vue b/src/modules/first-leg/components/InboundBillingPanel.vue index 5094542..24f81cc 100644 --- a/src/modules/first-leg/components/InboundBillingPanel.vue +++ b/src/modules/first-leg/components/InboundBillingPanel.vue @@ -10,6 +10,7 @@ import { formatInboundMeasure, formatInboundMoney, formatInboundNumber, + getCalculationRuleLabel, getChargeModeLabel, getTaxModeLabel, } from '@/modules/first-leg/utils/inboundBilling' @@ -139,6 +140,7 @@ async function confirmFee() { + @@ -241,6 +243,7 @@ async function confirmFee() { + /) assert.match(apiSource, /apiRequest>/) assert.match(storeSource, /function mapFirstLegOrderRow/) - for (const field of ['inboundId', 'inboundCode', 'channelName', 'destinationWarehouseName', 'pickupMethod', 'packageCount', 'expressCompany', 'trackingNo', 'totalGrossWeightKg', 'totalNetWeightKg', 'totalVolumeCbm', 'totalQuantity', 'remark', 'shipmentId', 'referenceId', 'createdAt']) { + for (const field of ['inboundId', 'inboundCode', 'channelName', 'destinationWarehouseName', 'pickupMethod', 'packageCount', 'expressCompany', 'trackingNo', 'totalGrossWeightKg', 'totalNetWeightKg', 'totalVolumeCbm', 'totalQuantity', 'remark', 'shipmentId', 'fulfillmentType', 'lxCode', 'referenceId', 'createdAt']) { assert.match(storeSource, new RegExp(`row\\.${field}`)) } assert.match(storeSource, /row\.skuNos/) @@ -102,7 +102,9 @@ test('keeps unified order pagination valid when the store omits page and size', test('keeps drafts on the legacy read path without assigning a unified main status', () => { assert.match(storeSource, /getMerchantFirstLegOrders\(legacyQuery\(query, 'DRAFT'\)\)/) - assert.match(storeSource, /getById\(id\)\?\.status === 'DRAFT' \? loadLegacyDetail\(id\) : loadUnifiedDetail\(id\)/) + assert.match(storeSource, /const listOrder = getById\(id\)/) + assert.match(storeSource, /listOrder\?\.status === 'DRAFT' \? loadLegacyDetail\(id, listOrder\) : loadUnifiedDetail\(id\)/) + assert.match(storeSource, /detail\.order\.lxCode == null && listOrder\?\.lxCode/) assert.match(storeSource, /return loadLegacyDetail\(String\(createdId\)\)/) assert.match(storeSource, /draftLoadError/) }) diff --git a/src/modules/first-leg/store/firstLegOrders.ts b/src/modules/first-leg/store/firstLegOrders.ts index d202fc2..96ce9c5 100644 --- a/src/modules/first-leg/store/firstLegOrders.ts +++ b/src/modules/first-leg/store/firstLegOrders.ts @@ -359,7 +359,7 @@ function mapFirstLegOrderRow(row: MerchantFirstLegOrderRow): FirstLegOrder { const uniqueSkuNos = [...new Set(resolvedSkuNos)] return { id: String(row.orderId), orderNo: row.orderNo, referenceNo: row.referenceId ?? '', transportMode: null, - businessType: 'EXPORT', origin: '', destination: row.destinationWarehouseName ?? '', receivingWarehouseId: '', + businessType: 'EXPORT', fulfillmentType: row.fulfillmentType ?? 'STANDARD', lxCode: row.lxCode ?? '', origin: '', destination: row.destinationWarehouseName ?? '', receivingWarehouseId: '', receivingWarehouseName: '', receivingWarehouseSnapshot: null, expectedDepartureDate: '', etd: '', eta: '', shipperPartyId: '', shipperPartySnapshot: null, shipper: '', consigneePartyId: '', consigneePartySnapshot: null, consignee: row.receivingCompanyName ?? '', expressCompanyName: row.expressCompany ?? '', trackingNumber: row.trackingNo ?? '', @@ -542,9 +542,19 @@ export const useFirstLegOrdersStore = defineStore('client-first-leg-orders', () return mapped } - async function loadLegacyDetail(id: string) { + async function loadLegacyDetail(id: string, listOrder?: FirstLegOrder) { const detail = await getMerchantFirstLegOrder(id) - return upsertOrder(mapOrder(detail.order, warehouses.value, detail)) + const mapped = mapOrder(detail.order, warehouses.value, detail) + // Older detail responses may omit newly added dropship fields. Keep the + // values already returned by the list row so editing a draft does not + // clear the persisted LX code in the form. + if (detail.order.fulfillmentType == null && listOrder?.fulfillmentType) { + mapped.fulfillmentType = listOrder.fulfillmentType + } + if (detail.order.lxCode == null && listOrder?.lxCode) { + mapped.lxCode = listOrder.lxCode + } + return upsertOrder(mapped) } async function loadUnifiedDetail(id: string) { @@ -558,7 +568,8 @@ export const useFirstLegOrdersStore = defineStore('client-first-leg-orders', () } async function loadDetail(id: string) { - return getById(id)?.status === 'DRAFT' ? loadLegacyDetail(id) : loadUnifiedDetail(id) + const listOrder = getById(id) + return listOrder?.status === 'DRAFT' ? loadLegacyDetail(id, listOrder) : loadUnifiedDetail(id) } async function loadWarehouseDetail(id: string) { @@ -616,7 +627,7 @@ export const useFirstLegOrdersStore = defineStore('client-first-leg-orders', () } async function loadDraftDetail(id: string) { - return loadLegacyDetail(id) + return loadLegacyDetail(id, getById(id)) } return { orders, warehouses, loading, loadedFromApi, loadError, warehouseLoadError, draftLoadError, activeCount, pendingCount, getById, load, loadDetail, loadDraftDetail, loadWarehouseDetail, loadWarehouseType, saveDraft, saveDraftBatch, submitSaved, submit } diff --git a/src/modules/first-leg/utils/inboundBilling.test.mjs b/src/modules/first-leg/utils/inboundBilling.test.mjs index fec95b4..5751d98 100644 --- a/src/modules/first-leg/utils/inboundBilling.test.mjs +++ b/src/modules/first-leg/utils/inboundBilling.test.mjs @@ -19,6 +19,13 @@ test('translates backend rounding modes into customer-facing calculation labels' assert.match(source, /return value \? labels\[value\] \|\| value : '-'/) }) +test('translates carton calculation rules into customer-facing labels', () => { + assert.match(source, /export function getCalculationRuleLabel/) + assert.match(source, /ACTUAL_DIMENSION_V1/) + assert.match(source, /按实际箱规计算/) + assert.match(source, /CUSTOMER_DIMENSION_\(SMALL\|MEDIUM\|LARGE\|EXTRA_LARGE\)_V/) +}) + test('renders conversion metadata as one complete label or a single empty marker', () => { assert.match(source, /export function formatConversionPrecision/) assert.match(source, /roundingScale === null \|\| roundingScale === undefined/) diff --git a/src/modules/first-leg/utils/inboundBilling.ts b/src/modules/first-leg/utils/inboundBilling.ts index 600fcad..b880932 100644 --- a/src/modules/first-leg/utils/inboundBilling.ts +++ b/src/modules/first-leg/utils/inboundBilling.ts @@ -46,6 +46,20 @@ export function getTaxModeLabel(value: string) { return value || '-' } +export function getCalculationRuleLabel(value: string | null | undefined) { + if (!value) return '-' + if (value === 'ACTUAL_DIMENSION_V1' || value === 'DIMENSION_ACTUAL_V1') return '按实际箱规计算' + const customerRule = /^CUSTOMER_DIMENSION_(SMALL|MEDIUM|LARGE|EXTRA_LARGE)_V(\d+)$/.exec(value) + if (customerRule) { + const sizeLabel: Record = { + SMALL: '小号', MEDIUM: '中号', LARGE: '大号', EXTRA_LARGE: '超大号', + } + return `客户箱规规则(${sizeLabel[customerRule[1]]},V${customerRule[2]})` + } + const warehouseRule = /^WAREHOUSE_OUTER_OVERRIDE_(.+)$/.exec(value) + return warehouseRule ? `仓库外箱规覆盖(${warehouseRule[1]})` : value +} + export function getRoundingModeLabel(value: string | null | undefined) { const labels: Record = { UP: '向上舍入', diff --git a/src/modules/overseas-warehouse/views/WarehouseServiceView.vue b/src/modules/overseas-warehouse/views/WarehouseServiceView.vue index eda096f..313c351 100644 --- a/src/modules/overseas-warehouse/views/WarehouseServiceView.vue +++ b/src/modules/overseas-warehouse/views/WarehouseServiceView.vue @@ -106,6 +106,7 @@ interface ServiceDetail extends Record { estimatedShipAt?: string; actualShipAt?: string; fbaShipmentNo?: string; trackingNo?: string remark?: string; needRelabel?: boolean; labelDeadline?: string; relabelContactName?: string relabelContactPhone?: string; relabelDeliveryMethod?: string + createdAt?: string items?: Array<{ skuCode?: string; productNameZh?: string; packageCount?: number; shippingMark?: string }> relabelBindings?: Array<{ operationType?: string; customerCartonMark?: string; originalSku?: string; newSku?: string; quantity?: number; fbaCartonMark?: string; destinationWarehouseCode?: string; remark?: string }> cartons?: TransferCarton[]; pallets?: TransferPallet[]; measurementPhotos?: TransferMeasurementPhoto[]; customerConfirmedAt?: string @@ -1138,7 +1139,7 @@ function selectRelabelInventory(inboundOrderId: string) {