/*
 * @Author: your name
 * @Date: 2021-12-29 13:12:35
 * @LastEditTime : 2022-04-11 16:41:43
 * @LastEditors  : Shiming
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\ticket-management\\services\\ticket.service.ts
 */
import { Injectable, Injector } from '@angular/core';
import { EACacheService, ShipperBaseService } from '@shared';

@Injectable({
  providedIn: 'root'
})
export class TicketService extends ShipperBaseService {
  $mock_url = '/rule?_allow_anonymous=true';

  // 运营端查询发票申请记录
  $api_get_invoice_requested_page = '/api/fcc/ficoVatappH/queryOperateVatappHList';
  // 导出发票申请记录
  $api_export_invoice_requested_page = '/api/fcc/ficoVatappH/reportOperateVatappHList';
  // 获取开票申请订单明细头部信息
  $api_get_invoice_requested_header_detail = '/api/fcc/ficoVatappBill/getDetailHeadByVatappHId';
  // 货主/运营端获取开票申请订单明细
  $api_get_invoice_requested_order_detail = '/api/fcc/ficoVatappBill/getDetailByVatapp';
  // 删除开票申请订单明细
  // $api_remove_bill = '/api/fcc/ficoVatappBill/deletebatch';
  // $api_remove_bill = '/api/fcc/ficoVatappH/remove';
  $api_remove_bill = '/api/fcc/ficoVatappBill/removeVatappBill';
  // 运营端单个/批量驳回
  $api_reject_invoice = '/api/fcc/ficoVatappH/rejectInvoiceApple';
  // 运营端修改开票地址
  $api_update_invoice_address = '/api/fcc/ficoVatappH/updateInvoiceAddr';

  // 运营端销票处理-订单明细页面
  $api_ficoVatinvHList = '/api/fcc/ficoVatinvH/ficoVatinvHList';
  // 获取开票申请订单明细头部信息
  $api_ficoVatinv_header = '/api/fcc/ficoVatappBill/getDetailHeadByVatappHId';
  // 获取分票发票明细
  $api_ficoVatinv_Detail = '/api/fcc/ficoVatinvL/getDetailByVatinvHId';
  // 运营端订单明细开票处理
  $api_apply_fico = '/api/fcc/ficoVatinvH/crmPushInvo';
  // 手工开票获取开票申请信息展示
  $api_get_apply_fico_info = '/api/fcc/ficoVatappH/get';
  // 运营端手工开票/确认/E税云开票成功后的回调
  $api_apply_fico_invoic = '/api/fcc/ficoVatinvH/operateAffirmVatinv';
  // 运营端推送开票-E税云开票
  $api_push_invoic = '/api/fcc/ficoVatinvH/crmPushInvo';
  // 运营端批量推送开票-E税云开票
  $api_batch_push_invoic = '/api/fcc/ficoVatinvH/crmPushInvoBath';
  // 发票作废
  $api_cancel_invoic = '/api/fcc/ficoVatinvH/inpinvHCancel';
  // 运营端销票处理导出销售清单
  $api_export_invoic_detail = '/api/fcc/ficoVatinvH/reportVatinvHByOperator';

  // 获取汇总下单路径
  $api_get_order_summary_path = '/api/fcc/ficoExpressH/getSummaryOrderAddress';
  // 新建快递单
  $api_create_express = '/api/fcc/ficoExpressH/save';
  // 获取汇总下单
  $api_get_order_summary = '/api/fcc/ficoExpressH/summaryOrder';
  // 打印快递面单
  $api_get_print_pdf = '/api/fcc/ficoExpressH/printData';

  // 已开发票查询
  $api_get_invoice_page = '/api/fcc/ficoVatinvH/list/page';

  // 更新快递信息
  $api_update_Express = '/api/fcc/ficoVatinvH/updateExpress';

  // 发票作废
  $api_delete_invoice = '/api/fcc/ficoVatinvH/inpinvHCancel';
  // 发票取消
  $api_cancel_invoice = '/api/fcc/ficoVatinvH/cancel';
  // 获取销项发票抬头
  $api_get_invoice_header_detail = '/api/fcc/ficoVatinvH/get';
  // 获取分票发票抬头开票申请订单明细
  $api_get_invoice_order_detail = '/api/fcc/ficoVatappBill/getDetailByVatinvHId';
  // 货主/运营端获取开票申请订单明细导出
  $api_export_invoice_order_detail = '/api/fcc/ficoVatappBill/reportDetailByVatinvHId';
  // 获取分票发票抬头开票申请费用明细
  $api_get_invoice_cost_detail = '/api/fcc/ficoVatappFee/getDetailByVatinvHId';
  // 获取分票发票明细
  $api_get_invoice_details = '/api/fcc/ficoVatinvL/getDetailByVatinvHId';
  // 运营端订单明细开票处理
  $api_get_applyFicoVatinv = '/api/fcc/ficoVatinvH/applyFicoVatinv';
  // 开票申请列表批量开票
  $api_get_applyBatchFicoVatinv = '/api/fcc/ficoVatinvH/applyBatchFicoVatinv';
  // 删除销项发票抬头
  $api_delete_deletebatch = '/api/fcc/ficoVatinvH/deletebatch';
  // 保存开票申请费用明细
  $api_ficoVatappFee_save = '/api/fcc/ficoVatappFee/save';
  // 更新销项发票信息
  $api_update_evatinh = '/api/fcc/ficoVatinvH/updatEvatinvH';

