fix โหลด ใบแจ้งชำระเงิน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-01-31 14:41:52 +07:00
parent 424808fab0
commit 014e23bac1
2 changed files with 28 additions and 23 deletions

View file

@ -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<string>(route.params.positionId.toString())
const bank = ref<any>([])
const fee = ref<number>()
const filePayment = ref<File[]>([])
const candidateId = ref<string>('')
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)