import { ColumnsType } from 'antd/lib/table'
import React from 'react'
import './index.less'
function columns() {
    let newArr: ColumnsType<any> = [
        {
            title: '公众号',
            dataIndex: 'channel',
            key: 'channel',
            align: 'center',
            width: 100,
            ellipsis: true
        },
        {
            title: '消耗时间',
            dataIndex: 'cost_time',
            key: 'cost_time',
            align: 'center',
            width: 160,
        },
        {
            title: '充值时间',
            dataIndex: 'date',
            key: 'date',
            align: 'center',
            width: 90,
        },
        {
            title: '总消耗',
            dataIndex: 'cost',
            key: 'cost',
            align: 'center',
            width: 100,
            sorter: true,
        },
        {
            title: '总充值',
            dataIndex: 'amount',
            key: 'amount',
            align: 'center',
            width: 100,
            sorter: true,
        },
        {
            title: '回收率',
            dataIndex: `roi`,
            key: `roi`,
            width: 85,
            align: 'center',
            sorter: true,
            render: (a: any) => {
                return a === 999999999 ? <div>--</div> : a ?
                    <div style={a >= 1 ? {  color: 'red'  } : { color: '#0f990f' }}>{(a * 100).toFixed(2) + '%'}</div>
                    : a === 0 ?
                        <div>0</div>
                        : <div>--</div>
            }
        }
    ]
    return newArr
}
export { columns }