import { BasicTableProps } from '@/components/VxeTable';
import { reactive } from 'vue';

/**
 * 费用比较表格配置
 * @returns 
 */
function useMoneyCompareListModel() {
    const moneyCompareGridOptions = reactive<BasicTableProps>({
        id: 'moneycompare_list_table',
        border: true,
        keepSource: true,
        showOverflow: true,
        height: 520,
        loading: false,
        stripe: true,
        rowConfig: {
            isHover: true,
            keyField: 'id'
        },
        customConfig: {
            storage: {
                visible: true
            }
        },
        columnConfig: {
            resizable: true
        },
        toolbarConfig: {
            custom: true
        },
        cellClassName: ({ row, column }) => {
            if (column.field == 'feeAmount' || column.field == 'oldFeeAmount') {
                if (row.feeAmount !== row.oldFeeAmount) return 'class-oldFeeAmount'
            } else if (column.field == 'countFeeWeight' || column.field == 'opWeight') {
                if (row.countFeeWeight !== row.opWeight) return 'class-countFeeWeight'
            } else if (column.field == 'weightPrice' || column.field == 'opcServiceCharge') {
                if (row.weightPrice !== row.opcServiceCharge) return 'class-weightPrice'
            } else if (column.field == 'operatePrice' || column.field == 'opcOperationFee') {
                if (row.operatePrice !== row.opcOperationFee) return 'class-operatePrice'
            }
        },
        columns: [
            { type: "checkbox", width: 45, visible: true },
            { type: "seq", width: 55, title: '序号' },
            { field: 'customerName', title: '客户名称', minWidth: 100 },
            { field: 'salesmanName', title: '业务员', minWidth: 70 },
            { field: 'productName', title: '产品名称', minWidth: 100 },
            { field: 'orderId', title: '订单号', minWidth: 160 },
            { field: 'transferNumber', title: '转单号', minWidth: 140 },
            { field: 'receiveTime', title: '收货时间', minWidth: 110 },
            { field: 'createTime', title: '创建时间', minWidth: 110 },
            { field: 'feeVersionNumber', title: '费用版本(新)', minWidth: 110 },
            { field: 'opcVersion', title: '费用版本(旧)', minWidth: 110 },
            { field: 'differenceFeeAmount', title: '新老系统费用差值', minWidth: 135 },
            { field: 'formulaDescription', title: '计费公式', minWidth: 100 },
            { field: 'feeAmount', title: '费用(新)', minWidth: 85, slots: { default: 'feeAmount' } },
            { field: 'oldFeeAmount', title: '费用(旧)', minWidth: 85 },
            { field: 'countFeeWeight', title: '计费重(新)', minWidth: 90 },
            { field: 'opWeight', title: '计费重(旧)', minWidth: 90 },
            { field: 'length', title: '长', minWidth: 60 },
            { field: 'width', title: '宽', minWidth: 60 },
            { field: 'height', title: '高', minWidth: 60 },
            { field: 'countryName', title: '国家', minWidth: 60 },
            { field: 'weightPrice', title: '公斤价(新)', minWidth: 90 },
            { field: 'opcServiceCharge', title: '公斤价(旧)', minWidth: 90 },
            { field: 'operatePrice', title: '操作费(新)', minWidth: 90 },
            { field: 'opcOperationFee', title: '操作费(旧)', minWidth: 90 },
            { field: 'attachFee', title: '附加费(旧)', minWidth: 90 },
            { field: 'euTariff', title: '税费(旧)', minWidth: 80 },
            { field: 'trackingNumber', title: '跟踪号', minWidth: 150 },
            { field: 'customerOrderId', title: '客单号', minWidth: 140 },
            { field: 'remark', title: '备注', minWidth: 100 }
        ],
        data: []
    })

    return {
        moneyCompareGridOptions
    }
}

export {
    useMoneyCompareListModel
}