<template>
|
<ProDialog :title="title" v-model="visible" @close="onDialogClose" destroy-on-close draggable>
|
<PortraitTableWithAttachment v-bind="portraitTableWithAttachmentProps" />
|
<ProForm
|
:model="form"
|
ref="dialogForm"
|
label-width="90px"
|
style="margin-top: 20px"
|
:is-read="form.isCheck"
|
>
|
<ProFormCol>
|
<ProFormColItem :span="12">
|
<ProFormItemV2
|
label="审核:"
|
prop="checkStatus"
|
:check-rules="[{ message: '请选择审核状态' }]"
|
>
|
<ProFormRadio
|
v-model="form.checkStatus"
|
:value-enum="EnterpriseRechargeStatusEnumTextForAdudit"
|
/>
|
</ProFormItemV2>
|
</ProFormColItem>
|
</ProFormCol>
|
<ProFormCol v-if="form.isCheck">
|
<ProFormColItem :span="12">
|
<ProFormItemV2 label="审核日期:" prop="creationTime">
|
<ProFormDatePicker v-model="form.creationTime" type="date" format="YYYY-MM-DD HH:mm" />
|
</ProFormItemV2>
|
</ProFormColItem>
|
</ProFormCol>
|
<ProFormCol>
|
<ProFormColItem :span="12">
|
<ProFormItemV2
|
label="上传凭证:"
|
prop="checkFileUrl"
|
:required="form.checkStatus === EnterpriseRechargeStatusEnum.CheckPassed"
|
:check-rules="[
|
{
|
message: '请上传凭证',
|
validator: (rule, value, callback) => {
|
if (
|
value?.length === 0 &&
|
form.checkStatus === EnterpriseRechargeStatusEnum.CheckPassed
|
) {
|
callback(new Error('请上传凭证'));
|
}
|
callback();
|
},
|
},
|
]"
|
>
|
<ProFormUpload
|
v-model:file-url="form.checkFileUrl"
|
:limit="1"
|
:showTip="false"
|
:limitFileSize="50"
|
></ProFormUpload>
|
</ProFormItemV2>
|
</ProFormColItem>
|
</ProFormCol>
|
|
<ProFormCol>
|
<ProFormColItem>
|
<ProFormItemV2
|
label="审核理由:"
|
prop="checkRemark"
|
:required="form.checkStatus === EnterpriseRechargeStatusEnum.CheckReject"
|
:check-rules="[
|
{
|
message: '请输入审核理由',
|
validator: (rule, value, callback) => {
|
if (!value && form.checkStatus === EnterpriseRechargeStatusEnum.CheckReject) {
|
callback(new Error('请输入驳回理由'));
|
}
|
callback();
|
},
|
},
|
]"
|
>
|
<ProFormTextArea
|
v-model="form.checkRemark"
|
placeholder="请输入"
|
show-word-limit
|
:maxlength="150"
|
></ProFormTextArea>
|
</ProFormItemV2>
|
</ProFormColItem>
|
</ProFormCol>
|
</ProForm>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="emit('onCancel')">取 消</el-button>
|
<el-button type="primary" @click="handleConfirm">确 定</el-button>
|
</span>
|
</template>
|
</ProDialog>
|
</template>
|
|
<script setup lang="ts">
|
import { FormInstance } from 'element-plus';
|
import {
|
ProDialog,
|
ProForm,
|
ProFormItemV2,
|
ProFormTextArea,
|
ProFormCol,
|
ProFormColItem,
|
ProFormRadio,
|
ProFormUpload,
|
ProFormDatePicker,
|
UploadUserFile,
|
} from '@bole-core/components';
|
import * as parkBountyApplyServices from '@/services/api/ParkBountyApply';
|
import { usePortraitTableWithAttachment } from '@/hooks';
|
import { convertApi2FormUrl, convertApi2FormUrlOnlyOne } from '@/utils';
|
import { useQuery } from '@tanstack/vue-query';
|
import {
|
EnterpriseRechargeStatusEnum,
|
EnterpriseRechargeStatusEnumTextForAdudit,
|
} from '@/constants';
|
|
defineOptions({
|
name: 'WithdrawalApprovalAuditDialog',
|
});
|
|
// type Props = {};
|
|
// const props = withDefaults(defineProps<Props>(), {});
|
|
const visible = defineModel({ type: Boolean });
|
|
type Form = {
|
title?: string;
|
drawWithId: string;
|
checkStatus: EnterpriseRechargeStatusEnum;
|
checkRemark: string;
|
creationTime?: string;
|
isCheck: boolean;
|
checkFileUrl: UploadUserFile[];
|
};
|
|
const form = defineModel<Form>('form');
|
|
const title = computed(() => (form.value?.isCheck ? '详情' : '提现审批'));
|
|
const emit = defineEmits<{
|
(e: 'onConfirm'): void;
|
(e: 'onCancel'): void;
|
}>();
|
|
watch(
|
() => visible.value,
|
(val) => {
|
if (val) {
|
refetch();
|
}
|
}
|
);
|
|
const {
|
data: detail,
|
refetch,
|
isLoading,
|
} = useQuery({
|
queryKey: ['parkBountyApplyServices/getEnterpriseDrawWithDetail', form.value?.drawWithId],
|
queryFn: async () => {
|
return await parkBountyApplyServices.getEnterpriseDrawWithDetail(
|
{
|
drawWithId: form.value?.drawWithId,
|
},
|
{
|
showLoading: true,
|
}
|
);
|
},
|
placeholderData: () => ({} as API.GetEnterpriseDrawWithDetailOutput),
|
enabled: !!form.value?.drawWithId,
|
onSuccess(data) {
|
form.value.checkRemark = data.checkRemark ?? '';
|
form.value.creationTime = data.creationTime ?? '';
|
form.value.checkStatus = form.value?.isCheck
|
? data.checkStatus
|
: ('' as any as EnterpriseRechargeStatusEnum);
|
form.value.checkFileUrl = convertApi2FormUrlOnlyOne(data.checkFileUrl);
|
},
|
});
|
|
const { portraitTableWithAttachmentProps } = usePortraitTableWithAttachment({
|
data: detail,
|
annexList: computed(() =>
|
detail.value?.invoiceUrl
|
? detail.value?.invoiceUrl.split('|').map((item) => convertApi2FormUrl(item))
|
: []
|
),
|
columns: [
|
{
|
label: '企业名称',
|
key: 'enterpriseName',
|
},
|
{
|
label: '统一社会信用代码',
|
key: 'societyCreditCode',
|
},
|
{
|
label: '账户名称',
|
key: 'accountName',
|
},
|
{
|
label: '银行帐号',
|
key: 'bankNumber',
|
},
|
{
|
label: '开户银行',
|
key: 'bankName',
|
},
|
{
|
label: '开户支行',
|
key: 'bankResumeName',
|
},
|
{
|
label: '提现金额',
|
key: 'amount',
|
type: 'money',
|
},
|
{
|
label: '申请日期',
|
key: 'creationTime',
|
type: 'date',
|
},
|
],
|
});
|
|
const dialogForm = ref<FormInstance>();
|
|
function onDialogClose() {
|
if (!dialogForm.value) return;
|
dialogForm.value.resetFields();
|
}
|
|
function handleConfirm() {
|
if (!dialogForm.value) return;
|
if (form.value?.isCheck) {
|
emit('onCancel');
|
return;
|
}
|
dialogForm.value.validate((valid) => {
|
if (valid) {
|
emit('onConfirm');
|
} else {
|
return;
|
}
|
});
|
}
|
</script>
|