  // 查询ETC白名单（货主）
  $api_get_etc_shipper_list = '/api/fcc/ficoShipperWhiteList/list/page';
  // 删除ETC白名单（货主）
  $api_delete_etc_shipper = '/api/fcc/ficoShipperWhiteList/deleteBatch';
  // 保存ETC白名单（货主）
  $api_save_etc_shipper = '/api/fcc/ficoShipperWhiteList/save';
  // 查询ETC企业列表
  $api_get_etc_list = '/api/mdc/cuc/enterpriseInfo/operate/etcList';
  // 查询ETC认证车辆信息筛选
  $api_get_etc_cart_list = '/api/mdc/cuc/carLicense/operate/findCarLicenseScreenList';
  // 查询ETC认证车辆信息筛选
  $api_get_etc_cart_page = '/api/fcc/ficoCarWhiteList/list/page';
  // 保存ETC白名单（车辆）
  $api_save_etc_cart = '/api/fcc/ficoCarWhiteList/save';
  // 删除ETC白名单（车辆）
  $api_delete_etc_cart = '/api/fcc/ficoCarWhiteList/deleteBatch';

  // ETC申请开票界面查询
  $api_get_apply_invoice_page = '/api/sdc/invoiceEtcOperate/list/listEtcApplyPageList';
  // ETC开票申请
  $api_get_apply_invoice = '/api/sdc/invoiceEtcOperate/applyForInvoicingBatch';
  // ETC开票记录界面查询
  $api_get_invoice_record_page = '/api/sdc/invoiceEtcOperate/list/listEtcRecordPageList';
  // 查询ETC发票明细表
  $api_get_invoice_logs_page = '/api/fcc/ficoEtcInvoiceL/list/page';
  // 导出ETC发票明细表
  $api_export_invoice_logs_page = '/api/fcc/ficoEtcInvoiceL/asyncExport';

  // 进项发票查询
  $api_get_input_invoice_page = '/api/fcc/ficoInpinvH/getListPage';
  // 根据ID获取进项发票详情
  $api_get_input_invoice_header = '/api/fcc/ficoInpinvH/getFicoInpinvHByid';
  // 查询进项发票明细
  $api_get_input_invoice_detail_page = '/api/fcc/ficoInpinvL/list/page';

  // 查询快递轨迹
  $api_get_express_routes = '/api/fcc/ficoExpressH/searchRoutes';
  // 下载对账单文件
  $api_downloadPdf = '/api/fcc/ficoVatappBill/downloadPdf';
  // 对账单文件下载
  $api_download_Reconciliatio_pdf = '/api/fcc/ficoVatappBill/downloadReconciliationPdf';

  // 根据地区code查询列表
  $api_get_region_by_code = '/api/mdc/pbc/region/getRegionByCode';
  // ETC申请开票导出
  $api_get_asyncExportEtcApplyList = '/api/sdc/invoiceEtcOperate/asyncExportEtcApplyList';
  // ETC开票记录导出
  $api_get_asyncExportEtcApplyRecordList = '/api/sdc/invoiceEtcOperate/asyncExportEtcApplyRecordList';
  // ETC白名单（货主）导出接口
  $api_get_aficoShipperWhiteList_asyncExport = '/api/fcc/ficoEtcInvoiceL/asyncExportWhiteList';
  // ETC白名单（车辆）导出接口
  $api_get_ficoCarWhiteList_asyncExport = '/api/fcc/ficoEtcInvoiceL/asyncExportCarWhiteList';

  constructor(public injector: Injector) {
    super(injector);
  }

  public reviewPDF(url: string) {
    if (!url) {
      return;
    }
    this.openURL(url);
    // const uA = window.navigator.userAgent; // 判断浏览器内核
    // const isIE =
    //   /msie\s|trident\/|edge\//i.test(uA) &&
    //   !!('uniqueID' in document || 'documentMode' in document || 'ActiveXObject' in window || 'MSInputMethodContext' in window);
    // const objectUrl = url;
    // const a = document.createElement('a');
    // document.body.appendChild(a);
    // a.href = objectUrl;
    // a.download = '面单.pdf';
    // if (isIE) {
    //   // 兼容IE11无法触发下载的问题
    //   (navigator as any).msSaveBlob(url, a.download);
    // } else {
    //   a.click();
    // }
    // a.remove();
  }
}
