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

import dayjs from "dayjs";
import { h } from "vue";
import { ElTag } from "element-plus";
import { capital_status } from "./configs";

const columns = [
  {
    type: "selection",
    width: 55,
    hide: ({ checkList }) => !checkList.includes("勾选列")
  },
  {
    label: "序号",
    type: "index",
    width: 70,
    hide: ({ checkList }) => !checkList.includes("序号列")
  },
  {
    label: "资金编号",
    prop: "tradNo"
  },
  {
    label: "资金认领编号",
    prop: "logNo"
  },
  {
    label: "交易时间",
    prop: "trade_time"
  },
  {
    label: "认领资金总金额",
    prop: "total_fee"
  },
  {
    label: "申请人",
    prop: "apply_name"
  },
  {
    label: "状态",
    prop: "status",
    cellRenderer: ({ row }) => {
      return h(ElTag, null, {
        default: () => capital_status.find(s => s.value === row.status)?.label
      });
    }
  },
  {
    label: "认领时间",
    prop: "addtime",
    formatter: ({ addtime }) => dayjs(addtime).format("YYYY-MM-DD HH:mm:ss")
  },
  {
    label: "操作",
    fixed: "right",
    width: 80,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "资金公海池",
  powers: ["001", "002", "003", "004", "005", "006", "007", "008"],
  columns,
  apis: {
    httpList
  }
};

export default contentConfig;
