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


//  销售退货明细 删除
export const salesReturnDetailDel = (params) => {
  return axios({
    url: `/salesReturn/detail/delete`,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('明细删除')
    }
  })
}

//  新增销售退货明细
export const salesReturnDetailInsert = (params) => {
  return axios({
    url: '/salesReturn/detail/insert',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('添加')
    }
  })
}

// 修改销售退货明细返库数量
export const updateBackStockQty = (params) => {
  return axios({
    url: '/salesReturn/detail/updateBackStockQty',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('修改返库数量')
    }
  })
}

// 分页查询销售退货明细
export const salesReturnDetailList = (params) => {
  const url = `/salesReturn/detail/queryPage/${params.pageNo}/${params.pageSize}`
  const mid = params.pageSize==999999?'打印':'明细列表查询'
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent(mid)
    }
  })
}

// 修改销售退货明细数量
export const salesReturnDetailUpdateQty = (params) => {
  return axios({
    url: '/salesReturn/detail/updateQty',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('修改退货数量')
    }
  })
}
// 修改销售退货明细退货原因
export const salesReturnDetailUpdateReason = (params) => {
  return axios({
    url: '/salesReturn/detail/updateReason',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent(params.returnReason ? '修改退货原因' : '修改备注')
    }
  })
}
// 批量修改销售退货明细退货原因
export const salesReturnDetailSetReason = (params) => {
  return axios({
    url: '/salesReturn/detail/setReturnReason',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('批量设置退货原因')
    }
  })
}
// 整单修改退货原因
export const salesReturnUpdateAllReason = (params) => {
  return axios({
    url: '/salesReturn/detail/updateAllReason',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('整单设置退货原因')
    }
  })
}
// 生成新的销退单
export const salesReturnAgainCreate = (params) => {
  return axios({
    url: '/salesReturn/againCreate',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('生成新销退单')
    }
  })
}
// 修改销售退货明细实收数量
export const salesReturnDetailUpdateReceiveQty = (params) => {
  return axios({
    url: '/salesReturn/detail/updateReceiveQty',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('修改实收数量')
    }
  })
}
// 批量修改销售退货明细良品数量
export const updateBatchGoodQty = (params) => {
  return axios({
    url: '/salesReturn/detail/updateBatchGoodQty',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('批量修改良品数量')
    }
  })
}
// 批量修改销售退货明细返库数量
export const updateBatchBackStockQty = (params) => {
  return axios({
    url: '/salesReturn/detail/updateBatchBackStockQty',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('批量修改返库数量')
    }
  })
}

// 收货 批量实收
export const salesReturnDetailReceiveBatch = (params) => {
  return axios({
    url: '/salesReturn/detail/receiveBatch',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('批量实收')
    }
  })
}

// 客服确认单行保存
export const updateByCustomerService = (params) => {
  return axios({
    url: '/salesReturn/detail/updateByCustomerService',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('编辑')
    }
  })
}

// 客服设置退货单价
export const setReturnPrice = (params) => {
  return axios({
    url: '/salesReturn/detail/setReturnPrice',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('设置退货单价')
    }
  })
}

// 客服删除销售退货明细
export const deleteByCustomerService = (params) => {
  return axios({
    url: `/salesReturn/detail/deleteByCustomerService`,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('删除')
    }
  })
}

// 收货删除销售退货明细
export const deleteByReceiver = (params) => {
  return axios({
    url: `/salesReturn/detail/deleteByReceiver`,
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('删除')
    }
  })
}

// 新增销售退货明细(收货添加)
export const insertByReceive = (params) => {
  return axios({
    url: '/salesReturn/detail/insertByReceive',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('新增产品(收货添加)')
    }
  })
}

// 新增销售退货明细(客服确认添加)
export const insertByCustomerService = (params) => {
  return axios({
    url: '/salesReturn/detail/insertByCustomerService',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('新增产品(客服确认添加)')
    }
  })
}

// 批量导入-修改价格
export const updateBatchUpdatePrice = (params) => {
  return axios({
    url: '/salesReturn/detail/updateBatchUpdatePrice',
    data: params,
    method: 'post',
    headers:{
        'module': encodeURIComponent('批量导入修改价格')
    }
  })
}

// 批量导入修改价格错误项
export const salesReturnDetailExportErrorUpdatePrice = (params) => {
  return axios({
    url: '/salesReturn/detail/exportErrorUpdatePrice',
    data: params,
    method: 'post',
    responseType: 'blob',
    headers:{
        'module': encodeURIComponent('批量导入修改价格错误项')
    }
  })
}