import { useState, useEffect} from 'react';
import { connect } from '@umijs/max';
import { ConfigProvider } from 'antd';
import PagesMainCompanyVipTable from '@/components/Render/Main/Company/Vip/table'
import PagesMainCompanyVipCreate from '@/components/Render/Main/Company/Vip/create'
import PagesMainCompanyVipFee from '@/components/Render/Main/Company/Vip/fee'


const CompanyVipPage: React.FC = ({ dispatch, openModel }: any) => {
    const [id, setId] = useState<number>(0);
    const getId = (value: number) => {
        setId(value)
    }

    useEffect(() => {
        if(!openModel.openModal) {
            setId(0)
        }
    }, [openModel.openModal])

    return (
        <>
            <ConfigProvider
                theme={{
                    token: {
                        colorPrimary: '#4FBE70',
                    }
                }}
            >
                <PagesMainCompanyVipTable getId={getId}></PagesMainCompanyVipTable>
                <PagesMainCompanyVipCreate id={id}></PagesMainCompanyVipCreate>
                <PagesMainCompanyVipFee id={id}></PagesMainCompanyVipFee>

            </ConfigProvider>
        </>
    );
};

export default connect(({  openModel }: any) => ({
    openModel
}))(CompanyVipPage);

