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

import { ElTag } from "element-plus";
import { h } from "vue";
import { RETURN_STATUS, RETURN_TYPE } from "/@/utils/details/inv-return";
import { invoiceTypeList } 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: "returnCode",
    width: 150
  },
  {
    label: "发票申请编码",
    prop: "invNo",
    width: 150
  },
  {
    label: "发票金额",
    prop: "inv_value",
    width: 110
  },

  {
    label: "退票状态",
    prop: "status",
    width: 120,
    cellRenderer: ({ row }) => {
      return h(ElTag, null, {
        default: () =>
          RETURN_STATUS.find(s => s.value === String(row.status))?.label
      });
    }
  },
  {
    label: "发票类型",
    prop: "inv_type",
    width: 160,
    cellRenderer: ({ row }) => {
      return h(ElTag, null, {
        default: () =>
          invoiceTypeList.find(s => s.value === String(row.inv_type))?.label ||
          "--"
      });
    }
  },
  {
    label: "退票方式",
    prop: "return_type",
    width: 130,
    cellRenderer: ({ row }) => {
      return h(ElTag, null, {
        default: () =>
          RETURN_TYPE.find(s => s.value === String(row.return_type))?.label ||
          "--"
      });
    }
  },
  // {
  //   label: "业务公司编码",
  //   prop: "inv_out",
  //   width: 150
  // },
  {
    label: "业务公司",
    prop: "companyName",
    minWidth: 180,
    ...renderIconLabelLeft('inv_out','companyName','业务公司编码:')
  },
  {
    label: "申请人",
    prop: "apply_name",
    width: 70
  },
  {
    label: "申请时间",
    prop: "addtime",
    width: 145
  },
  {
    label: "操作",
    fixed: "right",
    width: 50,
    slot: "operation"
  }
];

const contentConfig: ContentConfig = {
  title: "退票申请管理",
  superUserNoAction: true,
  columns,
  apis: {
    httpList,
    httpAdd: true
  }
};

export default contentConfig;
