fix:产品管理折扣值浮点精度问题处理
parent
4b7021b45e
commit
c66bdbcc74
|
|
@ -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 => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue