/**
 *  退票详情
 */

import { ElTag } from "element-plus";
import { h } from "vue";
import { DescriptionColumns } from "/@/components/BasicDescriptions";

export const RETURN_TYPE = [
  {
    value: "1",
    label: "金税"
  },
  {
    value: "2",
    label: "线下"
  }
];

export const RETURN_STATUS = [
  {
    value: "0",
    label: "待审核"
  },
  {
    value: "1",
    label: "待退票"
  },
  {
    value: "2",
    label: "退票成功"
  },
  {
    value: "3",
    label: "驳回"
  },
  {
    value: "4",
    label: "退票失败"
  }
];

const OPEN_TYPE = [
  {
    value: "0",
    label: "金税开票"
  },
  {
    value: "1",
    label: "金税线下"
  },
  {
    value: "2",
    label: "纯线下"
  }
];

export const INV_RETURN_COLUMNS: DescriptionColumns = [
  {
    field: "returnCode",
    label: "退票编号"
  },
  {
    field: "invNo",
    label: "开票申请编号"
  },
  {
    field: "return_reason",
    label: "退票原因"
  },
  {
    field: "return_type",
    label: "退票方式",
    render(data) {
      return h(ElTag, null, {
        default: () => RETURN_TYPE.find(t => t.value === data)?.label
      });
    }
  },
  {
    field: "remark",
    label: "备注"
  },
  {
    field: "status",
    label: "退票状态",
    render(data) {
      return h(ElTag, null, {
        default: () => RETURN_STATUS.find(t => t.value === data)?.label
      });
    }
  },
  {
    field: "red_inv",
    label: "红冲发票信息"
  },
  {
    field: "apply_name",
    label: "申请人"
  },
  {
    field: "inv_out",
    label: "开票业务公司"
  },
  {
    field: "inv_value",
    label: "发票总额"
  },
  {
    field: "open_type",
    label: "开票类型",
    render(data) {
      return h(ElTag, null, {
        default: () => OPEN_TYPE.find(t => t.value === data)?.label || "--"
      });
    }
  },
  {
    field: "email",
    label: "电子邮箱"
  },
  {
    field: "post_code",
    label: "物流编号"
  }
];
