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

// 车架号
export const supperCodeByVin = (params) => {
  return axios({
    url: `/vinIdentify/queryPartCodeByVin/${params.vin}`,
    method: 'get',
    headers: {
      'module': encodeURIComponent('按车架号查询列表')
    }
  })
}
// 车架号  识别图片内容
export const vinCodeParse = params => {
  return axios.request({
    url: `/vinIdentify/ocr`,
    method: 'post',
    data: params,
    responseType: 'blob',
    headers: {
      'module': encodeURIComponent('车架号图片识别')
    }
  })
}

//  销售 打印
export const salesPrint = (params) => {
  return axios({
    url: '/sales/print',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('销售打印')
    }
  })
}

//  销售 打印预览
export const salesPrintPreview = (params) => {
  return axios({
    url: '/sales/printPreview',
    data: params,
    method: 'post',
    headers: {
      'module': encodeURIComponent('销售打印预览')
    }
  })
}

// 获取促销活动
export const getPromoacActiveList = (params) => {
  return axios({
    url: `/sales/getPromoacActiveList/${params.salesBillSn}`,
    data: params,
    method: 'get'
  })
}
//  促销订单统计 列表  有分页
export const salesPromoList = (params) => {
  const url = `/sales/queryPageByPromo/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}
//  促销订单统计 合计
export const salesPromoCount = (params) => {
  return axios({
    url: '/sales/queryCountByPromo',
    data: params,
    method: 'post'
  })
}

// 销售 详情  打印
export const salesDetailPrint = params => {
  const url = `/sales/print/${params.priceType}`
  const id = params.priceType.indexOf('_TYPE') >= 0 ? '销售分类打印' : '销售打印'
  delete params.priceType
  return axios.request({
    url: url,
    data: params,
    method: 'post',
    responseType: 'blob',
    headers: {
      'module': encodeURIComponent(id)
    }
  })
}
// 销售 详情  导出
export const salesDetailExcel = params => {
  const url = `/sales/excel/${params.priceType}`
  delete params.priceType
  return axios.request({
    url: url,
    data: params,
    method: 'post',
    responseType: 'blob',
    headers: {
      'module': encodeURIComponent('导出')
    }
  })
}
// 销售 详情  分类导出
export const salesDetailTypeExcel = params => {
  const url = `/sales/detail/typeExcel`
  return axios.request({
    url: url,
    data: params,
    method: 'post',
    responseType: 'blob',
    headers: {
      'module': encodeURIComponent('分类导出')
    }
  })
}

// 销售  详情  选择发货经销商  弹窗列表
export const querySuperiorDealer = (params) => {
  return axios({
    url: '/sales/tire/querySuperiorDealer',
    data: params,
    method: 'post'
  })
}

// 销售  详情  选择发货经销商  确定
export const queryTransferDealerStock = (params) => {
  return axios({
    url: '/sales/tire/detail/queryTransferDealerStock',
    data: params,
    method: 'post'
  })
}

// 转单校验
export const transferVerify = (params) => {
  return axios({
    url: '/sales/tire/transferVerify',
    data: params,
    method: 'post'
  })
}

// 转单
export const transfer = (params) => {
  return axios({
    url: '/sales/tire/transfer',
    data: params,
    method: 'post'
  })
}
// 转单审核
export const transferAudit = (params) => {
  return axios({
    url: '/sales/tire/audit',
    data: params,
    method: 'post'
  })
}
