import { ContentConfig } from "/@/components/PageContent";
import { httpList } from "/@/api/InvoiceSales/capitalClaim";

import { h } from "vue";
import { ElTag } from "element-plus";
import { capital_status } from "./configs";
import { CAPITAL_STATUS } from "/@/utils/details/tragelog";

const columns = [
  // {
  //   type: "selection",
  //   width: 40,
  // align: "center"
  //   hide: ({ checkList }) => !checkList.includes("勾选列")
  // },
  // {
  //   label: "序号",
  //   type: "index",
  //   width: 70,
  //   hide: ({ checkList }) => !checkList.includes("序号列")
  // },
  {
    type: "expand",
    slot: "expand",
    fixed: "left"
  },
  {
    label: "资金编码",
    prop: "tradNo",
    fixed: "left",
    width: 150
  },
  {
    label: "状态",
    prop: "status",
    width: 100,
    cellRenderer: ({ row, props }) =>
      h(
        ElTag,
        {
          size: props.size
        },
        {
          default: () => {
            const status = row.logNo ? CAPITAL_STATUS : capital_status;
            return (
              status.find(s => String(row.status) === String(s.value))?.label ||
              "--"
            );
          }
        }
      )
  },
  {
    label: "收入金额",
    prop: "total_fee",
    width: 120
  },
  {
    label: "未认领金额",
    prop: "balance",
    width: 120
  },
  {
    label: "已认领金额",
    prop: "used_fee",
    width: 120
  },
  {
    label: "交易用途",
    prop: "trade_used",
    width: 120
  },
  {
    label: "交易时间",
    prop: "trade_time",
    width: 140
  },
  {
    label: "付款单位名称",
    prop: "trade_out",
    width: 160
  },
  {
    label: "付款单位账号",
    prop: "trade_account",
    width: 160
  },

  {
    label: "收款公司账户",
    prop: "trade_in_account",
    width: 145
  },
  {
    label: "交易行名",
    prop: "trade_bank",
    width: 160
  },

  {
    label: "收款公司编码",
    prop: "companyNo",
    width: 150
  },
  {
    label: "收款公司名称",
    prop: "companyName",
    width: 145
  },
  {
    label: "资金导入时间",
    prop: "addtime",
    width: 140
  },
  {
    label: "操作",
    fixed: "right",
    width: 60,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "资金认领管理",
  columns,
  isTree: true,
  apis: {
    httpList
  }
};

export default contentConfig;
