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

function columns12(gameType: any) {

    let newArr: { label: string, data: any[] }[] = [
        {
            label: '游戏充值排行榜',
            data: [
                { title: '游戏ID', dataIndex: 'gameId', label: '游戏充值排行榜', align: 'center', width: 60 },
                {
                    title: '游戏名称',
                    dataIndex: 'gameName',
                    label: '游戏充值排行榜',
                    align: 'center',
                    width: 80,
                    default: 1,
                    render: (a: string, b: any) => (<WidthEllipsis value={a} />)
                },
                {
                    title: '游戏类型',
                    dataIndex: 'gameClassify',
                    label: '游戏充值排行榜',
                    align: 'center',
                    width: 85,
                    default: 2,
                    render: (a: string) => (<span>{gameClassifyEnum[a]}</span>)
                },
                {
                    title: '当天充值金额', dataIndex: 'todayAmount', label: '游戏充值排行榜', align: 'center', width: 90, default: 3, sorter: true,
                    className: 'progress',
                    render: (a: number) => {
                        return <ProgressTable
                            strokeColor={{
                                from: '#108ee9',
                                to: '#87d068',
                            }}
                            percent={a ? a / 10000 * 100 : 0}
                            value={a || 0}
                            valueStyle={a >= 7000 ? { color: '#000', fontWeight: 500 } : { fontWeight: 500 }}
                        />
                    },
                },
                { title: '当天买量充值金额', dataIndex: 'todayBuyAmount', label: '游戏充值排行榜', align: 'center', width: 90, default: 4, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
                { title: '当天自然量充值金额', dataIndex: 'todayNatureAmount', label: '游戏充值排行榜', align: 'center', width: 90, default: 5, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
                {
                    title: '累计充值金额', dataIndex: 'totalAmount', label: '游戏充值排行榜', align: 'center', width: 100, default: 6, sorter: true,
                    className: 'progress',
                    render: (a: number) => {
                        return <ProgressTable
                            strokeColor={{
                                from: '#ff5900',
                                to: '#ffd380',
                            }}
                            percent={a ? a / 200000 * 100 : 0}
                            value={a || 0}
                            valueStyle={a >= 160000 ? { color: '#000', fontWeight: 500 } : { fontWeight: 500 }}
                        />
                    },
                },
                { title: '累计买量充值金额', dataIndex: 'totalBuyAmount', label: '游戏充值排行榜', align: 'center', width: 90, default: 7, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
                { title: '累计自然量充值金额', dataIndex: 'totalNatureAmount', label: '游戏充值排行榜', align: 'center', width: 85, default: 8, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
                { title: '平均客单价', dataIndex: 'avgAmount', label: '游戏充值排行榜', align: 'center', width: 70, default: 9, sorter: true, render: (a: string) => <Statistic value={a || 0} /> },
                { title: '注册人数', dataIndex: 'regUserCount', label: '游戏充值排行榜', align: 'center', width: 70, default: 10, sorter: true, },
                { title: '累计充值人数', dataIndex: 'totalRechargeUserCount', label: '游戏充值排行榜', align: 'center', width: 70, default: 11, sorter: true, },
                { title: '累计充值次数', dataIndex: 'totalRechargeCount', label: '游戏充值排行榜', align: 'center', width: 70, default: 12, sorter: true, },
                {
                    title: '累计消耗', dataIndex: 'totalCost', label: '游戏充值排行榜', align: 'center', width: 100, default: 13, sorter: true,
                    className: 'progress',
                    render: (a: number) => {
                        return <ProgressTable
                            strokeColor={{
                                from: '#e7a0f5',
                                to: '#d161f7',
                            }}
                            percent={a ? a / 100000 * 100 : 0}
                            value={a || 0}
                            valueStyle={a >= 100000 ? { color: '#000', fontWeight: 500 } : { fontWeight: 500 }}
                        />
                    },
                },
                { title: '回本率', dataIndex: 'totalRoi', label: '游戏充值排行榜', align: 'center', width: 70, default: 14, sorter: true, render: (a: number) => <Statistic value={a ? a * 100 : 0} precision={2} valueStyle={a >= 1 ? { color: 'red' } : { color: '#0f990f' }} suffix="%" /> }
            ]
        },
    ]

    return newArr
}

export default columns12