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

//  销售详情 删除
export const salesDetailDel = (params) => {
  return axios({
    url: `/salesn/detail/delete`,
    data: params,
    method: 'post'
  })
}
// 销售详情 统计 正常产品
export const salesDetaiCount = (params) => {
  return axios({
    url: `/salesn/detail/queryCount`,
    data: params,
    method: 'post'
  })
}
// 活动产品统计
export const salesPromoDetailCount = (params) => {
  return axios({
    url: `/salesPromo/detail/queryCount`,
    data: params,
    method: 'post'
  })
}
// 批量删除
export const salesDetailBatchDel = (params) => {
  return axios({
    url: `/salesn/detail/delete/batch`,
    data: params,
    method: 'post'
  })
}
// 仓库设置
export const updateWarehouse = (params) => {
    return axios({
      url: '/salesn/detail/updateWarehouse',
      method: 'post',
      data: params
    })
}
// 删除全部已选产品
export const deleteAll = (params) => {
    return axios({
      url: `/salesn/detail/delete/all`,
      method: 'post',
      data: params
    })
  }

// 新增销售明细
export const salesDetailInsert = (params) => {
  return axios({
    url: '/salesn/detail/insert',
    data: params,
    method: 'post'
  })
}
// 批量新增销售明细
export const salesBatchInsert = (params) => {
  return axios({
    url: `/salesn/detail/insertBatch`,
    data: params,
    method: 'post'
  })
}
//  销售 导入产品 导出错误项
export const salesFailExcel = (params) => {
  const url = `/salesn/detail/exportImportError`
  return axios.request({
    url: url,
    method: 'post',
    data: params.list,
    responseType: 'blob'
  })
} 
// 销售详情列表分页
export const salesDetailList = (params) => {
  const url = `/salesn/detail/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}

// 销售详情列表不分页
export const salesDetailAllList = (params) => {
  const url = `/salesn/detail/query`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}

//  修改销售明细数量
export const salesDetailUpdateQty = (params) => {
    return axios({
        url: '/salesn/detail/updateQty',
        data: params,
        method: 'post'
    })
}
// 销售  解析导入的文件
export const salesParseProducts = params => {
    return axios({
      url: '/salesn/detail/importParse',
      data: params,
      method: 'post'
    })
  }
// 禁用活动信息
export const salesDisablePromo = params => {
    return axios({
      url: '/salesn/detail/disablePromo',
      data: params,
      method: 'post'
    })
  }
// 启用活动
export const salesEnablePromoPromo = params => {
  return axios({
    url: '/salesn/detail/enablePromo',
    data: params,
    method: 'post'
  })
}
 // 更换活动
 export const salesChangePromo = params => {
  return axios({
    url: '/salesn/detail/changePromo',
    data: params,
    method: 'post'
  })
}
// 新活动是否参与
export const salesDetailAddPromo = (params) => {
  return axios({
    url: '/salesn/detail/addPromo',
    data: params,
    method: 'post'
  })
}
// 修改销售明细取消数量
export const salesDetailUpdateCancelQty = (params) => {
  return axios({
    url: '/salesn/detail/cancleOfBatch',
    data: params,
    method: 'post'
  })
}
// 整单取消待下推
export const salesDetailCancleOfAll = (params) => {
  return axios({
    url: '/salesn/detail/cancelAll',
    data: params,
    method: 'post'
  })
}
// 批量新增代发货信息
export const insertBatchOfWaitDispatch = (params) => {
    return axios({
      url: '/salesn/detail/pushOfBatch',
      data: params,
      method: 'post'
    })
  }



// 缺货明细
export const salesStockoutDetail = (params) => {
  const url = `/sales/detail/queryPageStock`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
 
// 导出缺货明细
export const exportStockout = params => {
  const url = `/sales/detail/exportStockout`
  delete params.priceType
  return axios.request({
    url: url,
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}
// 导出分组缺货明细
export const exportGroupStockout = params => {
  const url = `/sales/detail/exportGroupStockout`
  delete params.priceType
  return axios.request({
    url: url,
    data: params,
    method: 'post',
    responseType: 'blob'
  })
}

