import axios from '@/libs/axios.js'

// 数据统计信息
export const bizData = (params) => {
  return axios.request({
    url: `home/queryBizData`,
    data: params,
    method: 'post'
  })
}

// 销售单列表
export const salesList = (params) => {
  const url = `sales/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios.request({
    url: url,
    data: params,
    method: 'post'
  })
}
//  销售 审核
export const salesWriteAudit = (params) => {
  return axios.request({
    url: 'sales/audit',
    data: params,
    method: 'post'
  })
}
//  销售 出库
export const salesWriteStockOut = (params) => {
  return axios.request({
    url: `sales/stockOut/${params.salesBillSn}`,
    method: 'get'
  })
}
//  销售 提交
export const salesSubmit = (params) => {
  return axios.request({
    url: 'sales/submit',
    data: params,
    method: 'post'
  })
}
//  销售 折扣
export const salesDiscount = (params) => {
  return axios.request({
    url: 'sales/discount',
    data: params,
    method: 'post'
  })
}
//  销售 详情
export const salesDetail = (params) => {
  return axios.request({
    url: `sales/findById/${params.id}`,
    data: params,
    method: 'get'
  })
}
//  销售 详情bysn
export const salesDetailBySn = (params) => {
  return axios.request({
    url: `sales/findBySn`,
    data: params,
    method: 'post'
  })
}
//  销售 删除
export const salesDel = (params) => {
  return axios.request({
    url: `sales/delete/${params.id}`,
    data: params,
    method: 'post'
  })
}
// 车架号
export const supperCodeByVin = (params) => {
  return axios.request({
    url: `vinIdentify/queryPartCodeByVin/${params.vin}`,
    method: 'get'
  })
}
//  销售详情 列表  分页
export const salesDetailList = (params) => {
  const url = `salesDetail/queryPage/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios.request({
    url: url,
    data: params,
    method: 'post'
  })
}
//  销售详情 删除
export const salesDetailDel = (params) => {
  return axios.request({
    url: `salesDetail/delete/${params.id}`,
    method: 'get'
  })
}
//  销售详情 新增配件
export const salesDetailInsert = (params) => {
  return axios.request({
    url: 'salesDetail/insert',
    data: params,
    method: 'post'
  })
}
//  销售详情 编辑已选产品信息
export const salesDetailUpdate = (params) => {
  return axios.request({
    url: 'salesDetail/update',
    data: params,
    method: 'post'
  })
}
// 销售单新增
export const salesSave = (params) => {
  const url = 'sales/save'
  return axios.request({
    url: url,
    data: params,
    method: 'post'
  })
}
//  仓库列表  无分页
export const warehouseAllList = (params) => {
  const url = 'warehouse/queryList'
  return axios.request({
    url: url,
    data: params,
    method: 'post'
  })
}
// 车架号  识别图片内容
export const vinCodeParse = params => {
  return axios.request({
    url: `vinIdentify/ocr`,
    method: 'post',
    data: params,
    responseType: 'blob'
  })
}

// 产品报价列表
export const dealerProductList = (params) => {
  const url = `dealerProduct/queryPageForSalesOffer/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios.request({
    url: url,
    data: params,
    method: 'post'
  })
}
//  结算方式列表
export const settleStyleQueryAll = (params) => {
  return axios.request({
    url: 'settleStyle/findAll',
    data: params,
    method: 'post'
  })
}

// 销售记录
export const salesRecordlList = (params) => {
  const url = `salesDetail/querySalesRecord/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios.request({
    url: url,
    data: params,
    method: 'post'
  })
}

// 销售统计
export const salesStatistics = (params) => {
  return axios.request({
    url: 'sales/appStatistics',
    data: params,
    method: 'post'
  })
}