import request, { postBlob, handleImport, getBlob } from '@/utils/request'

export function getListV2(params) {
  return request({
    url: `/stock/listV2?moduleId=${params.moduleId}`,
    method: 'post',
    data: params
  })
}

export function exportListV2(data, name) {
  return postBlob({
    url: '/stock/listV2/export',
    data,
    name
  })
}
export function importStockV2(data) {
  return handleImport('stock/importToll', data.formdata, data.id || '')
}

export function getListStockV2(params) {
  return request({
    url: `/stock/listStockV2?moduleId=${params.moduleId}`,
    method: 'post',
    data: params
  })
}

export function exportListStockV2(data, name) {
  return postBlob({
    url: '/stock/listStockV2/export',
    data,
    name
  })
}

export function getListTollV2(params) {
  return request({
    url: `/stock/listTollV2?moduleId=${params.moduleId}`,
    method: 'post',
    data: params
  })
}

export function exportListTollV2(data, name) {
  return postBlob({
    url: '/stock/listTollV2/export',
    data,
    name
  })
}

export function getList(params) {
  return request({
    url: '/stock/list',
    method: 'get',
    params
  })
}

export function getStockDetail(params) {
  return request({
    url: '/stock/detail',
    method: 'get',
    params
  })
}

export function getStockDetailStock(params) {
  return request({
    url: '/stock/detailStock',
    method: 'get',
    params
  })
}

export function getListReserve(params) {
  return request({
    url: '/stock/listReserve',
    method: 'get',
    params
  })
}



export function getListStock(params) {
  return request({
    url: '/stock/listStock',
    method: 'get',
    params
  })
}

export function addStock(params) {
  return request({
    url: '/stock/addStock',
    method: 'post',
    data: params
  })
}
export function updateStock(params) {
  return request({
    url: '/stock/updateStock',
    method: 'post',
    data: params
  })
}
export function deleteStock(params) {
  return request({
    url: '/stock/deleteStock',
    method: 'get',
    params
  })
}

export function getListToll(params) {
  return request({
    url: '/stock/listToll',
    method: 'get',
    params
  })
}

export function getDetail(params) {
  return request({
    url: '/stock/detailToll',
    method: 'get',
    params
  })
}

export function updateToll(params) {
  return request({
    url: '/stock/updateToll',
    method: 'post',
    data: params
  })
}

export function addToll(params) {
  return request({
    url: '/stock/addToll',
    method: 'post',
    data: params
  })
}

export function deleteToll(params) {
  return request({
    url: '/stock/deleteToll',
    method: 'get',
    params
  })
}
// 导入
// /stock/importToll
// 导出

// /stock/exportToll

// 经销商列表

export function getCustomerList(params) {
  return request({
    url: '/customer/list',
    method: 'get',
    params
  })
}

export function addReserve(params) {
  return request({
    url: '/stock/addReserve',
    method: 'post',
    data: params
  })
}

export function setStock(params) {
  return request({
    url: '/stock/update',
    method: 'get',
    params
  })
}

export function updateReserve(params) {
  return request({
    url: '/stock/updateReserve',
    method: 'post',
    data: params
  })
}

export function categoryList(params) {
  return request({
    url: '/k3/category/list',
    method: 'get',
    params
  })
}
