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

/**
 * page func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function getPurchaseReimbursePage (parameter) {
  return axios({
    url: '/purchase/purchase-reimburses/page?' + stringify(parameter),
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * add func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function addPurchaseReimburse (parameter) {
  return axios({
    url: '/purchase/purchase-reimburses',
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Content-Type': 'application/json;charset=UTF-8'
    },
    data: parameter
  })
}

/**
 * update func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function updatePurchaseReimburse (parameter) {
  return axios({
    url: '/purchase/purchase-reimburses/' + parameter.id,
    method: 'PUT',
    data: parameter
  })
}

/**
 * update func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function submitPurchaseReimburse (id) {
  return axios({
    url: '/purchase/purchase-reimburses/' + id + '/submit',
    method: 'PUT'
  })
}

/**
 * fetch single func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function fetchPurchaseReimburse (parameter) {
  return axios({
    url: '/purchase/purchase-reimburses/' + parameter.id,
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * query list func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function queryPurchaseReimburse (parameter) {
  return axios({
    url: '/purchase/purchase-reimburses?' + stringify(parameter),
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * delete batch func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function deletePurchaseReimburses (parameter) {
  return axios({
    url: '/purchase/purchase-reimburses',
    method: 'DELETE',
    data: parameter
  })
}

/**
 * delete single func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function deletePurchaseReimburse (parameter) {
  return axios({
    url: '/purchase/purchase-reimburses/' + parameter.id,
    method: 'DELETE',
    data: parameter
  })
}

/**
 * export file
 * parameter: { }
 * @param parameter :
 * @returns {*}
 */
export function exportPurchaseReimburse (parameter) {
  return axios({
    url: '/purchase/purchase-reimburses/export?' + stringify(parameter),
    method: 'get',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    },
    responseType: 'blob'
  })
}
