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 "/@/utils/details/tragelog";
import {
  xs_order_source_options,
  xs_order_type_options,
  useTypeOptions
} from "/@/utils/status";
import { renderIconLabelLeft } from "/@/utils/columnRenderHelper";

const columns = [
  // {
  //   type: "selection",
  //   width: 40,
  // align: "center"
  //   hide: ({ checkList }) => !checkList.includes("勾选列")
  // },
  // {
  //   label: "序号",
  //   type: "index",
  //   width: 70,
  //   hide: ({ checkList }) => !checkList.includes("序号列")
  // },
  {
    label: "资金认领编码",
    prop: "logNo",
    fixed: "left",
    width: "150px"
  },
  {
    label: "资金编码",
    prop: "tradNo",
    width: "150px"
  },

  {
    label: "销售订单编码",
    prop: "orderCode",
    width: "150px"
  },
  {
    label: "销售主单号",
    prop: "cxCode",
    width: "160px"
  },
  {
    label: "认领金额",
    prop: "total_fee",
    width: "110px"
  },
  {
    label: "平台类型",
    prop: "platform",
    width: "120px",
    cellRenderer({ row }) {
      return h(ElTag, null, {
        default: () =>
          useTypeOptions.find(s => s.value === row.platform_type)?.label || "--"
      });
    }
  },
  {
    label: "资金认领状态",
    prop: "status",
    width: 100,
    cellRenderer: ({ row }) => {
      return h(ElTag, null, {
        default: () =>
          CAPITAL_STATUS.find(s => s.value === row.status)?.label || "--"
      });
    }
  },
  {
    label: "订单来源",
    prop: "qrdSource",
    width: "100px",
    cellRenderer({ row }) {
      return h(ElTag, null, {
        default: () =>
          xs_order_source_options.find(s => s.value === row.qrdSource)?.label
      });
    }
  },
  {
    label: "商品类型",
    prop: "qrdType",
    width: "100px",
    cellRenderer({ row }) {
      return h(ElTag, null, {
        default: () =>
          xs_order_type_options.find(s => s.value === row.qrdType)?.label
      });
    }
  },
  {
    label: "平台名称",
    prop: "platName",
    width: "120px"
  },
  // {
  //   label: "商品编码",
  //   prop: "goodNo",
  //   width: "150px"
  // },
  {
    label: "商品名称",
    prop: "goodName",
    nimWidth: "160px",
    ...renderIconLabelLeft('goodNo','goodName','商品编码:')
  },
  // {
  //   label: "交易银行",
  //   prop: "trade_bank",
  //   width: "120px"
  // },
  // {
  //   label: "交易账户",
  //   prop: "trade_account",
  //   width: "120px"
  // },

  {
    label: "申请人",
    prop: "apply_name",
    width: "70px"
  },
  // {
  //   label: "交易时间",
  //   prop: "trade_time",
  //   width: "160px"
  // },
  {
    label: "认领时间",
    prop: "addtime",
    width: "140px"
  },
  {
    label: "操作",
    fixed: "right",
    width: 60, //后期修改
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "资金公海池",
  columns,
  apis: {
    httpList
  }
};

export default contentConfig;
