<template>
    <simple-form
        :items="formItems"
        ref="formRef"
        label-width="140px"
        :footer="true"
        @submit="handleSubmit"
    />
</template>

<script setup name="baseConfig">
    import { ref, shallowRef } from 'vue';
    import SimpleForm from '@/components/CommonPage/SimpleForm.vue';

    const formRef = ref(null);
    const formItems = shallowRef([
        { type: 'input', label: 'mchid', prop: 'mchid', required: true },
        {
            type: 'radio',
            label: '支付接口类型',
            prop: 'type',
            required: true,
            options: [
                {
                    label: 'v2',
                    value: 1
                },
                {
                    label: 'v3',
                    value: 2
                }
            ]
        },
        { type: 'input', label: 'key', prop: 'key', required: true },
        {
            type: 'imageUpload',
            label: '微信支付证书',
            prop: 'logoImage',
            required: true,
            props: { limit: 1, tips: '支持.jpg .png 格式，建议上传50*50尺寸' }
        },
        {
            type: 'imageUpload',
            label: '微信支付证书密钥',
            prop: 'backgroundImage',
            required: true,
            props: { limit: 1, tips: '支持.jpg .png 格式，建议上传50*50尺寸' }
        },
        {
            type: 'input',
            label: '小程序mchid',
            prop: 'minimchid',
            required: true
        }
    ]);

    function handleSubmit(data) {
        console.log(data);
    }
</script>
