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

//  散件退货  列表  分页
export const sparePartsRetList = (params) => {
  const url = `/sparePartsRet/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  散件退货  列表  保存
export const sparePartsRetSave = (params) => {
  return axios({
    url: '/sparePartsRet/save',
    data: params,
    method: 'post'
  })
}
//  散件退货  详情  列表  分页
export const sparePartsRetDetailList = (params) => {
  const url = `/sparePartsRet/detail/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  散件退货  详情  保存
export const sparePartsRetDetailSave = (params) => {
  return axios({
    url: '/sparePartsRet/detail/save',
    data: params,
    method: 'post'
  })
}
//  散件退货  详情  合计
export const sparePartsRetDetailCount = (params) => {
  return axios({
    url: '/sparePartsRet/detail/queryPageCount',
    data: params,
    method: 'post'
  })
}
//  散件退货  详情  产品（不抓单）  列表  分页
export const stockDetailProductList = (params) => {
  const url = `/stock/detail/findStockDetailPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  散件退货  详情  删除
export const sparePartsRetDetailDel = (params) => {
  const url = `/sparePartsRet/detail/delete/${params.id}`
  delete params.id
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  散件退货  删除
export const sparePartsRetDel = (params) => {
  return axios({
    url: `/sparePartsRet/delete/${params.id}`,
    method: 'get'
  })
}
//  散件退货  出库
export const sparePartsRetOutStock = (params) => {
  const url = `/sparePartsRet/outStock/${params.id}`
  delete params.id
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  散件退货  审核
export const sparePartsRetAudit = (params) => {
  return axios({
    url: '/sparePartsRet/audit',
    data: params,
    method: 'post'
  })
}
//  散件退货  详情  提交
export const sparePartsRetSubmit = (params) => {
  return axios({
    url: '/sparePartsRet/submit',
    data: params,
    method: 'post'
  })
}
//  散件退货  详情
export const sparePartsRetDetail = (params) => {
  return axios({
    url: `/sparePartsRet/queryBySn/${params.sn}`,
    method: 'get'
  })
}
// 散件退货详情  打印
export const sparePartsRetDetailPrint = params => {
  const data = {
    url: `/sparePartsRet/print/${params.sn}/${params.type}`,
    method: 'get'
  }
  // 喷墨打印
  if (params.type == 'INK') {
    data.responseType = 'blob'
  }
  return axios.request(data)
}
// 散件退货详情  导出
export const sparePartsRetDetailExport = params => {
  return axios.request({
    url: `/sparePartsRet/excel/${params.sn}`,
    method: 'get',
    responseType: 'blob'
  })
}