2023-03-15 14:20:18 +07:00
|
|
|
<template>
|
2023-03-22 00:25:55 +07:00
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="row justify-center q-pa-md">
|
|
|
|
|
<div class="col-4">
|
|
|
|
|
<q-card-actions class="q-pa-md text-left row" :class="getClass(status)">
|
|
|
|
|
<div class="text-bold col-12" :class="getFontColor(status)">
|
|
|
|
|
{{ message(status) }}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12" v-if="status === 'rejected'" :class="getFontColor(status)">
|
|
|
|
|
<li>{{ rejectMessage }}</li>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card-actions>
|
|
|
|
|
<q-file borderless v-model="fileData" stack-label @update:model-value="uploadImg">
|
|
|
|
|
<q-img :src="img" fit="contain" style="max-height: 300px" class="col-12">
|
|
|
|
|
<div class="absolute-bottom text-center">หลักฐานชำระเงิน</div>
|
|
|
|
|
</q-img>
|
|
|
|
|
</q-file>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-03-19 00:43:28 +07:00
|
|
|
<div class="q-pa-md text-center col-12">
|
2023-03-24 20:47:01 +07:00
|
|
|
<q-btn color="primary" @click="clickPayment" label="ส่งหลักฐานการชำระเงิน" />
|
2023-03-19 00:43:28 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="text-black text-center q-pb-lg col-12">
|
2023-03-22 11:04:52 +07:00
|
|
|
***ถ้าต้องการเเก้ไขหลักฐานการโอนเงินกรุณาอัปโหลดซ้ำ***
|
2023-03-16 13:55:50 +07:00
|
|
|
</div>
|
2023-03-15 14:20:18 +07:00
|
|
|
</div>
|
2023-03-22 00:25:55 +07:00
|
|
|
<q-btn color="negative" @click="setStatus('rejected')">Re</q-btn>
|
|
|
|
|
<q-btn color="positive" @click="setStatus('success')">Su</q-btn>
|
|
|
|
|
<q-btn color="positive" @click="setStatus('next')">Ne</q-btn>
|
2023-03-15 14:20:18 +07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2023-03-19 00:43:28 +07:00
|
|
|
import { ref } from 'vue'
|
2023-03-24 20:47:01 +07:00
|
|
|
import { useQuasar } from 'quasar'
|
|
|
|
|
import { useCounterMixin } from '@/stores/mixin'
|
|
|
|
|
import http from '@/plugins/http'
|
|
|
|
|
import config from '@/app.config'
|
2023-03-19 00:43:28 +07:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
fetchStep: {
|
|
|
|
|
type: Function,
|
|
|
|
|
default: () => console.log('not function')
|
|
|
|
|
},
|
|
|
|
|
step: {
|
|
|
|
|
type: Number,
|
|
|
|
|
required: true
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
2023-03-24 20:47:01 +07:00
|
|
|
const $q = useQuasar()
|
|
|
|
|
const mixin = useCounterMixin() //เรียกฟังก์ชันกลาง
|
|
|
|
|
const { success } = mixin
|
2023-03-17 17:12:27 +07:00
|
|
|
const status = ref<string>('')
|
2023-03-17 17:35:37 +07:00
|
|
|
const rejectMessage = ref<string>('กรุณาจ่ายเงินให้ครบตามจำนวน')
|
2023-03-17 17:12:27 +07:00
|
|
|
const img = ref<string>('https://cdn-icons-png.flaticon.com/512/2496/2496846.png')
|
2023-03-19 00:43:28 +07:00
|
|
|
const fileData = ref<any>()
|
2023-03-24 20:47:01 +07:00
|
|
|
const loader = ref<boolean>(false)
|
|
|
|
|
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
|
2023-03-17 12:12:49 +07:00
|
|
|
|
2023-03-16 17:30:44 +07:00
|
|
|
const uploadImg = (file: any) => {
|
2023-03-19 00:43:28 +07:00
|
|
|
fileData.value = null
|
2023-03-17 17:12:27 +07:00
|
|
|
// img.value =
|
|
|
|
|
// 'https://s359.kapook.com/r/600/auto/pagebuilder/ba154685-db18-4ac7-b318-a4a2b15b9d4c.jpg'
|
|
|
|
|
img.value =
|
|
|
|
|
'https://www.bangkokbank.com/-/media/feature/page-content/bbl-corporate/image-carousel-slides/digital-banking/bualuang-mbanking/how-to-use/payment/others/7_en.png'
|
2023-03-16 17:30:44 +07:00
|
|
|
}
|
2023-03-17 17:12:27 +07:00
|
|
|
|
2023-03-24 20:47:01 +07:00
|
|
|
const setStatus = async (val: string) => {
|
2023-03-17 17:12:27 +07:00
|
|
|
status.value = val
|
2023-03-19 00:43:28 +07:00
|
|
|
if (val == 'next') props.fetchStep()
|
2023-03-17 12:12:49 +07:00
|
|
|
}
|
|
|
|
|
|
2023-03-24 20:47:01 +07:00
|
|
|
const clickPayment = async () => {
|
|
|
|
|
loader.value = true
|
|
|
|
|
await http
|
|
|
|
|
.get(config.API.candidatePayment(candidateId.value))
|
|
|
|
|
.then(() => {
|
|
|
|
|
success($q, 'ส่งหลักฐานชำระเงินสำเร็จ')
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {})
|
|
|
|
|
.finally(async () => {
|
|
|
|
|
loader.value = false
|
|
|
|
|
props.fetchStep()
|
|
|
|
|
})
|
|
|
|
|
status.value = 'processing'
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-17 17:12:27 +07:00
|
|
|
const getClass = (val: string) => {
|
|
|
|
|
switch (val) {
|
|
|
|
|
case 'processing':
|
2023-03-21 11:08:27 +07:00
|
|
|
return 'bg-yellow-3'
|
2023-03-17 17:12:27 +07:00
|
|
|
case 'rejected':
|
2023-03-21 11:08:27 +07:00
|
|
|
return 'bg-red-2'
|
2023-03-17 17:12:27 +07:00
|
|
|
case 'success':
|
2023-03-21 12:05:29 +07:00
|
|
|
return 'bg-light-green-3'
|
2023-03-17 17:12:27 +07:00
|
|
|
default:
|
2023-03-21 11:08:27 +07:00
|
|
|
return 'bg-light-blue-1'
|
2023-03-17 17:12:27 +07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const message = (val: string) => {
|
|
|
|
|
switch (val) {
|
|
|
|
|
case 'processing':
|
|
|
|
|
return 'รอการตรวจสอบ'
|
|
|
|
|
case 'rejected':
|
|
|
|
|
return 'หลักฐานการชำระเงินผิดพลาด'
|
|
|
|
|
case 'success':
|
|
|
|
|
return 'ตรวจสอบเเล้ว'
|
|
|
|
|
default:
|
|
|
|
|
return 'รออัปโหลดหลักฐานชำระเงิน'
|
2023-03-17 12:12:49 +07:00
|
|
|
}
|
|
|
|
|
}
|
2023-03-21 11:08:27 +07:00
|
|
|
const getFontColor = (val: string) => {
|
|
|
|
|
switch (val) {
|
|
|
|
|
case 'processing':
|
2023-03-21 12:05:29 +07:00
|
|
|
return 'text-orange'
|
2023-03-21 11:08:27 +07:00
|
|
|
case 'rejected':
|
2023-03-21 12:05:29 +07:00
|
|
|
return 'text-red-12'
|
2023-03-21 11:08:27 +07:00
|
|
|
case 'success':
|
2023-03-21 12:05:29 +07:00
|
|
|
return 'text-green'
|
2023-03-21 11:08:27 +07:00
|
|
|
default:
|
2023-03-21 12:05:29 +07:00
|
|
|
return 'text-blue'
|
2023-03-21 11:08:27 +07:00
|
|
|
}
|
|
|
|
|
}
|
2023-03-15 14:20:18 +07:00
|
|
|
</script>
|
|
|
|
|
|
2023-03-16 13:55:50 +07:00
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.q-img {
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
}
|
|
|
|
|
</style>
|