import WidthEllipsis from "@/components/widthEllipsis"
import React from "react"
const week = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
import moment from 'moment'
import { Statistic } from "antd"
import './index.less'

function columns12(): { label: string, fieldSHow?: { label: string, saveField: string, defaultValue: any[], data: any[] }, data: any[] }[] {

    let newArr: { label: string, data: any[] }[] = [
        {
            label: '充值历史',
            data: [
                {
                    title: '消耗时间(监控数据源)', dataIndex: 'costBeginDate', label: '充值历史', align: 'center', width: 160, default: 1,
                    render: (a: string, b: any) => (<WidthEllipsis value={a + '~' + b?.costEndDate} />)
                },
                {
                    title: '订单日期', dataIndex: 'orderDate', label: '充值历史', align: 'center', width: 90, default: 2,
                    render: (a: string) => (<WidthEllipsis value={a} />)
                },
                {
                    title: '星期', dataIndex: 'week', label: '充值历史', align: 'center', width: 90, default: 3,
                    render: (_: any, b: any) => (<WidthEllipsis value={week[moment(b?.orderDate).day()]} />)
                },
                {
                    title: '10:00', dataIndex: 'tenAmount', label: '充值历史', align: 'center', width: 90, default: 4,
                    children: [
                        {
                            title: '充值',
                            dataIndex: `tenAmount`,
                            key: `tenAmount`,
                            align: 'center',
                            width: 85,
                            render: (a: any) => {
                                return <Statistic value={a ? a : '--'} />
                            }
                        },
                        {
                            title: '环比',
                            dataIndex: `tenRate`,
                            key: `tenRate`,
                            width: 85,
                            align: 'center',
                            className: 'ringRatio',
                            render: (a: any) => {
                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a < 100 ? { color: '#52c41a' } : {}} />
                            }
                        },
                        {
                            title: '回收率',
                            dataIndex: `tenRecovery`,
                            key: `tenRecovery`,
                            width: 85,
                            align: 'center',
                            className: 'ringRoi',
                            render: (a: any) => {
                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a >= 50 ? { color: '#0f990f' } : { color: 'red' }} />
                            }
                        }
                    ]
                },
                {
                    title: '14:00', dataIndex: 'fourteenAmount', label: '充值历史', align: 'center', width: 90, default: 5,
                    children: [
                        {
                            title: '充值',
                            dataIndex: `fourteenAmount`,
                            key: `fourteenAmount`,
                            align: 'center',
                            width: 85,
                            render: (a: any) => {
                                return <Statistic value={a ? a : '--'} />
                            }
                        },
                        {
                            title: '环比',
                            dataIndex: `fourteenRate`,
                            key: `fourteenRate`,
                            width: 85,
                            align: 'center',
                            className: 'ringRatio',
                            render: (a: any) => {
                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a < 100 ? { color: '#52c41a' } : {}} />
                            }
                        },
                        {
                            title: '回收率',
                            dataIndex: `fourteenRecovery`,
                            key: `fourteenRecovery`,
                            width: 85,
                            align: 'center',
                            className: 'ringRoi',
                            render: (a: any) => {
                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a >= 50 ? { color: '#0f990f' } : { color: 'red' }} />
                            }
                        }
                    ]
                },
                {
                    title: '17:00', dataIndex: 'seventeenAmount', label: '充值历史', align: 'center', width: 90, default: 6,
                    children: [
                        {
                            title: '充值',
                            dataIndex: `seventeenAmount`,
                            key: `seventeenAmount`,
                            align: 'center',
                            width: 85,
                            render: (a: any) => {
                                return <Statistic value={a ? a : '--'} />
                            }
                        },
                        {
                            title: '环比',
                            dataIndex: `seventeenRate`,
                            key: `seventeenRate`,
                            width: 85,
                            align: 'center',
                            className: 'ringRatio',
                            render: (a: any) => {
                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a < 100 ? { color: '#52c41a' } : {}} />
                            }
                        },
                        {
                            title: '回收率',
                            dataIndex: `seventeenRecovery`,
                            key: `seventeenRecovery`,
                            width: 85,
                            align: 'center',
                            className: 'ringRoi',
                            render: (a: any) => {
                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a >= 50 ? { color: '#0f990f' } : { color: 'red' }} />
                            }
                        }
                    ]
                },
                {
                    title: '24:00', dataIndex: 'twentyfourAmount', label: '充值历史', align: 'center', width: 90, default: 7,
                    children: [
                        {
                            title: '充值',
                            dataIndex: `twentyfourAmount`,
                            key: `twentyfourAmount`,
                            align: 'center',
                            width: 85,
                            render: (a: any) => {
                                return <Statistic value={a ? a : '--'} />
                            }
                        },
                        {
                            title: '环比',
                            dataIndex: `twentyfourRate`,
                            key: `twentyfourRate`,
                            width: 85,
                            align: 'center',
                            className: 'ringRatio',
                            render: (a: any) => {
                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a < 100 ? { color: '#52c41a' } : {}} />
                            }
                        },
                        {
                            title: '回收率',
                            dataIndex: `twentyfourRecovery`,
                            key: `twentyfourRecovery`,
                            width: 85,
                            align: 'center',
                            className: 'ringRoi',
                            render: (a: any) => {
                                return <Statistic value={a} precision={2} suffix="%" valueStyle={a >= 50 ? { color: '#0f990f' } : { color: 'red' }} />
                            }
                        },
                        {
                            title: '消耗',
                            dataIndex: `costCount`,
                            key: `costCount`,
                            align: 'center',
                            width: 95,
                            className: 'costCount',
                            render: (a: any) => {
                                return <Statistic value={a ? a : '--'} />
                            }
                        }
                    ]
                }
            ]
        }
    ]

    return newArr
}

export default columns12