import React from 'react'
import { Badge, Space, Statistic, Switch, Tooltip } from 'antd'
import '../../launchSystemNew/adq/index.less'
import { copy } from '@/utils/utils'
import { ColumnsType } from 'antd/lib/table'
import StatisticNull from '@/components/StatisticNull'
import { QuestionCircleOutlined } from '@ant-design/icons'
import { DELIVERY_MODE, DYNAMIC_CREATIVE_TYPE } from '../adqv3/const'
import { creativeTemplate } from '../tencentAdPutIn/const'
import CreativePreview from './CreativePreview'

function tableDynamicConfig(
    suspendHandle: (b: any, suspend: '启动' | '暂停') => void
): ColumnsType<any> {

    let adArr: ColumnsType<any> = [
        {
            title: '启停',
            dataIndex: 'configured_status',
            key: 'configured_status',
            align: 'center',
            width: 40,
            fixed: 'left',
            render: (a: string, b: any) => {
                if (b?.account_id === '总计') {
                    return '--'
                }
                return <Switch size="small" checked={a === 'AD_STATUS_NORMAL'} onChange={(checked) => { suspendHandle(b, checked ? '启动' : '暂停') }} />
            }
        },
        {
            title: '所属账号',
            dataIndex: 'account_id',
            key: 'account_id',
            align: 'center',
            width: 80,
            ellipsis: true,
            render: (a: string) => {
                return <Space>
                    <a onClick={() => copy(a)} >{a}</a>
                </Space>
            }
        },
        {
            title: '广告ID',
            dataIndex: 'adgroup_id',
            key: 'adgroup_id',
            align: 'center',
            width: 100,
            ellipsis: true,
            render: (a: string, b: any) => {
                if (b?.account_id === '总计') {
                    return '--'
                }
                return <Space>
                    <a onClick={() => copy(a)} >{a}</a>
                </Space>
            }
        },
        {
            title: '创意ID',
            dataIndex: 'dynamic_creative_id',
            key: 'dynamic_creative_id',
            align: 'center',
            width: 100,
            ellipsis: true,
            render: (a: string, b: any) => {
                if (b?.account_id === '总计') {
                    return '--'
                }
                return <Space>
                    <a onClick={() => copy(a)} >{a}</a>
                </Space>
            }
        },
        {
            title: '投手',
            dataIndex: 'put_user_name',
            key: 'put_user_name',
            align: 'center',
            width: 70,
            ellipsis: true,
            render(value, record) {
                if (record?.account_id === '总计') return '--';
                return value
            },
        },
        {
            title: '广告名称',
            dataIndex: 'adgroup_name',
            key: 'adgroup_name',
            width: 280,
            ellipsis: true,
            render: (a: string, b: any) => {
                if (b?.account_id === '总计') return '--';
                return a
            }
        },
        {
            title: '创意名称',
            dataIndex: 'dynamic_creative_name',
            key: 'dynamic_creative_name',
            width: 280,
            ellipsis: true,
            render: (a: string, b: any) => {
                if (b?.account_id === '总计') return '--'
                return a
            }
        },
        {
            title: '投放模式',
            dataIndex: 'delivery_mode',
            key: 'delivery_mode',
            align: 'center',
            width: 120,
            render: (a: string) => {
                return DELIVERY_MODE[a as keyof typeof DELIVERY_MODE]
            }
        },
        {
            title: '创意形式匹配方式',
            dataIndex: 'dynamic_creative_type',
            key: 'dynamic_creative_type',
            align: 'center',
            width: 120,
            render: (a: string) => {
                return DYNAMIC_CREATIVE_TYPE[a as keyof typeof DYNAMIC_CREATIVE_TYPE]
            }
        },
        {
            title: '是否已删除',
            dataIndex: 'is_deleted',
            key: 'is_deleted',
            align: 'center',
            width: 60,
            render: (a: any, b: any) => {
                if (b?.account_id === '总计') return '--';
                return <Badge status={!a ? "processing" : "error"} text={a ? '是' : '否'} />
            }
        },
        {
            title: '创意形式',
            dataIndex: 'creative_template_id',
            key: 'creative_template_id',
            align: 'center',
            width: 120,
            ellipsis: true,
            render: (a: string) => {
                return creativeTemplate[a as keyof typeof creativeTemplate] || '--'
            }
        },
        {
            title: '创建时间',
            dataIndex: 'created_time',
            key: 'created_time',
            align: 'center',
            width: 140,
            ellipsis: true,
        },
        {
            title: '创意预览',
            dataIndex: 'creative_components_json',
            key: 'creative_components_json',
            width: 140,
            ellipsis: true,
            render: (_: any, b: any) => {
                return <CreativePreview creativePreview={b?.creative_components ? [b?.creative_components] : []} deliveryMode={[b?.delivery_mode]} />
            }
        },
        {
            title: '操作',
            dataIndex: 'cz',
            key: 'cz',
            width: 130,
            align: 'center',
            render: (a: any, b: any) => {
                if (b?.account_id === '总计') return '--';
                return <Space>
                    {/* <Dropdown overlay={<Menu>
                        <Menu.Item><a onClick={() => log(b)}>告警日志</a></Menu.Item>
                        <Menu.Item><a onClick={() => handleTag(b)}>打标记</a></Menu.Item>
                        {b?.tag_value ? <Menu.Item><a style={{ color: 'red' }} onClick={() => delTag(b)}>删除标记</a></Menu.Item> : undefined}
                    </Menu>}>
                        <a><Space size={2}>更多 <DownOutlined /></Space></a>
                    </Dropdown> */}
                    <a style={{ color: '#1890ff' }} onClick={() => window.open(`https://ad.qq.com/atlas/${b?.account_id}/admanage/index?tab=adgroup&query={%22operation_status%22:[%22CALCULATE_STATUS_EXCLUDE_DEL%22],%22system_status%22:[],%22search_name%22:%22${b.adgroup_id}%22}`)} target="_blank">腾讯广告</a>
                </Space>
            }
        }
    ]

    let adDataArr: ColumnsType<any> = [
        {
            title: '消耗',
            dataIndex: 'cost_day',
            key: 'cost_day',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='cost_day' />
            }
        },
        {
            title: '曝光量',
            dataIndex: 'view_count_day',
            key: 'view_count_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='view_count_day' />
            }
        },
        {
            title: '点击量',
            dataIndex: 'valid_click_count_day',
            key: 'valid_click_count_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='valid_click_count_day' />
            }
        },
        {
            title: '公众号关注人数(点击归因)',
            dataIndex: 'from_follow_by_click_uv_day',
            key: 'from_follow_by_click_uv_day',
            align: 'center',
            width: 120,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='from_follow_by_click_uv_day' />
            }
        },
        {
            title: '公众号关注成本(点击归因)',
            dataIndex: 'from_follow_by_click_cost_day',
            key: 'from_follow_by_click_cost_day',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='from_follow_by_click_cost_day' precision={2} />
            }
        },
        {
            title: '公众号关注人数(平台上报)',
            dataIndex: 'biz_follow_uv_day',
            key: 'biz_follow_uv_day',
            align: 'center',
            width: 120,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='biz_follow_uv_day' />
            }
        },
        {
            title: '目标转化量',
            dataIndex: 'conversions_count_day',
            key: 'conversions_count_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='conversions_count_day' />
            }
        },
        {
            title: '目标转化成本',
            dataIndex: 'conversions_cost_day',
            key: 'conversions_cost_day',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='conversions_cost_day' precision={2} />
            }
        },
        {
            title: '深度目标转化量',
            dataIndex: 'deep_conversions_count_day',
            key: 'deep_conversions_count_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='deep_conversions_count_day' />
            }
        },
        {
            title: '加企业微信客服次数',
            dataIndex: 'scan_follow_count_day',
            key: 'scan_follow_count_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='scan_follow_count_day' />
            }
        },
        {
            title: '加企业微信客服人数',
            dataIndex: 'scan_follow_user_count_day',
            key: 'scan_follow_user_count_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='scan_follow_user_count_day' />
            }
        },
        {
            title: '下单次数',
            dataIndex: 'order_pv_day',
            key: 'order_pv_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_pv_day' />
            }
        },
        {
            title: '下单人数',
            dataIndex: 'order_uv_day',
            key: 'order_uv_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_uv_day' />
            }
        },
        {
            title: '下单金额',
            dataIndex: 'order_amount_day',
            key: 'order_amount_day',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_amount_day' precision={2} />
            }
        },
        {
            title: '下单次数(点击归因)',
            dataIndex: 'order_by_click_count_day',
            key: 'order_by_click_count_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_by_click_count_day' />
            }
        },
        {
            title: '下单人数(点击归因)',
            dataIndex: 'order_by_click_amount_day',
            key: 'order_by_click_amount_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_by_click_amount_day' />
            }
        },
        {
            title: '点击首日下单次数（点击归因）',
            dataIndex: 'first_day_order_by_click_count_day',
            key: 'first_day_order_by_click_count_day',
            align: 'center',
            width: 120,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='first_day_order_by_click_count_day' />
            }
        },
        {
            title: '点击首日付费次数',
            dataIndex: 'cheout_pv1d_day',
            key: 'cheout_pv1d_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='cheout_pv1d_day' />
            }
        },
        {
            title: '点击首日付费金额',
            dataIndex: 'cheout_fd_day',
            key: 'cheout_fd_day',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='cheout_fd_day' precision={2} />
            }
        },
        {
            title: '点击首日付费成本',
            dataIndex: 'cheout1d_cost_day',
            key: 'cheout1d_cost_day',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='cheout1d_cost_day' precision={2} />
            }
        },
        {
            title: '点击首日付费金额(平台上报)',
            dataIndex: 'purchase_pla_clk1d_amount_day',
            key: 'purchase_pla_clk1d_amount_day',
            align: 'center',
            width: 120,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='purchase_pla_clk1d_amount_day' precision={2} />
            }
        },
        {
            title: '点击首日下单次数(首日新增下单量)',
            dataIndex: 'first_day_order_count_day',
            key: 'first_day_order_count_day',
            align: 'center',
            width: 120,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='first_day_order_count_day' />
            }
        },
        {
            title: '首日新增下单金额(点击归因)',
            dataIndex: 'first_day_order_by_click_amount_day',
            key: 'first_day_order_by_click_amount_day',
            align: 'center',
            width: 120,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='first_day_order_by_click_amount_day' precision={2} />
            }
        },
        {
            title: '点击首日下单金额(首日新增下单金额)',
            dataIndex: 'first_day_order_amount_day',
            key: 'first_day_order_amount_day',
            align: 'center',
            width: 120,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='first_day_order_amount_day' precision={2} />
            }
        },
        {
            title: '点击7日下单次数',
            dataIndex: 'order_clk7d_pv_day',
            key: 'order_clk7d_pv_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_clk7d_pv_day' />
            }
        },
        {
            title: '点击7日下单金额',
            dataIndex: 'order_clk7d_amount_day',
            key: 'order_clk7d_amount_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_clk7d_amount_day' precision={2} />
            }
        },
        {
            title: '点击15日下单次数',
            dataIndex: 'order_clk15d_pv_day',
            key: 'order_clk15d_pv_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_clk15d_pv_day' />
            }
        },
        {
            title: '点击15日下单金额',
            dataIndex: 'order_clk15d_amount_day',
            key: 'order_clk15d_amount_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_clk15d_amount_day' precision={2} />
            }
        },
        {
            title: '点击30日下单次数',
            dataIndex: 'order_clk30d_pv_day',
            key: 'order_clk30d_pv_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_clk30d_pv_day' />
            }
        },
        {
            title: '点击30日下单金额',
            dataIndex: 'order_clk30d_amount_day',
            key: 'order_clk30d_amount_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_clk30d_amount_day' precision={2} />
            }
        },
        {
            title: '不感兴趣点击次数',
            dataIndex: 'no_interest_count_day',
            key: 'no_interest_count_day',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='no_interest_count_day' />
            }
        },
        {
            title: '千次曝光成本',
            dataIndex: 'thousand_display_price',
            key: 'thousand_display_price',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='thousand_display_price' precision={2} />
            }
        },
        {
            title: '点击均价',
            dataIndex: 'cpc',
            key: 'cpc',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='cpc' precision={2} />
            }
        },
        {
            title: '点击率',
            dataIndex: 'ctr',
            key: 'ctr',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.ctr !== undefined && b?.ctr !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '公众号关注率(点击归因)',
            dataIndex: 'biz_follow_rate_click',
            key: 'biz_follow_rate_click',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.biz_follow_rate_click !== undefined && b?.biz_follow_rate_click !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '公众号关注成本(平台上报)',
            dataIndex: 'biz_follow_cost',
            key: 'biz_follow_cost',
            align: 'center',
            width: 120,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='biz_follow_cost' precision={2} />
            }
        },
        {
            title: '公众号关注率(平台上报)',
            dataIndex: 'biz_follow_rate',
            key: 'biz_follow_rate',
            align: 'center',
            width: 120,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.biz_follow_rate !== undefined && b?.biz_follow_rate !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '目标转化率',
            dataIndex: 'conversions_rate',
            key: 'conversions_rate',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.conversions_rate !== undefined && b?.conversions_rate !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '深度目标转化率',
            dataIndex: 'deep_conversions_rate',
            key: 'deep_conversions_rate',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.deep_conversions_rate !== undefined && b?.deep_conversions_rate !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '加企业微信客服成本(人数)',
            dataIndex: 'scan_follow_user_cost',
            key: 'scan_follow_user_cost',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='scan_follow_user_cost' precision={2} />
            }
        },
        {
            title: '加企业微信客服率(人数)',
            dataIndex: 'scan_follow_user_rate',
            key: 'scan_follow_user_rate',
            align: 'center',
            width: 120,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.scan_follow_user_rate !== undefined && b?.scan_follow_user_rate !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '下单单价',
            dataIndex: 'order_unit_price',
            key: 'order_unit_price',
            align: 'center',
            width: 80,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_unit_price' precision={2} />
            }
        },
        {
            title: '下单率',
            dataIndex: 'order_rate',
            key: 'order_rate',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.order_rate !== undefined && b?.order_rate !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '下单成本',
            dataIndex: 'order_by_display_cost',
            key: 'order_by_display_cost',
            align: 'center',
            width: 80,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_by_display_cost' precision={2} />
            }
        },
        {
            title: '下单ROI',
            dataIndex: 'order_roi',
            key: 'order_roi',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.order_roi !== undefined && b?.order_roi !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '客单价',
            dataIndex: 'unit_price',
            key: 'unit_price',
            align: 'center',
            width: 80,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='unit_price' precision={2} />
            }
        },
        {
            title: '下单率(点击归因)',
            dataIndex: 'order_by_click_rate',
            key: 'order_by_click_rate',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.order_by_click_rate !== undefined && b?.order_by_click_rate !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '下单成本(点击归因)',
            dataIndex: 'order_by_click_cost',
            key: 'order_by_click_cost',
            align: 'center',
            width: 80,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_by_click_cost' precision={2} />
            }
        },
        {
            title: '下单ROI(点击归因)',
            dataIndex: 'order_by_click_roi',
            key: 'order_by_click_roi',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.order_by_click_roi !== undefined && b?.order_by_click_roi !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '点击首日付费率',
            dataIndex: 'cheout_1d_rate',
            key: 'cheout_1d_rate',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.cheout_1d_rate !== undefined && b?.cheout_1d_rate !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '点击首日付费ROI',
            dataIndex: 'cheout_fd_reward',
            key: 'cheout_fd_reward',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.cheout_fd_reward !== undefined && b?.cheout_fd_reward !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '点击30日下单单价',
            dataIndex: 'order_clk_30d_unit_price',
            key: 'order_clk_30d_unit_price',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_clk_30d_unit_price' precision={2} />
            }
        },
        {
            title: '点击15日下单单价',
            dataIndex: 'order_clk_15d_unit_price',
            key: 'order_clk_15d_unit_price',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_clk_15d_unit_price' precision={2} />
            }
        },
        {
            title: '点击7日下单单价',
            dataIndex: 'order_clk_7d_unit_price',
            key: 'order_clk_7d_unit_price',
            align: 'center',
            width: 100,
            sorter: true,
            render: (a: any, b: any) => {
                return <StatisticNull data={b} field='order_clk_7d_unit_price' precision={2} />
            }
        },
        {
            title: '点击30日下单ROI',
            dataIndex: 'order_clk_30d_roi',
            key: 'order_clk_30d_roi',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.order_clk_30d_roi !== undefined && b?.order_clk_30d_roi !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '点击15日下单ROI',
            dataIndex: 'order_clk_15d_roi',
            key: 'order_clk_15d_roi',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.order_clk_15d_roi !== undefined && b?.order_clk_15d_roi !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: '点击7日下单ROI',
            dataIndex: 'order_clk_7d_roi',
            key: 'order_clk_7d_roi',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.order_clk_7d_roi !== undefined && b?.order_clk_7d_roi !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
        {
            title: <Space>
                <span>点击首日下单ROI</span>
                <Tooltip title="首日新增下单ROI">
                    <QuestionCircleOutlined />
                </Tooltip>
            </Space>,
            dataIndex: 'first_day_order_roi',
            key: 'first_day_order_roi',
            align: 'center',
            width: 110,
            sorter: true,
            render: (a: any, b: any) => {
                if (b?.first_day_order_roi !== undefined && b?.first_day_order_roi !== null) {
                    return <Statistic value={a ? (a * 100).toFixed(2) : 0} precision={2} valueStyle={{ color: '#3f8600' }} suffix="%" />
                } else {
                    return '--'
                }
            }
        },
    ]

    return [
        ...adArr,
        ...adDataArr
    ]
}
export default tableDynamicConfig