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 () => {
|
||||
|
||||
Reference in New Issue
Block a user