import { h } from "vue";
import { ElTag } from "element-plus";
import { createTooltip } from "/@/utils/tootip";
import { DescriptionColumns } from "/@/components/BasicDescriptions";
import {
  redReasonOptions,
  returnTypeOptions,
  openTypeOptions,
  returnStatusOptions
} from "./_options";

export const invReturnColumns: DescriptionColumns = [
  {
    field: "returnCode",
    label: "退票编码"
  },
  {
    field: "status",
    label: "状态",
    render(data) {
      return h(
        ElTag,
        { size: "small" },
        {
          default: () =>
            returnStatusOptions.find(t => t.value === String(data))?.label ||
            "--"
        }
      );
    }
  },
  {
    field: "apply_name",
    label: "申请人",
    render: (apply_name, { apply_id }) =>
      createTooltip(apply_name, "申请人ID : " + apply_id, 160)
  },
  {
    field: "addtime",
    label: "申请时间"
  },
  {
    field: "invNo",
    label: "开票申请编码"
  },
  // {
  //   field: "inv_value",
  //   label: "退票总额"
  // },
  {
    field: "red_inv",
    label: "红冲信息表编码"
  },
  {
    field: "return_reason",
    label: "红冲原因",
    render(data) {
      return h(
        ElTag,
        { size: "small" },
        {
          default: () =>
            redReasonOptions.find(t => t.value === String(data))?.label || "--"
        }
      );
    }
  },
  {
    field: "return_type",
    label: "退票方式",
    render(data) {
      return h(
        ElTag,
        { size: "small" },
        {
          default: () =>
            returnTypeOptions.find(t => t.value === String(data))?.label || "--"
        }
      );
    }
  },
  {
    field: "reason",
    label: "退票原因",
    span: 24
  },
  {
    field: "remark",
    label: "备注",
    span: 24
  },
  {
    field: "eaxm_remark",
    label: "审核备注",
    span: 24
  }
];

export const inv_columns = [
  {
    label: "发票申请编码",
    prop: "invNo",
    width: 150
  },
  {
    label: "业务公司编码",
    prop: "inv_out",
    width: 160
  },
  {
    label: "业务公司名称",
    prop: "inv_company",
    width: 140
  },
  {
    label: "发票号码",
    prop: "inv_code",
    width: 110
  },
  {
    label: "发票代码",
    prop: "inv_number",
    width: 110
  },
  {
    label: "发票额度",
    prop: "inv_value",
    width: 110
  },
  {
    label: "申请人",
    prop: "apply_name",
    width: 80
  },
  {
    label: "开票日期",
    width: 145,
    prop: "open_date"
  },
  {
    label: "创建时间",
    width: 145,
    prop: "addtime"
  }
];
