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

//  库存列表  分页
export const stockList = (params) => {
  const url = `/stock/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}
//  库存 列表 合计
export const stockCount = (params) => {
  return axios({
    url: '/stock/queryPageCount',
    data: params,
    method: 'post'
  })
}
//  库存 导出
export const stockExport = (params) => {
  return axios({
    url: '/stock/exportExcel',
    data: params,
    method: 'post',
    responseType: 'blob',
    headers: {
      'module': encodeURIComponent('导出')
    }
  })
}
//  库存 详情列表  分页
export const stockDetailList = (params) => {
  const url = `/stock/queryDetailPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('明细列表查询')
    }
  })
}
//  库存 详情列表 合计
export const stockDetailCount = (params) => {
  return axios({
    url: '/stock/queryDetailPageCount',
    data: params,
    method: 'post'
  })
}

// 分页查询产品库存列表
export const queryStockProductPage = (params) => {
  const url = `/stock/queryStockProductPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}

// 非经销商产品库存列表
export const queryStockProductForOtherPage = (params) => {
  const url = `/stock/queryStockProductForOtherPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}
// 分页查询促销产品
export const queryPromoProductPage = (params) => {
  const url = `/stock/queryPromoProductPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}

//  出入库明细 列表  有分页
export const stockFlowList = (params) => {
  const url = `/stock/queryFlowPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}
//  出入库明细  列表  合计
export const stockFlowCount = (params) => {
  return axios({
    url: '/stock/queryFlowPageCount',
    data: params,
    method: 'post'
  })
}

//  库存预警 列表  分页
export const stockWarnList = (params) => {
  const url = `/stock/queryWarnPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('列表查询')
    }
  })
}
//  库存预警 保存
export const stockWarnSaveBatch = (params) => {
  return axios({
    url: '/stock/updateStateBatch',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('保存')
    }
  })
}

//  根据产品sn查询库存
export const stockByProductSn = (params) => {
  const url = `/stock/queryStockByProductSn/${params.sn}`
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('库存查询')
    }
  })
}
//  库存 出入库明细 导出
export const stockFlowExport = (params) => {
  return axios({
    url: '/stock/exportStockFlow',
    data: params,
    method: 'post',
    responseType: 'blob',
    headers: {
      'module': encodeURIComponent('导出')
    }
  })
}
