import { TabList } from "@/common/components/description/interface";
import { queryTableList } from "@/common/setup/table";
import { queryWrScfContractInterest } from "@/services/go/wrtrade";
import { WrScfContractInterest } from "@/services/go/wrtrade/interface";

// 费用明细
export const useFeeDetail = () => {
    // 表头
    const FeeColumns = [
        { title: '日期', dataIndex: 'updatetime', key: 'updatetime', align: 'center', slots: { customRender: 'updatetime' }, width: 160 },
        { title: '费用', dataIndex: 'interestamount', key: 'interestamount', align: 'center', width: 160 },
        { title: '已结', dataIndex: 'closeinterest', key: 'closeinterest', align: 'center', width: 160 },
        { title: '状态', dataIndex: 'closeintereststatus', key: 'closeintereststatus', align: 'center', slots: { customRender: 'closeintereststatus' }, width: 160 }
    ];
    // 表格列表数据
    const { tableList, queryTable } = queryTableList<WrScfContractInterest>();

    //结息状态 - 1:未结 2:已结
    const getCloseInterRestStatus = (status: number) => {
        let result = '--'
        switch (status) {
            case 1:
                result = '未结'
                break
            case 2:
                result = '已结'
                break
        }
        return result
    }
    const queryFeeDetail = (scfcontractid: string) => {
        const param = { scfcontractid }
        queryTable(queryWrScfContractInterest, param)
    }

    const tabList: TabList[] = [
        { lable: '费用明细', code: 'fee-detail' }
    ]

    return { FeeColumns, feeList: tableList, tabList, queryFeeDetail, getCloseInterRestStatus }
}

