import LeftSelectTree from "@/components/leftSelectTree/leftSelectTree";
import { encryptAES } from "@/utils/handleAes";
import { useRef, useState } from "react";
import { connect } from "umi";
import { handlGetMonthAnalysis, handlGetPERCENTAGEOFCOMMISSIONList, handlGetREGISTERCOMPACTList, handlGetRENTCALCULATIONList, handlGetSPCONTRIBUTIONList } from "../operationReport/service";
import { handleGetPassportInfoById } from "../DigitalElectronics/service";
import { ActionType, FormInstance, ProTable } from "@ant-design/pro-components";
import moment from "moment";
import { Modal, Tooltip } from "antd";
import './style.less'
import operation from '../../assets/operation.png'

const rentComparison: React.FC<{ currentUser: any }> = (props) => {
    const actionRef = useRef<ActionType>();
    const formRef = useRef<FormInstance>();
    // 树相关的属性和方法
    const [selectedId, setSelectedId] = useState<string>()
    const [collapsible, setCollapsible] = useState<boolean>(false)
    // 当前的用户信息
    const [userInfoDetail, setUserInfoDetail] = useState<any>()
    // 详情悬浮框
    const [detailModal, setDetailModal] = useState<boolean>(false)
    // 当前行数据
    const [currentRow, setCurrentRow] = useState<any>()
    // 表格的默认搜索条件
    const [searchParams, setSearchParams] = useState<any>()
    // 悬浮框里面 需要显示的内容的总体对象
    const [currentObj, setCurrentObj] = useState<any>()
    // 对比的 排名前五的数据
    const [top5Data, setTop5Data] = useState<any>()
    // 悬浮框在请求数据的时候的加载效果
    const [modalLoading, setModalLoading] = useState<boolean>(false)

    const SERVERPART_TYPEObj: any = {
        1000: "立标杆",
        2000: "提能级",
        3000: "稳营收",
        4000: "保功能",
    }


    const columns: any = [
        {
            title: "统计日期",
            dataIndex: "staticDate",
            hideInTable: true,
            valueType: "dateRange",
            initialValue: [moment().startOf('M'), moment()],
            search: {
                transform: (value: any) => {
                    return {
                        COMPACT_STARTDATE_End: moment().startOf('y').format('YYYY-MM-DD'),
                        COMPACT_ENDDATE_Start: moment().format('YYYY-MM-DD')
                    };
                },
            },
            fieldProps: {
                picker: "day",
                format: 'YYYY-MM-DD',
            }
        },
        {
            title: "服务区名称",
            dataIndex: "SERVERPART_NAME",
            width: 150,
            hideInSearch: true,
            ellipsis: true,
            align: 'center'
        },
        {
            title: "合同名称",
            dataIndex: "COMPACT_NAME",
            width: 300,
            hideInSearch: true,
            ellipsis: true,
            align: 'center',
            render: (_, record) => {
                return record?.COMPACT_NAME ?
                    <a onClick={() => {
                        setModalLoading(true)
                        setCurrentRow(record)
                        setDetailModal(true)
                    }}>{record?.COMPACT_NAME || ""}</a> : ""
            }
        },
        {
            title: "合同格式",
            dataIndex: "ISFORMAT",
            width: 150,
            hideInSearch: true,
            ellipsis: true,
            valueType: 'select',
            valueEnum: {
                1000: "联合经营",
                2000: "委托运营管理",
                3000: "固定租金",
                4000: "业主自营",
            },
            align: 'center'
        },
        {
            title: <div style={{ textAlign: 'center' }}>合同金额(万元)</div>,
            dataIndex: "COMPACT_AMOUNT",
            width: 150,
            hideInSearch: true,
            ellipsis: true,
            align: 'right',
            valueType: 'digit'
        },
        {
            title: <div style={{ textAlign: 'center' }}>履约保证金(万元)</div>,
            dataIndex: "SECURITYDEPOSIT",
            width: 150,
            hideInSearch: true,
            ellipsis: true,
            align: 'right',
            valueType: 'digit'
        },
        {
            title: <div style={{ textAlign: 'center' }}>合同期限(天)</div>,
            dataIndex: "DURATIONDAY",
            width: 150,
            hideInSearch: true,
            ellipsis: true,
            align: 'right',
            valueType: 'digit'
        },
        {
            title: "开始时间",
            dataIndex: "COMPACT_STARTDATE",
            width: 150,
            hideInSearch: true,
            ellipsis: true,
            align: 'center',
            render: (_, record) => {
                return record?.COMPACT_STARTDATE ? moment(record?.COMPACT_STARTDATE).format('YYYY-MM-DD') : ""
            }
        },
        {
            title: "结束时间",
            dataIndex: "COMPACT_ENDDATE",
            width: 150,
            hideInSearch: true,
            ellipsis: true,
            align: 'center',
            render: (_, record) => {
                return record?.COMPACT_ENDDATE ? moment(record?.COMPACT_ENDDATE).format('YYYY-MM-DD') : ""
            }
        },
        {
            title: "甲方",
            dataIndex: "FIRSTPART_NAME",
            width: 250,
            hideInSearch: true,
            ellipsis: true,
            align: 'center'
        },
        {
            title: "乙方",
            dataIndex: "SECONDPART_NAME",
            width: 250,
            hideInSearch: true,
            ellipsis: true,
            align: 'center'
        }
    ]

    // 租金对比
    const handleGetRentComparison = async () => {
        console.log('dsakdas', currentRow);
        // 先拿到当前合同的提成比例
        const req: any = {
            searchParameter: {
                REGISTERCOMPACT_IDS: currentRow?.REGISTERCOMPACT_ID,
                STARTDATE_End: searchParams?.COMPACT_ENDDATE_Start || "",
                ENDDATE_Start: searchParams?.COMPACT_STARTDATE_End || "",
            },
            PageIndex: 1,
            PageSize: 999999,
        }
        console.log('reqreqreqreq', req);
        let newReq: any = {
            name: "",
            value: encryptAES(JSON.stringify(req))
        }
        const data = await handlGetPERCENTAGEOFCOMMISSIONList(newReq)
        console.log('dakdjsakldjsa', data);
        // 可能会查出来多条  我们取最新的 就是后面的那条
        // 提成比例的数据  这是取出当期的  
        let commissionObj: any = {}
        if (data && data.length > 0) {
            commissionObj = data[data.length - 1]
        }

        // 现在取出上一期的
        let previousReq: any = {
            searchParameter: {
                REGISTERCOMPACT_IDS: currentRow?.REGISTERCOMPACT_ID,
                STARTDATE_End: moment(searchParams?.COMPACT_ENDDATE_Start).subtract(1, 'y').format('YYYY-MM-DD'),
                ENDDATE_Start: moment(searchParams?.COMPACT_STARTDATE_End).subtract(1, 'y').format('YYYY-MM-DD'),
            },
            PageIndex: 1,
            PageSize: 999999,
        }
        let newPreviousReq: any = {
            name: "",
            value: encryptAES(JSON.stringify(previousReq))
        }

        const previousData = await handlGetPERCENTAGEOFCOMMISSIONList(newPreviousReq)
        console.log('previousDatapreviousDatapreviousData', previousData);
        // 拿到上一期的数据
        let commissionObjPrevious: any = {}
        if (previousData && previousData.length > 0) {
            commissionObjPrevious = previousData[previousData.length - 1]
        }
        console.log('commissionObjPreviouscommissionObjPreviouscommissionObjPrevious', commissionObjPrevious);

        // 拿到营收数据
        // 这里的时间 先写死 25年1月到8月
        const revenueReq: any = {
            StatisticsDate: "2025/12/31",
            StartDate: "2025/01/01",
            EndDate: "2025/08/31",
            Serverpart_ID: currentRow?.SERVERPART_ID
        }


        const revenueData: any = await handlGetMonthAnalysis(revenueReq)
        console.log('revenueDatarevenueDatarevenueData', revenueData);
        // 这是一个月一个月给的营收数据的数组 我们算全年的 就 取平均 然后 *12 
        let yearRevenueSum: number = 0
        if (revenueData && revenueData.length > 0) {
            // 取营收的平均值  车流当前显示的内容 不需要车流数据了 
            let revenueSum: number = 0
            let revenueAvg: number = 0
            revenueData.forEach((item: any) => {
                revenueSum += item.RevenueAmount
            })
            revenueAvg = Number((revenueSum / revenueData.length).toFixed(2))
            yearRevenueSum = revenueAvg * 12
        }

        // 全年营收
        console.log('yearRevenueSumyearRevenueSumyearRevenueSumyearRevenueSum', yearRevenueSum);
        // 提成比例的数据对象
        console.log('commissionObjcommissionObj', commissionObj);
        let nowProfit: number = Number(((Number(yearRevenueSum) * Number(commissionObj.GUARANTEERATIO / 100)) / 10000).toFixed(2))
        let res: any = {
            ...currentRow,
            noRate: commissionObj.GUARANTEERATIO ? false : true,
            max: commissionObj?.EXCESSRATIO || commissionObj?.GUARANTEERATIO || "",
            min: commissionObj?.GUARANTEERATIO || "",
            MINTURNOVERMin: commissionObj?.MINTURNOVER || "",
            MINTURNOVERMax: commissionObj?.MINTURNOVER || "",
            avg: commissionObj?.GUARANTEERATIO || "",
            MINTURNOVERAvg: commissionObj?.MINTURNOVER || "",
            MINTURNOVER: commissionObj?.MINTURNOVER || "",
            GUARANTEERATIO: commissionObj?.GUARANTEERATIO || "",
            profit: Number((yearRevenueSum / 10000).toFixed(2)),
            avgThanNowRate: commissionObjPrevious.GUARANTEERATIO > commissionObj.GUARANTEERATIO,
            oldRate: commissionObjPrevious.GUARANTEERATIO,
            reduce: commissionObjPrevious.GUARANTEERATIO - commissionObj.GUARANTEERATIO,
            nowRate: commissionObj.GUARANTEERATIO,
            BUSINESS_TYPEMINTURNOVER: commissionObjPrevious.MINTURNOVER,
            nowGUARANTEERATIO: commissionObjPrevious.GUARANTEERATIO,
            differenceGUARANTEERATIO: commissionObj.GUARANTEERATIO - commissionObjPrevious.GUARANTEERATIO,

            MINTURNOVERAvgThanAvg: commissionObjPrevious.MINTURNOVER > commissionObj.MINTURNOVER,
            addMINTURNOVER: nowProfit - commissionObj.MINTURNOVER,
            addMINTURNOVERRate: commissionObjPrevious.MINTURNOVER ? (nowProfit / commissionObjPrevious.MINTURNOVER * 100).toFixed(2) : "",
            nowProfit: nowProfit,
            currentThanRecently: commissionObj.MINTURNOVER > commissionObjPrevious.MINTURNOVER,
            recentREVENUE_AMOUNT: Number((yearRevenueSum).toFixed(2)),
            nowMINTURNOVER: commissionObj.MINTURNOVER
        }

        // 这里再添加判断 之前是有业态 所以知道行业提成比例 现在也没有业态 那么就拿我们之前租金测算出来的 第三次比例 当作 他的比例去计算
        if (res.noRate) {
            let contributionReq: any = {
                searchParameter: {
                    SERVERPART_IDS: currentRow?.SERVERPART_ID
                },
                PageIndex: 1,
                PageSize: 999999,
            }

            let newContributionReq: any = {
                name: "",
                value: encryptAES(JSON.stringify(contributionReq))
            }
            const contributionData = await handlGetSPCONTRIBUTIONList(newContributionReq)
            console.log('contributionDatacontributionDatacontributionData', contributionData);
            // 拿到分类定级
            if (contributionData && contributionData.length > 0) {
                let SERVERPART_TYPEStr: string = contributionData[0].SERVERPART_TYPE


                const req: any = {
                    searchParameter: {
                        SERVERPART_IDS: currentRow?.SERVERPART_ID,
                        SERVERPART_TYPES: SERVERPART_TYPEStr,
                        RENTCALCULATION_STATE: 1
                    },
                    PageIndex: 1,
                    PageSize: 999999,
                    SortStr: "OPERATE_DATE desc"
                }
                let newReq: any = {
                    name: "",
                    value: encryptAES(JSON.stringify(req))
                }
                const data = await handlGetRENTCALCULATIONList(newReq)
                console.log('dskadjaskldjaslkdjsal', data);
                if (data && data.length > 0) {
                    // 建议提成比例
                    let newGUARANTEERATIO: number = Number(data[0].THIRD_PURCHASER_RATE)
                    let nowProfit: number = Number(((Number(yearRevenueSum) * Number(newGUARANTEERATIO / 100)) / 10000).toFixed(2))

                    res = {
                        ...res,
                        avgThanNowRate: false,
                        nowRate: newGUARANTEERATIO,
                        oldRate: newGUARANTEERATIO,
                        MINTURNOVERAvgThanAvg: nowProfit < commissionObj?.MINTURNOVER,
                        nowProfit: nowProfit,
                        addMINTURNOVER: nowProfit - commissionObj.MINTURNOVER,
                        addMINTURNOVERRate: commissionObjPrevious.MINTURNOVER ? (nowProfit / commissionObjPrevious.MINTURNOVER * 100).toFixed(2) : "",
                        currentThanRecently: commissionObj.MINTURNOVER > commissionObjPrevious.MINTURNOVER,
                        recentREVENUE_AMOUNT: Number((yearRevenueSum).toFixed(2)),
                        nowMINTURNOVER: commissionObj.MINTURNOVER



                    }
                }
            }
        }


        console.log('dklashdoashldjashkl', res);

        setCurrentObj(res)

        setModalLoading(false)
    }

    const truncateDecimal = (num: number) => {
        if (!num && num !== 0) {
            return 0
        }
        // 先用 toFixed 保留两位小数以消除精度问题
        const fixedNum = parseFloat(num.toFixed(10));
        // 将数字转换为字符串
        let strNum = fixedNum.toString();

        // 找到小数点的位置
        const dotIndex = strNum.indexOf('.');

        // 如果有小数点且小数点后有至少两位，则截取
        if (dotIndex !== -1) {
            strNum = strNum.substring(0, dotIndex + 3);
        }

        // 转换回数字类型
        return parseFloat(strNum);
    }

    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) => {
                        // 地址栏传参    UserIdEncrypted 为当前登录用户的加密id
                        const search = window.location.search;
                        const addressParams = Object.fromEntries(new URLSearchParams(search).entries());
                        const reqtoken: any = {
                            UserIdEncrypted: addressParams.UserIdEncrypted
                        }
                        const userInfo = await handleGetPassportInfoById(reqtoken)
                        setUserInfoDetail(userInfo)
                        if (!selectedId) {
                            return { data: [], success: true }
                        }

                        const req: any = {
                            searchParameter: {
                                COMPACT_TYPE: 530001,
                                COMPACT_DETAILS: 1000,
                                SERVERPART_IDS: selectedId,
                                COMPACT_STARTDATE_End: params?.COMPACT_STARTDATE_End || "",
                                COMPACT_ENDDATE_Start: params?.COMPACT_ENDDATE_Start || "",
                            },
                            PageIndex: 1,
                            PageSize: 999999,
                            SortStr: "MODIFYDATE desc"
                        }
                        let newReq: any = {
                            name: "",
                            value: encryptAES(JSON.stringify(req))
                        }
                        setSearchParams(params)
                        const data = await handlGetREGISTERCOMPACTList(newReq)
                        console.log('datadatadatadata', data);

                        if (data && data.length > 0) {
                            return { data, success: true }
                        }
                        return { data: [], success: true }
                    }}
                    toolbar={{
                        actions: [

                        ]
                    }}
                />
            </div>


            <Modal
                title={'租金对比'}
                destroyOnClose
                width={1200}
                open={detailModal}
                className="rentComparisonModalBox"
                onCancel={() => {
                    setCurrentRow(undefined)
                    setDetailModal(false)
                }}
                footer={false}
                afterOpenChange={(open: boolean) => {
                    if (open) {
                        // 获取租金对比的数据  并计算数据
                        handleGetRentComparison()
                    }
                }}
                loading={modalLoading}
            >
                <div className="analysisModalContentBox">
                    <div className={'serverPart'}>
                        <div className={'serverPartDetail'}>
                            <div className={'serverPartDetailTop'}>
                                <span className={'serverPartName'}>{currentObj?.SERVERPART_NAME}</span>
                                <div className={'serverPartType'}>{SERVERPART_TYPEObj[currentObj?.SERVERPART_TYPE]}</div>
                            </div>
                            <div className="bigTitlte">{`${currentObj?.COMPACT_NAME || ''}`}</div>
                        </div>
                    </div>

                    <div className={'operateLeft'}>
                        <img className={'operateIcon'} src={operation} />
                        <span className={'titleName'}>招商分析</span>
                    </div>
                    <div style={{ fontWeight: 600, color: '#FE7628' }}>通过查询云南彩云驿所有经营项目数据：</div>

                    <div className="paragraph" style={{ textIndent: '2rem' }}>
                        大模型调用租金收益和服务区整体营收，2项核心数据指标，对各候选项目的潜在收益及服务区适应性进行综合衡量，优化即将到期得
                        <span className="keynote">{currentObj?.SERVERPART_NAME}</span>
                        的
                        <span className="keynote">{currentObj?.COMPACT_NAME}</span>
                        具体分析如下：
                    </div>

                    <div className="proposal" style={{ marginTop: '12px' }}>
                        <div style={{ marginTop: '12px' }}>
                            当前在营项目的提成比例为：{
                                currentObj?.noRate ? '固定租金' :
                                    <span>{currentObj?.min === currentObj?.max ?
                                        <span>
                                            <span className="keynote">{currentObj?.max}%</span>
                                        </span> :
                                        <span>
                                            <span className="keynote">{currentObj?.min}%</span>—
                                            <span className="keynote">{currentObj?.max}%</span>
                                        </span>}</span>
                            }，保底租金为：{
                                currentObj?.MINTURNOVERMin === currentObj?.MINTURNOVERMax ?
                                    <span className="keynote">{currentObj?.MINTURNOVERMin}</span> :
                                    <span>
                                        <span className="keynote">{currentObj?.MINTURNOVERMin}</span>万元—
                                        <span className="keynote">{currentObj?.MINTURNOVERMax}</span>
                                    </span>
                            }万元，平均提成比例：{currentObj?.noRate ? '固定租金' : <span className="keynote">{currentObj?.avg}%</span>}，平均保底租金为：<span className="keynote">{currentObj?.MINTURNOVERAvg}万元</span>，
                        </div>
                        <div>
                            <span className="keynote">{`${currentObj?.COMPACT_NAME}`}</span>目前保底租金为<span className="keynote">{currentObj?.MINTURNOVER || ''}</span>万/年，
                            {
                                currentObj?.noRate ?
                                    '' :
                                    <span>提成比例<span className="keynote">{currentObj?.GUARANTEERATIO || '-'}%，</span></span>
                            }
                            <Tooltip title={currentObj?.indexRevenue || ''}>
                                累计盈利：<span className="keynote">{currentObj?.profit || ''}</span>万元
                            </Tooltip>
                        </div>


                        <div style={{ marginTop: '12px' }}><span className="proposalTitle">租金提成建议</span>：</div>
                        <div style={{ fontWeight: 600 }}>提成比例{
                            currentObj?.avgThanNowRate ?
                                <span>
                                    <Tooltip title={`${currentObj?.oldRate}%${currentObj?.reduce ? `-${currentObj.reduce}%` : ''}`}>
                                        <span className="keynote" style={{ color: 'red' }}>{currentObj?.nowRate || ''}%</span>
                                    </Tooltip>
                                    —
                                    <span className="keynote" style={{ color: 'red' }}>{currentObj?.avg || ''}%</span>
                                    {
                                        currentObj?.BUSINESS_TYPE === 2000 ?
                                            <span>(原合同固定租金：<span className="keynote">{currentObj?.BUSINESS_TYPEMINTURNOVER || ''}</span>万/年)</span> :
                                            <span>(原合同提成比例<span className="keynote">{currentObj?.nowGUARANTEERATIO || ''}%</span>
                                                {
                                                    currentObj?.differenceGUARANTEERATIO ?
                                                        <span>，{currentObj?.differenceGUARANTEERATIO > 0 ? '优于' : currentObj?.differenceGUARANTEERATIO < 0 ? '下浮' : ''}<span className="keynote">{currentObj?.differenceGUARANTEERATIO || ''}%</span></span> : ''
                                                }
                                                )
                                            </span>
                                    }
                                </span> :
                                <span>
                                    <Tooltip title={`${currentObj?.oldRate}%${currentObj?.reduce ? `-${currentObj.reduce}%` : ''}`}>
                                        <span className="keynote" style={{ color: 'red' }}>{currentObj?.nowRate || ''}%</span>
                                    </Tooltip>
                                    {
                                        currentObj?.noRate ?
                                            <span>(原合同固定租金：<span className="keynote">{currentObj?.BUSINESS_TYPEMINTURNOVER || ''}</span>万/年)</span> :
                                            <span>(原合同提成比例<span className="keynote">{currentObj?.nowGUARANTEERATIO || ''}%</span>
                                                {
                                                    currentObj?.differenceGUARANTEERATIO ?
                                                        <span>，{currentObj?.differenceGUARANTEERATIO > 0 ? '优于' : currentObj?.differenceGUARANTEERATIO < 0 ? '下浮' : ''}
                                                            <span className="keynote">{currentObj?.differenceGUARANTEERATIO || ''}%</span>
                                                        </span> : ''
                                                }
                                                )</span>
                                    }
                                </span>
                        }
                        </div>
                        <div style={{ fontWeight: 600 }}>保底租金
                            {
                                currentObj?.MINTURNOVERAvgThanAvg ?
                                    <span>
                                        {/* title={`${currentObj?.currentThanRecently ? '当前' : '上个'}合同年的对客销售总额${truncateDecimal(currentObj?.recentREVENUE_AMOUNT / 10000)}万元×${currentObj?.nowRate || ''}% = ${currentObj?.nowProfit}万元，保底租金${currentObj?.addMINTURNOVER>0?'优于':currentObj?.addMINTURNOVER<0?'下浮':''}${currentObj?.addMINTURNOVER}万/年。`} */}
                                        <Tooltip title={currentObj?.BUSINESS_TYPE === 2000 ? `` : `比原来${currentObj?.addMINTURNOVER > 0 ? '优于' : currentObj?.addMINTURNOVER < 0 ? '下浮' : ''}${currentObj?.addMINTURNOVER}万元，${currentObj?.addMINTURNOVERRate > 0 ? '提升' : currentObj?.addMINTURNOVERRate < 0 ? '降低' : ''}${Math.abs(currentObj?.addMINTURNOVERRate)}%`}>
                                            <span className="keynote" style={{ color: 'red' }}>{currentObj?.nowProfit}</span>万元
                                        </Tooltip>
                                        —
                                        <span className="keynote" style={{ color: 'red' }}>{currentObj?.MINTURNOVERAvg}万元</span>
                                        ({currentObj?.currentThanRecently ? '当前' : '上个'}合同年的对客销售总额<span className="keynote">{((currentObj?.recentREVENUE_AMOUNT / 10000).toFixed(2))}</span>万元×<span className="keynote">{currentObj?.nowRate || ''}%</span> = <span className="keynote">{currentObj?.nowProfit}</span>万元，原合同保底租金<span className="keynote">{currentObj?.BUSINESS_TYPE === 2000 ? currentObj?.BUSINESS_TYPEMINTURNOVER : currentObj?.nowMINTURNOVER}</span>万元，{currentObj?.addMINTURNOVER > 0 ? '优于' : currentObj?.addMINTURNOVER < 0 ? '下浮' : ''}<span className="keynote">{currentObj?.addMINTURNOVER}</span>万/年)
                                    </span>
                                    :
                                    <span>
                                        <Tooltip title={currentObj?.BUSINESS_TYPE === 2000 ? `` : `比原来${currentObj?.addMINTURNOVER > 0 ? '优于' : currentObj?.addMINTURNOVER < 0 ? '下浮' : ''}${currentObj?.addMINTURNOVER}万元，${currentObj?.addMINTURNOVERRate > 0 ? '提升' : currentObj?.addMINTURNOVERRate < 0 ? '降低' : ''}${Math.abs(currentObj?.addMINTURNOVERRate)}%`}>
                                            <span className="keynote" style={{ color: 'red' }}>{currentObj?.nowProfit}</span>万元
                                        </Tooltip>
                                        ({currentObj?.currentThanRecently ? '当前' : '上个'}合同年的对客销售总额<span className="keynote">{((currentObj?.recentREVENUE_AMOUNT / 10000).toFixed(2))}</span>万元×<span className="keynote">{currentObj?.nowRate || ''}%</span> = <span className="keynote">{currentObj?.nowProfit}</span>万元，原合同保底租金<span className="keynote">{currentObj?.BUSINESS_TYPE === 2000 ? currentObj?.BUSINESS_TYPEMINTURNOVER : currentObj?.nowMINTURNOVER}</span>万元，{currentObj?.addMINTURNOVER > 0 ? '优于' : currentObj?.addMINTURNOVER < 0 ? '下浮' : ''}<span className="keynote">{currentObj?.addMINTURNOVER}</span>万/年)
                                    </span>

                            }
                        </div>
                    </div>

                </div>
            </Modal>
        </div>
    )
}

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