feat: also get installment no from preset data
This commit is contained in:
parent
810b8b96ba
commit
640aac51e2
3 changed files with 26 additions and 2 deletions
|
|
@ -137,7 +137,10 @@ const agentPrice = ref(false);
|
||||||
|
|
||||||
function getPrice(
|
function getPrice(
|
||||||
list: typeof productServiceList.value,
|
list: typeof productServiceList.value,
|
||||||
filterHook?: (arg: (typeof productServiceList.value)[number]) => boolean,
|
filterHook?: (
|
||||||
|
item: (typeof productServiceList.value)[number],
|
||||||
|
index?: number,
|
||||||
|
) => boolean,
|
||||||
) {
|
) {
|
||||||
if (filterHook) list = list.filter(filterHook);
|
if (filterHook) list = list.filter(filterHook);
|
||||||
|
|
||||||
|
|
@ -492,6 +495,23 @@ function convertToTable(nodes: Node[]) {
|
||||||
});
|
});
|
||||||
|
|
||||||
productServiceList.value = list;
|
productServiceList.value = list;
|
||||||
|
|
||||||
|
quotationFormData.value.paySplitCount = Math.max(
|
||||||
|
...list.map((v) => v.installmentNo || 0),
|
||||||
|
);
|
||||||
|
quotationFormData.value.paySplit = Array.apply(
|
||||||
|
null,
|
||||||
|
new Array(quotationFormData.value.paySplitCount),
|
||||||
|
).map((_, i) => ({
|
||||||
|
no: i + 1,
|
||||||
|
amount: getPrice(list, (v) => {
|
||||||
|
return (
|
||||||
|
v.installmentNo === i + 1 ||
|
||||||
|
(i + 1 === quotationFormData.value.paySplitCount && !v.installmentNo)
|
||||||
|
);
|
||||||
|
}).finalPrice,
|
||||||
|
}));
|
||||||
|
|
||||||
pageState.productServiceModal = false;
|
pageState.productServiceModal = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,10 @@ function calculateInstallments(param: {
|
||||||
newCount: number;
|
newCount: number;
|
||||||
oldCount: number;
|
oldCount: number;
|
||||||
}) {
|
}) {
|
||||||
|
if (payType.value !== 'SplitCustom' && payType.value !== 'BillSplitCustom') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (param.newCount !== null && param.oldCount !== null) {
|
if (param.newCount !== null && param.oldCount !== null) {
|
||||||
const totalAmount = summaryPrice.value.finalPrice;
|
const totalAmount = summaryPrice.value.finalPrice;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,7 @@ export type QuotationPayload = {
|
||||||
_count: { worker: number };
|
_count: { worker: number };
|
||||||
discount?: number;
|
discount?: number;
|
||||||
payBillDate?: Date | null;
|
payBillDate?: Date | null;
|
||||||
paySplit: { no: number; date: string | Date; amount: number }[];
|
paySplit: { no: number; amount: number }[];
|
||||||
paySplitCount?: number | null; // int
|
paySplitCount?: number | null; // int
|
||||||
payCondition:
|
payCondition:
|
||||||
| 'Full'
|
| 'Full'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue