import { WeaTools } from "ecCom";
import { postExportFetch, postFetch } from "../util/request";
import { convertToUrlString } from "../util/url";

//个税申报表-个税申报表列表
export const getDeclareList = params => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/list", params);
};
//个税申报表-个税申报表表单
export const getDeclareForm = params => {
  return WeaTools.callApi("/api/bs/hrmsalary/taxdeclaration/getForm", "get", params);
};

//个税申报表-个税申报表生成
export const saveDeclare = params => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/save", params);
};

//个税申报表-获取分类
export const getTaxReports = params => {
  return WeaTools.callApi("/api/bs/hrmsalary/taxdeclaration/getTaxReports", "get", params);
};
//个税申报表-个税申报表相关信息
export const getDeclareInfo = params => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/getTaxDeclarationInfo", params);
};

// 个税申报表详情列表
export const getDetailList = params => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/detail/list", params);
};

// 个税申报表导出
export const exportSalaryArchive = (id = "") => {
  fetch("/api/bs/hrmsalary/taxdeclaration/export?taxDeclarationId=" + id).then(res => res.blob().then(blob => {
    var filename = `个税申报表.xlsx`;
    var a = document.createElement("a");
    var url = window.URL.createObjectURL(blob);
    a.href = url;
    a.download = filename;
    a.click();
    window.URL.revokeObjectURL(url);
  }));
};
//个税申报表-撤回申报
export const withDrawTaxDeclaration = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/withDrawTaxDeclaration", params);
};
//人员信息报送-个税扣缴义务人列表
export const taxAgentDeclareList = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/taxAgentDeclareList", params);
};
//人员信息报送-全部人员列表
export const employeedeclareList = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/list", params);
};
//人员信息报送-本月新增人员列表
export const employeedeclareList4Add = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/list4Add", params);
};
//人员信息报送-本月信息变动列表
export const employeedeclareList4Update = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/list4Update", params);
};

//人员信息报送-本月报送失败人员列表
export const employeedeclareList4Fail = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/list4Fail", params);
};

//人员报送-刷新数据
export const employeedeclareRefresh = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/refresh", params);
};

//人员报送-获取报送结果反馈
export const getDeclareFeedback = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/getDeclareFeedback", params);
};

//人员报送-获取整体的报送情况
export const getEmployeeDeclareInfo = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/getDeclareInfo", params);
};

//人员报送-后端业务逻辑是否已经完成
export const employeedeclareGetRate = params => {
  return WeaTools.callApi("/api/bs/hrmsalary/employeedeclare/getRate", "GET", params);
};

//人员报送-获取新建或编辑的表单
export const employeedeclareGetForm = params => {
  return WeaTools.callApi("/api/bs/hrmsalary/employeedeclare/getForm", "GET", params);
};

//人员报送-新增人员/编辑人员保存
export const getEmployeeSave = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/save", params);
};

//人员报送-删除
export const employeeDelete = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/delete", params);
};
//人员报送-作废
export const employeeInvalid = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/invalid", params);
};

//人员报送-全部报送
export const employeedeclareDeclare = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/declare", params);
};

//个税在线对接-获取个税申报记录下的个税申报表TAB
export const getTaxDeclarationTab = params => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/getTaxDeclarationTab", params);
};

//个税在线对接-个税申报表是否已经生成
export const taxdeclarationGetRate = params => {
  return WeaTools.callApi("/api/bs/hrmsalary/taxdeclaration/getRate", "GET", params);
};

//人员报送-刷新数据
export const taxdeclarationRefreshData = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/refreshData", params);
};

//人员报送-在线申报
export const taxdeclarationDeclare = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/declare", params);
};
//个税申报表申报数据-人员未报送列表
export const taxdeclarationEmployeeList4NotDeclare = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/employee/list4NotDeclare", params);
};
//个税申报表申报数据-报送人员无申报数据列表
export const taxdeclarationEmployeeList4NoValue = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/employee/list4NoValue", params);
};
//个税申报表申报数据-申报失败列表
export const taxdeclarationEmployeeList4Fail = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/employee/list4Fail", params);
};
//个税申报表申报数据-删除个税申报表
export const taxdeclarationDelete = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/delete", params);
};

//个税申报表申报数据-获取在线申报反馈
export const taxdeclarationGetDeclareFeedback = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/getDeclareFeedback", params);
};

//个税申报表申报数据-更正申报
export const taxdeclaratioUpdateDeclare = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/updateDeclare", params);
};

//个税申报表申报数据-作废申报
export const taxdeclaratioUpdateCancel = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/cancel", params);
};

//个税申报表申报数据-获取作废反馈
export const taxdeclaratioGetCancelFeedback = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/getCancelFeedback", params);
};

//个税申报表申报数据-三方协议缴款反馈
export const taxPaymentAgreementPayFeedback = (params) => {
  return postFetch("/api/bs/hrmsalary/taxPayment/agreement/pay/feedback", params);
};

//个税申报表申报数据-应缴税额查询
export const taxPaymentTaxAmount = (params) => {
  return postFetch("/api/bs/hrmsalary/taxPayment/tax/amount", params);
};

