import { Statistic } from 'antd'
import { ColumnsType } from 'antd/lib/table'
import React from 'react'

function columns() {
    let newArr: ColumnsType<any> = [
        {
            title: '时间',
            dataIndex: 'date',
            key: 'date',
            align: 'center',
            width: 95,
            fixed: 'left',
            sorter:true
        },
        {
            title: '公众号',
            dataIndex: 'channel',
            key: 'channel',
            align: 'center',
            width: 70,
            fixed: 'left',
        },
        {
            title: '投手',
            dataIndex: 'pitcher',
            key: 'pitcher',
            align: 'center',
            width: 50,
            fixed: 'left',
        },
        {
            title: '期数',
            dataIndex: 'stage',
            key: 'stage',
            align: 'center',
            width: 85,
            fixed: 'left',
        },
        {
            title: '主投书',
            dataIndex: 'book',
            key: 'book',
            width: 90,
            align: 'center',
            fixed: 'left',
            ellipsis: true
        },
        {
            title: '投放位置',
            dataIndex: 'type',
            key: 'type',
            width: 40,
            align: 'center',
            fixed: 'left',
        },
        {
            title: '曝光量',
            dataIndex: 'view_count',
            key: 'view_count',
            align: 'center',
            width: 110,
            sorter:true,
            render:(a:any)=>{
                return <Statistic  value={a || 0}  />
            }
        },
        {
            title: '点击量',
            dataIndex: 'click_count',
            key: 'click_count',
            align: 'center',
            width: 110,
            sorter:true,
            render:(a:any)=>{
                return <Statistic  value={a || 0}  />
            }
        },
        {
            title: '点击率',
            dataIndex: 'click_rate',
            key: 'click_rate',
            align: 'center',
            width: 75,
            sorter:true,
            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: 'click_follow_rate',
            key: 'click_follow_rate',
            align: 'center',
            width: 75,
            sorter:true,
            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: 'follow_user',
            key: 'follow_user',
            align: 'center',
            width: 100,
            sorter:true,
            render:(a:any)=>{
                return <Statistic  value={a || 0}  />
            }
        },
        // {
        //     title: '关注率',
        //     dataIndex: 'follow_rate',
        //     key: 'follow_rate',
        //     align: 'center',
        //     width: 75,
        //     sorter:true,
        //     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: 'follow_order_rate',
            key: 'follow_order_rate',
            align: 'center',
            width: 75,
            sorter:true,
            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: 'follow_per_cost',
            key: 'follow_per_cost',
            align: 'center',
            width: 60,
            sorter:true,
            render: (a: number) => {
                return <Statistic value={a || 0}  />
            },
        },
        {
            title: '首日新用户充值成本',
            dataIndex: 'first_order_user_per_cost',
            key: 'first_order_user_per_cost',
            align: 'center',
            width: 95,
            sorter:true,
            render: (a: number) => {
                return <Statistic value={a || 0}  />
            },
        },
        {
            title: '客单价',
            dataIndex: 'user_per_amount',
            key: 'user_per_amount',
            align: 'center',
            width: 75,
            sorter:true,
            render: (a: number) => {
                return <Statistic value={a || 0}  />
            },
        },
        {
            title: '下单率',
            dataIndex: 'order_rate',
            key: 'order_rate',
            align: 'center',
            width: 75,
            sorter:true,
            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: 'cost',
            key: 'cost',
            align: 'center',
            width: 110,
            sorter:true,
            render: (a: number) => {
                return <Statistic  value={a || 0}  />
            },
        },
        {
            title: '新用户充值次数',
            dataIndex: 'first_order_count',
            key: 'first_order_count',
            align: 'center',
            width: 90,
            sorter:true,
            render:(a:any)=>{
                return <Statistic  value={a || 0}  />
            }
        },
        {
            title: '新用户充值人数',
            dataIndex: 'first_order_user',
            key: 'first_order_user',
            align: 'center',
            width: 85,
            sorter:true,
            render:(a:any)=>{
                return <Statistic  value={a || 0}  />
            }
        },
        {
            title: '新用户充值金额',
            dataIndex: 'first_order_amount',
            key: 'first_order_amount',
            align: 'center',
            width: 110,
            sorter:true,
            render: (a: number) => {
                return <Statistic  value={a || 0}  />
            },
        },
        {
            title: '充值次数',
            dataIndex: 'order_count',
            key: 'order_count',
            align: 'center',
            width: 100,
            sorter:true,
            render:(a:any)=>{
                return <Statistic  value={a || 0}  />
            }
        },
        {
            title: '充值人数',
            dataIndex: 'order_user',
            key: 'order_user',
            align: 'center',
            width: 100,
            sorter:true,
            render:(a:any)=>{
                return <Statistic  value={a || 0}  />
            }
        },
        {
            title: '充值金额',
            dataIndex: 'order_amount',
            key: 'order_amount',
            align: 'center',
            width: 110,
            sorter:true,
            render: (a: number) => {
                return <Statistic  value={a || 0}  />
            },
        },
        {
            title: '老用户充值金额',
            dataIndex: 'old_order_amount',
            key: 'old_order_amount',
            align: 'center',
            width: 110,
            sorter:true,
            render: (a: number) => {
                return <Statistic value={a || 0}  />
            },
        },
        {
            title: '首日客单价',
            dataIndex: 'first_amount_per_user',
            key: 'first_amount_per_user',
            align: 'center',
            width: 75,
            sorter:true,
            render: (a: number) => {
                return <Statistic value={a || 0}  />
            },
        },
        {
            title: '单位关注收益',
            dataIndex: 'amount_per_follow',
            key: 'amount_per_follow',
            align: 'center',
            width: 75,
            sorter:true,
            render: (a: number) => {
                return <Statistic value={a || 0}  />
            },
        },
        {
            title: '新用户充值成本',
            dataIndex: 'first_cost_per_user',
            key: 'first_cost_per_user',
            align: 'center',
            width: 85,
            sorter:true,
            render: (a: number) => {
                return <Statistic value={a || 0}  />
            },
        },
        {
            title: '新用户累计充值',
            dataIndex: 'reg_user_amount',
            key: 'reg_user_amount',
            align: 'center',
            width: 85,
            sorter:true,
            render: (a: number) => {
                return <Statistic value={a || 0}  />
            },
        },
        {
            title: '新用户充值率',
            dataIndex: 'new_user_order_rate',
            key: 'new_user_order_rate',
            align: 'center',
            width: 75,
            sorter:true,
            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: 'day_roi',
            key: 'day_roi',
            align: 'center',
            width: 75,
            sorter:true,
            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: 'roi',
            key: 'roi',
            align: 'center',
            width: 75,
            sorter:true,
            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: 'old_user_once_order_rate',
            key: 'old_user_once_order_rate',
            align: 'center',
            width: 75,
            sorter:true,
            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 >
            },
        },
    ]
    return newArr
}
export { columns }