<template>
|
<ProDialog
|
title="上传凭证"
|
v-model="visible"
|
@close="onDialogClose"
|
destroy-on-close
|
draggable
|
width="700px"
|
>
|
<ProForm :model="form" ref="dialogForm" label-width="120px">
|
<ProFormItemV2
|
label="入账类型:"
|
prop="incomeType"
|
:check-rules="[{ message: '请选择入账类型' }]"
|
>
|
<ProFormRadio
|
v-model="form.incomeType"
|
:value-enum="incomeTypeEnum"
|
:button-style="false"
|
/>
|
</ProFormItemV2>
|
<ProFormItemV2
|
label="上传入账凭证:"
|
prop="fileUrl"
|
:check-rules="[{ message: '请上传入账凭证', type: 'upload' }]"
|
>
|
<ProFormUpload
|
v-model:file-url="form.fileUrl"
|
:limitFileSize="50"
|
accept="doc,docx,pdf,xls,xlsx,jpg/jpeg,png"
|
></ProFormUpload>
|
</ProFormItemV2>
|
</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,
|
UploadUserFile,
|
ProFormUpload,
|
ProFormRadio,
|
} from '@bole-core/components';
|
import { IncomeTypeEnumText, IncomeTypeEnum } from '@/constants';
|
|
defineOptions({
|
name: 'UploadCertRewardDialog',
|
});
|
|
const visible = defineModel({ type: Boolean });
|
|
type Form = {
|
title?: string;
|
fileUrl: UploadUserFile[];
|
parkBountyApplyId: string;
|
incomeType: IncomeTypeEnum;
|
showSuportPlatRecharge: boolean;
|
showSuportFiscalRecharge: boolean;
|
};
|
|
const form = defineModel<Form>('form');
|
|
const emit = defineEmits<{
|
(e: 'onConfirm'): void;
|
(e: 'onCancel'): void;
|
}>();
|
|
const incomeTypeEnum = computed(() => {
|
return [
|
form.value.showSuportFiscalRecharge && {
|
label: IncomeTypeEnumText[IncomeTypeEnum.Fiscal],
|
value: IncomeTypeEnum.Fiscal,
|
},
|
form.value.showSuportPlatRecharge && {
|
label: IncomeTypeEnumText[IncomeTypeEnum.Platform],
|
value: IncomeTypeEnum.Platform,
|
},
|
].filter(Boolean);
|
});
|
|
const dialogForm = ref<FormInstance>();
|
|
function onDialogClose() {
|
if (!dialogForm.value) return;
|
dialogForm.value.resetFields();
|
}
|
|
function handleConfirm() {
|
if (!dialogForm.value) return;
|
dialogForm.value.validate((valid) => {
|
if (valid) {
|
emit('onConfirm');
|
} else {
|
return;
|
}
|
});
|
}
|
</script>
|