import request from '@/utils/request'

export function fetchBillList(query) {
  return request({
    url: '/bills',
    method: 'get',
    params: query
  })
}

// 保存草稿 或者 发布账单
export function billUploadExcelAdd(data) {
  return request({
    url: '/bill/uploadExcel/add',
    method: 'post',
    header: {
      'Content-Type': 'multipart/form-data'
    },
    data
    // data: {
    //   file: data.files,
    //   billName: data.billName,
    //   billExplain: data.billExplain,
    //   endDate: data.endDate,
    //   billStatus: data.billStatus
    // }
  })
}

// 根据 id 修改缴费项状态
export function updateBillStatus(data) {
  return request({
    url: '/bill/updateBillStatus/' + data.id,
    method: 'put',
    params: {
      billStatus: data.billStatus
    }
  })
}

//  根据 id集合 删除缴费项
export function deleteBillBeach(data) {
  return request({
    url: '/bill/deleteBillBeach',
    method: 'post',
    data
  })
}

// 下载excel模板
export function billDownloadExcel() {
  return request({
    url: '/bill/downloadExcel',
    method: 'get',
    responseType: 'blob'
  })
}

// 根据收费项ID查询,收费项详情
export function getBillInfoBydId(id) {
  return request({
    url: '/bill/' + id,
    method: 'get'
  })
}

