lilei 3 vuotta sitten
vanhempi
commit
d24dddf514
4 muutettua tiedostoa jossa 281 lisäystä ja 22 poistoa
  1. 215 0
      api/car.js
  2. 16 3
      pages/morePage/morePage.vue
  3. 22 10
      pages/scan-frame/scan-frame.vue
  4. 28 9
      pages/vinInput/confirmVin.vue

+ 215 - 0
api/car.js

@@ -0,0 +1,215 @@
+import axios from '@/libs/axios.js'
+
+//  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',
+  })
+}

+ 16 - 3
pages/morePage/morePage.vue

@@ -48,17 +48,30 @@
 </template>
 </template>
 
 
 <script>
 <script>
+	import {
+	    mapState,
+	    mapMutations
+	} from 'vuex'
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
 				
 				
 			}
 			}
 		},
 		},
+		computed: {
+			...mapState(['hasLogin'])
+		},
 		methods: {
 		methods: {
 			toPage(path){
 			toPage(path){
-				uni.navigateTo({
-					url: path
-				})
+				if(this.hasLogin){
+					uni.navigateTo({
+						url: path
+					})
+				}else{
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
+				}
 			}
 			}
 		}
 		}
 	}
 	}

+ 22 - 10
pages/scan-frame/scan-frame.vue

@@ -24,7 +24,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
- 
+import { vinCode } from '@/api/car.js'
 export default {
 export default {
   data() {
   data() {
     return {
     return {
@@ -125,18 +125,11 @@ export default {
 			const base64Str = 'data:image/' + this.imageInfo.type + ';base64,' + base.data
 			const base64Str = 'data:image/' + this.imageInfo.type + ';base64,' + base.data
 			// 拿到base64,不需要base64  就把上层的转换去掉
 			// 拿到base64,不需要base64  就把上层的转换去掉
 			this.scanShow = true
 			this.scanShow = true
-			uni.hideLoading()
-			uni.showToast({
-				title: '已识别到图片,看console',
-				duration: 2000
-			});
 			// 此处为后端接口 传base64图片 进行ocr识别
 			// 此处为后端接口 传base64图片 进行ocr识别
-			// http.request()
-			uni.redirectTo({
-				url: "/pages/vinInput/confirmVin?verifyCode=123456ads11234567&filePath="+base64Str
-			})
+			this.parseVinNo(base64Str)
 		  },
 		  },
 		  fail: (err) => {
 		  fail: (err) => {
+			uni.hideLoading()
 			console.log(err)
 			console.log(err)
 		  }
 		  }
 		})
 		})
@@ -152,6 +145,25 @@ export default {
         }
         }
       })
       })
     },
     },
+	// 识别vin
+	parseVinNo(data) {
+		const _this = this
+		vinCode({
+			imageByte: data
+		}).then(res => {
+			console.log(res, '识别VIN')
+			uni.hideLoading()
+			uni.redirectTo({
+				url: "/pages/vinInput/confirmVin?verifyCode=123456ads11234567&filePath="+base64Str + "&verifyCode="+res.data
+			})
+		}).catch(err => {
+			uni.hideLoading()
+			uni.showToast({
+				icon: 'none',
+				title: '系统错误或超时,请重试'
+			})
+		})
+	},
     error(e) {
     error(e) {
       console.log(e.detail)
       console.log(e.detail)
     }
     }

+ 28 - 9
pages/vinInput/confirmVin.vue

@@ -34,6 +34,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
+	import { getVehicleInfoByVin } from '@/api/car.js'
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
@@ -78,17 +79,35 @@
 				console.log(code)
 				console.log(code)
 				this.verifyCode = code
 				this.verifyCode = code
 			},
 			},
-			ok(){
-				if(this.verifyCode==''){
-					uni.showToast({
-						title: "请输入VIN码",
-						icon:"none"
+			// 提交并匹配车型
+			submitForm(){
+				const _this = this
+				const vinNo = this.verifyCode.toUpperCase()
+				console.log(vinNo, 'vinvinvinvinvin')
+				if(vinNo.length>=17){
+					getVehicleInfoByVin({
+						vin:vinNo
+					}).then(res => {
+						console.log(res, 'vinvinvinvinvin')
+						if (res.status == 200&&res.data) {
+							// 打开选择配件页面
+							uni.redirectTo({
+								url: "/pages/digitalShelf/choosePart?vinNumber="+vinNo+"&carList="+encodeURIComponent(JSON.stringify(res.data))
+							})
+						} else {
+							uni.showModal({
+								title: '匹配错误',
+								content: '此VIN码没有匹配的车型,请检查VIN码是否正确',
+								showCancel: false,
+								confirmText: '知道了'
+							})
+						}
 					})
 					})
 				}else{
 				}else{
-					// 到选择配件页面
-					// uni.navigateTo({
-					// 	url: "/pages/vinInput/confirmVin"
-					// })
+					uni.showToast({
+						icon: 'none',
+						title: '请输入正确的VIN码'
+					})
 				}
 				}
 			}
 			}
 		}
 		}