import request from '@/utils/request'
import { download } from '@/utils/request'
// 查询扣款记录列表
export function listDeduct(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/deduct/list',
    method: 'get',
    params: query
  })
}

// 查询扣款记录详细
export function getDeduct(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/deduct/' + id,
    method: 'get'
  })
}

export function genDeduct(options) {
  console.log(options)
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/deduct/gen',
    method: 'get',
    params: options
  })
}

export function getEntrustOrder(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: `/business/deduct/getEntrustOrder/${id}`,
    method: 'get',
  })
}

export function checkStatementAccount(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/deduct/checkStatementAccount/' + id,
    method: 'get'
  })

}

// 新增扣款记录
export function addDeduct(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/deduct',
    method: 'post',
    data: data
  })
}

// 修改扣款记录
export function updateDeduct(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/deduct',
    method: 'put',
    data: data
  })
}

// 删除扣款记录
export function delDeduct(id) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/deduct/' + id,
    method: 'delete'
  })
}


export function exportDeduct(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  download(
    "business/deduct/export",
    {
      ...query,
    },
    `概览导出_${new Date().getTime()}.xlsx`
  )
}
export function confirmDeduct(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/deduct/confirm',
    method: 'post',
    data: data
  })
}

export function rejectDeduct(data) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  return request({
    url: '/business/deduct/reject',
    method: 'post',
    data: data
  })

}


export function exportAccountStatement(query) {
  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
  console.log(query);
  download(
    "/business/deduct/exportAccountStatement",
    {
      ...query,
    },
 
    `对账单导出_${query.title}.xlsx`
  )
}


