import axios from 'axios'
import urls from '../baseUrl'
import Qs from 'qs'

let url = urls.serviceUrl

// 获取报表数据
const $axiosGetReportData = params => axios.get(url + '/reportservice/personWorkAvg/getReportData', { params })
// 城市门店
const $axiosGetCityStation = params => axios.get(url + '/reportservice/report/getCityStation', { params })
//获取投诉咨询类型1，2级分类
const $axiosGetTicketConsultType = params => axios.get(url + '/reportservice/report/getTicketConsultType', { params })

// 一级二级类目
const $axiosGetdisplay = params => axios.get(url + '/reportservice/report/getdisplay', { params })
// 每日报表
const $axiosGetSaleReportData = params => axios.get(url + '/reportservice/report/getSaleReportData', { params })
// 月度报表
const $axiosGetMonthlySaleReportData = params => axios.get(url + '/reportservice/report/getMonthlySaleReportData', { params })
// 服务gmv统计报表
const $axiosGetServiceGmv = params => axios.get(url + '/reportservice/report/getServiceGmv', { params })
//导出日志
const $axiosExportLog = params => axios.post(url + '/managerapi/logservice/sysexportlog/insertLog', params)


// 列表查询/salesTarget/pageData
const $axiosTargetPageData = params => axios.post(url + '/reportservice/salesTarget/pageData', params)
//销售目标单条删除 /salesTarget/delete
const $axiosSalesTargetDel = params => axios.get(url + '/reportservice/salesTarget/delete', { params })
//销售目标导入/salesTarget/import
const $axiosSalesTargetImport = params => axios.post(url + '/reportservice/salesTarget/import', params)
// 销售目标单条新增 /salesTarget/add
const $axiosSalesTargetAdd = params => axios.post(url + '/reportservice/salesTarget/add', params)
// 销售目标单条新增 /salesTarget/update
const $axiosSalesTargetUpdate = params => axios.post(url + '/reportservice/salesTarget/update', params)

