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

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

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

/**
 * update func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function updateOutStoreForm (parameter) {
  return axios({
    url: '/store/transfer-store-forms/' + parameter.id,
    method: 'PUT',
    data: parameter
  })
}

/**
 * 更新库存
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function updateStore (parameter) {
  return axios({
    url: '/store/transfer-store-forms/out/' + parameter.id,
    method: 'PUT',
    data: parameter
  })
}

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

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

/**
 * delete batch func
 * parameter: { }
 * @param parameter
 * @returns {*}
 */
export function deleteOutStoreForms (parameter) {
  return axios({
    url: '/store/transfer-store-forms',
    method: 'DELETE',
    data: parameter
  })
}

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

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