import request from '@/utils/request'

// 查询借款计划列表
export function listBorrow(query) {
  return request({
    url: '/dk/borrow/list',
    method: 'get',
    params: query
  })
}

// 查询借款计划详细
export function getBorrow(id) {
  return request({
    url: '/dk/borrow/' + id,
    method: 'get'
  })
}

export function getContract(tradeNo) {
  return request({
    url: '/dk/borrow/getContract',
    method: 'get',
    params: {
      tradeNo
    }
  })
}

// 新增借款计划
export function addBorrow(data) {
  return request({
    url: '/dk/borrow',
    method: 'post',
    data: data
  })
}

export function updateBorrowLoan(data) {
  return request({
    url: '/dk/borrow/updateLoan',
    method: 'post',
    data: data
  })
}

export function updateBorrowStatus(data) {
  return request({
    url: '/dk/borrow/updateStatus',
    method: 'post',
    data: data
  })
}

export function updateBorrow(data) {
  return request({
    url: '/dk/borrow',
    method: 'put',
    data: data
  })
}

export function updateBank(data) {
  return request({
    url: '/dk/borrow/updateBank',
    method: 'post',
    data: data
  })
}

// 删除借款计划
export function delBorrow(id) {
  return request({
    url: '/dk/borrow/' + id,
    method: 'delete'
  })
}

// 导出借款计划
export function exportBorrow(query) {
  return request({
    url: '/dk/borrow/export',
    method: 'get',
    params: query
  })
}
