优化
This commit is contained in:
@@ -13,7 +13,7 @@ vi.mock('../api/warehouseTransfers', () => ({ getWarehouseTransfer: vi.fn() }))
|
||||
enableAutoUnmount(afterEach)
|
||||
|
||||
describe('LastMileOrderDetailView domestic detail alignment', () => {
|
||||
it.each(['PENDING_REVIEW', 'PARTIALLY_RECEIVED'])('shows SKU forecast before receipt completion (%s) without forecast box counts', async status => {
|
||||
it.each(['PENDING_REVIEW', 'PARTIALLY_RECEIVED', 'COMPLETED'])('shows only customer SKU forecast regardless of receipt status (%s)', async status => {
|
||||
vi.mocked(getLastMileOrder).mockResolvedValue({ order: { id: 'return-tail', customerId: 'C1', orderType: 'RETURN_RELABEL', orderNo: 'RT-1', currentStatus: status, packageCount: 30 },
|
||||
cargo: [], fees: [], statusHistory: [], operationHistory: [],
|
||||
returnReceipt: { order: { returnNo: 'RT-1', status, expectedQuantity: 30, receivedQuantity: 5 }, receipts: [],
|
||||
@@ -28,15 +28,16 @@ describe('LastMileOrderDetailView domestic detail alignment', () => {
|
||||
expect(panel.text()).toContain('30')
|
||||
expect(panel.text()).not.toContain('箱数')
|
||||
})
|
||||
it('uses actual cargo after return receipt completion', async () => {
|
||||
it('keeps customer forecast after completion instead of using actual signed cargo', async () => {
|
||||
vi.mocked(getLastMileOrder).mockResolvedValue({ order: { id: 'return-tail', customerId: 'C1', orderType: 'RETURN_RELABEL', orderNo: 'RT-1', currentStatus: 'INBOUND_COMPLETED' },
|
||||
cargo: [{ id: 'actual', skuCode: 'SKU-ACTUAL', productNameZh: '实收商品', productQuantity: 25, packageCount: 2 }], fees: [], statusHistory: [], operationHistory: [],
|
||||
returnReceipt: { order: { returnNo: 'RT-1', status: 'COMPLETED', expectedQuantity: 30, receivedQuantity: 25 }, receipts: [], items: [{ skuCode: 'SKU-FORECAST', expectedQuantity: 30, receivedQuantity: 25 }] } })
|
||||
const wrapper = mount(LastMileOrderDetailView, { global: { plugins: [ElementPlus] } }); await flushPromises()
|
||||
await wrapper.findAll('[role="tab"]').find(tab => tab.text().includes('货物信息'))!.trigger('click'); await flushPromises()
|
||||
expect(wrapper.get('.table-panel').text()).toContain('SKU-ACTUAL')
|
||||
expect(wrapper.get('.table-panel').text()).not.toContain('SKU-FORECAST')
|
||||
expect(wrapper.get('.table-panel').text()).toContain('25')
|
||||
expect(wrapper.get('.table-panel').text()).not.toContain('SKU-ACTUAL')
|
||||
expect(wrapper.get('.table-panel').text()).toContain('SKU-FORECAST')
|
||||
expect(wrapper.get('.table-panel').text()).toContain('30')
|
||||
expect(wrapper.get('.table-panel').text()).not.toContain('箱数')
|
||||
})
|
||||
it('shows signed box contents and actual quantities on return orders', async () => {
|
||||
vi.mocked(getLastMileOrder).mockResolvedValue({ order: { id: 'tail-return', customerId: 'customer-1', orderNo: 'RETU-1', orderType: 'RETURN_RELABEL', currentStatus: 'INBOUND_COMPLETED' }, cargo: [], fees: [], statusHistory: [], operationHistory: [],
|
||||
|
||||
@@ -135,8 +135,8 @@ const documents = computed<DocumentRow[]>(() => {
|
||||
.filter((item) => item[1]).map(([type, number]) => ({ type: String(type), number: String(number), createdAt: '—', quote: '—' } as DocumentRow))
|
||||
.concat((order.relabelApplications || []).map(application => ({ type: '换标单', number: application.relabelNo, createdAt: formatOverseasDateTime(application.createdAt), quote: '—', status: relabelApplicationStatusLabel(application.status), quantity: application.quantity })))
|
||||
})
|
||||
const cargo = computed<CargoRow[]>(() => showReturnForecast.value && detail.value?.returnReceipt?.items?.length
|
||||
? detail.value.returnReceipt.items.map(item => ({ id: item.skuCode, sku: item.skuCode, productName: text(item.productNameZh),
|
||||
const cargo = computed<CargoRow[]>(() => isReturnOrder.value
|
||||
? (detail.value?.returnReceipt?.items || []).map(item => ({ id: item.skuCode, sku: item.skuCode, productName: text(item.productNameZh),
|
||||
quantity: item.expectedQuantity, pallets: 0, cartons: 0, weight: 0, volume: 0 }))
|
||||
: (detail.value?.cargo || []).map((item) => ({
|
||||
id: String(item.id), sku: text(item.skuCode), productName: text(item.productNameZh), pallets: Number(item.palletCount || 0),
|
||||
@@ -157,7 +157,7 @@ const logs = computed<LogRow[]>(() => {
|
||||
return [...statusRows, ...operationRows].sort((left, right) => right.sortAt.localeCompare(left.sortAt))
|
||||
})
|
||||
|
||||
const cargoColumns = computed<DataTableColumn[]>(() => showReturnForecast.value ? [
|
||||
const cargoColumns = computed<DataTableColumn[]>(() => isReturnOrder.value ? [
|
||||
{ key: 'sku', prop: 'sku', label: 'SKU', minWidth: 150 },
|
||||
{ key: 'productName', prop: 'productName', label: '中文品名', minWidth: 180 },
|
||||
{ key: 'quantity', prop: 'quantity', label: '预报件数', width: 120, align: 'right' },
|
||||
@@ -238,7 +238,7 @@ onMounted(load)
|
||||
<div v-for="field in basicFields" :key="field.label" :class="{ wide: field.wide }"><dt>{{ field.label }}</dt><dd :class="{ 'detail-field-value--business': isSingleLineBusinessField(field), 'package-difference--nonzero': isNonzeroDifference(field) }" :title="isSingleLineBusinessField(field) ? String(field.value) : undefined">{{ field.value }}</dd></div>
|
||||
</dl>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane name="cargo"><template #label><span class="density-tab-icon" aria-hidden="true">📦</span><span>货物信息</span></template><section class="table-panel"><DataTable :data="cargo" :columns="cargoColumns" column-settings-mode="hide" row-key="id" empty-text="暂无货物明细"></DataTable></section></el-tab-pane>
|
||||
<el-tab-pane name="cargo"><template #label><span class="density-tab-icon" aria-hidden="true">📦</span><span>货物信息</span></template><section class="table-panel"><DataTable :data="cargo" :columns="cargoColumns" column-settings-mode="hide" row-key="id" :empty-text="isReturnOrder ? '暂无客户预报货物明细' : '暂无货物明细'"></DataTable></section></el-tab-pane>
|
||||
<el-tab-pane v-if="detail?.order.orderType === 'RETURN_RELABEL'" name="return-receipt"><template #label><span class="density-tab-icon" aria-hidden="true">📦</span><span>退货签收与箱内清点</span></template>
|
||||
<section v-if="detail.returnReceipt" class="table-panel" aria-label="退货签收与箱内清点">
|
||||
<h3>{{ detail.returnReceipt.order.returnNo }} · 实收 {{ detail.returnReceipt.order.receivedQuantity }} / 预报 {{ detail.returnReceipt.order.expectedQuantity }} 件</h3>
|
||||
|
||||
Reference in New Issue
Block a user