import request, { postBlob, handleImport, getBlob } from '@/utils/request'

// 销售执行明细列表-零售订单-V2
export function saleOrderListV2(data) {
  return request({
    url: `/sale/order/listV2?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

//销售执行明细列表-政策零售订单-V2-导出
export function saleOrderListV2Export(data, name) {
  return postBlob({
    url: '/sale/order/listV2/export',
    method: 'post',
    data,
    name
  })
}

export function getSaleOrderListV2(data) {
  return request({
    url: `/sale/order/listV2?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function getSaleOrderListV3(data) {
  return request({
    url: `/sale/order/listV3?moduleId=${data.moduleId}`,
    method: 'post',
    data
  })
}

export function exportSaleOrderListV2(data, name) {
  return postBlob({
    url: '/sale/order/listV2/export',
    method: 'post',
    data,
    name
  })
}

// 获取列表
export function getList(params) {
  return request({
    url: '/sale/order/list',
    method: 'get',
    params
  })
}

// 获取详情
export function getDetail(params) {
  return request({
    url: '/sale/order/detail',
    method: 'get',
    params
  })
}

// 获取发货单列表
export function getListOrderNo(params) {
  return request({
    url: '/sale/order/listOrderNo',
    method: 'get',
    params
  })
}

// 审批
export function examineData(params) {
  return request({
    url: '/sale/order/approval',
    method: 'post',
    data: params
  })
}

// 弃审
export function abandonData(params) {
  return request({
    url: '/sale/order/trialApproval',
    method: 'post',
    params
  })
}

// 审批进入判断
export function examineJudge(params) {
  return request({
    url: '/sale/order/approvalJudge',
    method: 'post',
    params
  })
}

// 批量审批
export function examineBatch(params) {
  return request({
    url: '/sale/order/allApproval',
    method: 'post',
    params
  })
}

// 获取仓库列表
export function getWarehouseList(params) {
  return request({
    url: '/stock/manager/listStock',
    method: 'get',
    params
  })
}

// 获取产品列表
export function getSalesGoodsList(params) {
  return request({
    url: '/saleRetreat/order/listSales',
    method: 'get',
    params
  })
}

// 获取经销商列表
export function getDealerList(params) {
  return request({
    url: '/customer/list',
    method: 'get',
    params
  })
}

// 新增退货申请
export function addReturn(params) {
  return request({
    url: '/saleRetreat/order/add',
    method: 'post',
    data: params
  })
}

export function updateNum(params) {
  return request({
    url: '/saleRetreat/order/update',
    method: 'post',
    data: params
  })
}