//  /salesdata/getCSGmvData 公司销售GMV目标和复购情况 2021-06
const $axiosGetCSGmvData = params => axios.get(url + '/reportservice/salesdata/getCSGmvData', { params })
//公司销售GMV目标 GET /salesdata/getCSGmvTarget
const $axiosGetCSGmvTarget = params => axios.get(url + '/reportservice/salesdata/getCSGmvTarget', { params })
// GET /report/getResignAndLossReason  查看离职&跟单流失原因
const $axiosGetResignAndLossReason = params => axios.get(url + '/reportservice/report/getResignAndLossReason', { params })
// POST /report/importResignAndLossReason  导入离职原因&跟单流失原因
const $axiosImportResignAndLossReason = params => axios.post(url + '/reportservice/report/importResignAndLossReason', params)
// /report/investmentAndResignList 招商情况和离职情况及各来源入职情况
const $axiosInvestmentAndResignList = params => axios.post(url + '/reportservice/report/investmentAndResignList', params)
// POST /report/serviceQualityStackLine 服务质量情况堆叠折线图
const $axiosServiceQualityStackLine = params => axios.post(url + '/reportservice/report/serviceQualityStackLine', params)
// 客诉报表汇总及保洁&品类客诉条形图 /report/claimSummaryAndPie
const $axiosClaimSummaryAndPie = params => axios.get(url + '/reportservice/report/claimSummaryAndPie', { params })
// 销售报表/salesdata/getCSTrendchart 公司销售GMV趋势图和单量趋势图 timeType 1天2月
const $axiosGetCSTrendchart = params => axios.get(url + '/reportservice/salesdata/getCSTrendchart', { params })
// GET /salesdata/getOrderNumberchart   服务GMV与单量 timeType 1天2月
const $axiosGetOrderNumberchart = params => axios.get(url + '/reportservice/salesdata/getOrderNumberchart', { params })
// getCityStation GET /report/getBjCityStation
const $axiosGetBjCityStation = params => axios.get(url + '/reportservice/report/getBjCityStation', { params })
// 获取来源渠道/salesdata/getChannel
const $axiosGetChannel = params => axios.get(url + '/reportservice/salesdata/getChannel', { params })
// 服务力多Y轴看板 /report/servicePowerReport
const $axiosServicePowerReport = params => axios.post(url + '/reportservice/report/servicePowerReport', params);
// /report/servicePowerSalaryReport  服务力薪资分布散点图
const $axiosServicePowerSalaryReport = params => axios.post(url + '/reportservice/report/servicePowerSalaryReport', params);
// 查询用户拥有的权限数据 /citystation/getUserAuthBuzData
const $axiosGetUserAuthBuzData = params => axios.get(url + '/reportservice/citystation/getUserAuthBuzData', { params });
// 小程序订单列表 GET /salesdata/selectLittleAppOrder
const $axiosSelectLittleAppOrder = params => axios.get(url + '/reportservice/salesdata/selectLittleAppOrder', { params });
const $axiosSelectLittleAppOrderExport = params => axios.get(url + '/reportservice/salesdata/selectLittleAppOrder', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});
// salesdata/getBjGoodsAttr
const $axiosGetBjGoodsAttr = params => axios.get(url + '/reportservice/salesdata/getBjGoodsAttr', { params });
// 各渠道销售 GET /salesdata/selectChannelSales
const $axiosSelectChannelSales = params => axios.get(url + '/reportservice/salesdata/selectChannelSales', { params });
// 销售汇总列表 /salesdata/salesSummary
const $axiosSalesSummary = params => axios.get(url + '/reportservice/salesdata/salesSummary', { params });
// 招商明细 /report/dayInvestMenDetail
const $axiosDayInvestMenDetail = params => axios.post(url + '/reportservice/report/dayInvestMenDetail', params);
//客诉明细 /report/dayCustomerClaimDetail
const $axiosDayCustomerClaimDetail = params => axios.post(url + '/reportservice/report/dayCustomerClaimDetail', params);
//S级工单明细 GET /report/superTicketDetail
const $axiosSuperTicketDetail = params => axios.get(url + '/reportservice/report/superTicketDetail', { params });
// 48小时工单明细/report/aliveTwoDayTicketDetail
const $axiosAliveTwoDayTicketDetail = params => axios.get(url + '/reportservice/report/aliveTwoDayTicketDetail', { params });
// 服务力工单明细/report/servicePowerTicketDetail
const $axiosServicePowerTicketDetail = params => axios.post(url + '/reportservice/report/servicePowerTicketDetail', params);
// 服务力工单汇总 /report/servicePowerTicketInfo
const $axiosServicePowerTicketInfo = params => axios.post(url + '/reportservice/report/servicePowerTicketInfo', params);
// 服务力商家信息 /report/servicePowerServerInfo
const $axiosServicePowerServerInfo = params => axios.post(url + '/reportservice/report/servicePowerServerInfo', params);
// 服务力当月人员汇总/report/servicePowerStationPersonInfo
const $axiosServicePowerStationPersonInfo = params => axios.post(url + '/reportservice/report/servicePowerStationPersonInfo', params);
// 住宿费 POST /report/servicePowerRentFee
const $axiosServicePowerRentFee = params => axios.post(url + '/reportservice/report/servicePowerRentFee', params);
// 宿舍长补贴/report/servicePowerWornSubsidies
const $axiosServicePowerWornSubsidies = params => axios.post(url + '/reportservice/report/servicePowerWornSubsidies', params);
// 师傅奖励/report/servicePowerTeacherReward
const $axiosServicePowerTeacherReward = params => axios.post(url + '/reportservice/report/servicePowerTeacherReward', params);
// 跟单奖励 POST /report/servicePowerOrderReward
const $axiosServicePowerOrderReward = params => axios.post(url + '/reportservice/report/servicePowerOrderReward', params);
// 获取保姆来源 /salesdata/getNurseSource
const $axiosGetNurseSource = params => axios.get(url + '/reportservice/salesdata/getNurseSource', { params });
// 线索列表 /salesdata/selectClue
const $axiosSelectClue = params => axios.get(url + '/reportservice/salesdata/selectClue', { params });
// 保姆签单/salesdata/servantSignOrder
const $axiosServantSignOrder = params => axios.get(url + '/reportservice/salesdata/servantSignOrder', { params });
// 支付记录 /salesdata/cluePayOrder
const $axiosCluePayOrder = params => axios.get(url + '/reportservice/salesdata/cluePayOrder', { params });
// 服务GMV汇总 /salesdata/serviceGMVCount
const $axiosServiceGMVCount = params => axios.get(url + '/reportservice/salesdata/serviceGMVCount', { params });
// 月销售进度回溯（每日） /salesdata/monthSalesPlan
const $axiosMonthSalesPlan = params => axios.get(url + '/reportservice/salesdata/monthSalesPlan', { params });
// BD转化 /salesdata/bdInvertDetail
const $axiosBdInvertDetail = params => axios.post(url + '/reportservice/salesdata/bdInvertDetail', params);
// 非盒马渠道当月实销额扇形图/salesdata/notHMActualSales
const $axiosNotHMActualSales = params => axios.get(url + '/reportservice/salesdata/notHMActualSales', { params });
// 城市进度,某天,日期不能为空/salesdata/cityProgress
const $axiosCityProgress = params => axios.get(url + '/reportservice/salesdata/cityProgress', { params });
// 单品走势 /salesdata/orderTrend
const $axiosOrderTrend = params => axios.get(url + '/reportservice/salesdata/orderTrend', { params });
// 在线客服报表-汇总/report/onlineChatSummary
const $axiosOnlineChatSummary = params => axios.get(url + '/reportservice/report/onlineChatSummary', { params });
// 查询招商看板的城市-服务站 /citystation/getCityStation
const $axiosGetSelfCityStation = params => axios.get(url + '/reportservice/citystation/getCityStation', { params });
// 查询服务力&服务质量看板的城市-服务站-门店 /citystation/getHmCityStation
const $axiosGetHmCityStation = params => axios.get(url + '/reportservice/citystation/getHmCityStation', { params });
// 查询城市服务站门店信息  /citystation/getLocationAllInOne
const $axiosGetCityStationAllInOne = params => axios.get(url + '/reportservice/citystation/getLocationAllInOne', { params });
// 导入各城市14天库存率 /report/importCity14DaysStockRadio
const $axiosImportCity14DaysStockRadio = params => axios.post(url + '/reportservice/report/importCity14DaysStockRadio', params)
// 导入近30天商品库存 /report/import30DaysProductStock
const $axiosImport30DaysProductStock = params => axios.post(url + '/reportservice/report/import30DaysProductStock', params)
// 服务力14天库存 /report/service14DayStock
const $axiosService14DayStock = params => axios.get(url + '/reportservice/report/service14DayStock', { params });
// 服务站与门店库存 /report/stationAndShopStock
const $axiosStationAndShopStock = params => axios.post(url + '/reportservice/report/stationAndShopStock', params)
// 单品走势下拉框，业务线，关键字 /salesdata/orderTrendSelect
const $axiosOrderTrendSelect = params => axios.get(url + '/reportservice/salesdata/orderTrendSelect', { params });
// 客诉数和服务能力折线图 /report/customerClaimAndServicePowerLineGraph
const $axiosCustomerClaimAndServicePowerLineGraph = params => axios.post(url + '/reportservice/report/customerClaimAndServicePowerLineGraph', params)
// 订单热力图 POST /report/orderHeatMap
const $axiosOrderHeatMap = params => axios.post(url + '/reportservice/report/orderHeatMap', params)
// 打卡记录导入 POST /importExcel/clockLog
const $axiosClockLog = params => axios.post(url + '/reportservice/importExcel/clockLog', params)
// 生活服务评价导入 /importExcel/evaluateLifeService
const $axiosEvaluateLifeService = params => axios.post(url + '/reportservice/importExcel/evaluateLifeService', params)
// 复购导入/importExcel/rebuy
const $axiosRebuy = params => axios.post(url + '/reportservice/importExcel/rebuy', params)
// 服务力指标&服务站指标  /report/serviceGoalData
const $axiosServiceGoalData = params => axios.get(url + '/reportservice/report/serviceGoalData', { params });
// 保洁人均单量&品类人均工时 POST /report/CleanPerCapitalOrderQuality
const $axiosCleanPerCapitalOrderQuality = params => axios.post(url + '/reportservice/report/CleanPerCapitalOrderQuality', params)
// /report/onlineChathz
const $axiosOnlineChathz = params => axios.get(url + '/reportservice/report/onlineChathz', { params });
//商城引荐指标&整体指标/report/shopReferenceIndexAndoverAllIndex
const $axiosShopReferenceIndexAndoverAllIndex = params => axios.get(url + '/reportservice/report/shopReferenceIndexAndoverAllIndex', { params });
// 新增人数和销售趋势&销量最高的商品列表 POST /report/newAdditionsAndSalesTrendsAndHighestSalesProducts
const $axiosNewAdditionsAndSalesTrendsAndHighestSalesProducts = params => axios.post(url + '/reportservice/report/newAdditionsAndSalesTrendsAndHighestSalesProducts', params)

