fix: wrong decimal
This commit is contained in:
parent
7cb8dd6000
commit
6d43d4e796
2 changed files with 11 additions and 16 deletions
|
|
@ -57,17 +57,13 @@ const currentBtnOpen = ref<{ title: string; opened: boolean[] }[]>([
|
||||||
]);
|
]);
|
||||||
|
|
||||||
function calcPrice(c: (typeof rows.value)[number]) {
|
function calcPrice(c: (typeof rows.value)[number]) {
|
||||||
return precisionRound(
|
const price = c.pricePerUnit * c.amount;
|
||||||
c.pricePerUnit * c.amount -
|
const vat = c.product.calcVat
|
||||||
c.discount +
|
? (c.pricePerUnit * (c.discount ? c.amount : 1) - c.discount) *
|
||||||
precisionRound(
|
(config.value?.vat || 0.07) *
|
||||||
c.product.calcVat
|
(!c.discount ? c.amount : 1)
|
||||||
? (c.pricePerUnit * (c.discount ? c.amount : 1) - c.discount) *
|
: 0;
|
||||||
(config.value?.vat || 0.07)
|
return precisionRound(price + vat);
|
||||||
: 0,
|
|
||||||
) *
|
|
||||||
(!c.discount ? c.amount : 1),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const discount4Show = ref<string[]>([]);
|
const discount4Show = ref<string[]>([]);
|
||||||
|
|
|
||||||
|
|
@ -242,12 +242,11 @@ function getPrice(
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
const price = precisionRound(c.pricePerUnit * c.amount);
|
const price = c.pricePerUnit * c.amount;
|
||||||
const vat =
|
const vat =
|
||||||
precisionRound(
|
(c.pricePerUnit * (c.discount ? c.amount : 1) - c.discount) *
|
||||||
(c.pricePerUnit * (c.discount ? c.amount : 1) - c.discount) *
|
(config.value?.vat || 0.07) *
|
||||||
(config.value?.vat || 0.07),
|
(!c.discount ? c.amount : 1);
|
||||||
) * (!c.discount ? c.amount : 1);
|
|
||||||
|
|
||||||
a.totalPrice = precisionRound(a.totalPrice + price);
|
a.totalPrice = precisionRound(a.totalPrice + price);
|
||||||
a.totalDiscount = precisionRound(a.totalDiscount + Number(c.discount));
|
a.totalDiscount = precisionRound(a.totalDiscount + Number(c.discount));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue