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

// 导入
export function reserveImportData(data) {
  return handleImport('/reserve/importData', data.formdata, data.id || '')
}

// 下载模板
export function reserveImportDataExcel(data, name) {
  return getBlob({
    url: '/reserve/download',
    data,
    name
  })
}

// 提货-列表V2
export function reserveListV2(data) {
  return request({
    url: `/reserve/listV2?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

//提货-列表V2导出
export function reserveListV2Export(data, name) {
  return postBlob({
    url: '/reserve/listV2/export',
    method: 'post',
    data,
    name
  })
}

// 获取列表
export function getList(params) {
  return request({
    url: '/reserve/list',
    method: 'get',
    params
  })
}

// 获取详情
export function getDetail(params) {
  return request({
    url: '/reserve/detail',
    method: 'get',
    params
  })
}

// 关闭
export function closeData(params) {
  return request({
    url: '/reserve/close',
    method: 'post',
    params
  })
}

// 获取产品列表
export function getGoodsList(params) {
  return request({
    url: '/reserve/listOrder',
    method: 'get',
    params
  })
}

// 新增
export function addData(params) {
  return request({
    url: '/reserve/add',
    method: 'post',
    data: params
  })
}

// 编辑
export function editData(params) {
  return request({
    url: '/reserve/updateReserved',
    method: 'post',
    data: params
  })
}

// 查询经销商列表
export function checkDealerList(params) {
  return request({
    url: '/reserve/detailCustomer',
    method: 'get',
    params
  })
}

// 查询物料列表
export function checkMaterialList(params) {
  return request({
    url: '/reserve/detailMaterialNumber',
    method: 'get',
    params
  })
}

// 获取仓库列表
export function getWarehouseList(params) {
  return request({
    url: '/stock/manager/listStock',
    method: 'get',
    params
  })
}

// 获取仓库列表
export function getListStock(params) {
  return request({
    url: '/reserve/listStock',
    method: 'get',
    params
  })
}
