import type { MerchantInboundBilling } from '../types/inboundBilling' /** Published billing quantity and physical gross weight have different meanings. */ export function orderBillingMetric(billing: MerchantInboundBilling | null, measuredChargeableWeight: number | null) { if (billing) { const basis = billing.billingBasis return basis.chargeUnit === 'KG' ? { label: '计费重量', quantity: basis.chargeableQuantity, unit: 'kg' } : basis.chargeUnit === 'CBM' ? { label: '计费体积', quantity: basis.chargeableQuantity, unit: 'm³' } : { label: '计费量', quantity: null, unit: '' } } return { label: '计费重量', quantity: measuredChargeableWeight, unit: 'kg' } }