//电访任务报表
//获取所有电访任务
const $axiosGetCampaign = params => axios.get(url + '/reportservice/callTask/getAllCampaign', { params })
const $axiosGetAllUser = params => axios.get(url + '/reportservice/callTask/getAllSysUser', { params })

const $axiosGetCallTask = params => axios.get(url + '/reportservice/callTask/getCallTask', { params })
const $axiosGetCallIB = params => axios.get(url + '/reportservice/callTask/getCallIB', { params }) //进电结果报表
const $axiosGetCallTicketConsultDetailList = params => axios.get(url + '/reportservice/callTask/ticketConsultDetailList', { params }) //工单任务咨询明细报表
const $axiosGetCallResult = params => axios.get(url + '/reportservice/callTask/callResult', { params }) //任务拨打情况报表

const $axiosGetCallTaskBoard = params => axios.get(url + '/reportservice/callTask/callTaskBoard', { params })//电访任务看板
const $axiosGetQywxCall = params => axios.get(url + '/reportservice/callTask/qywxCall', { params })//企微回访


//销售复购提醒报表
const $axiosMarketRebuyRemind = params => axios.get(url + '/reportservice/market/remind', { params });
const $axiosMarketRebuyRemindExport = params => axios.get(url + '/reportservice/market/remind', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

//导入盒马排班，盒马请假导入
const $axiosScheduleAndOnleave = params => axios.post(url + '/reportservice/importExcel/scheduleAndOnleave', params)

//导入库存利用率导入-城市-服务站
const $axiosImportHmStockAvailability = params => axios.post(url + '/reportservice/bjStockStatistics/importHmStockAvailability', params)

//服务力薪资列表
const $axiosGetServicerSalary = params => axios.get(url + '/reportservice/servicer/salaryList', { params })
const $axiosGetServicerSalaryExport = params => axios.get(url + '/reportservice/servicer/salaryList', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

//服务力T+7复购
const $axiosGetServicerRebuy = params => axios.get(url + '/reportservice/servicer/rebuy', { params })
const $axiosGetServicerRebuyExport = params => axios.get(url + '/reportservice/servicer/rebuy', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});


//服务力T+7复购明细-保洁
const $axiosGetServicerRebuyDetail = params => axios.get(url + '/reportservice/servicer/rebuyDetail', { params })
const $axiosGetServicerRebuyDetailExport = params => axios.get(url + '/reportservice/servicer/rebuyDetail', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

//服务力T+7复购明细-品类
const $axiosGetServicerRebuyPLDetail = params => axios.get(url + '/reportservice/servicer/rebuyPLDetail', { params })
const $axiosGetServicerRebuyPLDetailExport = params => axios.get(url + '/reportservice/servicer/rebuyPLDetail', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});


//新客首次履约完成后的复购情况
const $axiosGetMarketNewCustomerRebuy = params => axios.get(url + '/reportservice/market/ncRebuy', { params })
const $axiosGetMarketNewCustomerRebuyExport = params => axios.get(url + '/reportservice/market/ncRebuy', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});


