mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 06:29:20 +08:00
fix(workbench): 修复税率输入7%时显示7.000000000000001的浮点精度问题
This commit is contained in:
@@ -131,7 +131,7 @@ const formatTaxRate = (value: null | number | string | undefined) => {
|
||||
const parseTaxRate = (value: string | undefined) => {
|
||||
if (!value) return 0;
|
||||
const num = Number(value.replace('%', '').trim());
|
||||
return Number.isFinite(num) ? num / 100 : 0;
|
||||
return Number.isFinite(num) ? Math.round((num / 100) * 1e12) / 1e12 : 0;
|
||||
};
|
||||
|
||||
const platforms = ref<PlatformVO.Info[]>([]);
|
||||
|
||||
Reference in New Issue
Block a user