import request from '@/utils/request'

// 获取保单来佣列表
export function getPolicyCommissionList(data) {
  return request({
    url: '/csf/api/commission/list/page/vo',
    method: 'post',
    data: data
  })
}

// 生成可出账记录
export function generateCommissionRecord(data) {
  return request({
    url: '/csf/api/commission/generate/fortune',
    method: 'post',
    data: data
  })
}

// 更新保单发佣信息
export function updatePolicyFortune(data) {
  return request({
    url: '/csf/api/fortune/update',
    method: 'post',
    data: data
  })
}

// 获取保单发佣列表

export function getPolicyFortuneList(data) {
  return request({
    url: '/csf/api/fortune/list/page/vo',
    method: 'post',
    data: data
  })
}

// 下载选中的发佣数据

export function downloadPolicyFortune(data) {
  return request({
    url: '/csf/api/fortune/download/raw',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}

// 生成出账清单
// /csf/api/fortune/download/account
export function downloadPolicyFortuneAccount(data) {
  return request({
    url: '/csf/api/fortune/download/account',
    method: 'post',
    data: data
  })
}

// 按照人的维度，查询出账列表
export function getReferrerFortuneList(data) {
  return request({
    url: '/csf/api/fortune/list/page/fortuneAccount',
    method: 'post',
    data: data
  })
}

// 删除来佣数据
// /csf/api/commission/delete
export function deletePolicyCommission(data) {
  return request({
    url: '/csf/api/commission/delete',
    method: 'post',
    data: data
  })
}

// 更新出账状态
// /csf/api/fortune/update/status
export function updatePolicyFortuneStatus(data) {
  return request({
    url: '/csf/api/fortune/update/status',
    method: 'post',
    data: data
  })
}

// 完成出账
// /csf/api/fortune/complete
export function completePolicyFortune(data) {
  return request({
    url: '/csf/api/fortune/complete/fortuneAccount',
    method: 'post',
    data: data
  })
}

// 获取对账公司
// /csf/api/reconciliation_company/list/page
export function getReconciliationCompanyList(data) {
  return request({
    url: '/csf/api/reconciliation_company/list/page',
    method: 'post',
    data: data
  })
}

// 删除出账
// /csf/api/fortune/delete
export function deletePolicyFortune(data) {
  return request({
    url: '/csf/api/fortune/delete/fortuneAccount',
    method: 'post',
    data: data
  })
}

// 修改出账信息
// /csf/api/fortune/update/fortuneAccount
export function updatePolicyFortuneAccount(data) {
  return request({
    url: '/csf/api/fortune/update/fortuneAccount',
    method: 'post',
    data: data
  })
}

// 新建出账
// /csf/api/fortune/add/fortuneAccount
export function addPolicyFortuneAccount(data) {
  return request({
    url: '/csf/api/fortune/add/fortuneAccount',
    method: 'post',
    data: data
  })
}

// 删除发佣
// /csf/api/fortune/delete/fortuneAccount
export function deletePolicyFortuneAccount(data) {
  return request({
    url: '/csf/api/fortune/delete',
    method: 'post',
    data: data
  })
}

// 新建来佣
// /csf/api/commission/add
export function addPolicyCommission(data) {
  return request({
    url: '/csf/api/commission/add',
    method: 'post',
    data: data
  })
}
// 入账管理的统计数据
export function incomeStatistics(data) {
  return request({
    url: '/csf/api/commission/statistics',
    method: 'post',
    data: data
  })
}
// 出账管理的统计数据
export function billStatistics(data) {
  return request({
    url: '/csf/api/fortune/statistics',
    method: 'post',
    data: data
  })
}
// 出账管理的统计数据
export function salaryStatistics(data) {
  return request({
    url: '/csf/api/fortune/fortuneAccount/statistics',
    method: 'post',
    data: data
  })
}
// 薪资管理修订记录
export function salaryEditRecords(data) {
  return request({
    url: '/csf/api/fortune/editRecords/fortuneAccount',
    method: 'post',
    data: data
  })
}
// 入账管理操作记录
export function incomeEditRecords(data) {
  return request({
    url: '/csf/api/commission/edit/records',
    method: 'post',
    data: data
  })
}

// 保单号列表
export function policyData(data) {
  return request({
    url: '/csf/api/CommissionExpected/list/page',
    method: 'post',
    data: data
  })
}

// 应付款管理列表
export function expectedFortuneList(data) {
  return request({
    url: '/csf/api/expectedFortune/list',
    method: 'post',
    data: data
  })
}

// 应收款管理列表
export function receivedFortuneList(data) {
  return request({
    url: '/csf/api/CommissionExpected/queryCommissionExpectedByPage',
    method: 'post',
    data: data
  })
}
// 统计应收数据总金额、总入账金额、待入账金额、已入账比例（已入账金额-总金额）、总保单数
export function commissionExpectedStatistics(data) {
  return request({
    url: '/csf/api/CommissionExpected/statistics',
    method: 'post',
    data: data
  })
}
// 统计计算统计数据 预计发佣金额 HKD、已出账金额 HKD、待出账金额 HKD、总保单数、总保费 HKD
export function expectedFortuneStatistics(data) {
  return request({
    url: '/csf/api/expectedFortune/statistics',
    method: 'post',
    data: data
  })
}
// 入账比对记录查询
export function commissionEntryRecord(data) {
  return request({
    url: '/csf/api/commission/compare/records',
    method: 'post',
    data: data
  })
}
// 入账操作记录查询
export function commissionEntryEditRecords(data) {
  return request({
    url: '/csf/api/commission/edit/records',
    method: 'post',
    data: data
  })
}

// 获取保单发佣列表
export function policyNoCommissionPayRecord(data) {
  return request({
    url: '/csf/api/fortune/list/page/vo',
    method: 'post',
    data: data
  })
}

// 应收款导出
export function exportReceivedFortune(data) {
  return request({
    url: '/csf/api/CommissionExpected/export',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}

// 入账记录查询
export function commissionExpectedRecord(data) {
  return request({
    url: '/csf/api/commission/pageByCommissionexpectedBizId',
    method: 'post',
    data: data
  })
}
// 出账记录查询
export function payRecordList(data) {
  return request({
    url: '/csf/api/fortune/pageByExpectedFortuneBizId',
    method: 'post',
    data: data
  })
}
// 更新入账信息
export function updateCommissionExpected(data) {
  return request({
    url: '/csf/api/CommissionExpected/update',
    method: 'post',
    data: data
  })
}

// 修改出账状态
export function updataPayrollStatus(data) {
  return request({
    url: '/csf/api/fortune/update/status',
    method: 'post',
    data: data
  })
}

// 批量新增检核记录
export function addPayrollCheckRecord(data) {
  return request({
    url: '/csf/api/commission/addBatch',
    method: 'post',
    data: data
  })
}

// 新增应收款
export function addReceivedFortune(data) {
  return request({
    url: '/csf/api/CommissionExpected/add',
    method: 'post',
    data: data
  })
}

// 新增出账记录
export function addPayRecord(data) {
  return request({
    url: '/csf/api/expectedFortune/add',
    method: 'post',
    data: data
  })
}
// 获取销售员详情
export function userSaleExpandDetail(data) {
  return request({
    url: '/insurance/base/api/userSaleExpand/detail?userSaleBizId=' + data,
    method: 'get'
  })
}
// 更新比对状态
export function updateCompareStatus(data) {
  return request({
    url: '/csf/api/commission/updateCompareStatus',
    method: 'post',
    data: data
  })
}

// 更新数据
export function updateCommissionRecord(data) {
  return request({
    url: '/csf/api/commission/update',
    method: 'post',
    data: data
  })
}

// 出账检核---新增出账检核记录
export function addCheckRecordaddBatch(data) {
  return request({
    url: '/csf/api/fortune/addBatch',
    method: 'post',
    data: data
  })
}

// 设置本期出账金额
export function updatePayoutAmount(data) {
  return request({
    url: '/csf/api/fortune/update',
    method: 'post',
    data: data
  })
}

// 同步预计来佣
export function syncExpectedCommission(data) {
  return request({
    url: '/csf/api/commission/addToExpected',
    method: 'post',
    data: data
  })
}
// 更新出账记录
export function updatePayRecord(data) {
  return request({
    url: '/csf/api/expectedFortune/update',
    method: 'post',
    data: data
  })
}
// 应付款导出
export function exportPayRecord(data) {
  return request({
    url: '/csf/api/expectedFortune/export',
    method: 'post',
    data: data,
    responseType: 'blob'
  })
}
// 入账检核重新比对
export function compareCommissionEntry(data) {
  return request({
    url: '/csf/api/commission/compare?commissionBizId=' + data,
    method: 'get'
  })
}

// 应付款查询，按照保单期数维度
export function payableReport(data) {
  return request({
    url: '/csf/api/expectedFortune/payable_report',
    method: 'post',
    data: data
  })
}

// 应收款报表查询，按照保单期数维度
export function receivableReport(data) {
  return request({
    url: '/csf/api/CommissionExpected/receivable_report',
    method: 'post',
    data: data
  })
}
// 应收款报表统计
export function receivableStatistics(data) {
  return request({
    url: '/csf/api/CommissionExpected/receivable_report/statistics',
    method: 'post',
    data: data
  })
}

// 薪资拆分应发信息汇总列表
export function salarySummary(data) {
  return request({
    url: 'csf/api/salarySplit/summary/page',
    method: 'post',
    data: data
  })
}

// 薪资拆分应发信息汇总列表下载---待提供
export function exportPayRoll(data) {
  return request({
    url: 'csf/api/salarySplit/export/summary/list',
    method: 'post',
    data: data
  })
}

// 拆分出账列表
export function salarySplitList(data) {
  return request({
    url: 'csf/api/salarySplit/page',
    method: 'post',
    data: data
  })
}

// 拆分出账查询-原币种剩余总金额和原币种
export function billSplitRemaining(data) {
  return request({
    url: 'csf/api/salarySplit/query/remaining',
    method: 'post',
    data: data
  })
}

// 获取转介人详情
export function borkerDetail(data) {
  return request({
    url: '/insurance/base/api/userSaleExpand/detail?clientUserBizId=' + data,
    method: 'get'
  })
}
// 拆分出账查询-原币种和原币种金额——>目标币种即时汇率和目标币种金额
export function billSplitRate(data) {
  return request({
    url: 'csf/api/salarySplit/query/rate',
    method: 'post',
    data: data
  })
}

// 拆分出账查询-批量保存-薪资拆分应发信息列表
export function billBatchSave(data) {
  return request({
    url: 'csf/api/salarySplit/batch/save',
    method: 'post',
    data: data
  })
}

// 拆分出账查询-计算目标金额
export function billCalculateToAmount(data) {
  return request({
    url: 'csf/api/salarySplit/calculate/toAmount',
    method: 'post',
    data: data
  })
}
// 应收款管理--明细列表
export function newQueryCommissionExpectedByPage(data) {
  return request({
    url: 'csf/api/CommissionExpected/queryCommissionExpectedByPage/new',
    method: 'post',
    data: data
  })
}

// 应收款管理修改应收记录状态
export function CommissionExpectedChangeStatus(data) {
  return request({
    url: 'csf/api/CommissionExpected/edit/status',
    method: 'put',
    data: data
  })
}
// 出账检核--分期出账
export function billSplitApi(data) {
  return request({
    url: 'csf/api/fortune/split',
    method: 'post',
    data: data
  })
}
//用保单查询结算汇率
export function commissionExchangeRateApi(data) {
  return request({
    url: 'csf/api/commission/commission_exchange_rate',
    method: 'post',
    data: data
  })
}
//出账检核--设置出账年月(单个)
export function actualPayoutDateApi(data) {
  return request({
    url: 'csf/api/fortune/edit/actual_payout_date',
    method: 'post',
    data: data
  })
}
//入账检核--修改入账状态
export function editStatusApi(data) {
  return request({
    url: 'csf/api/commission/edit/status',
    method: 'put',
    data: data
  })
}

//出账检核--修改结算汇率
export function editExchangeRateApi(data) {
  return request({
    url: 'csf/api/fortune/edit/exchange_rate',
    method: 'post',
    data: data
  })
}
// 批量设置出账年月实
export function batchActualPayoutDate(data) {
  return request({
    url: '/csf/api/fortune/edit/actual_payout_date/batch',
    method: 'post',
    data: data
  })
}
// 计算出账检核统计
export function statisticsFortune(data) {
  return request({
    url: '/csf/api/fortune/statistics',
    method: 'post',
    data: data
  })
}
// 计算入账检核统计
export function statisticsCommission(data) {
  return request({
    url: '/csf/api/commission/statistics',
    method: 'post',
    data: data
  })
}
// 计算薪资发放统计
export function statisticsFortuneAccount(data) {
  return request({
    url: '/csf/api/fortune/fortuneAccount/statistics',
    method: 'post',
    data: data
  })
}
