import { httpList, httpDel } from "/@/api/purchase/orderRecord";

import dayjs from "dayjs";
import { ContentConfig } from "/@/components/PageContent";
import { renderIconLabelLeft, renderProp } from "/@/utils/columnRenderHelper";
import { orderRecordStatusOptions } from "/@/utils/status";

const columns = [
  {
    type: "selection",
    width: 40,
    align: "center"
  },
  {
    label: "序号",
    type: "index",
    minWidth: 60,
    align: "left", 
    hide: ({ checkList }) => !checkList.includes("序号列")
  },
  {
    label: "对账编码",
    prop: "payNo",
    width: 150,
    align: "left"
  },
  {
    label: "总额款",
    prop: "total_fee",
    width: 110,
    align: "total_fee"
  },
  {
    label: "状态",
    prop: "status",
    width: 140,
    ...renderProp(orderRecordStatusOptions)
  },
  // {
  //   label: "卖方公司编码",
  //   prop: "supplierNo",
  //   width: 150,
  //   align: "left"
  // },
  {
    label: "卖出方公司",
    prop: "supplierName",
    minWidth: 180,
    align: "left",
    ...renderIconLabelLeft('supplierNo','supplierName','卖出方公司编码:')
  },
  {
    label: "买入方公司",
    prop: "companyNo",
    minWidth: 180,
    align: "left",
      ...renderIconLabelLeft('companyNo','companyName','买入方公司:')
  },
  // {
  //   label: "买方公司名称",
  //   prop: "companyName",
  //   minWidth: 180,
  //   align: "left"
  // },
  {
    label: "申请人",
    prop: "apply_name",
    width: 70,
    align: "left"
  },
  {
    label: "申请时间",
    width: 140,
    prop: "addtime",
    formatter: ({ addtime }) => dayjs(addtime).format("YYYY-MM-DD HH:mm:ss")
  },
  {
    label: "操作",
    fixed: "right",
    width: 80,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "订单对账",
  columns,
  deleteProp: "payNo",
  apis: {
    httpList,
    httpDelete: httpDel,
    httpAdd: true
  },
  companyProp: "supplierNo",
  superUserNoAction: true,
  listNoRelation: true,
  showDelete: ({ status }) => false
};

export default contentConfig;
