diff --git a/oms_web/oms_vue/src/views/system/product/index.vue b/oms_web/oms_vue/src/views/system/product/index.vue index 048c2b5b..1c48053f 100644 --- a/oms_web/oms_vue/src/views/system/product/index.vue +++ b/oms_web/oms_vue/src/views/system/product/index.vue @@ -353,13 +353,15 @@ export default { if (this.form.guidanceDiscount === null || this.form.guidanceDiscount === undefined) { return ''; } - return (this.form.guidanceDiscount * 100).toString(); + const percentValue = this.normalizeDecimalNumber(this.form.guidanceDiscount * 100); + return percentValue.toString(); }, set(val) { if (val === '' || val === null) { this.form.guidanceDiscount = null; } else { - this.form.guidanceDiscount = parseFloat(val) / 100; + const discountValue = this.normalizeDecimalNumber(parseFloat(val) / 100); + this.form.guidanceDiscount = discountValue; } } } @@ -372,6 +374,9 @@ export default { this.getVendorList(); }, methods: { + normalizeDecimalNumber(value, digits = 12) { + return parseFloat(Number(value).toFixed(digits)); + }, /** 加载字典数据 */ getDicts() { return getDicts('product_type').then(response => {