<template>
    <vxe-modal v-model="dialogVisible" :title="title" show-zoom resize show-footer destroy-on-close transfer @hide="close" :width="width">
        <template #default>
            <div>
                是否确认将企业
                <span class="c-primary">{{ props.info?.cpyName }}</span>
                审核为通过?
            </div>
        </template>
        <template #footer>
            <el-button @click="close">取消</el-button>
            <el-button type="primary" @click="submitForm">确认通过</el-button>
        </template>
    </vxe-modal>
</template>

<script setup name="CheckPass" lang="ts">
import { approvalMember } from '@/api/dgtmedicine/approvalLog/index';
import { uploadInvoice } from '@/api/dgtmedicine/vipPayment/index';
import { propTypes } from '@/utils/propTypes';
import { FormInstance } from 'element-plus';
const emit = defineEmits(['update:show', 'close', 'success']);
const props = defineProps({
    show: propTypes.bool.def(false),
    title: propTypes.string.def('审核通过'),
    width: propTypes.number.def(400),
    info: propTypes.any.def(null)
});
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const dialogVisible = ref(false);
const form = ref<any>({
    reviewStatus: '1'
});
const rules = reactive({});
const formRef = ref<FormInstance>();
const close = () => {
    // formRef.value?.resetFields();
    emit('update:show', false);
    emit('close', false);
};
const submitForm = async () => {
    try {
        // await formRef.value?.validate();
        const res = await approvalMember({ ...form.value, id: props.info?.id });
        if (res) {
            proxy.$modal.msgSuccess('审核通过成功!');
            close();
            emit('success', true);
        }
    } catch (error) {
        console.error(error);
    }
};

watch(
    () => props.show,
    (val) => {
        dialogVisible.value = val;
    },
    { immediate: true }
);
</script>
