fix: calc price
This commit is contained in:
parent
997d6c4afa
commit
6c299b8c1b
1 changed files with 16 additions and 15 deletions
|
|
@ -704,18 +704,22 @@ function handleUpdateProductTable(
|
||||||
newInstallmentNo: number;
|
newInstallmentNo: number;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
|
handleChangePayType(quotationFormData.value.payCondition);
|
||||||
// calc price
|
// calc price
|
||||||
const calc = (c: QuotationPayload['productServiceList'][number]) => {
|
const calc = (c: QuotationPayload['productServiceList'][number]) => {
|
||||||
const pricePerUnit = c.pricePerUnit || 0;
|
const originalPrice = c.pricePerUnit || 0;
|
||||||
const discount = c.discount || 0;
|
const finalPriceWithVat = precisionRound(
|
||||||
|
originalPrice * (1 + (config.value?.vat || 0.07)),
|
||||||
return (
|
|
||||||
pricePerUnit * c.amount -
|
|
||||||
discount +
|
|
||||||
(c.product.calcVat
|
|
||||||
? (pricePerUnit * c.amount - discount) * (config.value?.vat || 0.07)
|
|
||||||
: 0)
|
|
||||||
);
|
);
|
||||||
|
const finalPriceNoVat =
|
||||||
|
finalPriceWithVat / (1 + (config.value?.vat || 0.07));
|
||||||
|
|
||||||
|
const price = finalPriceNoVat * c.amount;
|
||||||
|
const vat = c.product.calcVat
|
||||||
|
? (finalPriceNoVat * c.amount - (c.discount || 0)) *
|
||||||
|
(config.value?.vat || 0.07)
|
||||||
|
: 0;
|
||||||
|
return precisionRound(price + vat);
|
||||||
};
|
};
|
||||||
|
|
||||||
// installment
|
// installment
|
||||||
|
|
@ -2057,23 +2061,20 @@ watch(
|
||||||
|
|
||||||
<div class="surface-1 q-pa-md flex" style="gap: var(--size-2)">
|
<div class="surface-1 q-pa-md flex" style="gap: var(--size-2)">
|
||||||
<SelectInput
|
<SelectInput
|
||||||
style="max-width: 250px"
|
class="q-mr-sm"
|
||||||
class="q-mr-xl"
|
|
||||||
incremental
|
|
||||||
v-model="templateForm"
|
v-model="templateForm"
|
||||||
id="quotation-branch"
|
id="quotation-branch"
|
||||||
:option="templateFormOption"
|
:option="templateFormOption"
|
||||||
:label="$t('quotation.templateForm')"
|
:label="$t('quotation.templateForm')"
|
||||||
:option-label="locale === 'eng' ? 'labelEN' : 'label'"
|
|
||||||
/>
|
/>
|
||||||
<MainButton
|
<!-- <MainButton
|
||||||
outlined
|
outlined
|
||||||
icon="mdi-play-box-outline"
|
icon="mdi-play-box-outline"
|
||||||
color="207 96% 32%"
|
color="207 96% 32%"
|
||||||
@click="storeDataLocal"
|
@click="storeDataLocal"
|
||||||
>
|
>
|
||||||
{{ $t('general.view', { msg: $t('general.example') }) }}
|
{{ $t('general.view', { msg: $t('general.example') }) }}
|
||||||
</MainButton>
|
</MainButton> -->
|
||||||
<MainButton
|
<MainButton
|
||||||
solid
|
solid
|
||||||
icon="mdi-pencil-outline"
|
icon="mdi-pencil-outline"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue