export type InvoiceDetail = Partial<{
  title: string; //发票类型
  code: string; //发票代码
  number: string; //发票号码
  openTime: string; //开票日期

  checkNumber: string; //校验码
  buyerTitle: string; //购买方抬头
  buyerCode: string; //购买方纳税人识别号
  buyerAddr: string; //购买方地址
  buyerMobile: string; //购买方联系方式
  buyerBank: string; //购买方银行
  buyerBankNo: string; //购买方账号

  sellerTitle: string; //销售方抬头
  sellerCode: string; //销售方纳税人识别号
  sellerAddr: string; //销售方地址
  sellerMobile: string; //销售方联系方式
  sellerBank: string; //销售方银行
  sellerBankNo: string; //销售方账号

  //发票商品列表
  goodList: string;

  //列表下的属性
  listInfo: {
    name: string; //名称
    spec: string; //规格
    unit: string; //单位
    num: string; //数量
    goodPrice: string; //单价
    totalPrice: string; //总价
    taxRate: string; //税率
    tax: string; //税额
  };

  amountTax: string; //总税额
  amountPrice: string; //总金额

  TotalIncludingTax_C: string; //价税合计 大写
  TotalIncludingTax_L: string; //价税合计 小写

  payee: string; //收款人
  reviewer: string; //复核人
  drawer: string; //开票人
  seller: string; //销售方
  remarks: string; //备注
}>;

//销售发票配置
export const SALE: InvoiceDetail = {
  title: "title", //发票类型
  code: "inv_code", //发票代码
  number: "inv_number", //发票号码
  openTime: "open_date", //开票日期
  checkNumber: "check_code", //校验码

  buyerTitle: "buyer_title", //购买方抬头
  buyerCode: "buyer_id", //购买方纳税人识别号
  buyerAddr: "buyer_addr", //购买方地址
  buyerMobile: "buyer_mobile", //购买方联系方式
  buyerBank: "buyer_bank", //购买方银行
  buyerBankNo: "buyer_bankNo", //购买方账号

  sellerTitle: "seller_title", //销售方抬头
  sellerCode: "seller_id", //销售方纳税人识别号
  sellerAddr: "seller_addr", //销售方地址
  sellerMobile: "seller_mobile", //销售方联系方式
  sellerBank: "seller_bank", //销售方银行
  sellerBankNo: "seller_bankNo", //销售方账号

  //发票商品列表
  goodList: "item",

  //列表下的属性
  listInfo: {
    name: "XMMC", //名称
    spec: "", //规格
    unit: "DW", //单位
    num: "SPSL", //数量
    goodPrice: "DJ", //单价
    totalPrice: "JE", //总价
    taxRate: "SL", //税率
    tax: "SE" //税额
  },

  amountTax: "tax_fee", //总税额
  amountPrice: "inv_subtotal", //总金额

  TotalIncludingTax_C: "total_in_words", //价税合计 大写
  TotalIncludingTax_L: "inv_total", //价税合计 小写

  payee: "reciver", //收款人
  reviewer: "reviewer", //复核人
  drawer: "issuer", //开票人
  seller: "", //销售方
  remarks: "remark" //备注
};

//采购发票配置
export const PURCHASE: InvoiceDetail = {
  title: "title", //发票类型
  code: "code", //发票代码
  number: "number", //发票号码
  openTime: "issue_date", //开票日期
  checkNumber: "check_code", //校验码

  buyerTitle: "buyer_name", //购买方抬头
  buyerCode: "buyer_id", //购买方纳税人识别号
  buyerAddr: "buyer_address", //购买方地址
  buyerMobile: "", //购买方联系方式
  buyerBank: "buyer_bank", //购买方银行
  buyerBankNo: "", //购买方账号

  sellerTitle: "seller_name", //销售方抬头
  sellerCode: "seller_id", //销售方纳税人识别号
  sellerAddr: "seller_address", //销售方地址
  sellerMobile: "", //销售方联系方式
  sellerBank: "seller_bank", //销售方银行
  sellerBankNo: "", //销售方账号

  //发票商品列表
  goodList: "item_list",

  //列表下的属性
  listInfo: {
    name: "name", //名称
    spec: "specification", //规格
    unit: "unit", //单位
    num: "quantity", //数量
    goodPrice: "unit_price", //单价
    totalPrice: "amount", //总价
    taxRate: "tax_rate", //税率
    tax: "tax" //税额
  },

  amountTax: "subtotal_tax", //总税额
  amountPrice: "subtotal_amount", //总金额

  TotalIncludingTax_C: "total_in_words", //价税合计 大写
  TotalIncludingTax_L: "total", //价税合计 小写

  payee: "receiver", //收款人
  reviewer: "reviewer", //复核人
  drawer: "issuer", //开票人
  seller: "", //销售方
  remarks: "remarks" //备注
};

export const mapInvoiceType = {
  purchase: PURCHASE,
  sale: SALE
};

export const sale_type = [
  {
    value: "004",
    label: "纸质专用发票"
  },
  {
    value: "007",
    label: "纸质普通发票"
  },
  {
    value: "026",
    label: "电子普通发票"
  },
  {
    value: "028",
    label: "电子专用发票"
  }
];
