hookehuyr

feat(plan): 年缴保费显示添加千分位分隔符

- 修改 AmountKeyboard 组件的 displayValue 计算属性
- 显示已确认数值时自动添加千分位(如 1,000、15,000)
- 输入过程中保持原始显示,避免跳动干扰
- 数据存储不变,仅影响显示层

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
......@@ -296,26 +296,24 @@ const inputValue = ref('')
const showAmountModal = ref(false)
/**
* 显示值(元)
* 显示值(元,带千分位
* @type {ComputedRef<string>}
*/
const displayValue = computed(() => {
// 优先显示输入过程中的值(不自动添加小数点)
// 优先显示输入过程中的值(不自动添加小数点/千分位,避免输入时跳动
if (inputValue.value) {
// 直接返回用户输入的值,不自动格式化
return inputValue.value
}
// 如果没有输入值,显示表单的原始值
// 如果没有输入值,显示表单的原始值(带千分位)
if (props.modelValue !== null && props.modelValue !== undefined) {
const yuan = props.modelValue / 100
// 判断是否为整数
if (Number.isInteger(yuan)) {
// 整数,不添加小数点
return yuan.toString()
} else {
// 有小数,保留原样
return yuan.toString()
}
const valueStr = Number.isInteger(yuan)
? yuan.toString()
: yuan.toString()
// 添加千分位分隔符
return valueStr.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}
return ''
})
......