我是 JS 和这段代码的初学者
$('.brutto_amount').each(function (index, value) {
let amount = $(this).text().replace(' brutto / rok', '').replace('(', ''); console.log(amount);
if (discountType == 0) {
let newAmount = (amount - discountValue).toFixed(2);
if(newAmount < 0) newAmount = 1;
$(this).html(`${newAmount} brutto / rok `);
} else if (discountType == 1) {
let newAmount = (amount - ((parseInt(amount) * parseInt(discountValue)) / 100)).toFixed(2);
if(newAmount < 0) newAmount = 1;
$(this).html(`${newAmount} brutto / rok `);
}
});
到目前为止工作正常。
如何从变量中减去 23% 的增值税newAmount并将其四舍五入到小数点后两位?
BIG阳
相关分类