feat: add final discount as payload
This commit is contained in:
parent
99c43bdd66
commit
ee45da0e8c
3 changed files with 7 additions and 4 deletions
|
|
@ -137,11 +137,9 @@ const workerList = ref<Employee[]>([]);
|
||||||
|
|
||||||
const selectedProductGroup = ref('');
|
const selectedProductGroup = ref('');
|
||||||
const agentPrice = ref(false);
|
const agentPrice = ref(false);
|
||||||
const finalDiscount = ref(0);
|
|
||||||
const summaryPrice = computed(() =>
|
const summaryPrice = computed(() =>
|
||||||
productServiceList.value.reduce(
|
productServiceList.value.reduce(
|
||||||
(a, c) => {
|
(a, c) => {
|
||||||
console.log(finalDiscount.value);
|
|
||||||
const price = precisionRound(c.pricePerUnit * c.amount);
|
const price = precisionRound(c.pricePerUnit * c.amount);
|
||||||
const vat = precisionRound(
|
const vat = precisionRound(
|
||||||
(c.pricePerUnit * c.amount - c.discount) * (config.value?.vat || 0.07),
|
(c.pricePerUnit * c.amount - c.discount) * (config.value?.vat || 0.07),
|
||||||
|
|
@ -151,7 +149,10 @@ const summaryPrice = computed(() =>
|
||||||
a.totalDiscount = precisionRound(a.totalDiscount + Number(c.discount));
|
a.totalDiscount = precisionRound(a.totalDiscount + Number(c.discount));
|
||||||
a.vat = precisionRound(a.vat + vat);
|
a.vat = precisionRound(a.vat + vat);
|
||||||
a.finalPrice = precisionRound(
|
a.finalPrice = precisionRound(
|
||||||
a.totalPrice - a.totalDiscount + a.vat - Number(finalDiscount.value),
|
a.totalPrice -
|
||||||
|
a.totalDiscount +
|
||||||
|
a.vat -
|
||||||
|
Number(quotationFormData.value.discount || 0),
|
||||||
);
|
);
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
|
|
@ -833,7 +834,7 @@ watch(
|
||||||
v-model:pay-split-count="quotationFormData.paySplitCount"
|
v-model:pay-split-count="quotationFormData.paySplitCount"
|
||||||
v-model:pay-split="quotationFormData.paySplit"
|
v-model:pay-split="quotationFormData.paySplit"
|
||||||
:readonly
|
:readonly
|
||||||
v-model:final-discount="finalDiscount"
|
v-model:final-discount="quotationFormData.discount"
|
||||||
v-model:summary-price="summaryPrice"
|
v-model:summary-price="summaryPrice"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ const DEFAULT_DATA: QuotationPayload = {
|
||||||
paySplitCount: 0,
|
paySplitCount: 0,
|
||||||
payCondition: 'Full',
|
payCondition: 'Full',
|
||||||
dueDate: new Date(),
|
dueDate: new Date(),
|
||||||
|
discount: 0,
|
||||||
documentReceivePoint: '',
|
documentReceivePoint: '',
|
||||||
contactTel: '',
|
contactTel: '',
|
||||||
contactName: '',
|
contactName: '',
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,7 @@ export type QuotationPayload = {
|
||||||
urgent: boolean;
|
urgent: boolean;
|
||||||
worker: EmployeeWorker[];
|
worker: EmployeeWorker[];
|
||||||
_count: { worker: number };
|
_count: { worker: number };
|
||||||
|
discount?: number;
|
||||||
payBillDate?: Date | null;
|
payBillDate?: Date | null;
|
||||||
paySplit: { no: number; date: string | Date; amount: number }[];
|
paySplit: { no: number; date: string | Date; amount: number }[];
|
||||||
paySplitCount?: number | null; // int
|
paySplitCount?: number | null; // int
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue