import { TYPE, gameClassifyEnum } from "@/components/QueryForm/const"
import WidthEllipsis from "@/components/widthEllipsis"
import { Statistic } from "antd"
import React from "react"

function columns12() {

    const roiC = Array(29).fill('').map((_item: string, index: number) => {
        let data = {
            title: `${index + 2}日ROI`,
            dataIndex: `roi${index + 2}`,
            label: '付费数据',
            align: 'center',
            width: 80,
            sorter: true,
            render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
        }
        index++;
        return data
    })

    let newArr: { label: string, data: any[] }[] = [
        {
            label: '基本信息',
            data: [
                {
                    title: '推广游戏名称', dataIndex: 'gameName', label: '基本信息', align: 'center', width: 95, default: 1,
                    render: (a: string, b: any) => (<WidthEllipsis value={a} />)
                },
                {
                    title: '推广游戏CP名称', dataIndex: 'gameCp', label: '基本信息', align: 'center', width: 95, default: 2,
                    render: (a: string, b: any) => (<WidthEllipsis value={a} />)
                },
                {
                    title: '推广游戏应用类型', dataIndex: 'gameType', label: '基本信息', align: 'center', width: 95, default: 3,
                    render: (a: string, b: any) => (<WidthEllipsis value={gameClassifyEnum[a as keyof typeof gameClassifyEnum]} />)
                },
                {
                    title: '推广媒体', dataIndex: 'accountType', label: '基本信息', align: 'center', width: 95, default: 4,
                    render: (a: string, b: any) => (<WidthEllipsis value={TYPE[a as keyof typeof TYPE]} />)
                },
                {
                    title: '消耗', dataIndex: 'cost', label: '基本信息', align: 'center', width: 70, default: 5, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '推广账号数量', dataIndex: 'accountCount', label: '基本信息', align: 'center', width: 80, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '推广渠道数量', dataIndex: 'agentCount', label: '基本信息', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                // {
                //     title: '推广游戏数量', dataIndex: 'cost', label: '基本信息', align: 'center', width: 90, sorter: true,
                // },
                {
                    title: '推广计划数量', dataIndex: 'planCount', label: '基本信息', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                }
            ]
        },
        {
            label: '用户数据',
            data: [
                {
                    title: '注册人数', dataIndex: 'registerNum', label: '用户数据', align: 'center', width: 70, sorter: true, default: 6,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '注册成本', dataIndex: 'registerCost', label: '用户数据', align: 'center', width: 70, sorter: true, default: 7,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                // {
                //     title: '活跃用户人数', dataIndex: 'clickRate', label: '用户数据', align: 'center', width: 80, sorter: true,
                //     render: (a: number) => <Statistic value={a || 0} valueStyle={a >= 100 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                // },
                {
                    title: '创角人数', tips: '消耗时间范围内的用户，在充值时间范围内创角', dataIndex: 'roleNum', label: '用户数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '首日创角人数', tips: '消耗时间范围内的用户，在注册当天创建角色用户人数', dataIndex: 'firstRoleNum', label: '用户数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '新用户累计创角人数', tips: '消耗时间范围内的用户，累计创建角色用户人数', dataIndex: 'newUserTotalRoleNum', label: '用户数据', align: 'center', width: 100, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '首日创角成本', dataIndex: 'firstRoleCost', label: '用户数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '新用户累计创角成本', dataIndex: 'newUserTotalRoleCost', label: '用户数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                // {
                //     title: '创角量', tips: '消耗时间范围内的用户，在充值时间范围内创角数量', dataIndex: 'roleNum', label: '用户数据', align: 'center', width: 70, sorter: true,
                //     render: (a: string) => <Statistic value={a || 0} />
                // },
                // {
                //     title: '首日创角量', tips: '消耗时间范围内的用户，在注册当天创建角色数量', dataIndex: 'firstRoleNum', label: '用户数据', align: 'center', width: 70, sorter: true,
                //     render: (a: string) => <Statistic value={a || 0} />
                // },
                // {
                //     title: '新用户累计创角量', dataIndex: 'newUserTotalRoleNum', label: '用户数据', align: 'center', width: 70, sorter: true,
                //     render: (a: string) => <Statistic value={a || 0} />
                // },
                // {
                //     title: '新用户累计有效创角量', dataIndex: 'totalAmount', label: '用户数据', align: 'center', width: 70, sorter: true,
                // },
                {
                    title: '首日创角率', tips: '首日创角人数/注册人数', dataIndex: 'firstRoleRate', label: '用户数据', align: 'center', width: 70, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 50 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '新用户创角率', tips: '新用户累计创角人数/注册人数', dataIndex: 'newUserTotalRoleRate', label: '用户数据', align: 'center', width: 70, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 50 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                }
            ]
        },
        {
            label: '付费数据',
            data: [
                {
                    title: '新用户充值次数', dataIndex: 'newUserAmountCount', label: '付费数据', align: 'center', width: 90,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '新用户充值人数', dataIndex: 'newUserAmountNum', label: '付费数据', align: 'center', width: 100, sorter: true, default: 8,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '新用户充值金额', tips: '消耗时间范围内用户，在充值时间内充值金额统计', dataIndex: 'newUserAmount', label: '付费数据', align: 'center', width: 70, default: 9,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '首日新用户充值次数', dataIndex: 'firstNewUserAmountCount', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '首日新用户充值人数', dataIndex: 'firstNewUserAmountNum', label: '付费数据', align: 'center', width: 70, sorter: true, default: 10,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '首日新用户充值金额', dataIndex: 'firstNewUserAmount', label: '付费数据', align: 'center', width: 70, sorter: true, default: 11,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '老用户充值次数', dataIndex: 'oldAmountCount', label: '付费数据', align: 'center', width: 70,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '老用户充值人数', dataIndex: 'oldAmountNum', label: '付费数据', align: 'center', width: 70,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '老用户充值金额', dataIndex: 'oldAmount', label: '付费数据', align: 'center', width: 70,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '账面充值次数', dataIndex: 'amountCount', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '账面充值人数', dataIndex: 'amountNum', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '账面充值金额', dataIndex: 'amount', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '新用户累计充值次数', dataIndex: 'buyNewUserTotalAmountCount', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '新用户累计充值人数', dataIndex: 'buyNewUserTotalAmountNum', label: '付费数据', align: 'center', width: 70, sorter: true, default: 12,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '新用户累计充值金额', dataIndex: 'buyNewUserTotalAmount', label: '付费数据', align: 'center', width: 70, sorter: true, default: 13,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '首日ROI', tips: '首日新用户充值金额/实际消耗', dataIndex: 'firstRoi', label: '付费数据', align: 'center', width: 70, sorter: true, default: 15,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '新用户回收率', tips: '新用户充值金额/实际消耗', dataIndex: 'newUserRoi', label: '付费数据', align: 'center', width: 70, default: 14,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '至今回收率', tips: '新用户累计充值金额/实际消耗', dataIndex: 'todayRoi', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '毛利额', dataIndex: 'grossProfit', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: number) => <Statistic value={a} precision={2} valueStyle={a < 0 ? { color: 'red' } : {}} />
                },
                ...roiC,
                {
                    title: '60日ROI', dataIndex: 'roi60', label: '付费数据', align: 'center', width: 80, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 0.9 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '90日ROI', dataIndex: 'roi90', label: '付费数据', align: 'center', width: 80, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '180日ROI', dataIndex: 'roi180', label: '付费数据', align: 'center', width: 80, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '1年ROI', dataIndex: 'roi1yaer', label: '付费数据', align: 'center', width: 80, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '总ROI', dataIndex: 'todayRoi', label: '付费数据', align: 'center', width: 80, default: 16, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '首日付费率', tips: '首日新用户充值人数/注册人数', dataIndex: 'firstRate', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '新用户付费率', tips: '新用户充值人数/注册人数', dataIndex: 'newUserAmountRate', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '至今付费率', tips: '至今付费率=新用户累计充值人数/注册人数', dataIndex: 'todayRate', label: '付费数据', align: 'center', width: 80, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '新用户付费比', tips: '新用户充值人数/账面充值人数', dataIndex: 'newUserAmountRatio', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                // {
                //     title: '活跃用户付费率', dataIndex: 'newUserRate1', label: '付费数据', align: 'center', width: 70, sorter: true,
                //     render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                // },
                {
                    title: '首日客单价', tips: '首日新用户充值金额/首日新用户充值次数', dataIndex: 'firstAvg', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '新用户客单价', tips: '新用户充值金额/新用户充值次数', dataIndex: 'newUserAvg', label: '付费数据', align: 'center', width: 70,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '账面客单价', dataIndex: 'paperAvg', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '至今客单价', tips: '新用户累计充值金额/新用户累计充值次数', dataIndex: 'todayAvg', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '首日充值成本', tips: '实际消耗/首日新用户充值人数', dataIndex: 'firstAmountCost', label: '付费数据', align: 'center', width: 70, sorter: true, default: 18,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '新用户充值成本', tips: '实际消耗/新用户充值人数', dataIndex: 'newUserAmountCost', label: '付费数据', align: 'center', width: 70, sorter: true, default: 17,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '至今充值成本', dataIndex: 'todayAmountCost', label: '付费数据', align: 'center', width: 70, sorter: true, default: 19,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '新用户复充率', tips: '消耗时间范围内注册用户，在充值时间内重复充值（用户在充值时间范围内的累计充值次数n≥2)。计算公式：复冲率=新用户复充人数/新用户累计充值人数', dataIndex: 'newUserAgainRate', label: '付费数据', align: 'center', width: 70, sorter: true, default: 20,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                {
                    title: '至今复充率', tips: '消耗时间范围内注册用户，重复充值（即用户累计充值次数n≥2)。计算公式：至今复充率=复充人数/新用户累计充值人数', dataIndex: 'todayAgainRate', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                },
                // {
                //     title: '平均活跃付费率', dataIndex: 'newUserRate4', label: '付费数据', align: 'center', width: 70, sorter: true,
                //     render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={!a ? {} : a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" />
                // },

                {
                    title: '新增注册ARPPU', tips: '新用户累计充值金额/注册人数', dataIndex: 'newRegArpu', label: '付费数据', align: 'center', width: 70, sorter: true, default: 21,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                // {
                //     title: '活跃ARPPU', dataIndex: 'regUserArpu1', label: '付费数据', align: 'center', width: 70, sorter: true,
                //     render: (a: string) => <Statistic value={a || 0} />
                // },
                {
                    title: '首日付费ARPPU', tips: '首日新用户充值金额/首日新用户充值人数', dataIndex: 'firstArpu', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '新用户付费ARPPU', tips: '新用户充值金额/新用户充值人数', dataIndex: 'newUserArpu', label: '付费数据', align: 'center', width: 70,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '至今付费ARPPU', tips: '新用户累计充值金额/新用户累计充值人数', dataIndex: 'todayArpu', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                },
                {
                    title: '账面ARPPU', dataIndex: 'paperArpu', label: '付费数据', align: 'center', width: 70, sorter: true,
                    render: (a: string) => <Statistic value={a || 0} />
                }
            ]
        }
    ]
    return newArr
}

export default columns12