import LeftSelectTree from "@/components/leftSelectTree/leftSelectTree";
import { ActionType, FormInstance, ProForm, ProFormDatePicker, ProFormDigit, ProFormSelect, ProFormText, ProTable } from "@ant-design/pro-components";
import { Button, Col, Divider, message, Modal, Row } from "antd";
import { useRef, useState } from "react";
import { connect } from "umi";
import './style.less'
import { handleGetServerpartTree, handleGetSERVERPARTTYPEList, handlGetSPCONTRIBUTIONList } from "../operationReport/service";
import { handleGetServerpartInfo } from "../serverpartAssets/service";
import { encryptAES } from "@/utils/handleAes";


const RentCalculation: React.FC<{ currentUser: any }> = (props) => {
    const actionRef = useRef<ActionType>();
    const formRef = useRef<FormInstance>();
    const selectFormRef = useRef<FormInstance>();
    const modalRef = useRef<FormInstance>();
    // 树相关的属性和方法
    const [selectedId, setSelectedId] = useState<string>()
    const [collapsible, setCollapsible] = useState<boolean>(false)
    // 选择运营模式的悬浮框
    const [showSelectOperatingModel, setShowSelectOperatingModel] = useState<boolean>(false);
    // 当前选择的运营模式
    const [selectedOperatingModel, setSelectedOperatingModel] = useState<string | null>(null);
    // 实际计算租金的modal
    const [rentCalculateModal, setRentCalculateModal] = useState<boolean>(false)
    // 当前片区下的服务区列表
    const [serverPartList, setServerPartList] = useState<any>()
    // 当前服务区下的方位
    const [SERVERPARTREGION, setSERVERPARTREGION] = useState<any>()
    // 选择模式里面的 表单数据
    const [selectFormData, setSelectFormData] = useState<any>()


    const operatingModels = [
        '委托运营',
        '加盟项目',
        '保底收益一',
        '保底收益二'
    ];

    const columns: any = [
        {
            title: "片区",
            dataIndex: "",
            hideInSearch: true,
            align: 'center',
            width: 120,
            ellipsis: true,
        },
        {
            title: "服务区",
            dataIndex: "",
            hideInSearch: true,
            align: 'center',
            width: 120,
            ellipsis: true,
        },
        {
            title: "所属高速",
            dataIndex: "",
            hideInSearch: true,
            align: 'center',
            width: 120,
            ellipsis: true,
        },
        {
            title: "产权所属",
            dataIndex: "",
            hideInSearch: true,
            align: 'center',
            width: 120,
            ellipsis: true,
        },
        {
            title: "站点类型",
            dataIndex: "",
            hideInSearch: true,
            align: 'center',
            width: 120,
            ellipsis: true,
        },
        {
            title: "分类定级",
            dataIndex: "",
            hideInSearch: true,
            align: 'center',
            width: 120,
            ellipsis: true,
        },
        {
            title: <div style={{ textAlign: 'center' }}>断面车流统计(辆/日)</div>,
            dataIndex: "",
            hideInSearch: true,
            align: 'right',
            width: 180,
            ellipsis: true,
        },
        {
            title: "业态",
            dataIndex: "",
            hideInSearch: true,
            align: 'center',
            width: 120,
            ellipsis: true,
        },
        {
            title: "招商模式",
            dataIndex: "",
            hideInSearch: true,
            align: 'center',
            width: 120,
            ellipsis: true,
        },
        {
            title: "运营模式",
            dataIndex: "",
            hideInSearch: true,
            align: 'center',
            width: 120,
            ellipsis: true,
        },
        {
            title: <div style={{ textAlign: 'center' }}>首次保底营业额(元)</div>,
            dataIndex: "",
            hideInSearch: true,
            align: 'right',
            width: 150,
            ellipsis: true,
        },
        {
            title: <div style={{ textAlign: 'center' }}>首次采购人收益提点比例(%)</div>,
            dataIndex: "",
            hideInSearch: true,
            align: 'right',
            width: 200,
            ellipsis: true,
        },
        {
            title: <div style={{ textAlign: 'center' }}>二次保底营业额(元)</div>,
            dataIndex: "",
            hideInSearch: true,
            align: 'right',
            width: 150,
            ellipsis: true,
        },
        {
            title: <div style={{ textAlign: 'center' }}>二次采购人收益提点比例(%)</div>,
            dataIndex: "",
            hideInSearch: true,
            align: 'right',
            width: 200,
            ellipsis: true,
        },
        {
            title: <div style={{ textAlign: 'center' }}>三次保底营业额(元)</div>,
            dataIndex: "",
            hideInSearch: true,
            align: 'right',
            width: 150,
            ellipsis: true,
        },
        {
            title: <div style={{ textAlign: 'center' }}>三次采购人收益提点比例(%)</div>,
            dataIndex: "",
            hideInSearch: true,
            align: 'right',
            width: 200,
            ellipsis: true,
        }
    ]
    // 根据区域获取到服务区列表
    const handleGetServerPartList = async (id: string) => {
        const req: any = {
            ProvinceCode: "530000",
            SPRegionType_ID: id
        }
        const data = await handleGetServerpartTree(req)
        console.log('dsadasda', data);
        if (data && data.length > 0) {
            let list = data[0].children
            setServerPartList(list)
        } else {
            setServerPartList([])
        }
    }
    // 获取到服务区方位的方法
    const handleGetSERVERPARTREGION = async (id: string) => {
        setSERVERPARTREGION([])
        const req: any = {
            SERVERPARTId: id
        }
        const data = await handleGetServerpartInfo(req)
        console.log('datadatadata', data);
        let list: any = []
        if (data.RegionInfo && data.RegionInfo.length > 0) {
            data.RegionInfo.forEach((item: any) => {
                list.push({ label: item.SERVERPART_REGIONNAME, value: item.SERVERPART_REGION })
            })
        }
        console.log('listlistlist', list);



        const newReq: any = {
            SearchParameter: {
                SERVERPART_IDS: id
            },
            PageIndex: 1,
            PageSize: 999999,
        }

        let newreq: any = {
            name: "",
            value: encryptAES(JSON.stringify(newReq))
        }
        const newData = await handlGetSPCONTRIBUTIONList(newreq)
        console.log('newDatanewDatanewData', newData);
        if (newData && newData.length > 0) {
            let res: any = newData[0].SERVERPART_TYPE
            selectFormRef.current?.setFieldsValue({ rating: res })
        }

        setSERVERPARTREGION(list)
    }

    // 同步和新增方法
    const handleAddUpdate = async (formData: any) => {

    }

    return (
        <div style={{ height: 'calc(100vh - 100px)', backgroundColor: '#fff', display: 'flex' }}>
            <LeftSelectTree setSelectedId={setSelectedId} setCollapsible={setCollapsible} collapsible={collapsible} />
            <div style={{
                width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
                paddingTop: 0,
                paddingBottom: 0,
                paddingRight: 0
            }}>

                <ProTable
                    actionRef={actionRef}
                    formRef={formRef}
                    columns={columns}
                    bordered
                    scroll={{ x: '100%', y: 'calc(100vh - 450px)' }}
                    headerTitle={'租金测算列表'}
                    search={{ span: 6, }}
                    request={async (params) => {
                        if (!selectedId) {
                            return { data: [], success: true }
                        }

                        // if (data && data.length > 0) {
                        //     return { data, success: true }
                        // }
                        return { data: [], success: true }
                    }}
                    toolbar={{
                        actions: [
                            <Button type={'primary'} onClick={() => {
                                setShowSelectOperatingModel(true)
                                setSelectedOperatingModel(null); // Reset selection when opening modal
                            }}>添加租金测算</Button>
                        ]
                    }}
                />
            </div>


            <Modal
                title={'请选择运营模式'}
                destroyOnClose
                width={1200}
                open={showSelectOperatingModel}
                className={'operatingModelModal'}
                onCancel={() => {
                    setShowSelectOperatingModel(false)
                }}
                okText={'下一步'}
                onOk={async () => {
                    // setShowSelectOperatingModel(false);
                    selectFormRef.current?.validateFields().then((res: any) => {
                        if (selectedOperatingModel) {
                            setSelectFormData(res)
                            setRentCalculateModal(true)
                        } else {
                            message.success('请选择运营模式')
                        }
                    })
                }}
            >
                <div className="operatingModelModalBox">
                    {operatingModels.map((model) => (
                        <div
                            key={model}
                            className={`operatingModelModalItemBox ${selectedOperatingModel === model ? 'selected' : ''}`}
                            onClick={() => {
                                setSelectedOperatingModel(model)
                                // setShowSelectOperatingModel(false);
                                // setRentCalculateModal(true)
                            }}
                        >
                            {model}
                        </div>
                    ))}

                    <ProForm
                        formRef={selectFormRef}
                        submitter={false}
                        layout={'horizontal'}
                        labelCol={{ style: { width: 80 } }}
                        style={{ width: '100%', marginTop: '30px' }}
                    >
                        <Row gutter={8}>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'片区'}
                                    name={'belongAreaCode'}
                                    rules={[{ required: true, message: '请选择片区!' }]}
                                    request={async () => {
                                        const req: any = {
                                            SearchParameter: {
                                                SERVERPARTSTATICTYPE_ID: 1000,
                                                TYPE_STATE: 1,
                                                PROVINCE_CODE: 530000
                                            },
                                            PageIndex: 1,
                                            PageSize: 100,
                                            SortStr: "TYPE_INDEX,SERVERPARTTYPE_ID"
                                        }
                                        const data = await handleGetSERVERPARTTYPEList(req)
                                        console.log('datadatadatadata', data);
                                        let list: any = []
                                        if (data && data.length > 0) {
                                            data.forEach((item: any) => {
                                                list.push({ label: item.TYPE_NAME, value: item.SERVERPARTTYPE_ID })
                                            })
                                        }
                                        return list
                                    }}
                                    fieldProps={{
                                        showSearch: true,
                                        filterOption: (input, option) =>
                                            (option?.label ?? '').toLowerCase().includes(input.toLowerCase()),
                                        optionFilterProp: 'label',
                                        onChange: (value: any, option: any) => {
                                            handleGetServerPartList(value)
                                            if (value) {
                                                modalRef.current?.setFieldsValue({ belongArea: option.label })
                                            } else {
                                                modalRef.current?.setFieldsValue({ belongArea: "" })
                                            }
                                        }
                                    }}
                                />
                            </Col>
                            <Col span={8} style={{ display: 'none' }}>
                                <ProFormText
                                    label={'片区名称'}
                                    name={'belongArea'}
                                />
                            </Col>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'服务区'}
                                    name={'SACode'}
                                    options={serverPartList}
                                    fieldProps={{
                                        onChange: (e: any, option: any) => {
                                            handleGetSERVERPARTREGION(e)
                                            if (e) {
                                                modalRef.current?.setFieldsValue({ SAName: option.label })
                                            } else {
                                                modalRef.current?.setFieldsValue({ SAName: "" })
                                            }
                                        }
                                    }}
                                    rules={[{ required: true, message: '请选择服务区!' }]}
                                />
                            </Col>
                            <Col span={8} style={{ display: 'none' }}>
                                <ProFormText
                                    label={'服务区名称'}
                                    name={'SAName'}
                                />
                            </Col>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'方位'}
                                    name={'SERVERPART_REGION'}
                                    options={SERVERPARTREGION}
                                />
                            </Col>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'是否首次'}
                                    name={'isFirst'}
                                    rules={[
                                        {
                                            required: true,
                                            message: '请选择是否为首次'
                                        }
                                    ]}
                                    options={[
                                        { label: "首次", value: 1 },
                                        { label: "非首次", value: 2 }
                                    ]}
                                />
                            </Col>
                            <Col span={8} style={{ display: 'none' }}>
                                <ProFormSelect
                                    label={'分类定级'}
                                    name={'rating'}
                                    options={[
                                        { label: "立标杆", value: 1000 },
                                        { label: "提能级", value: 2000 },
                                        { label: "稳营收", value: 3000 },
                                        { label: "保功能", value: 4000 },
                                    ]}
                                // fieldProps={{
                                //     onChange: (e: any) => {
                                //         if (e) {
                                //             console.log('eeeeee', e);
                                //             let fromRes: any = modalRef.current?.getFieldValue('floorPrice')
                                //             if (fromRes) {
                                //                 let rate: number = 1.05
                                //                 if (e === 1000 || e === 2000) {
                                //                     rate = 1.15
                                //                 } else if (e === 3000) {
                                //                     rate = 1.1
                                //                 } else if (e === 4000) {
                                //                     rate = 1.05
                                //                 }
                                //                 let sum: number = fromRes * 1.15 * rate
                                //                 modalRef.current?.setFieldsValue({ floorPriceMore: sum.toFixed(2) })

                                //                 // 到这里是拿到新的  保底收益递增
                                //                 let newNumber: number = Number(sum.toFixed(2))
                                //                 // 先拿到判断是不是首次项目
                                //                 let formDataIsFirst: number = modalRef.current?.getFieldValue('isFirst')
                                //                 // 是首次 就不去改变  保底营业额的值 不是才计算
                                //                 if (formDataIsFirst === 1) {
                                //                     // 1 代表首次
                                //                     // 首次则  首次招标营业额 为 最高值收益(floorPriceMore) / 35%
                                //                     modalRef.current?.setFieldsValue({ firstMinimumRevenue: (Number(newNumber) / 0.35).toFixed(2) })
                                //                     // 那么二次保底营业额的值就是  第一次的值
                                //                     let firstMinimumRevenueNumber: number = Number((Number(sum.toFixed(2)) / 0.35).toFixed(2))
                                //                     modalRef.current?.setFieldsValue({ secondMinimumRevenue: (firstMinimumRevenueNumber).toFixed(2) })
                                //                     // 那么第三次保底营业额的值 就是 第二次的值 *90%
                                //                     let secondMinimumRevenue: number = Number((firstMinimumRevenueNumber).toFixed(2))
                                //                     modalRef.current?.setFieldsValue({ thriceMinimumRevenue: (secondMinimumRevenue * 0.9).toFixed(2) })

                                //                 } else if (formDataIsFirst === 2) {
                                //                     // 2 代表非首次 
                                //                     // 不是首次进来 那么就不管首次保底营业额了 只要看第二次 有没有值即可 有值算第三次 没值就不算
                                //                     let secondMinimumRevenueNumber: number = modalRef.current?.getFieldValue('secondMinimumRevenue')
                                //                     if (secondMinimumRevenueNumber) {
                                //                         modalRef.current?.setFieldsValue({ thriceMinimumRevenue: (secondMinimumRevenueNumber * 0.9).toFixed(2) })
                                //                     }
                                //                 }
                                //             }
                                //         }

                                //     }
                                // }}
                                />
                            </Col>
                        </Row>

                    </ProForm>
                </div>
            </Modal>


            {/* 打开实际填写测算的 悬浮框 */}
            <Modal
                title={'租金测算'}
                destroyOnClose
                width={1200}
                open={rentCalculateModal}
                onCancel={() => {
                    setSelectedOperatingModel(null)
                    setRentCalculateModal(false)
                }}
                onOk={async () => {
                    modalRef.current?.validateFields().then((res: any) => {
                        setSelectedOperatingModel(null)
                        setRentCalculateModal(false)
                        // 保存同步租金测算的方法
                        handleAddUpdate(res)
                    })
                }}
            >
                <div className="rentCalculateModalContent" style={{ height: '700px', overflowY: 'auto', overflowX: 'hidden', boxSizing: 'border-box', width: '100%' }}>
                    <ProForm
                        formRef={modalRef}
                        submitter={false}
                        layout={'horizontal'}
                        labelCol={{ style: { width: 120 } }}
                        request={async () => {
                            let formData: any = selectFormRef.current?.getFieldsValue({})
                            console.log('formDataformDataformData', formData);
                            if (formData) {
                                return {
                                    ...formData
                                }
                            } else {
                                return {}
                            }
                        }}
                    >

                        <Row gutter={16}>
                            <Divider orientation="left">基础信息</Divider>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'片区'}
                                    name={'belongAreaCode'}
                                    readonly
                                    request={async () => {
                                        const req: any = {
                                            SearchParameter: {
                                                SERVERPARTSTATICTYPE_ID: 1000,
                                                TYPE_STATE: 1,
                                                PROVINCE_CODE: 530000
                                            },
                                            PageIndex: 1,
                                            PageSize: 100,
                                            SortStr: "TYPE_INDEX,SERVERPARTTYPE_ID"
                                        }
                                        const data = await handleGetSERVERPARTTYPEList(req)
                                        console.log('datadatadatadata', data);
                                        let list: any = []
                                        if (data && data.length > 0) {
                                            data.forEach((item: any) => {
                                                list.push({ label: item.TYPE_NAME, value: item.SERVERPARTTYPE_ID })
                                            })
                                        }
                                        return list
                                    }}
                                />
                            </Col>
                            <Col span={8} style={{ display: 'none' }}>
                                <ProFormText
                                    label={'片区名称'}
                                    name={'belongArea'}
                                    readonly
                                />
                            </Col>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'服务区'}
                                    name={'SACode'}
                                    options={serverPartList}
                                    readonly
                                />
                            </Col>
                            <Col span={8} style={{ display: 'none' }}>
                                <ProFormText
                                    label={'服务区名称'}
                                    name={'SAName'}
                                    readonly
                                />
                            </Col>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'服务区方位'}
                                    name={'SERVERPART_REGION'}
                                    options={SERVERPARTREGION}
                                    readonly
                                />
                            </Col>
                            <Col span={8}>
                                <ProFormDigit
                                    label={'经营面积'}
                                    name={'operatingArea'}
                                    fieldProps={{
                                        onChange: (e: any) => {
                                            if (e) {
                                                let sum: number = e * 16.89
                                                modalRef.current?.setFieldsValue({ addWaterCost: sum.toFixed(2), addWaterCostMore: (Number(sum.toFixed(2)) * 1.15).toFixed(2) })
                                            }
                                        }
                                    }}
                                />
                            </Col>
                            {/* <Col span={8}>
                                <ProFormSelect
                                    label={'是否首次'}
                                    name={'isFirst'}
                                    options={[
                                        { label: "首次", value: 1 },
                                        { label: "非首次", value: 2 }
                                    ]}
                                    fieldProps={{
                                        onChange: (e: any) => {
                                            if (e) {
                                                // 因为是非首次 所以要拿到第三方保底递增收益的值 去判断 要不要重新计算首次保底营业额的值
                                                let floorPriceMore: number = modalRef.current?.getFieldValue('floorPriceMore')
                                                if (e === 2) {
                                                    modalRef.current?.setFieldsValue({ firstReminder: 32 })
                                                    if (floorPriceMore) {
                                                        modalRef.current?.setFieldsValue({ firstMinimumRevenue: Number(floorPriceMore / 0.35).toFixed(2) })
                                                    }
                                                } else if (e === 1) {
                                                    modalRef.current?.setFieldsValue({ firstReminder: 38 })
                                                    modalRef.current?.setFieldsValue({ firstMinimumRevenue: Number(floorPriceMore).toFixed(2) })
                                                }
                                            }
                                        }
                                    }}
                                />
                            </Col> */}
                            <Col span={8}>
                                <ProFormText
                                    label={'所属高速'}
                                    name={''}
                                />
                            </Col>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'站点类型'}
                                    name={''}
                                    options={[]}
                                />
                            </Col>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'评审方式'}
                                    name={''}
                                    options={[]}
                                />
                            </Col>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'业态'}
                                    name={''}
                                    options={[]}
                                />
                            </Col>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'招商模式'}
                                    name={''}
                                    options={[]}
                                />
                            </Col>
                            <Col span={8}>
                                <ProFormSelect
                                    label={'运营模式'}
                                    name={''}
                                    options={[]}
                                />
                            </Col>
                            {/* 每个类型 实际需要填写计算的内容 都不一样  所以要区分了 */}
                            {
                                selectedOperatingModel === '委托运营' ?
                                    <>
                                        <Divider orientation="left">委托运营</Divider>
                                        <Col span={8}>
                                            <ProFormDatePicker
                                                label={'合同到期时间'}
                                                name={''}
                                                width={'100%'}
                                            />
                                        </Col>
                                        <Col span={8}>
                                            <ProFormDigit
                                                label={'原合同末年租金'}
                                                name={''}
                                            />
                                        </Col>
                                        <Col span={8}>
                                            <ProFormText
                                                label={'捆绑方式'}
                                                name={''}
                                            />
                                        </Col>
                                        <Divider orientation="left">集团公司成本价格</Divider>
                                        <Col span={8}>
                                            <ProFormDigit
                                                label={'加水'}
                                                name={'addWaterCost'}
                                                fieldProps={{
                                                    onChange: (e: any) => {
                                                        if (e) {
                                                            modalRef.current?.setFieldsValue({ addWaterCostMore: (Number(e) * 1.15).toFixed(2) })
                                                        }
                                                    }
                                                }}
                                            />
                                        </Col>
                                        <Col span={8}>
                                            <ProFormDigit
                                                label={'加水成本递增15%'}
                                                name={'addWaterCostMore'}
                                            />
                                        </Col>
                                        <Divider orientation="left">第三方评估测算年保底收益</Divider>
                                        <Col span={8}>
                                            <ProFormDigit
                                                label={'保底价格'}
                                                name={'floorPrice'}
                                                fieldProps={{
                                                    onChange: (e: any) => {
                                                        if (e) {
                                                            let fromRes: any = Number(selectFormData?.rating)
                                                            if (fromRes) {
                                                                let rate: number = 1.05
                                                                if (fromRes === 1000 || fromRes === 2000) {
                                                                    rate = 1.15
                                                                } else if (fromRes === 3000) {
                                                                    rate = 1.1
                                                                } else if (fromRes === 4000) {
                                                                    rate = 1.05
                                                                }
                                                                let sum: number = e * 1.15 * rate
                                                                modalRef.current?.setFieldsValue({ floorPriceMore: sum.toFixed(2) })

                                                                // 是首次 那么就要把 1 2 3 次都算出来  不是首次的话  就算 2 3 即可
                                                                if (selectFormData?.isFirst === 1) {
                                                                    // 是首次的话 
                                                                    modalRef.current?.setFieldsValue({ firstMinimumRevenue: (Number(sum.toFixed(2)) / 0.35).toFixed(2) })
                                                                    // 首次的钱 赋值一下
                                                                    let firstMinimumRevenueNumber: number = Number((Number(sum.toFixed(2)) / 0.35).toFixed(2))
                                                                    // 第二次就是第一次的值 
                                                                    modalRef.current?.setFieldsValue({ secondMinimumRevenue: (Number(firstMinimumRevenueNumber)).toFixed(2) })
                                                                    // 给第二次的钱 赋值一下 
                                                                    let secondMinimumRevenueNumber: number = Number((Number(firstMinimumRevenueNumber)).toFixed(2))
                                                                    // 第三次的钱是第二次的90%
                                                                    modalRef.current?.setFieldsValue({ thriceMinimumRevenue: (Number(secondMinimumRevenueNumber) * 0.9).toFixed(2) })
                                                                } else if (selectFormData?.isFirst === 2) {
                                                                    // 非首次 这边怎么样都没关系了 等用户自己输入第一次的值之后 再给他补齐 2 3 次
                                                                }
                                                            }
                                                        }
                                                    }
                                                }}
                                            />
                                        </Col>
                                        <Col span={8}>
                                            <ProFormDigit
                                                label={'保底收益递增'}
                                                name={'floorPriceMore'}
                                                fieldProps={{
                                                    onChange: (e: any) => {
                                                        if (e) {
                                                            // 先拿到判断是不是首次项目
                                                            let formDataIsFirst: number = modalRef.current?.getFieldValue('isFirst')
                                                            // 是首次 就不去改变  保底营业额的值 不是才计算
                                                            if (formDataIsFirst === 1) {
                                                            } else if (formDataIsFirst === 2) {
                                                                modalRef.current?.setFieldsValue({ firstMinimumRevenue: Number(e / 0.35).toFixed(2) })
                                                            }
                                                        }
                                                    }
                                                }}
                                            />
                                        </Col>

                                        <>
                                            <Divider orientation="left">测算结果</Divider>
                                            <Col span={8}>
                                                <ProFormDatePicker
                                                    label={'合作期限'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDatePicker
                                                    label={'首次非招标启动时间'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Divider orientation="left">首次招标</Divider>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'保底营业额（元）'}
                                                    name={'firstMinimumRevenue'}
                                                    fieldProps={{
                                                        onChange: (e: any) => {
                                                            if (e) {
                                                                let sum: number = e * 0.9
                                                                modalRef.current?.setFieldsValue({
                                                                    secondMinimumRevenue: e,
                                                                    thriceMinimumRevenue: sum.toFixed(2)
                                                                })
                                                            }
                                                        }
                                                    }}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'收益提点比例（%）'}
                                                    name={'firstReminder'}
                                                    initialValue={selectFormData?.isFirst === 1 ? 38 : 32}
                                                />
                                            </Col>
                                            <Divider orientation="left">二次招标</Divider>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'保底营业额（元）'}
                                                    name={'secondMinimumRevenue'}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'收益提点比例（%）'}
                                                    name={'secondReminder'}
                                                    initialValue={32}
                                                />
                                            </Col>
                                            <Divider orientation="left">三次招标</Divider>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'保底营业额（元）'}
                                                    name={'thriceMinimumRevenue'}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'收益提点比例（%）'}
                                                    name={'thirdReminder'}
                                                    initialValue={32}
                                                />
                                            </Col>

                                        </>
                                    </> :
                                    selectedOperatingModel === '加盟项目' ?
                                        <>
                                            <Divider orientation="left">业态定位</Divider>
                                            <Col span={8}>
                                                <ProFormText
                                                    label={'餐饮'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormText
                                                    label={'小吃'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormText
                                                    label={'便利店'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Divider orientation="left">业态面积</Divider>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'综合楼面积'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'加水经营面积'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'汽修站面积'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Divider orientation="left">原合同末年租金</Divider>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'综合楼'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'加水'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'汽修站'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Divider orientation="left">集团公司成本价格</Divider>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'综合楼'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'综合楼成本递增15%'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'加水'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'加水成本递增15%'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'汽修站'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'汽修站成本递增15%'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'集团成本合计递增15%'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Divider orientation="left">第三方评估测算年保底收益（元）</Divider>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'综合楼'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'加水区域'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'汽修站'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Divider orientation="left">加盟项目</Divider>
                                            <Col span={8}>
                                                <ProFormDatePicker
                                                    label={'合同到期时间'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'保底收益合计'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormDigit
                                                    label={'保底收益递增'}
                                                    name={''}
                                                />
                                            </Col>
                                            <Col span={8}>
                                                <ProFormText
                                                    label={'捆绑方式'}
                                                    name={''}
                                                />
                                            </Col>

                                            <>
                                                <Divider orientation="left">首次招商</Divider>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'本年底价（元）'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'品牌营销费（元）'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDatePicker
                                                        label={'非招标启动时间'}
                                                        name={''}
                                                    />
                                                </Col>

                                                <Divider orientation="left">测算结果</Divider>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'本年二次招商底价（元）'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'本年三次招商底价（元）'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'物业费用（元）'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'装修免租期（月）'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'加盟费（元）'}
                                                        name={''}
                                                    />
                                                </Col>

                                                <Col span={8}>
                                                    <ProFormDatePicker
                                                        label={'合作期限'}
                                                        name={''}
                                                        width={'100%'}
                                                    />
                                                </Col>

                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'评估费'}
                                                        name={''}
                                                    />
                                                </Col>
                                            </>
                                        </> :
                                        selectedOperatingModel === '保底收益一' ?
                                            <>
                                                <Divider orientation="left">业态面积</Divider>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'综合楼面积'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'餐饮'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'小吃'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'便利店'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'加水'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'汽修站'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Divider orientation="left">第三方评估测算年保底收益（元）</Divider>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'综合楼'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'加水'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'汽修站'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Divider orientation="left">保底收益一</Divider>
                                                <Col span={8}>
                                                    <ProFormDatePicker
                                                        label={'合同到期时间'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'保底收益'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormDigit
                                                        label={'保底收益递增'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <Col span={8}>
                                                    <ProFormText
                                                        label={'捆绑方式'}
                                                        name={''}
                                                    />
                                                </Col>
                                                <>
                                                    <Divider orientation="left">测算结果</Divider>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'综合楼单平方价格（m²/元/年）'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'去年首次招商底价（元）'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'总物业费用（元）'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'装修免租期（月）'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDatePicker
                                                            label={'合作期限'}
                                                            width={'100%'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDatePicker
                                                            label={'首次非招标启动时间'}
                                                            width={'100%'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'去年评估费'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Divider orientation="left">面积拆分招商底价（元）</Divider>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'餐饮'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'小吃'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'便利店'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'汽修'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'加水'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Divider orientation="left">面积拆分物业费（元）</Divider>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'餐饮'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'小吃'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'便利店'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'汽修站'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                </>

                                            </> :
                                            selectedOperatingModel === '保底收益二' ?
                                                <>
                                                    <Divider orientation="left">业态面积</Divider>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'汽修站面积'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Divider orientation="left">原合同末年租金</Divider>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'综合楼'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'加水'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'汽修站'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Divider orientation="left">集团公司成本价格</Divider>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'汽修站'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'汽修站递增'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Divider orientation="left">第三方评估测算年保底收益（元）</Divider>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'汽修站'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Divider orientation="left">保底收益二</Divider>
                                                    <Col span={8}>
                                                        <ProFormDatePicker
                                                            label={'合同到期时间'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormDigit
                                                            label={'保底收益递增'}
                                                            name={''}
                                                        />
                                                    </Col>
                                                    <Col span={8}>
                                                        <ProFormText
                                                            label={'捆绑方式'}
                                                            name={''}
                                                        />
                                                    </Col>

                                                    <>
                                                        <Divider orientation="left">招商底价（元）</Divider>
                                                        <Col span={8}>
                                                            <ProFormDigit
                                                                label={'今年首次'}
                                                                name={''}
                                                            />
                                                        </Col>
                                                        <Col span={8}>
                                                            <ProFormDigit
                                                                label={'今年二次'}
                                                                name={''}
                                                            />
                                                        </Col>
                                                        <Col span={8}>
                                                            <ProFormDigit
                                                                label={'今年三次'}
                                                                name={''}
                                                            />
                                                        </Col>
                                                        <Divider orientation="left">测算结果</Divider>
                                                        <Col span={8}>
                                                            <ProFormDigit
                                                                label={'总物业费用（元）'}
                                                                name={''}
                                                            />
                                                        </Col>
                                                        <Col span={8}>
                                                            <ProFormDigit
                                                                label={'综合楼面积（m²）'}
                                                                name={''}
                                                            />
                                                        </Col>
                                                        <Col span={8}>
                                                            <ProFormDigit
                                                                label={'汽修物业费（元）'}
                                                                name={''}
                                                            />
                                                        </Col>
                                                        <Col span={8}>
                                                            <ProFormDatePicker
                                                                label={'合作期限'}
                                                                width={'100%'}
                                                                name={''}
                                                            />
                                                        </Col>
                                                        <Col span={8}>
                                                            <ProFormDatePicker
                                                                label={'首次招商启动时间'}
                                                                width={'100%'}
                                                                name={''}
                                                            />
                                                        </Col>
                                                        <Col span={8}>
                                                            <ProFormDigit
                                                                label={'评估费'}
                                                                name={''}
                                                            />
                                                        </Col>
                                                    </>
                                                </> :
                                                <></>

                            }
                        </Row>
                    </ProForm>
                </div>
            </Modal>

        </div >)
}

export default connect(({ user }: ConnectState) => ({
    currentUser: user.data
}))(RentCalculation);