import { Statistic } from 'antd'
import { ColumnsType } from 'antd/lib/table'
import React from 'react'
function columns() {
    let newArr: ColumnsType<any> = [
        {
            title: '公众号',
            dataIndex: 'channel',
            key: 'channel',
            align: 'center',
            // width: 150,
        },
        {
            title: '投手',
            dataIndex: 'pitcher',
            key: 'pitcher',
            align: 'center',
            width: 80,
        },
        {
            title: '期数',
            dataIndex: 'stage',
            key: 'stage',
            align: 'center',
            width: 80,
        },
        {
            title: '主投书',
            dataIndex: 'book',
            key: 'book',
            align: 'center',
            ellipsis: true,
            // width: 150,
        },
        {
            title: '当天消耗',
            dataIndex: 'cost',
            key: 'cost',
            align: 'center',
            // width: 150,
            render: (a: number) => {
                return <Statistic  value={a || 0} />
            }
        },
        {
            title: '当日新用户累计充值',
            dataIndex: 'reg_amount',
            key: 'reg_amount',
            align: 'center',
            // width: 150,
            render: (a: string) => {
                return <Statistic  value={a || 0} />
            }
        },
        {
            title: '回本率',
            dataIndex: 'roi',
            key: 'roi',
            align: 'center',
            // width: 150,
            render: (a: number) => {
                a = a ? parseFloat((a * 100).toFixed(2)) : 0
                return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a + '%'}</span >
            },
        },
        {
            title: '新增粉丝数',
            dataIndex: 'new_follow',
            key: 'new_follow',
            align: 'center',
            // width: 150,
            render: (a: any) => {
                return <Statistic value={a || 0} />
            }
        },
        {
            title: '新增粉丝成本',
            dataIndex: 'new_follow_per_cost',
            key: 'new_follow_per_cost',
            align: 'center',
            // width: 150,
            render: (a: string) => {
                return <Statistic  value={a || 0} />
            }
        },
        {
            title: '总充值人数',
            dataIndex: 'reg_user',
            key: 'reg_user',
            align: 'center',
            // width: 150,
            render: (a: any) => {
                return <Statistic value={a || 0} />
            }
        },
        {
            title: '总充值次数',
            dataIndex: 'reg_count',
            key: 'reg_count',
            align: 'center',
            // width: 150,
            render: (a: any) => {
                return <Statistic value={a || 0} />
            }
        },
        {
            title: '充值用户成本',
            dataIndex: 'cost_per_user',
            key: 'cost_per_user',
            align: 'center',
            // width: 150,
            render: (a: string) => {
                return <Statistic  value={a || 0} />
            }
        },
        {
            title: '平均复充比率',
            dataIndex: 'avg_again_order_rate',
            key: 'avg_again_order_rate',
            align: 'center',
            // width: 150,
            render: (a: number) => {
                a = a ? parseFloat((a * 100).toFixed(2)) : 0
                return <span style={a <= 8 ? { color: '#0f990f', fontWeight: 600 } : a >= 100 ? { color: 'red', fontWeight: 600 } : {}}> {a + '%'}</span >
            },
        },
        {
            title: '平均充值金额',
            dataIndex: 'avg_order_amount',
            key: 'avg_order_amount',
            align: 'center',
            // width: 150,
            render: (a: string) => {
                return <Statistic  value={a || 0} />
            }
        },
        {
            title: '平均充值次数',
            dataIndex: 'order_count',
            key: 'order_count',
            align: 'center',
            // width: 150,
            render: (a: any) => {
                return <Statistic value={a || 0} />
            }
        },
        // ...arr
    ]
    return newArr
}
export { columns }