import { axios } from '@/utils/request'

// 财务收款分页列表
export const financeBookQueryPage = (params) => {
  const url = `/financeBook/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('列表查询')
    }
  })
}
// 检查是否已打印
export const checkPrintStatus = (params) => {
  return axios({
    url: `/financeBook/detail/checkPrintStatus `,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent(params.length==1?'收款打印':'批量打印')
    }
  })
}
// 获取最新一次钉钉审核人员信息
export const queryLastFinishDingUser = (params) => {
  return axios({
    url: `/financeBook/queryLastFinishDingUser`,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('钉钉审核人员信息')
    }
  })
}
// 统计
export const financeBookQueryCount = (params) => {
  return axios({
    url: `/financeBook/queryCount`,
    data: params,
    method: 'post'
  })
}
// 批量修改打印状态
export const financeBookDetailUpdateBatch = (params,type) => {
  return axios({
    url: `/financeBook/detail/updateBatch`,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent(type==1 ? '批量允许打印':'批量开票')
    }
  })
}
// 财务收款明细-分页列表
export const financeBookDetailList = (params) => {
  const url = `/financeBook/detail/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('列表查询')
    }
  })
}
// 财务收款明细-报表分页列表
export const financeBookDetailQueryPage = (params) => {
  const url = `/report/financeBook/detail/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('列表查询')
    }
  })
}
// 财务收款明细-统计
export const financeBookReportDetailCount = (params) => {
  return axios({
    url: `/report/financeBook/detail/queryCount`,
    data: params,
    method: 'post'
  })
}

// 财务收款明细-导出
export const financeBookDetailExport = (params) => {
  const url = `/report/financeBook/detail/export`
  return axios({
    url: url,
    data: params,
    method: 'post',
    responseType: 'blob',
    headers:{
      'module': encodeURIComponent('导出')
    }
  })
}

// 详情
export const financeBookFindBySn = (params) => {
  const url = `/financeBook/queryBySn/${params.bookSn}`
  return axios({
    url: url,
    method: 'get'
  })
}
// 关联备货单接口
export const queryDispatchBillListBySn = (params) => {
  const url = `/financeBook/queryDispatchBillListBySn/${params.bookSn}`
  return axios({
    url: url,
    method: 'get',
    headers:{
      'module': encodeURIComponent('关联备货单')
    }
  })
}
// 删除
export const financeBookDeleteBySn = (params) => {
  const url = `/financeBook/deleteBySn/${params.bookSn}`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('删除')
    }
  })
}

// 再次编辑
export const financeBookDgainEditBySn = (params) => {
  const url = `/financeBook/againEdit/${params.bookSn}`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('再次编辑')
    }
  })
}

// 保存
export const financeBookSave = (params) => {
  const url = `/financeBook/save`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('新增')
    }
  })
}

// 查询账户信息
export const lastPayerAccountInfo = (params) => {
  const url = `/financeBook/detail/lastPayerAccountInfo`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('查询最近一次账户信息')
    }
  })
}

// 提交
export const financeBookSubmit = (params) => {
  const url = `/financeBook/submit`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('提交')
    }
  })
}
// 明细-列表
export const financeBookDetailQueryList = (params) => {
  const url = `/financeBook/detail/queryList/${params.bookSn}`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('明细列表查询')
    }
  })
}
// 明细-保存
export const financeBookDetailSave = (params) => {
  const url = `/financeBook/detail/save`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('添加')
    }
  })
}
// 明细-详情
export const financeBookDetailQueryBySn = (params) => {
  const url = `/financeBook/detail/queryBySn/${params.bookDetailSn}`
  return axios({
    url: url,
    method: 'get'
  })
}
// 明细-删除
export const financeBookDetailDelete = (params) => {
  const url = `/financeBook/detail/deleteBySn/${params.bookDetailSn}`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('删除')
    }
  })
}

// 修改开票日期
export const updateDetailInvoiceDate = (params) => {
  const url = `/financeBook/detail/updateDetailInvoiceDate`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('修改开票日期或备注')
    }
  })
}

// 修改备注信息
export const updateFinanceBookDetail = (params,type) => {
  const url = `/financeBook/detail/update`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent(type==1?'暂不打印':'收款打印状态')
    }
  })
}

// 保存关联业务
export const saveSettleReceiptFinanceBook = (params) => {
  const url = `/financeBook/saveSettleReceiptFinanceBook`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('选择关联单据')
    }
  })
}
// 查询关联业务列表
export const querySettleReceiptFinanceBookList = (params) => {
  const url = `/financeBook/querySettleReceiptFinanceBookList/${params.bookSn}`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('关联单据')
    }
  })
}
// 删除关联业务
export const deleteSettleReceiptFinanceBook = (params) => {
  const url = `/financeBook/deleteSettleReceiptFinanceBook/${params.id}`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('删除')
    }
  })
}

// 批量获取钉钉审核信息
export const getBatchLastProcessInstance = (params) => {
  const url = `/dingTalk/getBatchLastProcessInstance`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
      'module': encodeURIComponent('批量打印')
    }
  })
}
