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

//  提货单列表  分页
export const pickUpQueryPage = (params) => {
  const url = `/pickUp/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('列表查询')
    }
  })
}
//  仓库提货列表  分页
export const warehouseQueryPage = (params) => {
  const url = `/pickUp/warehouseQueryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('列表查询')
    }
  })
}
// 提货
export const pickUpFinish = (params) => {
  return axios({
    url: `/pickUp/finish/${params.pickUpSn}`,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('提货')
    }
  })
}
// 保存提货单
export const pickUpSave = (params) => {
  return axios({
    url: `/pickUp/save`,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('保存')
    }
  })
}
// 提交提货单
export const pickUpSubmit = (params) => {
  return axios({
    url: `/pickUp/submit`,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('提交')
    }
  })
}

// 删除提货单
export const pickUpDelete = (params) => {
  return axios({
    url: `/pickUp/deleteBySn/${params.pickUpSn}`,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('删除')
    }
  })
}
// 再次编辑
export const pickUpAgainEdit = (params) => {
  return axios({
    url: `/pickUp/againEdit/${params.pickUpSn}`,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('再次编辑')
    }
  })
}

// 提货单详情
export const pickUpDetail = (params) => {
  return axios({
    url: `/pickUp/queryBySn/${params.pickUpSn}`,
    method: 'get',
    headers:{
        'module': encodeURIComponent('提货单详情')
    }
  })
}

// 物流公司
export const pickUpLogisticsList = (params) => {
  return axios({
    url: `/pickUp/queryLogisticsList`,
    method: 'get'
  })
}
// 提货-物流点
export const pickUpPointList = (params) => {
  return axios({
    url: `/pickUp/queryLogisticsPointList`,
    method: 'get'
  })
}
// 销退单-列表
export const pickUpDetailQueryList = (params) => {
  return axios({
    url: `/pickUp/queryPickUpSalesReturnList/${params.pickUpSn}`,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('关联销退单列表查询')
    }
  })
}

// 导出
export const pickUpExport = (params) => {
  return axios({
    url: '/pickUp/excel',
    data: params,
    method: 'post',
    responseType: 'blob',
    headers:{
        'module': encodeURIComponent('导出')
    }
  })
}
// 打印
export const pickUpDetailPrint = params => {
  const url = `/pickUp/print`
  return axios({
    url: url,
    data: params,
    method: 'post',
    responseType: 'blob',
    headers:{
        'module': encodeURIComponent('打印')
    }
  })
}

// 提货单默认上次审核通过的审批人
export const getFinishDingUser = (params) => {
  return axios({
    url: '/pickUp/queryLastFinishDingUser',
    data: params,
    method: 'post'
  })
}
