import request from './request';

//  request()  第二个参数若为true则表示不传token

// 生成手机号码
export const getMobileVirtual = (params) => {
  return request({
    url: `customerVehicle/getMobileVirtual`,
    method: 'get',
    data: {}
  })
}
// 车辆和客户列表
export const  getCustomerCarList = params => {
  return request({
    url: `customerVehicle/findPage/${params.pageNo}/${params.pageSize}`,
    method: 'post',
    data: {
      condition: params.condition
    }
  })
}

// 车辆和客户列表明细查询
export const  getCustomerCarListDetail = params => {
  return request({
    url: `customerVehicle/findDetail`,
    method: 'post',
    data: params
  })
}
// 门店车辆--根据车牌查询车辆信息
export const  getCarData = params => {
  return request({
    url: `vehicle/findByNumber?number=${params}`,
    method: 'get',
    data: ''
  })
}

// 门店客户--根据电话查询客户信息
export const  getPhone = params => {
  return request({
    url: `customer/findByMobile?mobile=${params}`,
    method: 'get',
    data: ''
  })
}

// 门店客户车辆--保存客户车辆
export const  saveCustomerCar = (params) => {
  return request({
    url: `customerVehicle/save`,
    method: 'post',
    data: params
  })
}

// 精确查询客户车辆列表
export const  searchCustomerList = (params) => {
  return request({
    url: `customerVehicle/findList`,
    method: 'post',
    data: params
  })
}
//车辆列表
export const  getCarList = params => {
  return request({
    url: `vehicle/query/${params.pageNo}/${params.pageSize}`,
    method: 'post',
    data: {
      "source":params.source?params.source:"",
      "queryWord":params.queryWord,
      "level":params.level,
    },
  })
}

//删除车辆
export const  deletesCar = params => {
  return request({
    url: `vehicle/del/${params.id}`,
    method: 'get',
  })
}
//查询省
export const  getProvince = () => {
  return request({
    url: `area/PROVINCE`,
    method: 'get'
  }, true)
}
//查询市
export const  getCityByPro = params => {
  return request({
    url: `area/CITY/${params.id}`,
    method: 'get'
  }, true)
}
//查询区
export const  getDistrictByCity = params => {
  return request({
    url: `area/DISTRICT/${params.id}`,
    method: 'get'
  }, true)
}
//品牌
export const  findBrand = params => {
  return request({
    url: `vehicleModel/findBrand`,
    method: 'post',
    data: params,
  })
}
//车系
export const  findSeries = brandId => {
  return request({
    url: `vehicleModel/findSeries/${brandId}`,
    method: 'post',
    data: {},
  })
}
//排量
export const  findDisplacement = (brandId,seriesId) => {
  return request({
    url: `vehicleModel/findDisplacement/${brandId}/${seriesId}`,
    method: 'post',
    data: {},
  })
}
//生产年份
export const  findYear = (brandId,seriesId,displacement) => {
  return request({
    url: `vehicleModel/findYear/${brandId}/${seriesId}/${displacement}`,
    method: 'post',
    data: {},
  })
}
//车型
export const  findModel = (brandId,seriesId,displacement,year) => {
  return request({
    url: `vehicleModel/findModel/${brandId}/${seriesId}/${displacement}/${year}`,
    method: 'post',
    data: {},
  })
}
//带出车辆分类和厂商指导价
export const  findVehicleModel = (id) => {
  return request({
    url: `vehicleModel/findDetail/${id}`,
    method: 'post',
    data: {},
  })
}
//新增车辆
export const  addCar = (params,carId) => {
  if(carId != undefined && carId != '') {
    params.id = carId
  }
  return request({
    url: `vehicle/save`,
    method: 'post',
    data: params,
  })
}
//查询车辆详情
export const  getCarDetails = (id) => {
  return request({
    url: `vehicle/${id}`,
    method: 'get',
  })
}

//识别车牌
export const licensePlate = (params) => {
  return request({
    url: `vehicleIdentify/licensePlate`,
    method: 'post',
    data: params,
  })
}
//识别VIN码
export const vinCode = (params) => {
  return request({
    url: `vehicleIdentify/vinCode`,
    method: 'post',
    data: params,
  })
}

//拍照识别的车牌号保存
export const saveIdentityVehicle = (params) => {
  return request({
    url: `index/saveIdentityVehicle`,
    method: 'post',
    data: params
  })
}

// by vin 查询车辆信息
export const  getVehicleInfoByVin = (params) => {
  return request({
    url: `vehicleIdentify/getVehicleInfoByVin?vinCode=${params.vin}`,
    method: 'get',
  })
}

// by mobile 查询客户车辆信息是否存在
export const findCustomerCarIsOnly = (params) => {
  return request({
    url: `customerVehicle/findByMobile?mobile=${params}`,
    method: 'get',
  })
}

// 扫描记录
export const scanVinLog = (params) => {
  return request({
    url: `scanVinLog/create`,
    data: params,
    method: 'post'
  })
}
export const scanVinLogCopy = (params) => {
  return request({
    url: `scanVinLog/logCopy/${params.id}`,
    method: 'get'
  })
}
// 滚动扫描记录
export const scanVinLogQueryRoll = (params) => {
  return request({
    url: `scanVinLog/queryRoll/${params.pageNo}/${params.pageSize}`,
    data: params,
    method: 'post'
  }, true)
}
// vin查询记录分页
export const getScanVinLogList = (params) => {
  return request({
    url: `scanVinLog/queryPage/${params.pageNo}/${params.pageSize}`,
    data: params,
    method: 'post'
  })
}

// 游客vin扫描次数
export const getScanVinQty = (params) => {
  return request({
    url: `scanVinLog/getScanVinQty`,
    method: 'get'
  })
}
// 扫描最大限制数
export const getScanGetMaxQty = (params) => {
  return request({
    url: `scanVinLog/getMaxQty`,
    method: 'get'
  })
}