From 014e23bac1b3a056ff29991b51f571d8909046fc Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 31 Jan 2025 14:41:52 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=E0=B9=82=E0=B8=AB=E0=B8=A5=E0=B8=94=20?= =?UTF-8?q?=E0=B9=83=E0=B8=9A=E0=B9=81=E0=B8=88=E0=B9=89=E0=B8=87=E0=B8=8A?= =?UTF-8?q?=E0=B8=B3=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/exam/api.candidate.ts | 4 +- .../01_exam/components/ExamPayment.vue | 47 ++++++++++--------- 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/api/exam/api.candidate.ts b/src/api/exam/api.candidate.ts index 4c06051..181b7c4 100644 --- a/src/api/exam/api.candidate.ts +++ b/src/api/exam/api.candidate.ts @@ -43,5 +43,7 @@ export default { candidate, candidateBill: (examId: string, positionId: string) => `${candidate}bill/${examId}/${positionId}`, - candidateReport: (candidateId: string) => `${env.API_URI_V2}/report/candidate/pdf/${candidateId}` + candidateReport: (candidateId: string) => `${env.API_URI_V2}/report/candidate/pdf/${candidateId}`, + + candidatePaymentExport: (examId: string) => `${candidate}period-exam/payment-export/${examId}` } diff --git a/src/modules/01_exam/components/ExamPayment.vue b/src/modules/01_exam/components/ExamPayment.vue index 51ba3c4..976220f 100644 --- a/src/modules/01_exam/components/ExamPayment.vue +++ b/src/modules/01_exam/components/ExamPayment.vue @@ -207,6 +207,7 @@ import { useDataStore } from '@/stores/data' import http from '@/plugins/http' import config from '@/app.config' import { useRoute } from 'vue-router' +import genReport from '@/plugins/genreport' const props = defineProps({ fetchStep: { @@ -232,6 +233,7 @@ const positionId = ref(route.params.positionId.toString()) const bank = ref([]) const fee = ref() const filePayment = ref([]) +const candidateId = ref('') onMounted(async () => { await fetchPaymentExam() @@ -263,6 +265,7 @@ const fetchData = async () => { const data = res.data.result img.value = data.paymentImg rejectMessage.value = data.rejectDetail + candidateId.value = data.candidateId }) .catch((e) => { messageError($q, e) @@ -273,25 +276,25 @@ const fetchData = async () => { } const clickPayment = async () => { -// if (img.value != null || img.value != '') { -// const formData = new FormData() -// formData.append('', filePayment.value[0]) - loaderPage(true) - await http - .post(config.API.candidatePayment(examId.value, positionId.value)) - .then(() => { - success($q, 'ส่งหลักฐานชำระเงินสำเร็จ') - }) - .catch((e) => { - messageError($q, e) - }) - .finally(async () => { - filePayment.value = [] - await props.fetchStep() - }) -// } else { -// modalError($q, 'ไม่สามารถยืนยันการชำระเงินได้', 'กรุณาอัปโหลดเอกสารหลักฐานชำระเงิน') -// } + // if (img.value != null || img.value != '') { + // const formData = new FormData() + // formData.append('', filePayment.value[0]) + loaderPage(true) + await http + .post(config.API.candidatePayment(examId.value, positionId.value)) + .then(() => { + success($q, 'ส่งหลักฐานชำระเงินสำเร็จ') + }) + .catch((e) => { + messageError($q, e) + }) + .finally(async () => { + filePayment.value = [] + await props.fetchStep() + }) + // } else { + // modalError($q, 'ไม่สามารถยืนยันการชำระเงินได้', 'กรุณาอัปโหลดเอกสารหลักฐานชำระเงิน') + // } } const uploadImage = async (file: any) => { @@ -321,10 +324,10 @@ const uploadImage = async (file: any) => { const downloadBillPayment = async () => { loaderPage(true) await http - .get(config.API.candidateBill(examId.value, positionId.value)) - .then((res) => { + .get(config.API.candidatePaymentExport(candidateId.value)) + .then(async (res) => { const data = res.data.result - window.open(data) + await genReport(data, `พิมพ์ใบแจ้งการชำระเงิน`, 'pdf') }) .catch((e) => { messageError($q, e)