//获取服务力复购 报表更新时间
const $axiosGetMarketReportEtlTime = params => axios.get(url + '/reportservice/market/etlTime', { params })

//保洁品类拉新
const $axiosGetNewCustomerList = params => axios.get(url + '/reportservice/market/newcustomer', { params })
const $axiosGetNewCustomerListExport = params => axios.get(url + '/reportservice/market/newcustomer', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});


//周期老客续约率
const $axiosGetOldCustomerRebuyList = params => axios.get(url + '/reportservice/market/ocRebuy', { params })
const $axiosGetOldCustomerRebuyListExport = params => axios.get(url + '/reportservice/market/ocRebuy', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

//保洁新客首次履约后T+7复购周期卡
const $axiosGetNewCustomerRebuyBJTotal = params => axios.get(url + '/reportservice/market/ncRebuyTotal', { params })
const $axiosGetNewCustomerRebuyBJTotalExport = params => axios.get(url + '/reportservice/market/ncRebuyTotal', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

//周期老客续约明细
const $axiosGetOldCustomerRebuyDetailList = params => axios.get(url + '/reportservice/servicer/rebuyOldCustomerDetail', { params })
const $axiosGetOldCustomerRebuyDetailListExport = params => axios.get(url + '/reportservice/servicer/rebuyOldCustomerDetail', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

//散单新客 首单服务明细
const $axiosGetNewCustomerTradeDetailList = params => axios.get(url + '/reportservice/servicer/newCustomerTradeDetail', { params })
const $axiosGetNewCustomerTradeDetailListExport = params => axios.get(url + '/reportservice/servicer/newCustomerTradeDetail', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

//周期单服务明细
const $axiosGetCycleTradeDetailList = params => axios.get(url + '/reportservice/servicer/cycleTradeDetail', { params })
const $axiosGetCycleTradeDetailListExport = params => axios.get(url + '/reportservice/servicer/cycleTradeDetail', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

//获取服务力复购 报表更新时间
const $axiosGetServicerReportEtlTime = params => axios.get(url + '/reportservice/servicer/etlTime', { params })

// 导购数据
const $axiossalesPerformance = params => axios.get(url + '/reportservice/cleaningDataMonitor/salesPerformance', { params })
const $axiossalesPerformanceExport = params => axios.get(url + '/reportservice/cleaningDataMonitor/salesPerformance', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))

// 保洁管理工具
// 可邀约好评-服务站信息
const $axiosEvaluationInfo = params => axios.get(url + '/reportservice/bjManagerTool/evaluationInfo', { params })
// 可邀约好评-服务站每日明细
const $axiosEvaluationInfoByStation = params => axios.get(url + '/reportservice/bjManagerTool/evaluationInfoByStation', { params })
const $axiosEvaluationInfoByStationExport = params => axios.get(url + '/reportservice/bjManagerTool/evaluationInfoByStation', {
    params: params,
    responseType: 'blob'
})
    .then(res => $handleToExcel(res))

// 可邀约好评-商家每日明细
const $axiosEvaluationInfoByPerson = params => axios.get(url + '/reportservice/bjManagerTool/evaluationInfoByPerson', { params })
const $axiosEvaluationInfoByPersonExport = params => axios.get(url + '/reportservice/bjManagerTool/evaluationInfoByPerson', {
    params: params,
    responseType: 'blob'
})
    .then(res => $handleToExcel(res))

//个人排名
const $axiosIndividualRanking = params => axios.get(url + '/reportservice/bjManagerTool/individualRanking', { params })
const $axiosIndividualRankingExport = params => axios.get(url + '/reportservice/bjManagerTool/individualRanking', {
    params: params,
    responseType: 'blob'
})
    .then(res => $handleToExcel(res))
//个人评价明细
const $axiosIndividualRankingDetail = params => axios.get(url + '/reportservice/bjManagerTool/individualRankingDetail', { params })
const $axiosIndividualRankingDetailExport = params => axios.get(url + '/reportservice/bjManagerTool/individualRankingDetail', {
    params: params,
    responseType: 'blob'
})
    .then(res => $handleToExcel(res))

//签到打卡-城市维度信息
const $axiosSignIn = params => axios.get(url + '/reportservice/bjManagerTool/signAdnClockInfo', { params })
//签到打卡-服务站维度
const $axiosSignInByStation = params => axios.get(url + '/reportservice/bjManagerTool/signAdnClockInfoByStation', { params })
//签到打卡-个人到门情况
const $axiosSignInByPerson = params => axios.get(url + '/reportservice/bjManagerTool/signAdnClockOnDoorAndLeaveDoorInfo', { params })
const $axiosSignInByPersonExport = params => axios.get(url + '/reportservice/bjManagerTool/signAdnClockOnDoorAndLeaveDoorInfo', {
    params: params,
    responseType: 'blob'
})
    .then(res => $handleToExcel(res))

//投诉治理
const $axiosComplaintManagement = params => axios.get(url + '/reportservice/report/complaintManagement', { params })
const $axiosComplaintManagementExport = params => axios.get(url + '/reportservice/report/complaintManagementExport', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))

//一键报备
const $axiosOnceFilingTicket = params => axios.get(url + '/reportservice/report/onceFilingTicket', { params })
const $axiosOnceFilingTicketExport = params => axios.get(url + '/reportservice/report/onceFilingTicket', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))

//保洁结算
const $axiosBmSettlement = params => axios.get(url + '/reportservice/report/bmSettlement', { params })
const $axiosBmSettlementExport = params => axios.get(url + '/reportservice/report/bmSettlement', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))
//保姆结算
const $axiosBjSettlement = params => axios.get(url + '/reportservice/report/bjSettlement', { params })
const $axiosBjSettlementExport = params => axios.get(url + '/reportservice/report/bjSettlement', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))


