1
This commit is contained in:
@@ -19,6 +19,13 @@ test('translates backend rounding modes into customer-facing calculation labels'
|
||||
assert.match(source, /return value \? labels\[value\] \|\| value : '-'/)
|
||||
})
|
||||
|
||||
test('translates carton calculation rules into customer-facing labels', () => {
|
||||
assert.match(source, /export function getCalculationRuleLabel/)
|
||||
assert.match(source, /ACTUAL_DIMENSION_V1/)
|
||||
assert.match(source, /按实际箱规计算/)
|
||||
assert.match(source, /CUSTOMER_DIMENSION_\(SMALL\|MEDIUM\|LARGE\|EXTRA_LARGE\)_V/)
|
||||
})
|
||||
|
||||
test('renders conversion metadata as one complete label or a single empty marker', () => {
|
||||
assert.match(source, /export function formatConversionPrecision/)
|
||||
assert.match(source, /roundingScale === null \|\| roundingScale === undefined/)
|
||||
|
||||
@@ -46,6 +46,20 @@ export function getTaxModeLabel(value: string) {
|
||||
return value || '-'
|
||||
}
|
||||
|
||||
export function getCalculationRuleLabel(value: string | null | undefined) {
|
||||
if (!value) return '-'
|
||||
if (value === 'ACTUAL_DIMENSION_V1' || value === 'DIMENSION_ACTUAL_V1') return '按实际箱规计算'
|
||||
const customerRule = /^CUSTOMER_DIMENSION_(SMALL|MEDIUM|LARGE|EXTRA_LARGE)_V(\d+)$/.exec(value)
|
||||
if (customerRule) {
|
||||
const sizeLabel: Record<string, string> = {
|
||||
SMALL: '小号', MEDIUM: '中号', LARGE: '大号', EXTRA_LARGE: '超大号',
|
||||
}
|
||||
return `客户箱规规则(${sizeLabel[customerRule[1]]},V${customerRule[2]})`
|
||||
}
|
||||
const warehouseRule = /^WAREHOUSE_OUTER_OVERRIDE_(.+)$/.exec(value)
|
||||
return warehouseRule ? `仓库外箱规覆盖(${warehouseRule[1]})` : value
|
||||
}
|
||||
|
||||
export function getRoundingModeLabel(value: string | null | undefined) {
|
||||
const labels: Record<string, string> = {
|
||||
UP: '向上舍入',
|
||||
|
||||
Reference in New Issue
Block a user