//个税申报表申报数据-获取企业的三方信息
export const taxPaymentgetAgreement = (params) => {
  return postFetch("/api/bs/hrmsalary/taxPayment/getAgreement", params);
};

//个税申报表申报数据-获取企业的三方信息查询反馈
export const taxPaymentgetAgreementFeedback = (params) => {
  return postFetch("/api/bs/hrmsalary/taxPayment/getAgreementFeedback", params);
};

//个税申报表申报数据-同步缴款状态
export const taxPaymentVoucherStatusSync = (params) => {
  return postFetch("/api/bs/hrmsalary/taxPayment/voucher/status/sync", params);
};

//个税申报表申报数据-三方缴款,最终支付
export const taxPaymentAgreemenPay = (params) => {
  return postFetch("/api/bs/hrmsalary/taxPayment/agreement/pay", params);
};

//个税申报表申报数据-开具企业缴税完税证明
export const taxPaymentWithheldVoucherGet = (params) => {
  return postFetch("/api/bs/hrmsalary/taxPayment/withheldVoucher/get", params);
};

//个税申报表申报数据-作废缴款凭证
export const taxPaymentVoucherCancel = (params) => {
  return postFetch("/api/bs/hrmsalary/taxPayment/voucher/cancel", params);
};

//个税申报表申报数据-缴款凭证打印
export const taxPaymentVoucherPrint = (params) => {
  return postFetch("/api/bs/hrmsalary/taxPayment/voucher/print", params);
};

//个税申报表申报数据-缴款凭证打印反馈
export const taxPaymentVoucherPrintFeedback = (params) => {
  return postFetch("/api/bs/hrmsalary/taxPayment/voucher/print/feedback", params);
};

//个税申报表申报数据-缴款凭证打印反馈
export const taxdeclarationUpdateIcon = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/updateIcon", params);
};
export const employeedeclareExport = params => {
  return postExportFetch("/api/bs/hrmsalary/employeedeclare/export", params);
};
//个税申报表申报数据-获取表单
export const getTaxDecForm = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/getAddForm", params);
};
//个税申报表申报数据-新增
export const taxdeclarationAdd = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/add", params);
};
//个税申报表申报数据-编辑
export const taxdeclarationEdit = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/edit", params);
};
//个税申报表申报数据-详情
export const getTaxdeclarationDetailInfo = (params) => {
  return fetch(`/api/bs/hrmsalary/taxdeclaration/detailInfo?${convertToUrlString(params)}`, {
    method: "GET",
    mode: "cors"
  }).then((res) => res.json());
};
//个税申报表申报数据-下载模板
export const taxdeclarationExportTemplate = params => {
  return postExportFetch("/api/bs/hrmsalary/taxdeclaration/downloadTemplate", params);
};
//人员信息报送-下载人员信息报送导入模板
export const employeedeclareExportTemplate = params => {
  return postExportFetch("/api/bs/hrmsalary/employeedeclare/exportTemplate", params);
};
//个税申报表申报数据-下载申报内置算税结果
export const exportGetDeclareTaxResultFeedback = params => {
  return postExportFetch("/api/bs/hrmsalary/taxdeclaration/exportGetDeclareTaxResultFeedback", params);
};
//个税申报表申报数据-数据导入
export const taxdeclarationImportData = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/importData", params);
};
//人员信息报送-人员信息报送导入
export const employeedeclareImportData = (params) => {
  return postFetch("/api/bs/hrmsalary/employeedeclare/importData", params);
};
//个税申报表-新增申报表Tab
export const addTaxDeclaration = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/addTaxDeclaration", params);
};
//个税申报表-删除申报表Tab
export const deleteTaxDeclaration = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/deleteTaxDeclaration", params);
};
//个税申报表-删除申报表
export const deleteInfo = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/deleteInfo", params);
};
//个税申报表-对比申报结果
export const getTaxdeclarationContrastList = (params) => {
  return postFetch("/api/bs/hrmsalary/taxdeclaration/contrast", params);
};
export const exportContrast = params => {
  return postExportFetch("/api/bs/hrmsalary/taxdeclaration/exportContrast", params);
};

//扣除名单确认-人员列表
export const getDeductionAmountList = (params) => {
  return postFetch("/api/bs/hrmsalary/deductionAmount/list", params);
};
//扣除名单确认-增加人员
export const addDeductionAmount = (params) => {
  return postFetch("/api/bs/hrmsalary/deductionAmount/add", params);
};
//扣除名单确认-删除人员
export const deleteDeductionAmount = (params) => {
  return postFetch("/api/bs/hrmsalary/deductionAmount/delete", params);
};
//扣除名单确认-编辑人员
export const editDeductionAmount = (params) => {
  return postFetch("/api/bs/hrmsalary/deductionAmount/edit", params);
};
//扣除名单确认-确认人员
export const confirmDeductionAmount = (params) => {
  return postFetch("/api/bs/hrmsalary/deductionAmount/confirm", params);
};
//扣除名单确认-反馈人员
export const feedbackDeductionAmount = (params) => {
  return postFetch("/api/bs/hrmsalary/deductionAmount/feedback", params);
};