// 复购看板 //reBuy/reBuyLine  POST /reBuy/reBuyDetail  复购-详情


const $axiosReBuyLine = params => axios.post(url + '/reportservice/reBuy/reBuyLine', params)
const $axiosReBuyDetail = params => axios.post(url + '/reportservice/reBuy/reBuyDetail', params)
const $axiosReBuBookTradeOrderHistory = params => axios.get(url + '/reportservice/reBuy/bookTradeOrderHistory', { params })
const $axiosReBuyDetailExport = params => axios.post(url + '/reportservice/reBuy/reBuyDetailExport', params, {
    responseType: 'blob'
}).then(res => $handleToExcel(res));

//-------------------------------------库存指标
//各城市业务线在职情况
const $axiosgetStockStationPerson = params => axios.get(url + '/reportservice/bjStockStatistics/getStockStationPerson', { params })
const $axiosgetStockStationPersonExport = params => axios.get(url + '/reportservice/bjStockStatistics/getStockStationPerson', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))
//接单情况
const $axiosgetSpCityBuzlineServiceorderNumber = params => axios.get(url + '/reportservice/bjStockStatistics/getSpCityBuzlineServiceorderNumber', { params })
const $axiosgetSpCityBuzlineServiceorderNumberExport = params => axios.get(url + '/reportservice/bjStockStatistics/getSpCityBuzlineServiceorderNumber', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))
//各城市各业务线库存利用率和人均订单
const $axiosbuzlineStockAvailability = params => axios.get(url + '/reportservice/bjStockStatistics/buzlineStockAvailability', { params })
const $axiosbuzlineStockAvailabilityExport = params => axios.get(url + '/reportservice/bjStockStatistics/buzlineStockAvailability', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))
//各城市各服务站不同上线时长保洁师客诉率
const $axiosgetCityBuzServiceorderNumber = params => axios.get(url + '/reportservice/bjStockStatistics/getCityBuzServiceorderNumber', { params })
const $axiosgetCityBuzServiceorderNumberExport = params => axios.get(url + '/reportservice/bjStockStatistics/getCityBuzServiceorderNumber', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))


//各城市商品库存剩余率
const $axiosGetCityProductStock = params => axios.get(url + '/reportservice/bjStockStatistics/getCityProductStock', { params })
const $axiosGetCityProductStockExport = params => axios.get(url + '/reportservice/bjStockStatistics/getCityProductStock', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

//2022 双11活动
const $axiosGetReprotMarketActivity202211 = params => axios.get(url + '/reportservice/market/double11', { params });

//企微相关（预采、日常任务）
const $axiosGetPreCollect = params => axios.get(url + '/reportservice/cpReprot/preCollect', { params })
const $axiosGetPreCollectExport = params => axios.get(url + '/reportservice/cpReprot/preCollect', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res));

const $axiosGetCPDailyCall = params => axios.get(url + '/reportservice/cpReprot/cpDailyCall', { params })
const $axiosGetCPDailyCallExport = params => axios.get(url + '/reportservice/cpReprot/cpDailyCall', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))

const $axiosGetCPJoin = params => axios.get(url + '/reportservice/cpReprot/cpJoin', { params })

const $axiosGetCPTotal = params => axios.get(url + '/reportservice/cpReprot/cpTotal', { params })
const $axiosGetCPTotalExport = params => axios.get(url + '/reportservice/cpReprot/cpTotal', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))


const $axiosGetCPDetail = params => axios.get(url + '/reportservice/cpReprot/cpDetail', { params })
const $axiosGetCPDetailExport = params => axios.get(url + '/reportservice/cpReprot/cpDetail', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res))

