feat: 完善头程审核与计费信息
This commit is contained in:
@@ -35,9 +35,11 @@ const snapshot: InboundFeeSnapshot = {
|
||||
carrierRateId: '202', rateCode: 'RATE-LAX', carrierRateVersion: 5,
|
||||
customerId: '303', customerName: '测试客户', originWarehouseId: '404', originWarehouseName: '义乌仓',
|
||||
businessType: 'FBA_SEA', channelCode: 'SEA-TAX', carrierId: '505', carrierName: '测试船司',
|
||||
destinationCode: 'LAX9', taxMode: 'TAX_INCLUDED', chargeMode: 'KG',
|
||||
destinationCode: 'LAX9', taxMode: 'TAX_REFUND', pricingTaxMode: 'TAX_INCLUDED', chargeMode: 'KG',
|
||||
conversionFactor: 167, roundingScale: 2, roundingMode: 'HALF_UP',
|
||||
actualWeightKg: 100, actualVolumeCbm: 0.8, convertedQuantity: 133.6, chargeableQuantity: 133.6,
|
||||
actualWeightKg: 100, actualVolumeCbm: 0.8, convertedQuantity: 133.6,
|
||||
baselineChargeableQuantity: 133.6, lowerChargeableQuantity: 120.24, upperChargeableQuantity: 146.96,
|
||||
tolerancePercent: 10, chargeableQuantity: 133.6,
|
||||
chargeUnit: 'KG', unitPrice: 8.5, subtotalAmount: 1135.6, additionalAmount: 100,
|
||||
totalAmount: 1235.6, currency: 'CNY',
|
||||
rateEffectiveFrom: '2026-08-01T00:00:00', rateEffectiveTo: null,
|
||||
@@ -88,6 +90,8 @@ describe('InboundFeePanel', () => {
|
||||
await flushPromises()
|
||||
|
||||
expect(getLatestInboundFee).toHaveBeenCalledWith('10001', '88')
|
||||
expect(document.body.textContent).toContain('订单报关:退税报关')
|
||||
expect(document.body.textContent).toContain('报价税制:包税')
|
||||
expect(document.body.textContent).not.toContain('租户')
|
||||
expect(document.body.textContent).toContain('头程自动费用 · CNY')
|
||||
expect(document.body.textContent).toContain('¥1,235.60')
|
||||
@@ -237,6 +241,18 @@ describe('InboundFeePanel', () => {
|
||||
expect(wrapper.find('[data-testid="adjust-fee-button"]').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('allows a published fee adjustment until the customer confirms it', async () => {
|
||||
const wrapper = mountPanel()
|
||||
await flushPromises()
|
||||
expect(wrapper.get('[data-testid="adjust-fee-button"]').text()).toContain('调整已发布费用')
|
||||
|
||||
document.body.innerHTML = ''
|
||||
vi.mocked(getLatestInboundFee).mockResolvedValue({ ...snapshot, customerConfirmationStatus: 'CONFIRMED' })
|
||||
const confirmed = mountPanel()
|
||||
await flushPromises()
|
||||
expect(confirmed.find('[data-testid="adjust-fee-button"]').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('confirms and then sends a calculated fee through the implemented backend transitions', async () => {
|
||||
vi.mocked(getLatestInboundFee).mockResolvedValue({ ...snapshot, feeStatus: 'CALCULATED', confirmedAt: null, sentAt: null })
|
||||
vi.spyOn(ElMessageBox, 'confirm').mockResolvedValue(undefined as never)
|
||||
@@ -294,7 +310,7 @@ describe('InboundFeePanel', () => {
|
||||
expect(adjustPublishedInboundFee).toHaveBeenCalledWith(
|
||||
'10001',
|
||||
'88',
|
||||
{ expectedFeeVersion: 2, chargeableQuantity: 140, unitPrice: 8.2, additionalAmount: 80, reason: '补充已确认的附加费用' },
|
||||
{ expectedFeeVersion: 2, chargeableQuantity: 140, unitPrice: 8.2, additionalAmount: 80, reason: '补充已确认的附加费用', toleranceConfirmed: true },
|
||||
expect.stringMatching(/^fee-adjust-/),
|
||||
)
|
||||
expect(wrapper.emitted('changed')?.[0]?.[0]).toMatchObject({ feeVersion: 3 })
|
||||
@@ -307,6 +323,11 @@ describe('InboundFeePanel', () => {
|
||||
expect(source).toContain('grid-template-columns: repeat(3, minmax(0, 1fr))')
|
||||
expect(source).toContain('class="adjustment-unit"')
|
||||
expect(source).toContain('white-space: nowrap')
|
||||
expect(source).toContain('snapshot.value?.lowerChargeableQuantity')
|
||||
expect(source).toContain('snapshot.value?.upperChargeableQuantity')
|
||||
expect(source).toContain('toleranceConfirmed: true')
|
||||
expect(source).toContain("'再次确认计费量调整'")
|
||||
expect(source).toContain('nextQuantity < adjustmentMinimum.value || nextQuantity > adjustmentMaximum.value')
|
||||
})
|
||||
|
||||
it('refreshes the latest snapshot after a conflict while retaining the dialog', async () => {
|
||||
|
||||
@@ -86,11 +86,17 @@ const normalizedInboundId = computed(() => {
|
||||
return identifier && identifier !== 'null' && identifier !== 'undefined' ? identifier : ''
|
||||
})
|
||||
const adjustmentEligible = computed(() => (
|
||||
snapshot.value?.feeStatus === 'CALCULATED'
|
||||
['CALCULATED', 'CONFIRMED', 'SENT'].includes(snapshot.value?.feeStatus || '')
|
||||
&& snapshot.value?.nextProcessStatus === 'WAIT_SPLIT'
|
||||
&& snapshot.value?.customerConfirmationStatus !== 'CONFIRMED'
|
||||
))
|
||||
const chargeModeLabel = computed(() => snapshot.value?.chargeMode === 'KG' ? '按重量计费' : '按体积计费')
|
||||
const chargeUnitLabel = computed(() => snapshot.value?.chargeUnit === 'KG' ? 'KG' : 'CBM')
|
||||
const convertedQuantityLabel = computed(() => snapshot.value?.chargeMode === 'KG' ? '体积重量' : '重量折算体积')
|
||||
const adjustmentBaseline = computed(() => Number(snapshot.value?.baselineChargeableQuantity || 0))
|
||||
const adjustmentMinimum = computed(() => Number(snapshot.value?.lowerChargeableQuantity || 0))
|
||||
const adjustmentMaximum = computed(() => Number(snapshot.value?.upperChargeableQuantity || 0))
|
||||
const adjustmentQuantityChanged = computed(() => Math.abs(Number(adjustmentForm.chargeableQuantity) - adjustmentBaseline.value) > 1e-8)
|
||||
const statusInfo = computed(() => feeStatusInfo(snapshot.value?.feeStatus))
|
||||
const sourceOptions = computed(() => {
|
||||
const value = measurement.value
|
||||
@@ -145,6 +151,12 @@ function taxModeLabel(value: string) {
|
||||
return firstLegTaxModeLabel(value)
|
||||
}
|
||||
|
||||
function pricingTaxModeLabel(value: string | null | undefined) {
|
||||
if (value === 'TAX_INCLUDED') return '包税'
|
||||
if (value === 'TAX_EXCLUDED') return '不包税'
|
||||
return '—'
|
||||
}
|
||||
|
||||
function roundingModeLabel(value: string) {
|
||||
const labels: Record<string, string> = {
|
||||
UP: '远离零方向', DOWN: '向零方向', CEILING: '向上', FLOOR: '向下',
|
||||
@@ -275,6 +287,7 @@ function adjustmentPayload(): AdjustPublishedInboundFeeRequest {
|
||||
unitPrice: Number(adjustmentForm.unitPrice),
|
||||
additionalAmount: Number(adjustmentForm.additionalAmount),
|
||||
reason: adjustmentForm.reason.trim(),
|
||||
toleranceConfirmed: true,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,6 +304,22 @@ async function submitAdjustment() {
|
||||
if (!snapshot.value) return
|
||||
const valid = await adjustFormRef.value?.validate().catch(() => false)
|
||||
if (!valid) return
|
||||
const nextQuantity = Number(adjustmentForm.chargeableQuantity)
|
||||
if (nextQuantity < adjustmentMinimum.value || nextQuantity > adjustmentMaximum.value) {
|
||||
ElMessage.warning(`调整后计费量须在基准值的 ±10% 范围内(${formatNumber(adjustmentMinimum.value, 4)}–${formatNumber(adjustmentMaximum.value, 4)} ${chargeUnitLabel.value})`)
|
||||
return
|
||||
}
|
||||
if (adjustmentQuantityChanged.value) {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`计费量将由 ${formatNumber(adjustmentBaseline.value, 4)} 调整为 ${formatNumber(nextQuantity, 4)} ${chargeUnitLabel.value},并生成新费用版本。是否继续?`,
|
||||
'再次确认计费量调整',
|
||||
{ type: 'warning', confirmButtonText: '确认调整', cancelButtonText: '返回检查' },
|
||||
)
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
}
|
||||
const payload = adjustmentPayload()
|
||||
adjustmentError.value = null
|
||||
conflictRefreshed.value = false
|
||||
@@ -364,7 +393,7 @@ defineExpose({ reload: loadFee })
|
||||
data-testid="adjust-fee-button"
|
||||
type="primary"
|
||||
@click="openAdjustment"
|
||||
><PencilLine :size="16" />调整初算费用</el-button>
|
||||
><PencilLine :size="16" />{{ snapshot?.feeStatus === 'CALCULATED' ? '调整初算费用' : '调整已发布费用' }}</el-button>
|
||||
<el-button
|
||||
v-if="!displayOnly && canConfirm && snapshot?.feeStatus === 'CALCULATED'"
|
||||
data-testid="confirm-fee-button"
|
||||
@@ -452,12 +481,15 @@ defineExpose({ reload: loadFee })
|
||||
<section class="calculation-section" aria-labelledby="calculation-title">
|
||||
<div class="section-title">
|
||||
<div><h4 id="calculation-title">计费依据</h4><p v-if="!compact">实际重量与体积重量取大后计费,金额以服务端快照为准。</p></div>
|
||||
<el-tag effect="plain">{{ taxModeLabel(snapshot.taxMode) }}</el-tag>
|
||||
<div class="calculation-tags">
|
||||
<el-tag effect="plain">订单报关:{{ taxModeLabel(snapshot.taxMode) }}</el-tag>
|
||||
<el-tag effect="plain">报价税制:{{ pricingTaxModeLabel(snapshot.pricingTaxMode) }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<div class="calculation-flow">
|
||||
<div><span>实际重量</span><strong>{{ formatNumber(snapshot.actualWeightKg, 3) }} KG</strong></div>
|
||||
<div><span>实际体积</span><strong>{{ formatNumber(snapshot.actualVolumeCbm, 4) }} CBM</strong></div>
|
||||
<div><span>体积重量</span><strong>{{ formatNumber(snapshot.convertedQuantity, snapshot.roundingScale) }} {{ chargeUnitLabel }}</strong><small>系数 {{ formatNumber(snapshot.conversionFactor, 4) }}</small></div>
|
||||
<div><span>{{ convertedQuantityLabel }}</span><strong>{{ formatNumber(snapshot.convertedQuantity, snapshot.roundingScale) }} {{ chargeUnitLabel }}</strong><small>系数 {{ formatNumber(snapshot.conversionFactor, 4) }}</small></div>
|
||||
<div class="is-chargeable"><span>取大后的计费量</span><strong>{{ formatNumber(snapshot.chargeableQuantity, snapshot.roundingScale) }} {{ chargeUnitLabel }}</strong></div>
|
||||
</div>
|
||||
<div class="amount-equation" aria-label="费用计算公式">
|
||||
@@ -517,6 +549,10 @@ defineExpose({ reload: loadFee })
|
||||
@confirm="submitAdjustment"
|
||||
>
|
||||
<el-alert type="warning" :closable="false" show-icon title="调整会生成新的费用版本;小计和总额由服务端按计费量、单价和附加费重算。" />
|
||||
<el-alert class="adjustment-alert" type="info" :closable="false" show-icon>
|
||||
<template #title>计费量允许在系统原始基准值 ±{{ formatNumber(snapshot?.tolerancePercent, 2) }}% 内调整</template>
|
||||
<p>系统基准 {{ formatNumber(adjustmentBaseline, 4) }} {{ chargeUnitLabel }},服务端允许范围 {{ formatNumber(adjustmentMinimum, 4) }}–{{ formatNumber(adjustmentMaximum, 4) }} {{ chargeUnitLabel }}(包含边界);超出范围将无法提交。</p>
|
||||
</el-alert>
|
||||
<el-alert v-if="conflictRefreshed" class="adjustment-alert" type="warning" :closable="false" show-icon>
|
||||
<template #title>费用已被其他操作员更新,系统已刷新最新快照</template>
|
||||
<p>当前输入仍保留,请先核对最新版本后再提交。</p>
|
||||
@@ -524,7 +560,7 @@ defineExpose({ reload: loadFee })
|
||||
<el-form ref="adjustFormRef" :model="adjustmentForm" :rules="adjustmentRules" label-position="top" class="adjustment-form" :disabled="adjusting">
|
||||
<div class="adjustment-amounts">
|
||||
<el-form-item label="调整后计费量" prop="chargeableQuantity" required>
|
||||
<el-input-number v-model="adjustmentForm.chargeableQuantity" aria-label="调整后计费量" :min="0.0001" :max="999999999999.9999" :precision="4" :step="1" controls-position="right" placeholder="请输入调整后计费量" />
|
||||
<el-input-number v-model="adjustmentForm.chargeableQuantity" aria-label="调整后计费量" :min="adjustmentMinimum" :max="adjustmentMaximum" :precision="4" :step="1" controls-position="right" placeholder="请输入调整后计费量" />
|
||||
<span class="adjustment-unit">{{ chargeUnitLabel }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="调整后单价" prop="unitPrice" required>
|
||||
@@ -571,6 +607,7 @@ defineExpose({ reload: loadFee })
|
||||
.version-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
||||
.calculation-section, .fee-timeline { padding: 10px 0; border-bottom: 1px solid var(--cc-border); }
|
||||
.section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
||||
.calculation-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
|
||||
.section-title h4 { font-size: 14px; }
|
||||
.calculation-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 7px; border-top: 1px solid var(--cc-border); border-bottom: 1px solid var(--cc-border); }
|
||||
.calculation-flow > div { display: flex; min-width: 0; min-height: 46px; flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; border-right: 1px solid var(--cc-border); }
|
||||
|
||||
@@ -42,7 +42,7 @@ describe('inbound fee API', () => {
|
||||
|
||||
it('adjusts a published snapshot with the required idempotency key', async () => {
|
||||
vi.mocked(http.put).mockResolvedValue({ code: '200', message: 'success', data: { ...snapshot, feeVersion: 3 } })
|
||||
const payload = { expectedFeeVersion: 2, chargeableQuantity: 140, unitPrice: 8.2, additionalAmount: 80, reason: '补充已确认的附加费' }
|
||||
const payload = { expectedFeeVersion: 2, chargeableQuantity: 140, unitPrice: 8.2, additionalAmount: 80, reason: '补充已确认的附加费', toleranceConfirmed: true as const }
|
||||
|
||||
await expect(adjustPublishedInboundFee('10001', '88', payload, 'fee-adjust-1'))
|
||||
.resolves.toMatchObject({ feeVersion: 3 })
|
||||
@@ -78,7 +78,7 @@ describe('inbound fee API', () => {
|
||||
const error = await adjustPublishedInboundFee(
|
||||
'10001',
|
||||
'88',
|
||||
{ expectedFeeVersion: 2, chargeableQuantity: 140, unitPrice: 8.2, additionalAmount: 80, reason: '价格修正' },
|
||||
{ expectedFeeVersion: 2, chargeableQuantity: 140, unitPrice: 8.2, additionalAmount: 80, reason: '价格修正', toleranceConfirmed: true },
|
||||
'fee-adjust-2',
|
||||
).catch((reason: unknown) => reason)
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ export interface InboundFeeSnapshot {
|
||||
carrierName: string
|
||||
destinationCode: string
|
||||
taxMode: string
|
||||
pricingTaxMode: string | null
|
||||
chargeMode: InboundChargeMode
|
||||
conversionFactor: number
|
||||
roundingScale: number
|
||||
@@ -33,6 +34,10 @@ export interface InboundFeeSnapshot {
|
||||
actualWeightKg: number
|
||||
actualVolumeCbm: number
|
||||
convertedQuantity: number
|
||||
baselineChargeableQuantity: number
|
||||
lowerChargeableQuantity: number
|
||||
upperChargeableQuantity: number
|
||||
tolerancePercent: number
|
||||
chargeableQuantity: number
|
||||
chargeUnit: string
|
||||
unitPrice: number | null
|
||||
@@ -58,4 +63,5 @@ export interface AdjustPublishedInboundFeeRequest {
|
||||
unitPrice: number
|
||||
additionalAmount: number
|
||||
reason: string
|
||||
toleranceConfirmed: true
|
||||
}
|
||||
|
||||
@@ -89,6 +89,9 @@ function measurement(overrides: Partial<InboundMeasurementDetail> = {}): Inbound
|
||||
items: [{
|
||||
id: '9101',
|
||||
inboundDetailId: '8101',
|
||||
inboundCode: 'RK202608040001',
|
||||
fbaShipmentNo: 'FBA18ABC1234',
|
||||
scannedShipmentId: 'FBA18SCAN5678',
|
||||
boxCode: 'RK202608040001#10-1',
|
||||
itemNo: '001',
|
||||
boxSpecification: '50×40×30cm',
|
||||
@@ -168,6 +171,8 @@ describe('InboundMeasurementPanel', () => {
|
||||
|
||||
expect(getInboundMeasurement).toHaveBeenCalledWith('10001', '7001')
|
||||
expect(wrapper.text()).toContain('RK202608040001')
|
||||
expect(wrapper.find('.measurement-table').text()).toContain('FBA18ABC1234')
|
||||
expect(wrapper.find('.measurement-table').text()).toContain('FBA18SCAN5678')
|
||||
expect(wrapper.find('.measurement-table').text()).toContain('0.6')
|
||||
expect(wrapper.find('.measurement-table').text()).not.toContain('周长')
|
||||
await wrapper.find('.el-table__expand-icon').trigger('click')
|
||||
|
||||
@@ -32,6 +32,9 @@ const emit = defineEmits<{
|
||||
type EditableMeasurementItem = Omit<SaveInboundMeasurementItemRequest, 'coefficientMode'> & {
|
||||
itemId: string
|
||||
clientKey: string
|
||||
inboundCode: string
|
||||
fbaShipmentNo: string | null
|
||||
scannedShipmentId: string | null
|
||||
serverValues: Pick<InboundMeasurementItem, 'girthCm' | 'unitVolumeCbm' | 'totalWeightKg' | 'totalVolumeCbm' | 'volumeWeightKg'>
|
||||
chargeRuleId: string | null
|
||||
coefficientMode: 'ACTUAL' | 'ADD' | 'MULTIPLY'
|
||||
@@ -266,6 +269,9 @@ function editableItem(item: InboundMeasurementItem): EditableMeasurementItem {
|
||||
itemId: String(item.id),
|
||||
inboundDetailId: String(item.inboundDetailId || item.id),
|
||||
clientKey: nextItemKey(),
|
||||
inboundCode: item.inboundCode || '—',
|
||||
fbaShipmentNo: item.fbaShipmentNo || null,
|
||||
scannedShipmentId: item.scannedShipmentId || null,
|
||||
boxCode: item.boxCode,
|
||||
itemNo: item.itemNo,
|
||||
boxSpecification: item.boxSpecification,
|
||||
@@ -701,6 +707,15 @@ defineExpose({ saveDraft, submitForReview, updateActualWeights, mayMaintain, may
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="itemNo" label="#" width="70" align="center" />
|
||||
<el-table-column label="入仓码" min-width="154" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.inboundCode || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="FBA 货件号" min-width="150" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.fbaShipmentNo || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="设备实扫货件号" min-width="164" show-overflow-tooltip>
|
||||
<template #default="{ row }">{{ row.scannedShipmentId || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="箱号" min-width="156" show-overflow-tooltip>
|
||||
<template #default="{ row }"><span class="measurement-box-code">{{ row.boxCode || '—' }}</span></template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -13,7 +13,10 @@ export type InboundMeasurementProcessStatus =
|
||||
|
||||
export interface InboundMeasurementItem {
|
||||
id: MeasurementIdentifier
|
||||
inboundCode?: string | null
|
||||
inboundDetailId?: MeasurementIdentifier | null
|
||||
fbaShipmentNo?: string | null
|
||||
scannedShipmentId?: string | null
|
||||
boxCode: string | null
|
||||
itemNo: string
|
||||
boxSpecification: string
|
||||
|
||||
@@ -48,7 +48,7 @@ const detail = {
|
||||
summary: preloadSummary,
|
||||
items: [{
|
||||
itemId: 11, itemVersion: 4, accountId: 12, orderId: 15, orderNo: 'ORD-001', inboundId: 13, inboundDetailId: 14, containerNo: 'MSCU1234567', productQuantity: 20,
|
||||
customerName: '测试客户', inboundCode: 'RK001', skuCode: 'SKU001', destinationWarehouse: 'ONT8', chineseName: '产品', englishName: null,
|
||||
customerName: '测试客户', customsTaxMode: 'TAX_REFUND', taxRefundFlag: true, inboundCode: 'RK001', skuCode: 'SKU001', destinationWarehouse: 'ONT8', chineseName: '产品', englishName: null,
|
||||
goodsImageUrl: null, packageCount: 2, palletCount: 1, grossWeightKg: 10, netWeightKg: 9, volumeCbm: 1,
|
||||
dimensionalWeightKg: 2, unitsPerPackage: 10, fbaTrackingNo: null, shipmentNo: null, shippingMark: null,
|
||||
internalRemark: null, customerRemark: null, warehouseRemark: null, loadSequence: 1, frozenAt: null,
|
||||
@@ -75,7 +75,7 @@ describe('platform loading lists API', () => {
|
||||
vi.spyOn(http, 'get').mockResolvedValue({ code: '200', message: 'ok', data: detail })
|
||||
const result = await getPreloadPlan('100', '300')
|
||||
|
||||
expect(result.items[0]).toMatchObject({ itemId: '11', itemVersion: 4, accountId: '12', orderId: '15', orderNo: 'ORD-001', inboundId: '13', inboundDetailId: '14', containerNo: 'MSCU1234567', productQuantity: '20' })
|
||||
expect(result.items[0]).toMatchObject({ itemId: '11', itemVersion: 4, accountId: '12', orderId: '15', orderNo: 'ORD-001', inboundId: '13', inboundDetailId: '14', containerNo: 'MSCU1234567', productQuantity: '20', customsTaxMode: 'TAX_REFUND', taxRefundFlag: true })
|
||||
expect(result.summary.containerBookingId).toBe('1900000000000000004')
|
||||
expect(result.histories[0]).toMatchObject({ historyId: '21', itemId: '11', operationId: 'transport-21', operatorId: '22' })
|
||||
})
|
||||
|
||||
@@ -80,6 +80,8 @@ export interface LoadingItem {
|
||||
itemVersion: number
|
||||
accountId: string
|
||||
customerName: string | null
|
||||
customsTaxMode: 'TAX_REFUND' | 'BUY_DECLARATION' | null
|
||||
taxRefundFlag: boolean | null
|
||||
orderId: string
|
||||
orderNo: string
|
||||
inboundId: string
|
||||
|
||||
@@ -33,6 +33,7 @@ const baseItemColumns: DataTableColumn[] = [
|
||||
{ key: 'skuCode', prop: 'skuCode', label: 'SKU', minWidth: 150, className: 'identifier-column', showOverflowTooltip: true },
|
||||
{ key: 'destinationWarehouse', prop: 'destinationWarehouse', label: '目的仓', minWidth: 150, className: 'identifier-column', showOverflowTooltip: true },
|
||||
{ key: 'customerName', prop: 'customerName', label: '客户', minWidth: 150 },
|
||||
{ key: 'taxRefundFlag', label: '是否退税', width: 96, align: 'center', slotName: 'taxRefundFlag' },
|
||||
{ key: 'chineseName', prop: 'chineseName', label: '中文品名', minWidth: 160 },
|
||||
{ key: 'englishName', prop: 'englishName', label: '英文品名', minWidth: 170 },
|
||||
{ key: 'netWeightKg', label: '净重(kg)', width: 110, align: 'right', slotName: 'netWeight' },
|
||||
@@ -214,6 +215,7 @@ function formatNumber(value?: number | null, digits = 3) {
|
||||
</template>
|
||||
<template #grossWeight="{ row }">{{ formatNumber(row.grossWeightKg) }}</template>
|
||||
<template #netWeight="{ row }">{{ formatNumber(row.netWeightKg) }}</template>
|
||||
<template #taxRefundFlag="{ row }">{{ row.taxRefundFlag === true ? '是' : row.taxRefundFlag === false ? '否' : '—' }}</template>
|
||||
<template #volume="{ row }">{{ formatNumber(row.volumeCbm) }}</template>
|
||||
<template #dimensionalWeight="{ row }">{{ formatNumber(row.dimensionalWeightKg) }}</template>
|
||||
<template #customerRemark="{ row }"><div class="remark-cell"><span>{{ row.customerRemark || '—' }}</span><small>来源:客户下单</small></div></template>
|
||||
|
||||
@@ -152,6 +152,7 @@ describe('LoadingListsView', () => {
|
||||
expect(detailSource.indexOf("key: 'orderNo'")).toBeLessThan(detailSource.indexOf("key: 'containerNo'"))
|
||||
expect(detailSource.indexOf("key: 'containerNo'")).toBeLessThan(detailSource.indexOf("key: 'skuCode'"))
|
||||
const fields = [
|
||||
'taxRefundFlag',
|
||||
'chineseName',
|
||||
'englishName',
|
||||
'netWeightKg',
|
||||
|
||||
@@ -3,6 +3,7 @@ import { http } from '@/shared/api/http'
|
||||
import {
|
||||
approvePlatformUnifiedOrder,
|
||||
batchApprovePlatformUnifiedOrders,
|
||||
getPlatformUnifiedOrderBatchApprovalPreview,
|
||||
addPlatformUnifiedOrderNote,
|
||||
getPlatformUnifiedOrder,
|
||||
downloadPlatformProductImage,
|
||||
@@ -134,11 +135,39 @@ describe('unified orders API contract', () => {
|
||||
} })
|
||||
|
||||
await expect(batchApprovePlatformUnifiedOrders('2089176869176389634', [
|
||||
'2089223263733518337', '2089223263733518338',
|
||||
{ orderId: '2089223263733518337', orderVersion: 3 },
|
||||
{ orderId: '2089223263733518338', orderVersion: 8 },
|
||||
])).resolves.toMatchObject({ successCount: 1, failureCount: 1 })
|
||||
expect(http.post).toHaveBeenCalledWith(
|
||||
'/platform/v1/orders/first-leg/batch-approve',
|
||||
{ orderIds: ['2089223263733518337', '2089223263733518338'] },
|
||||
{ items: [
|
||||
{ orderId: '2089223263733518337', orderVersion: 3 },
|
||||
{ orderId: '2089223263733518338', orderVersion: 8 },
|
||||
] },
|
||||
{ params: { tenantId: '2089176869176389634' } },
|
||||
)
|
||||
})
|
||||
|
||||
it('loads one batch-review preview with Chinese goods and normalizes long IDs', async () => {
|
||||
vi.mocked(http.post).mockResolvedValue({ data: {
|
||||
total: 1,
|
||||
approvableCount: 1,
|
||||
items: [{
|
||||
orderId: '2089223263733518337', orderVersion: '3', inboundCode: 'NYEXX2609080001',
|
||||
customerId: '2089176869176389634', customerName: '测试客户', chineseGoodsNames: [' 蓝牙音箱 ', ''],
|
||||
channelCode: 'NY_EXX', channelName: '纽约海运', destinationWarehouseCode: 'ONT8',
|
||||
destinationWarehouseName: 'ONT8 亚马逊仓', canApprove: true, blockReason: null,
|
||||
}],
|
||||
} })
|
||||
const items = [{ orderId: '2089223263733518337', orderVersion: 3 }]
|
||||
|
||||
await expect(getPlatformUnifiedOrderBatchApprovalPreview('2089176869176389634', items)).resolves.toMatchObject({
|
||||
total: 1, approvableCount: 1,
|
||||
items: [{ orderId: '2089223263733518337', orderVersion: 3, chineseGoodsNames: ['蓝牙音箱'] }],
|
||||
})
|
||||
expect(http.post).toHaveBeenCalledWith(
|
||||
'/platform/v1/orders/first-leg/batch-review-preview',
|
||||
{ items },
|
||||
{ params: { tenantId: '2089176869176389634' } },
|
||||
)
|
||||
})
|
||||
|
||||
@@ -540,10 +540,59 @@ export interface UnifiedOrderBatchApprovalResult {
|
||||
failedOrders: Array<{ orderId: number | string; code: string; message: string }>
|
||||
}
|
||||
|
||||
export function batchApprovePlatformUnifiedOrders(tenantId: string, orderIds: string[]) {
|
||||
export interface UnifiedOrderBatchReviewItem {
|
||||
orderId: string
|
||||
orderVersion: number
|
||||
}
|
||||
|
||||
export interface UnifiedOrderBatchApprovalPreviewItem extends UnifiedOrderBatchReviewItem {
|
||||
inboundCode: string | null
|
||||
customerId: string | null
|
||||
customerName: string | null
|
||||
chineseGoodsNames: string[]
|
||||
channelCode: string | null
|
||||
channelName: string | null
|
||||
destinationWarehouseCode: string | null
|
||||
destinationWarehouseName: string | null
|
||||
canApprove: boolean
|
||||
blockReason: string | null
|
||||
}
|
||||
|
||||
export interface UnifiedOrderBatchApprovalPreview {
|
||||
total: number
|
||||
approvableCount: number
|
||||
items: UnifiedOrderBatchApprovalPreviewItem[]
|
||||
}
|
||||
|
||||
function normalizeBatchApprovalPreview(result: UnifiedOrderBatchApprovalPreview): UnifiedOrderBatchApprovalPreview {
|
||||
return {
|
||||
...result,
|
||||
total: integer(result.total, 0),
|
||||
approvableCount: integer(result.approvableCount, 0),
|
||||
items: (result.items || []).map((item) => ({
|
||||
...item,
|
||||
orderId: String(item.orderId),
|
||||
orderVersion: integer(item.orderVersion, 0),
|
||||
customerId: id(item.customerId),
|
||||
chineseGoodsNames: (item.chineseGoodsNames || []).map((name) => name.trim()).filter(Boolean),
|
||||
canApprove: Boolean(item.canApprove),
|
||||
})),
|
||||
}
|
||||
}
|
||||
|
||||
export async function getPlatformUnifiedOrderBatchApprovalPreview(tenantId: string, items: UnifiedOrderBatchReviewItem[]) {
|
||||
const response = await http.post<ApiEnvelope<UnifiedOrderBatchApprovalPreview>, ApiEnvelope<UnifiedOrderBatchApprovalPreview>>(
|
||||
'/platform/v1/orders/first-leg/batch-review-preview',
|
||||
{ items },
|
||||
{ params: { tenantId } },
|
||||
)
|
||||
return normalizeBatchApprovalPreview(unwrapApiResponse(response))
|
||||
}
|
||||
|
||||
export function batchApprovePlatformUnifiedOrders(tenantId: string, items: UnifiedOrderBatchReviewItem[]) {
|
||||
return http.post<ApiEnvelope<UnifiedOrderBatchApprovalResult>, ApiEnvelope<UnifiedOrderBatchApprovalResult>>(
|
||||
'/platform/v1/orders/first-leg/batch-approve',
|
||||
{ orderIds },
|
||||
{ items },
|
||||
{ params: { tenantId } },
|
||||
).then(unwrapApiResponse)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import type {
|
||||
InboundFeeSupplierOption, SaveInboundFeeDetailRequest,
|
||||
} from '@/modules/unified-orders/api/inboundFeeDetails'
|
||||
|
||||
const props = defineProps<{ accountId: string; inboundId: string }>()
|
||||
const props = defineProps<{ accountId: string; inboundId: string; destinationType?: string | null }>()
|
||||
interface OtherFeeSummary { currency: string; approvedReceivable: number; approvedPayable: number }
|
||||
const emit = defineEmits<{ changed: []; summary: [value: OtherFeeSummary] }>()
|
||||
const access = useAccessPreviewStore()
|
||||
@@ -74,7 +74,11 @@ const directionOptions = computed(() => [
|
||||
{ label: '应收', value: 'RECEIVABLE' },
|
||||
{ label: '应付', value: 'PAYABLE', disabled: !canViewSuppliers.value },
|
||||
])
|
||||
const applicableItems = computed(() => feeItems.value.filter((item) => form.direction === 'RECEIVABLE' ? item.warehouseReceivable : item.warehousePayable))
|
||||
const privateDeliveryFeeCode = 'PRIVATE_LAST_MILE_DELIVERY'
|
||||
const applicableItems = computed(() => feeItems.value.filter((item) => {
|
||||
if (item.feeCode === privateDeliveryFeeCode && props.destinationType !== 'PRIVATE') return false
|
||||
return form.direction === 'RECEIVABLE' ? item.warehouseReceivable : item.warehousePayable
|
||||
}))
|
||||
const selectedFeeItem = computed(() => feeItems.value.find((item) => String(item.id) === String(form.feeItemId)))
|
||||
|
||||
function isManual(row: InboundFeeDetail) { return row.sourceType === 'MANUAL' }
|
||||
@@ -298,7 +302,7 @@ onMounted(() => void load())
|
||||
<el-table-column label="应收/应付" width="110"><template #default="{ row }">{{ directionLabel(row.direction) }}</template></el-table-column>
|
||||
<el-table-column label="结算方式" width="120"><template #default="{ row }">{{ settlementLabel(row as InboundFeeDetail) }}</template></el-table-column>
|
||||
<el-table-column label="已付摘要" min-width="290" show-overflow-tooltip><template #default="{ row }">{{ paidSummary(row as InboundFeeDetail) }}</template></el-table-column>
|
||||
<el-table-column prop="feeTypeNameSnapshot" label="费用类型" min-width="150" />
|
||||
<el-table-column label="费用类型" min-width="190" show-overflow-tooltip><template #default="{ row }"><span>{{ row.feeTypeNameSnapshot }}</span><el-tag v-if="row.feeTypeNameSnapshot === '私人仓尾程派送费'" class="private-delivery-tag" size="small" type="warning" effect="light">仅私人仓</el-tag></template></el-table-column>
|
||||
<el-table-column label="供应商/客户" min-width="170"><template #default="{ row }">{{ row.direction === 'PAYABLE' ? row.supplierName : row.customerName || '—' }}</template></el-table-column>
|
||||
<el-table-column prop="businessDate" label="业务发生日" width="130" />
|
||||
<el-table-column prop="currency" label="货币" width="90" />
|
||||
@@ -314,6 +318,7 @@ onMounted(() => void load())
|
||||
|
||||
<AppDialog v-model="editorOpen" :title="editorMode === 'create' ? '新增费用' : editorMode === 'adjust' ? '调整已审核费用' : '编辑费用'" width="min(680px, calc(100vw - 28px))" :confirm-loading="saving" confirm-text="保存" @confirm="save">
|
||||
<el-alert v-if="editorMode === 'adjust'" title="调整将生成新版本并重新进入待审核状态" type="warning" :closable="false" show-icon />
|
||||
<el-alert v-if="selectedFeeItem?.feeCode === privateDeliveryFeeCode" title="私人仓尾程派送费仅适用于目的仓类型为“私人仓”的订单,最终资格由服务端校验。" type="info" :closable="false" show-icon />
|
||||
<el-alert v-if="!canViewFeeItems" title="当前账号缺少费用项目查看权限,无法新增或修改费用" type="warning" :closable="false" show-icon />
|
||||
<el-alert v-if="!canViewSuppliers" title="当前账号缺少供应商查看权限,应付费用不可维护;应收费用不受影响" type="warning" :closable="false" show-icon />
|
||||
<el-alert v-if="feeItemsError" type="error" :closable="true" @close="feeItemsError = null"><template #title>{{ feeItemsError.message }}</template><ApiErrorMeta :details="feeItemsError" /></el-alert>
|
||||
@@ -360,6 +365,7 @@ onMounted(() => void load())
|
||||
.voucher-field { grid-column: 1 / -1; }.voucher-control { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; width: 100%; }.voucher-picker { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--cc-border); border-radius: 6px; color: var(--el-color-primary); cursor: pointer; }.voucher-picker.is-disabled { cursor: not-allowed; opacity: .6; }.voucher-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }.voucher-hint { color: var(--cc-muted); font-size: 12px; }.voucher-list { display: grid; width: 100%; gap: 6px; margin-top: 8px; }.voucher-list > span { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 9px; border-radius: 5px; background: var(--el-fill-color-light); }.voucher-list > span > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.voucher-list button { display: inline-flex; padding: 2px; border: 0; background: transparent; color: var(--el-color-danger); cursor: pointer; }
|
||||
.fee-table-shell { min-width: 0; max-width: 100%; overflow: hidden; }
|
||||
.fee-table-shell :deep(.el-table) { width: 100%; max-width: 100%; }
|
||||
.private-delivery-tag { margin-left: 6px; vertical-align: middle; }
|
||||
@keyframes fee-refresh-spin { to { transform: rotate(360deg); } }
|
||||
@media (max-width: 720px) { .fee-toolbar { align-items: flex-start; flex-direction: column; } .fee-form { grid-template-columns: 1fr; } .fee-form :deep(.el-form-item:last-child) { grid-column: auto; } }
|
||||
</style>
|
||||
|
||||
@@ -108,6 +108,9 @@ describe('UnifiedOrdersView contract', () => {
|
||||
expect(source).not.toContain('批量审核接口待接入')
|
||||
expect(source).toContain('@selection-change="handleOrderSelectionChange"')
|
||||
expect(source).toContain('batchApprovePlatformUnifiedOrders')
|
||||
expect(source).toContain('getPlatformUnifiedOrderBatchApprovalPreview')
|
||||
expect(source).toContain('中文品名')
|
||||
expect(source).toContain('确认批量审核')
|
||||
expect(source).toContain('批量审核通过')
|
||||
expect(source).toContain('title="订单列表暂时无法加载"')
|
||||
expect(source).toContain('empty-text="暂无符合条件的订单"')
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
downloadPlatformProductImage,
|
||||
approvePlatformUnifiedOrder,
|
||||
batchApprovePlatformUnifiedOrders,
|
||||
getPlatformUnifiedOrderBatchApprovalPreview,
|
||||
addPlatformUnifiedOrderNote,
|
||||
listPlatformUnifiedOrders,
|
||||
updatePlatformUnifiedOrderPlanning,
|
||||
@@ -16,6 +17,8 @@ import {
|
||||
type UnifiedOrderCoLoadGroupSummary,
|
||||
type UnifiedOrderMainStatus,
|
||||
type UnifiedOrderResource,
|
||||
type UnifiedOrderBatchApprovalPreviewItem,
|
||||
type UnifiedOrderBatchReviewItem,
|
||||
} from '@/modules/unified-orders/api/unifiedOrders'
|
||||
import { cancelPlatformCoLoadGroup, createPlatformCoLoadGroup, getPlatformCoLoadGroupByInboundCode, type CoLoadBusinessSummary, type CoLoadGroup } from '@/modules/unified-orders/api/coLoadGroups'
|
||||
import OrderFulfillmentTreePanel from '@/modules/unified-orders/components/OrderFulfillmentTreePanel.vue'
|
||||
@@ -150,6 +153,12 @@ const approvalOpen = ref(false)
|
||||
const approvalLoadingId = ref('')
|
||||
const approvalSaving = ref(false)
|
||||
const batchApprovalSaving = ref(false)
|
||||
const batchApprovalLoading = ref(false)
|
||||
const batchApprovalOpen = ref(false)
|
||||
const batchApprovalError = ref<ApiErrorDetails | null>(null)
|
||||
const batchApprovalPreviewRows = ref<UnifiedOrderBatchApprovalPreviewItem[]>([])
|
||||
const batchApprovalSelectedRows = ref<UnifiedOrderBatchApprovalPreviewItem[]>([])
|
||||
const batchApprovalTableRef = ref<{ toggleRowSelection: (row: UnifiedOrderBatchApprovalPreviewItem, selected?: boolean) => void }>()
|
||||
const exportSubmitting = ref(false)
|
||||
const selectedApprovalOrders = ref<UnifiedOrderResource[]>([])
|
||||
const selectedOrders = ref<UnifiedOrderResource[]>([])
|
||||
@@ -1809,27 +1818,62 @@ async function cancelCoLoadGroup() {
|
||||
}
|
||||
}
|
||||
|
||||
async function batchApproveOrders() {
|
||||
function batchReviewItem(order: UnifiedOrderResource): UnifiedOrderBatchReviewItem {
|
||||
return { orderId: String(order.orderId), orderVersion: Number(order.orderVersion || 0) }
|
||||
}
|
||||
|
||||
function handleBatchApprovalSelection(rows: UnifiedOrderBatchApprovalPreviewItem[]) {
|
||||
batchApprovalSelectedRows.value = rows
|
||||
}
|
||||
|
||||
async function openBatchApproval() {
|
||||
const selected = [...selectedApprovalOrders.value]
|
||||
if (!selected.length || batchApprovalSaving.value) return
|
||||
batchApprovalSaving.value = true
|
||||
if (!selected.length || batchApprovalLoading.value || batchApprovalSaving.value) return
|
||||
batchApprovalOpen.value = true
|
||||
batchApprovalLoading.value = true
|
||||
batchApprovalError.value = null
|
||||
batchApprovalPreviewRows.value = []
|
||||
batchApprovalSelectedRows.value = []
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认批量审核通过已勾选的 ${selected.length} 个订单吗?审核后订单将进入待测量。`,
|
||||
'批量审核订单',
|
||||
{ confirmButtonText: '确认批量审核', cancelButtonText: '取消', type: 'warning' },
|
||||
)
|
||||
const groups = new Map<string, UnifiedOrderResource[]>()
|
||||
selected.forEach((order) => {
|
||||
const tenantId = String(order.tenantId)
|
||||
groups.set(tenantId, [...(groups.get(tenantId) || []), order])
|
||||
})
|
||||
const previews = await Promise.all([...groups].map(([tenantId, orders]) => (
|
||||
getPlatformUnifiedOrderBatchApprovalPreview(tenantId, orders.map(batchReviewItem))
|
||||
)))
|
||||
batchApprovalPreviewRows.value = previews.flatMap((preview) => preview.items)
|
||||
await nextTick()
|
||||
batchApprovalPreviewRows.value.forEach((row) => {
|
||||
if (row.canApprove) batchApprovalTableRef.value?.toggleRowSelection(row, true)
|
||||
})
|
||||
} catch (error) {
|
||||
batchApprovalError.value = getApiErrorDetails(error, '批量审核预览加载失败,请刷新订单后重试')
|
||||
} finally {
|
||||
batchApprovalLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function batchApproveOrders() {
|
||||
const selected = [...batchApprovalSelectedRows.value]
|
||||
if (!selected.length || batchApprovalSaving.value) return
|
||||
batchApprovalSaving.value = true
|
||||
try {
|
||||
const groups = new Map<string, UnifiedOrderBatchApprovalPreviewItem[]>()
|
||||
selected.forEach((order) => {
|
||||
const tenantId = String(order.customerId)
|
||||
groups.set(tenantId, [...(groups.get(tenantId) || []), order])
|
||||
})
|
||||
let successCount = 0
|
||||
let failureCount = 0
|
||||
const failures: string[] = []
|
||||
for (const [tenantId, orders] of groups) {
|
||||
try {
|
||||
const result = await batchApprovePlatformUnifiedOrders(tenantId, orders.map((order) => String(order.orderId)))
|
||||
const result = await batchApprovePlatformUnifiedOrders(tenantId, orders.map((order) => ({
|
||||
orderId: order.orderId,
|
||||
orderVersion: order.orderVersion,
|
||||
})))
|
||||
successCount += result.successCount
|
||||
failureCount += result.failureCount
|
||||
failures.push(...result.failedOrders.map((failure) => failure.message))
|
||||
@@ -1838,13 +1882,12 @@ async function batchApproveOrders() {
|
||||
failures.push(getApiErrorDetails(error, '该客户订单批量审核失败').message)
|
||||
}
|
||||
}
|
||||
batchApprovalOpen.value = false
|
||||
await loadOrders()
|
||||
const reason = [...new Set(failures.filter(Boolean))].slice(0, 3).join(';')
|
||||
if (!failureCount) ElMessage.success(`已批量审核通过 ${successCount} 个订单`)
|
||||
else if (successCount) ElMessage.warning(`批量审核完成:成功 ${successCount} 个,失败 ${failureCount} 个${reason ? `。${reason}` : ''}`)
|
||||
else ElMessage.error(`批量审核失败:${failureCount} 个订单未通过${reason ? `。${reason}` : ''}`)
|
||||
} catch (error) {
|
||||
if (error !== 'cancel' && error !== 'close') ElMessage.error(getApiErrorDetails(error, '批量审核失败').message)
|
||||
} finally {
|
||||
batchApprovalSaving.value = false
|
||||
}
|
||||
@@ -2243,6 +2286,7 @@ onBeforeUnmount(() => {
|
||||
<InboundFeeDetailManager
|
||||
:account-id="String(detail.summary.tenantId)"
|
||||
:inbound-id="normalizedInboundId"
|
||||
:destination-type="detail.summary.destinationType"
|
||||
@summary="otherFeeSummary = $event"
|
||||
@changed="loadDetail(true)"
|
||||
/>
|
||||
@@ -2464,7 +2508,7 @@ onBeforeUnmount(() => {
|
||||
<DataTable v-model:page="page" v-model:page-size="pageSize" :data="records" :columns="columns" preference-key="unified-orders-table-v2" :loading="loading" :total="total" :page-sizes="[20, 50, 100]" row-key="orderId" border stripe empty-text="暂无符合条件的订单" aria-label="统一订单列表" @selection-change="handleOrderSelectionChange">
|
||||
<template #toolbar-actions>
|
||||
<el-button v-if="can('platform:order:export') && can('platform:download:list')" :loading="exportSubmitting" :disabled="loading || exportSubmitting" @click="exportOrders"><Download :size="16" />导出<span v-if="selectedOrders.length">(已选 {{ selectedOrders.length }})</span></el-button>
|
||||
<el-button v-if="can('platform:order:approve')" type="success" :loading="batchApprovalSaving" :disabled="loading || !selectedApprovalOrders.length" @click="batchApproveOrders"><CircleCheck :size="16" />批量审核通过<span v-if="selectedApprovalOrders.length">({{ selectedApprovalOrders.length }})</span></el-button>
|
||||
<el-button v-if="can('platform:order:approve')" type="success" :loading="batchApprovalLoading || batchApprovalSaving" :disabled="loading || !selectedApprovalOrders.length" @click="openBatchApproval"><CircleCheck :size="16" />批量审核通过<span v-if="selectedApprovalOrders.length">({{ selectedApprovalOrders.length }})</span></el-button>
|
||||
<div v-if="can('platform:firstleg:smart-loading:assign')" class="coload-toolbar-action">
|
||||
<el-button type="primary" plain :loading="coLoadSaving" :disabled="loading || !canCreateCoLoadGroup" aria-label="合柜报关" @click="openCoLoadCreate"><Link2 :size="16" />合柜报关<span v-if="selectedOrders.length">({{ selectedOrders.length }})</span></el-button>
|
||||
</div>
|
||||
@@ -2554,6 +2598,22 @@ onBeforeUnmount(() => {
|
||||
</template>
|
||||
</ListPageLayout>
|
||||
<SmartLoadingDialog v-model="smartLoadingOpen" />
|
||||
<AppDialog v-model="batchApprovalOpen" title="批量审核订单" confirm-text="确认批量审核" confirm-type="success" width="min(1100px, calc(100vw - 28px))" :loading="batchApprovalLoading" :confirm-loading="batchApprovalSaving" :confirm-disabled="batchApprovalLoading || !batchApprovalSelectedRows.length" destroy-on-close @confirm="batchApproveOrders">
|
||||
<el-alert title="请逐票核对入仓码、客户、中文品名、渠道和目的仓;审核通过后订单进入待测量。" type="info" :closable="false" show-icon />
|
||||
<LoadErrorState v-if="batchApprovalError" compact title="批量审核预览加载失败" :message="batchApprovalError.message" :loading="batchApprovalLoading" @retry="openBatchApproval"><template #details><ApiErrorMeta :details="batchApprovalError" /></template></LoadErrorState>
|
||||
<template v-else>
|
||||
<div class="batch-approval-summary"><span>预览 {{ batchApprovalPreviewRows.length }} 票</span><strong>已勾选 {{ batchApprovalSelectedRows.length }} 票</strong></div>
|
||||
<el-table ref="batchApprovalTableRef" class="batch-approval-table" :data="batchApprovalPreviewRows" row-key="orderId" border stripe max-height="520" empty-text="暂无可审核订单" @selection-change="handleBatchApprovalSelection">
|
||||
<el-table-column type="selection" width="48" fixed="left" :selectable="(row: UnifiedOrderBatchApprovalPreviewItem) => row.canApprove" />
|
||||
<el-table-column label="入仓码" min-width="160" show-overflow-tooltip><template #default="{ row }"><strong>{{ row.inboundCode || '—' }}</strong></template></el-table-column>
|
||||
<el-table-column label="客户" min-width="150" show-overflow-tooltip><template #default="{ row }">{{ row.customerName || '—' }}</template></el-table-column>
|
||||
<el-table-column label="中文品名" min-width="220" show-overflow-tooltip><template #default="{ row }">{{ row.chineseGoodsNames.length ? row.chineseGoodsNames.join('、') : '—' }}</template></el-table-column>
|
||||
<el-table-column label="渠道" min-width="160" show-overflow-tooltip><template #default="{ row }">{{ row.channelName || row.channelCode || '—' }}</template></el-table-column>
|
||||
<el-table-column label="目的仓" min-width="180" show-overflow-tooltip><template #default="{ row }">{{ row.destinationWarehouseName || row.destinationWarehouseCode || '—' }}</template></el-table-column>
|
||||
<el-table-column label="校验结果" min-width="180" show-overflow-tooltip><template #default="{ row }"><el-tag :type="row.canApprove ? 'success' : 'danger'" effect="light">{{ row.canApprove ? '可审核' : row.blockReason || '不可审核' }}</el-tag></template></el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
</AppDialog>
|
||||
<AppDialog v-model="coLoadCreateOpen" title="合柜报关" confirm-text="确认建组" :confirm-loading="coLoadSaving" :confirm-disabled="!canCreateCoLoadGroup" @confirm="createCoLoadGroup">
|
||||
<el-alert type="warning" :closable="false" show-icon :title="`所选 ${selectedOrders.length} 票须属于同一国内仓、同一渠道,并全量进入同一柜;目的仓或目的港可以不同。资格由服务端按完整入仓片段校验。`" />
|
||||
<div class="coload-selection"><span v-for="row in selectedOrders" :key="String(row.orderId)">{{ row.inboundCode || '待生成入仓码' }}</span></div>
|
||||
@@ -2675,6 +2735,9 @@ onBeforeUnmount(() => {
|
||||
.subsequent-fulfillment { min-height: 72px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--cc-border); }
|
||||
.subsequent-fulfillment h3 { margin: 0 0 10px; font-size: 15px; }
|
||||
.fulfillment-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 10px; border: 1px solid var(--cc-border); border-radius: 6px; overflow: hidden; }
|
||||
.batch-approval-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px 0 8px; color: var(--cc-muted); font-size: 13px; white-space: nowrap; }
|
||||
.batch-approval-summary strong { color: var(--cc-text); }
|
||||
.batch-approval-table :deep(.cell) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.fulfillment-facts > div { min-width: 0; padding: 9px 10px; border-right: 1px solid var(--cc-border); background: #fff; }
|
||||
.fulfillment-facts > div.wide { grid-column: span 2; }
|
||||
.fulfillment-facts dt { color: var(--cc-muted); font-size: 12px; }
|
||||
|
||||
Reference in New Issue
Block a user