fix: installment force push
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 8s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 8s
This commit is contained in:
parent
e6f2a8df4e
commit
87de5b48ac
6 changed files with 52 additions and 17 deletions
|
|
@ -32,6 +32,8 @@ const prop = defineProps<{
|
|||
isDebitNote?: boolean;
|
||||
}>();
|
||||
|
||||
const firstCodePayment = defineModel<string>('firstCodePayment');
|
||||
|
||||
const refQFile = ref<InstanceType<typeof QFile>[]>([]);
|
||||
const refQMenu = ref<InstanceType<typeof QMenu>[]>([]);
|
||||
const paymentData = ref<QuotationPaymentData[]>([]);
|
||||
|
|
@ -206,10 +208,15 @@ onMounted(async () => {
|
|||
});
|
||||
if (ret) {
|
||||
paymentData.value = ret.result;
|
||||
slipFile.value = paymentData.value.map((v) => ({
|
||||
paymentId: v.id,
|
||||
data: [],
|
||||
}));
|
||||
slipFile.value = paymentData.value.map((v, i) => {
|
||||
if (i === 0) {
|
||||
firstCodePayment.value = v.code;
|
||||
}
|
||||
return {
|
||||
paymentId: v.id,
|
||||
data: [],
|
||||
};
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ const selectedWorkerItem = computed(() => {
|
|||
];
|
||||
});
|
||||
const workerList = ref<Employee[]>([]);
|
||||
|
||||
const firstCodePayment = ref('');
|
||||
const selectedProductGroup = ref('');
|
||||
const selectedInstallmentNo = ref<number[]>([]);
|
||||
const installmentAmount = ref<number>(0);
|
||||
|
|
@ -1093,12 +1093,14 @@ watch(
|
|||
// }
|
||||
|
||||
function storeDataLocal() {
|
||||
quotationFormData.value.productServiceList = productServiceList.value;
|
||||
quotationFormData.value.productServiceList = productService.value;
|
||||
|
||||
localStorage.setItem(
|
||||
'quotation-preview',
|
||||
JSON.stringify({
|
||||
data: {
|
||||
codeInvoice: code.value,
|
||||
codePayment: firstCodePayment.value,
|
||||
...quotationFormData.value,
|
||||
productServiceList: productService.value,
|
||||
},
|
||||
|
|
@ -1939,6 +1941,7 @@ function covertToNode() {
|
|||
view !== View.Complete
|
||||
"
|
||||
:data="quotationFormState.source"
|
||||
v-model:first-code-payment="firstCodePayment"
|
||||
@fetch-status="
|
||||
() => {
|
||||
fetchQuotation();
|
||||
|
|
@ -2105,6 +2108,8 @@ function covertToNode() {
|
|||
|
||||
installmentAmount = props.row.amount;
|
||||
view = View.Invoice;
|
||||
|
||||
console.log(code);
|
||||
}
|
||||
}
|
||||
"
|
||||
|
|
|
|||
|
|
@ -86,10 +86,22 @@ const summaryPrice = ref<SummaryPrice>({
|
|||
finalPrice: 0,
|
||||
});
|
||||
|
||||
async function fetchQuotationById(id: string) {
|
||||
async function fetchQuotationById(id: string, codeInvoice: string) {
|
||||
const res = await quotationStore.getQuotation(id);
|
||||
if (res) {
|
||||
const installmentNo = res.paySplit.find(
|
||||
(v) => codeInvoice === v.invoice?.code,
|
||||
)?.no;
|
||||
|
||||
if (res) data.value = res;
|
||||
data.value = {
|
||||
...res,
|
||||
productServiceList: !!installmentNo
|
||||
? res.productServiceList.filter(
|
||||
(v) => installmentNo === v.installmentNo,
|
||||
)
|
||||
: res.productServiceList,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async function getAttachment(quotationId: string) {
|
||||
|
|
@ -190,7 +202,8 @@ onMounted(async () => {
|
|||
if (data.value) {
|
||||
if (!!data.value.id) {
|
||||
await getAttachment(data.value.id);
|
||||
await fetchQuotationById(data.value.id);
|
||||
if (parsed.data.fetch)
|
||||
await fetchQuotationById(data.value.id, parsed.data.codeInvoice);
|
||||
}
|
||||
|
||||
const resCustomerBranch = await customerStore.getBranchById(
|
||||
|
|
@ -203,8 +216,15 @@ onMounted(async () => {
|
|||
|
||||
agentPrice.value = data.value.agentPrice || parsed?.meta?.agentPrice;
|
||||
|
||||
const currentCode =
|
||||
view.value === View.Invoice
|
||||
? parsed.data.codeInvoice
|
||||
: view.value === View.Payment
|
||||
? parsed.data.codePayment
|
||||
: (parsed?.meta?.source?.code ?? data.value?.code);
|
||||
|
||||
details.value = {
|
||||
code: parsed?.meta?.source?.code ?? data.value?.code,
|
||||
code: currentCode,
|
||||
createdAt:
|
||||
parsed?.meta?.source?.createdAt ??
|
||||
new Date(data.value?.createdAt || ''),
|
||||
|
|
|
|||
|
|
@ -88,12 +88,16 @@ function triggerView(opts: { quotationId: string }) {
|
|||
window.open(url.toString(), '_blank');
|
||||
}
|
||||
|
||||
function viewDocExample(quotationId: string) {
|
||||
function viewDocExample(quotationId: string, codeInvoice: string) {
|
||||
console.log(codeInvoice);
|
||||
|
||||
localStorage.setItem(
|
||||
'quotation-preview',
|
||||
JSON.stringify({
|
||||
data: {
|
||||
id: quotationId,
|
||||
codeInvoice,
|
||||
fetch: true,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
|
@ -346,7 +350,7 @@ watch(
|
|||
:rows="data"
|
||||
:grid="pageState.gridView"
|
||||
@view="(quotationId) => triggerView({ quotationId })"
|
||||
@preview="(quotationId) => viewDocExample(quotationId)"
|
||||
@preview="(item) => viewDocExample(item.quotation.id, item.code)"
|
||||
>
|
||||
<template #grid="{ item }">
|
||||
<div class="col-md-4 col-sm-6 col-12">
|
||||
|
|
@ -401,9 +405,7 @@ watch(
|
|||
() => triggerView({ quotationId: item.row.quotation.id })
|
||||
"
|
||||
@preview="
|
||||
() => {
|
||||
viewDocExample(item.row.quotation.id);
|
||||
}
|
||||
() => viewDocExample(item.row.quotation.id, item.row.code)
|
||||
"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ withDefaults(
|
|||
|
||||
defineEmits<{
|
||||
(e: 'view', id: string): void;
|
||||
(e: 'preview', id: string): void;
|
||||
(e: 'preview', data: Invoice): void;
|
||||
(e: 'edit', data: T, index: number): void;
|
||||
(e: 'delete', data: T, index: number): void;
|
||||
(e: 'download', data: T, index: number): void;
|
||||
|
|
@ -118,7 +118,7 @@ defineEmits<{
|
|||
icon="mdi-play-box-outline"
|
||||
size="12px"
|
||||
:title="$t('preview.doc')"
|
||||
@click.stop="$emit('preview', props.row.quotation.id)"
|
||||
@click.stop="$emit('preview', props.row)"
|
||||
/>
|
||||
|
||||
<q-btn
|
||||
|
|
|
|||
|
|
@ -414,6 +414,7 @@ export type QuotationPaymentData = {
|
|||
remark: string;
|
||||
date: string;
|
||||
id: string;
|
||||
code: string;
|
||||
};
|
||||
|
||||
export type Details = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue