fix: split custom default 1
This commit is contained in:
parent
58885e6180
commit
61e11c0503
1 changed files with 12 additions and 7 deletions
|
|
@ -147,7 +147,7 @@ const refSelectZoneEmployee = ref<InstanceType<typeof SelectZone>>();
|
|||
const mrz = ref<Awaited<ReturnType<typeof parseResultMRZ>>>();
|
||||
const toggleWorker = ref(true);
|
||||
const tempTableProduct = ref<ProductServiceList[]>([]);
|
||||
const tempPaySplitCount = ref(1);
|
||||
const tempPaySplitCount = ref(0);
|
||||
const tempPaySplit = ref<
|
||||
{ no: number; amount: number; name?: string; invoice?: boolean }[]
|
||||
>([]);
|
||||
|
|
@ -455,7 +455,7 @@ async function fetchQuotation() {
|
|||
const id = currentQuotationId.value || quotationFormData.value.id || '';
|
||||
|
||||
await quotationForm.assignFormData(id, quotationFormState.value.mode);
|
||||
tempPaySplitCount.value = quotationFormData.value.paySplitCount || 1;
|
||||
tempPaySplitCount.value = quotationFormData.value.paySplitCount || 0;
|
||||
tempPaySplit.value = JSON.parse(
|
||||
JSON.stringify(quotationFormData.value.paySplit),
|
||||
);
|
||||
|
|
@ -733,7 +733,7 @@ function triggerProductServiceDialog() {
|
|||
function handleChangePayType(type: PayCondition) {
|
||||
if (
|
||||
type === 'Split' &&
|
||||
tempPaySplitCount.value &&
|
||||
tempPaySplitCount.value !== undefined &&
|
||||
tempPaySplit.value &&
|
||||
tempTableProduct.value
|
||||
) {
|
||||
|
|
@ -746,6 +746,11 @@ function handleChangePayType(type: PayCondition) {
|
|||
installmentNo: tempTableProduct.value[index].installmentNo || 0,
|
||||
}));
|
||||
}
|
||||
|
||||
if (type === 'SplitCustom') {
|
||||
quotationFormData.value.paySplitCount = 1;
|
||||
quotationFormData.value.paySplit.push({ no: Number(1), amount: 0 });
|
||||
}
|
||||
}
|
||||
|
||||
function handleUpdateProductTable(
|
||||
|
|
@ -844,7 +849,7 @@ function toggleDeleteProduct(index: number) {
|
|||
|
||||
// find split count
|
||||
tempPaySplitCount.value = Math.max(
|
||||
...productServiceList.value.map((v) => v.installmentNo || 1),
|
||||
...productServiceList.value.map((v) => v.installmentNo || 0),
|
||||
);
|
||||
quotationFormData.value.paySplitCount = tempPaySplitCount.value;
|
||||
|
||||
|
|
@ -868,7 +873,7 @@ function convertToTable(nodes: Node[]) {
|
|||
const list = nodes.flatMap(_recursive).map((v) => v.value);
|
||||
|
||||
quotationFormData.value.paySplitCount = Math.max(
|
||||
...list.map((v) => v.installmentNo || 1),
|
||||
...list.map((v) => v.installmentNo || 0),
|
||||
);
|
||||
tempPaySplitCount.value = quotationFormData.value.paySplitCount;
|
||||
|
||||
|
|
@ -902,7 +907,7 @@ function convertToTable(nodes: Node[]) {
|
|||
}));
|
||||
} else {
|
||||
quotationFormData.value.paySplit = [];
|
||||
quotationFormData.value.paySplitCount = 1;
|
||||
quotationFormData.value.paySplitCount = 0;
|
||||
quotationFormData.value.payCondition = 'Full';
|
||||
}
|
||||
|
||||
|
|
@ -2116,7 +2121,7 @@ watch(
|
|||
:date="v.date"
|
||||
:pay-type="quotationFormData.payCondition"
|
||||
:index="i"
|
||||
:pay-split-count="quotationFormData.paySplitCount || 1"
|
||||
:pay-split-count="quotationFormData.paySplitCount || 0"
|
||||
@view="
|
||||
() => {
|
||||
selectedInstallmentNo = [v.invoice.installments[0].no];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue