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

//  产品 列表  分页
export const productList = (params) => {
  const url = `/product/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  产品 列表 已定过价的 分页
export const productPricedList = (params) => {
  const url = `/product/queryPricedPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
// 定价批量审核 
export const batchAuditPrice = (params) => {
  const url = `/product/pricing/batchAudit`
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
// 导出产品定价
export const productExportPricing = (params) => {
  return axios({
    url: '/product/pricing/exportExcel',
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}
// 产品定价 下载模板
export const productPriceTplDownload = params => {
  return axios.request({
    url: `/product/productPrice/importTemplate`,
    method: 'post',
    responseType: 'blob'
  })
}
// 产品定价 入库导入数据
export const productPriceInsertImport = params => {
  return axios({
    url: '/product/productPrice/insertImport',
    data: params,
    method: 'post'
  })
}
// 产品定价  批量插入
export const productPriceImport = params => {
  return axios({
    url: '/product/productPrice/import',
    data: params,
    method: 'post'
  })
}
//  产品定价 导入产品 导出错误项
export const productPriceFailExcel = (params) => {
  const url = `/product/productPrice/exportImportError`
  return axios.request({
    url: url,
    method: 'post',
    data: params,
    responseType: 'blob'
  })
}

//  产品 保存
export const productSave = (params) => {
  return axios({
    url: '/product/save',
    data: params,
    method: 'post'
  })
}
//  产品 删除
export const productDel = (params) => {
  return axios({
    url: `/product/delete/${params.sn}`,
    method: 'get'
  })
}
//  产品 导出
export const productExport = (params) => {
  return axios({
    url: '/product/exportExcel',
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}
//  产品 详情  根据sn查询
export const productSnDetail = (params) => {
  return axios({
    url: `/product/findBySn/${params.sn}`,
    method: 'get'
  })
}
//  产品 审核
export const productAudit = (params) => {
  return axios({
    url: `/product/audit/${params.sn}`,
    method: 'get'
  })
}
//  产品 批量审核
export const productBatchAudit = (params) => {
  return axios({
    url: '/product/batchAudit',
    data: params,
    method: 'post'
  })
}
//  产品 上线
export const productOnline = (params) => {
  return axios({
    url: `/product/online/${params.sn}`,
    method: 'get'
  })
}
//  产品 下线
export const productOffline = (params) => {
  return axios({
    url: `/product/offline`,
    data: params,
    method: 'post'
  })
}
//  产品 批量上线
export const productBatchOnline = (params) => {
  return axios({
    url: '/product/batchOnline',
    data: params,
    method: 'post'
  })
}

//  产品  定价  列表  分页
export const productPricingList = (params) => {
  const url = `/product/pricing/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  产品  定价 详情  根据sn查询
export const productPricingSnDetail = (params) => {
  return axios({
    url: `/product/pricing/getPricingInfo/${params.sn}`,
    method: 'get'
  })
}
//  产品  定价 编辑
export const productPricingSave = (params) => {
  return axios({
    url: '/product/pricing/save',
    data: params,
    method: 'post'
  })
}
//  产品  定价 审核
export const productPricingAudit = (params) => {
  return axios({
    url: '/product/pricing/audit',
    data: params,
    method: 'post'
  })
}

// 产品上线、下线分页接口
export const productLogList = (params) => {
  const url = `/productLog/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
// 产品上线、下线审核
export const productLogAudit = (params) => {
  return axios({
    url: `/productLog/audit`,
    data: params,
    method: 'post'
  })
}
// 批量上线、下线审核
export const productLogAuditBatch = (params) => {
  return axios({
    url: `/productLog/auditBatch`,
    data: params,
    method: 'post'
  })
}

//  产品  上线审核  列表  分页 （已废弃）
export const productOnlineList = (params) => {
  const url = `/product/online/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  产品 上线审核  审核（已废弃）
export const productOnlineAudit = (params) => {
  return axios({
    url: `/product/auditOnline/${params.sn}`,
    method: 'get'
  })
}
//  产品 批量上线审核（已废弃）
export const productBatchOnlineAudit = (params) => {
  return axios({
    url: '/product/batchAuditOnline',
    data: params,
    method: 'post'
  })
}

//  产品  下线审核  列表  分页 （已废弃）
export const productOfflineList = (params) => {
  const url = `/product/offline/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  产品 下线审核  审核（已废弃）
export const productOfflineAudit = (params) => {
  return axios({
    url: `/product/auditOffline/${params.sn}`,
    method: 'get'
  })
}
//  产品 批量下线审核（已废弃）
export const productBatchOfflineAudit = (params) => {
  return axios({
    url: '/product/batchAuditOffline',
    data: params,
    method: 'post'
  })
}

//  产品  价格变更记录  列表  分页
export const productPriceChangeList = (params) => {
  const url = `/product/priceChange/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  价格变更记录 导出
export const productPriceChangeExport = (params) => {
  return axios({
    url: '/product/priceChange/exportExcel',
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}
//  产品  级别 列表  分页
export const productLevelList = (params) => {
  const url = `/product/level/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  产品  级别 保存
export const productLevelSave = (params) => {
  return axios({
    url: '/product/saveProductLevel',
    data: params,
    method: 'post'
  })
}
//  价格查询 列表  分页
export const productPriceList = (params) => {
  const url = `/product/price/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  产品 获取价格
export const productPriceInfo = (params) => {
  return axios({
    url: `/product/getProductPriceInfo/${params.sn}`,
    method: 'get'
  })
}
// 查询最近上下线产品
export const queryNewProductPage = (params) => {
  const url = `/product/queryNewProductPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}

// 导出产品及货位信息
export const stackPlaceExport = (params) => {
  return axios({
    url: '/product/stackPlace/export',
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}

// 导入产品货位-导出错误
export const stackPlaceExportError = (params) => {
  return axios({
    url: '/product/stackPlace/exportImportError',
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}

// 导入产品货位
export const stackPlaceImport = (params) => {
  return axios({
    url: '/product/stackPlace/import',
    data: params,
    method: 'post'
  })
}
// 下载导入模板
export const stackPlaceImportTemplate= (params) => {
  return axios({
    url: '/product/stackPlace/importTemplate',
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}
// 导入产品货位-入库数据
export const stackPlaceInsertImport = (params) => {
  return axios({
    url: '/product/stackPlace/insertImport',
    data: params,
    method: 'post'
  })
}
// 查询产品货位历史变更记录
export const stackPlaceListHistory = (params) => {
  return axios({
    url: '/product/stackPlace/listHistoryByProductSn',
    data: params,
    method: 'post'
  })
}
// 分页查询产品及货位信息
export const queryStackPlaceQueryPage = (params) => {
  const url = `/product/stackPlace/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
// 保存产品货位信息
export const stackPlaceSave = (params) => {
  return axios({
    url: '/product/stackPlace/save',
    data: params,
    method: 'post'
  })
}

// 批量导入产品
export const batchImportProduct = (params) => {
  return axios({
    url: '/product/importProduct',
    data: params,
    method: 'post'
  })
}
// 导出错误项产品
export const exportErrorProduct = (params) => {
  return axios({
    url: '/product/exportErrorProduct',
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}

// 批量保存产品
export const saveBatchImportProduct = (params) => {
  return axios({
    url: '/product/saveBatchImportProduct',
    data: params,
    method: 'post'
  })
}