//报表浏览日志查询及导出
const $axiosGetReportLogList = params => axios.get(url + '/reportservice/reportLog/log', { params })
const $axiosGetReportLogExport = params => axios.get(url + '/reportservice/reportLog/log', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

//抖音相关报表
const $axiosGetDYPageList = params => axios.get(url + '/reportservice/douyin/pageData', { params })//获取小程序页面数据
const $axiosGetDYPageExport = params => axios.get(url + '/reportservice/douyin/pageData', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

const $axiosGetDYSalesList = params => axios.get(url + '/reportservice/douyin/salesData', { params })//获取抖音销售数据
const $axiosGetDYSalesExport = params => axios.get(url + '/reportservice/douyin/salesData', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

const $axiosGetDYSalesTotalList = params => axios.get(url + '/reportservice/douyin/salesTotal', { params })//获取抖音销售汇总数据
const $axiosGetDYSalesTotalExport = params => axios.get(url + '/reportservice/douyin/salesTotal', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});


const $axiosGetDYSalesTodayTotal = params => axios.get(url + '/reportservice/douyinBoard/today', { params })//获取抖音看板今日销量汇总
const $axiosGetDYSalesMonthTotal = params => axios.get(url + '/reportservice/douyinBoard/month', { params })//获取抖音看板本月销量汇总
const $axiosGetDYBookLineData = params => axios.get(url + '/reportservice/douyinBoard/lineBookData', { params })//获取抖音日服务订单走势图
const $axiosGetDYSalesHotMap = params => axios.get(url + '/reportservice/douyinBoard/hotMap', { params })//获取抖音销售热力图
const $axiosGetDYSalesLineData = params => axios.get(url + '/reportservice/douyinBoard/lineData', { params })//获取抖音销售曲线
const $axiosGetDYFianceList = params => axios.get(url + '/reportservice/douyinFiance/fiance', { params })//获取抖音财务对账单
const $axiosGetDYFianceExport = params => axios.get(url + '/reportservice/douyinFiance/fiance', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

const $axiosGetDYSinglelList = params => axios.get(url + '/reportservice/douyinRebuy/single', { params })//获取抖音散单服务及复购情况
const $axiosGetDYSingleExport = params => axios.get(url + '/reportservice/douyinRebuy/single', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});
const $axiosGetDYCyclelList = params => axios.get(url + '/reportservice/douyinRebuy/cycle', { params })//获取抖音散单服务及复购情况
const $axiosGetDYCycleExport = params => axios.get(url + '/reportservice/douyinRebuy/cycle', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

const $axiosGetDYServantlList = params => axios.get(url + '/reportservice/douyinServant/servant', { params })//获取抖音服务力
const $axiosGetDYCityStockList = params => axios.get(url + '/reportservice/douyinServant/cityStock', { params })//城市14天库存利用率
const $axiosGetDYStationStockList = params => axios.get(url + '/reportservice/douyinServant/stationStock', { params })//服务站库存利用率
const $axiosGetDYFraList = params => axios.get(url + '/reportservice/selfreBuy/getFraList', { params })//加盟商列表
const $axiosSelfReBuyLine = params => axios.post(url + '/reportservice/selfreBuy/selfReBuyLine', params)//复购折线图
const $axiosSelfReBuyDetail = params => axios.post(url + '/reportservice/selfreBuy/selfReBuyDetail', params)//复购明细

const $axiosSelfReBuyDetailExport = params => axios.post(url + '/reportservice/selfreBuy/selfReBuyDetail', params,
    {

        responseType: 'blob'
    }).then(res => {
        $handleToExcel(res);
    });

//美团SD
const $axiosGetMTLSDList = params => axios.get(url + '/reportservice/douyin/salesMTData', { params })
const $axiosGetMTLSDListExport = params => axios.get(url + '/reportservice/douyin/salesMTData', {
    params: params,
    responseType: 'blob'
}).then(res => $handleToExcel(res));

const $axiosGetOBCallDetaliList = params => axios.get(url + '/reportservice/callTask/callTaskDetail', {
    params: params,
    paramsSerializer: function (params) {
        return Qs.stringify(params, { arrayFormat: 'repeat' })
    }
})//外呼明细报表
const $axiosGetOBCallDetaliExport = params => axios.get(url + '/reportservice/callTask/callTaskDetail', {
    params: params,
    responseType: 'blob',
    paramsSerializer: function (params) {
        return Qs.stringify(params, { arrayFormat: 'repeat' })
    }
}).then(res => {
    $handleToExcel(res);
});


function randomNum(minNum, maxNum) {
    return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
}

//导出返回值 统一处理方法
const $handleToExcel = (res) => {
    let blob = new Blob([res.data], {
        type: 'application/vnd.ms-excel'
    });
    let fileName = Date.parse(new Date()) + randomNum(1, 1200) + '.xlsx'
    if (window.navigator.msSaveOrOpenBlob) {
        navigator.msSaveBlob(blob, fileName)
    } else {
        var link = document.createElement('a')
        link.href = window.URL.createObjectURL(blob)
        link.download = fileName
        link.click()
        //释放内存
        window.URL.revokeObjectURL(link.href)
    }
}
// privateDomain/topSalesNumber  顶部的销售统计和加盟商数量
const $axiosTopSalesNumber = params => axios.get(url + '/reportservice/privateDomain/topSalesNumber', { params });
// privateDomain/getServicedHotMap 获取核销热力图
const $axiosGetServicedHotMap = params => axios.get(url + '/reportservice/privateDomain/getServicedHotMap', { params });
// privateDomain/getAllRank
const $axiosGetAllRank = params => axios.get(url + '/reportservice/privateDomain/getAllRank', { params });
const $axiosSansaoContractList = params => axios.post(url + '/reportservice/sansao/sansaoContractList', params)//三嫂合同
const $axiosSansaoContractListExport = params => axios.post(url + '/reportservice/sansao/sansaoContractList', params, {
    responseType: 'blob'
}).then(res => $handleToExcel(res));


const $axiosGetOrderChannel = params => axios.get(url + '/reportservice/douyin/getChannel', { params });

//抖音门店评价
const $axiosGetStoreComment = params => axios.get(url + '/reportservice/douyin/getStoreComment', { params });
const $axiosGetStoreCommentExport = params => axios.get(url + '/reportservice/douyin/getStoreComment', {
    params: params,
    responseType: 'blob'
}).then(res => {
    $handleToExcel(res);
});

const $axiosGetAssignList = params =>axios.post(url + '/reportservice/jzOrderAssign/dailyAssign', params);
const $axiosGetAssignListExport = params => axios.post(url + '/reportservice/jzOrderAssign/dailyAssign', params, {
  responseType: 'blob',
}).then(res => {
    $handleToExcel(res);
});

//抖音优惠券导出
const $axiosGetDYCouponSummary = params =>axios.get(url + '/reportservice/douyin/getDYCouponSummary', {params});
const $axiosGetDYCouponSummaryExport = params => axios.get(url + '/reportservice/douyin/getDYCouponSummary', {
    params: params,
    responseType: 'blob',
}).then(res => {
    $handleToExcel(res);
});
//优惠券明细
const $axiosGetDYCouponDetail = params =>axios.get(url + '/reportservice/douyin/getDYCouponDetail', {params});
const $axiosGetDYCouponDetailExport = params => axios.get(url + '/reportservice/douyin/getDYCouponDetail', {
    params: params,
    responseType: 'blob',
}).then(res => {
    $handleToExcel(res);
});

export default {
    $axiosGetBjGoodsAttr,
    $axiosGetReportData,
    $axiosGetCityStation,
    $axiosGetTicketConsultType,
    $axiosGetdisplay,
    $axiosGetSaleReportData,
    $axiosGetMonthlySaleReportData,
    $axiosGetServiceGmv,
    $axiosExportLog,
    $axiosTargetPageData,
    $axiosSalesTargetDel,
    $axiosSalesTargetImport,
    $axiosSalesTargetAdd,
    $axiosSalesTargetUpdate,
    $axiosGetCSGmvData,
    $axiosGetCSGmvTarget,
    $axiosGetResignAndLossReason,
    $axiosImportResignAndLossReason,
    $axiosInvestmentAndResignList,
    $axiosServiceQualityStackLine,
    $axiosClaimSummaryAndPie,
    $axiosGetCSTrendchart,
    $axiosGetOrderNumberchart,
    $axiosGetBjCityStation,
    $axiosGetChannel,
    $axiosServicePowerReport,
    $axiosServicePowerSalaryReport,
    $axiosGetUserAuthBuzData,
    $axiosSelectLittleAppOrder,
    $axiosSelectLittleAppOrderExport,
    $axiosSelectChannelSales,
    $axiosSalesSummary,
    $axiosDayInvestMenDetail,
    $axiosDayCustomerClaimDetail,
    $axiosSuperTicketDetail,
    $axiosAliveTwoDayTicketDetail,
    $axiosServicePowerTicketDetail,
    $axiosServicePowerTicketInfo,
    $axiosServicePowerServerInfo,
    $axiosServicePowerStationPersonInfo,
    $axiosServicePowerRentFee,
    $axiosServicePowerWornSubsidies,
    $axiosServicePowerTeacherReward,
    $axiosServicePowerOrderReward,
    $axiosGetNurseSource,
    $axiosSelectClue,
    $axiosServantSignOrder,
    $axiosCluePayOrder,
    $axiosServiceGMVCount,
    $axiosMonthSalesPlan,
    $axiosBdInvertDetail,
    $axiosNotHMActualSales,
    $axiosCityProgress,
    $axiosOrderTrend,
    $axiosOnlineChatSummary,
    $axiosGetSelfCityStation,
    $axiosGetHmCityStation,
    $axiosImportCity14DaysStockRadio,
    $axiosImport30DaysProductStock,
    $axiosService14DayStock,
    $axiosStationAndShopStock,
    $axiosOrderTrendSelect,
    $axiosCustomerClaimAndServicePowerLineGraph,
    $axiosOrderHeatMap,
    $axiosClockLog,
    $axiosEvaluateLifeService,
    $axiosRebuy,
    $axiosServiceGoalData,
    $axiosCleanPerCapitalOrderQuality,
    $axiosOnlineChathz,
    $axiosShopReferenceIndexAndoverAllIndex,
    $axiosNewAdditionsAndSalesTrendsAndHighestSalesProducts,
    $axiosScheduleAndOnleave,

    $axiosGetCampaign,
    $axiosGetCallTask,
    $axiosGetCallIB,
    $axiosGetCallTicketConsultDetailList,
    $axiosMarketRebuyRemind,
    $axiosMarketRebuyRemindExport,
    $axiosGetCallResult,
    $axiosGetCallTaskBoard,
    $axiosGetQywxCall,

    $axiosGetServicerSalary,
    $axiosGetServicerSalaryExport,

    $axiosGetMarketNewCustomerRebuy,
    $axiosGetMarketNewCustomerRebuyExport,
    $axiosGetMarketReportEtlTime,
    $axiosGetNewCustomerRebuyBJTotal,
    $axiosGetNewCustomerRebuyBJTotalExport,

    $axiosGetServicerReportEtlTime,

    $axiosGetServicerRebuy,
    $axiosGetServicerRebuyExport,
    $axiosGetServicerRebuyDetail,
    $axiosGetServicerRebuyDetailExport,
    $axiosGetServicerRebuyPLDetail,
    $axiosGetServicerRebuyPLDetailExport,

    $axiosGetNewCustomerList,
    $axiosGetNewCustomerListExport,

    $axiosGetOldCustomerRebuyList,
    $axiosGetOldCustomerRebuyListExport,
    $axiosGetOldCustomerRebuyDetailList,
    $axiosGetOldCustomerRebuyDetailListExport,

    $axiossalesPerformance,
    $axiossalesPerformanceExport,

    $axiosEvaluationInfo,
    $axiosEvaluationInfoByStation,
    $axiosEvaluationInfoByStationExport,
    $axiosEvaluationInfoByPerson,
    $axiosEvaluationInfoByPersonExport,
    $axiosIndividualRanking,
    $axiosIndividualRankingExport,
    $axiosIndividualRankingDetail,
    $axiosIndividualRankingDetailExport,
    $axiosSignIn,
    $axiosSignInByStation,
    $axiosSignInByPerson,
    $axiosSignInByPersonExport,
    $axiosComplaintManagement,
    $axiosComplaintManagementExport,

    $axiosOnceFilingTicket,
    $axiosOnceFilingTicketExport,

    $axiosBjSettlement,
    $axiosBjSettlementExport,
    $axiosBmSettlement,
    $axiosBmSettlementExport,

    $axiosImportHmStockAvailability,

    $axiosgetStockStationPerson,
    $axiosgetStockStationPersonExport,
    $axiosgetSpCityBuzlineServiceorderNumber,
    $axiosgetSpCityBuzlineServiceorderNumberExport,
    $axiosbuzlineStockAvailability,
    $axiosbuzlineStockAvailabilityExport,
    $axiosgetCityBuzServiceorderNumber,
    $axiosgetCityBuzServiceorderNumberExport,

    $axiosGetCityProductStock,
    $axiosGetCityProductStockExport,

    $axiosGetNewCustomerTradeDetailList,
    $axiosGetNewCustomerTradeDetailListExport,

    $axiosGetCycleTradeDetailList,
    $axiosGetCycleTradeDetailListExport,

    $axiosGetReportLogList,
    $axiosGetReportLogExport,
    $axiosGetCityStationAllInOne,
    $axiosReBuyLine,
    $axiosReBuyDetail,
    $axiosReBuBookTradeOrderHistory,
    $axiosReBuyDetailExport,
    $axiosGetReprotMarketActivity202211,

    $axiosGetPreCollect,
    $axiosGetPreCollectExport,

    $axiosGetCPDailyCall,
    $axiosGetCPDailyCallExport,
    $axiosGetCPJoin,

    $axiosGetDYPageList,//抖音相关
    $axiosGetDYPageExport,
    $axiosGetDYSalesList,
    $axiosGetDYSalesExport,
    $axiosGetDYSalesTotalList,
    $axiosGetDYSalesTotalExport,
    $axiosGetDYSalesTodayTotal,
    $axiosGetDYSalesMonthTotal,
    $axiosGetDYSalesHotMap,
    $axiosGetDYSalesLineData,
    $axiosGetDYFianceList,
    $axiosGetDYFianceExport,
    $axiosGetDYSinglelList,
    $axiosGetDYSingleExport,
    $axiosGetDYCyclelList,
    $axiosGetDYCycleExport,
    $axiosGetDYServantlList,
    $axiosGetDYCityStockList,
    $axiosGetDYStationStockList,
    $axiosGetAllUser,
    $axiosGetOBCallDetaliList,
    $axiosGetOBCallDetaliExport,
    $axiosGetDYBookLineData,
    $axiosGetCPTotal,
    $axiosGetCPTotalExport,
    $axiosGetCPDetail,
    $axiosGetCPDetailExport,
    $axiosGetDYFraList,
    $axiosSelfReBuyLine,
    $axiosSelfReBuyDetail,
    $axiosSelfReBuyDetailExport,
    $axiosTopSalesNumber,
    $axiosGetServicedHotMap,
    $axiosGetAllRank,
    $axiosSansaoContractList,
    $axiosSansaoContractListExport,
    $axiosGetOrderChannel,
    $axiosGetStoreComment,
    $axiosGetStoreCommentExport,
    $axiosGetMTLSDList,
    $axiosGetMTLSDListExport,
    $axiosGetAssignListExport,
    $axiosGetAssignList,
    $axiosGetDYCouponSummary,
    $axiosGetDYCouponSummaryExport,
    $axiosGetDYCouponDetail,
    $axiosGetDYCouponDetailExport
}
