优化
This commit is contained in:
@@ -44,12 +44,12 @@ describe('inbound fee-detail API', () => {
|
||||
|
||||
it('keeps an empty supplier category as null and rejects an unknown non-empty category', async () => {
|
||||
vi.mocked(http.get).mockResolvedValue({ code: '200', data: { records: [
|
||||
{ id: 31, feeTypeName: '拖车费', feeCode: 'TRUCKING', supplierCategory: 'TRUCKING', warehousePayable: true },
|
||||
{ id: 31, feeTypeName: '拖车费', feeCode: 'TRUCKING', defaultPrice: '60.25', supplierCategory: 'TRUCKING', warehousePayable: true },
|
||||
{ id: 33, feeTypeName: '缺少类别', feeCode: 'MISSING', warehousePayable: true },
|
||||
] } })
|
||||
await expect(listInboundFeeItemOptions()).resolves.toMatchObject([
|
||||
{ id: 31, feeCode: 'TRUCKING', supplierCategory: 'TRUCKING' },
|
||||
{ id: 33, feeCode: 'MISSING', supplierCategory: null },
|
||||
{ id: 31, feeCode: 'TRUCKING', defaultPrice: 60.25, supplierCategory: 'TRUCKING' },
|
||||
{ id: 33, feeCode: 'MISSING', defaultPrice: null, supplierCategory: null },
|
||||
])
|
||||
vi.mocked(http.get).mockResolvedValue({ code: '200', data: { records: [
|
||||
{ id: 32, feeTypeName: '未知费用', feeCode: 'UNMAPPED', supplierCategory: 'UNKNOWN', warehousePayable: true },
|
||||
|
||||
@@ -53,6 +53,7 @@ export interface SaveInboundFeeDetailRequest {
|
||||
}
|
||||
|
||||
export interface InboundFeeItemOption {
|
||||
defaultPrice: number | null
|
||||
id: string | number
|
||||
feeTypeName: string
|
||||
feeCode: string
|
||||
@@ -123,6 +124,7 @@ export async function listInboundFeeItemOptions() {
|
||||
return (unwrapApiResponse(response).records || []).map((raw): InboundFeeItemOption => ({
|
||||
id: raw.id as string | number,
|
||||
feeTypeName: String(raw.feeTypeName || ''),
|
||||
defaultPrice: raw.defaultPrice == null ? null : Number(raw.defaultPrice),
|
||||
feeCode: String(raw.feeCode || ''),
|
||||
supplierCategory: supplierCategory(raw.supplierCategory),
|
||||
warehousePayable: Boolean(raw.warehousePayable),
|
||||
|
||||
Reference in New Issue
Block a user