fix(customers): wait for billing defaults before loading

This commit is contained in:
2026-09-10 22:12:27 +08:00
parent 781d25de08
commit b6b91297ae
4 changed files with 62 additions and 12 deletions
@@ -93,6 +93,24 @@ describe('CustomerBillingRulesPanel', () => {
expect(getCustomerDimensionConfig).not.toHaveBeenCalled()
})
it('does not request billing rules before customer defaults are ready', async () => {
mount(CustomerBillingRulesPanel, {
attachTo: document.body,
props: {
customerId: '8',
customerName: '柏悦物流',
dimensionInitializationStatus: 'PENDING',
},
global: { plugins: [ElementPlus] },
})
await flushPromises()
expect(document.body.textContent).toContain('客户计费规则正在初始化')
expect(document.body.textContent).not.toContain('箱规尺寸规则加载失败')
expect(getCustomerDimensionConfig).not.toHaveBeenCalled()
expect(listCustomerChargeRules).not.toHaveBeenCalled()
})
it('submits all four rows in one update request', async () => {
const wrapper = mount(CustomerBillingRulesPanel, { attachTo: document.body, props: { customerId: '8', customerName: '柏悦物流' }, global: { plugins: [ElementPlus] } })
await flushPromises()