Browse Source

错误的定位,未调整

caojunjie 4 years ago
parent
commit
bb1bedb33c
2 changed files with 26 additions and 37 deletions
  1. 14 14
      pages/home/scancode/index.vue
  2. 12 23
      pages/home/scancode/scancodeout.vue

+ 14 - 14
pages/home/scancode/index.vue

@@ -102,7 +102,8 @@
 				position: '',
 				point: '',
 				coord: '',
-				address: ''
+				address: '',
+				addd:''
 			}
 		},
 		onBackPress(options) {
@@ -161,11 +162,8 @@
 					geocode: true,
 					success: function(res) {
 						console.log(res)
-						that.point = new plus.maps.Point(res.longitude, res.latitude);
-						plus.maps.Map.convertCoordinates(that.point, {}, event => {
-							that.coord = event.coord; // 转换后的坐标值
-							that.tishi(that.coord, res)
-						})
+						this.addd = res
+						that.tishi(that.coord, res)
 					},
 					fail: function(e) {
 						uni.showToast({
@@ -187,14 +185,16 @@
 					success(res) {
 						var newCity = ''
 						// 取到用户的定位地址,赋值传递出去
-						let aress = res.result.address_component.nation + res.result.address_component.province + res.result.address_component
-							.city + res.result.formatted_addresses.recommend
-						this_.addreev(aress)
+						let aress = res.result.address_component.nation + res.result.address_component.province + res.result.address_component.city + res.result.formatted_addresses.recommend
+							console.log(res)
+						this_.addreev(res,aress)
 					}
 				})
 			},
-			async addreev(x) {
+			async addreev(res,x) {
 				this.address = x
+				this.addd = res.result.location
+				console.log(this.addd)
 			},
 			//手动录入调用
 			manualentry() {
@@ -210,8 +210,8 @@
 								tyreNum: this.number_a,
 								scanType: 1,
 								scanWay: 0,
-								longitude: this.coord.longitude,
-								latitude: this.coord.latitude,
+								longitude: this.addd.lng,
+								latitude: this.addd.lat,
 								scanAddress: this.address
 							}
 						}).then(res => {
@@ -392,8 +392,8 @@
 							tyreNum: this.number_s,
 							scanType: 1,
 							scanWay: 1,
-							longitude: this.coord.longitude,
-							latitude: this.coord.latitude,
+							longitude: this.addd.lng,
+							latitude: this.addd.lat,
 							scanAddress: this.address
 						}
 					}).then(res => {

+ 12 - 23
pages/home/scancode/scancodeout.vue

@@ -102,7 +102,8 @@
 				position: '',
 				point: '',
 				coord: '',
-				address: ''
+				address: '',
+				addd:''
 			}
 		},
 		onBackPress(options) {
@@ -161,11 +162,8 @@
 					geocode: true,
 					success: function(res) {
 						console.log(res)
-						that.point = new plus.maps.Point(res.longitude, res.latitude);
-						plus.maps.Map.convertCoordinates(that.point, {}, event => {
-							that.coord = event.coord; // 转换后的坐标值
-							that.tishi(that.coord, res)
-						})
+						this.addd = res
+						that.tishi(that.coord, res)
 					},
 					fail: function(e) {
 						uni.showToast({
@@ -189,28 +187,19 @@
 						// 取到用户的定位地址,赋值传递出去
 						let aress = res.result.address_component.nation + res.result.address_component.province + res.result.address_component
 							.city + res.result.formatted_addresses.recommend
-						this_.addreev(aress)
+						this_.addreev(res,aress)
 					}
 				})
 			},
-			async addreev(x) {
+			async addreev(res,x) {
 				this.address = x
+				this.addd = res.result.location
+				console.log(this.addd)
 			},
 			//手动录入调用
 			manualentry() {
 				console.log(this.coord)
 				console.log(this.address)
-				let data = {
-								storeId: this.$store.state.storeInfo.storeId,
-								userId: this.$store.state.storeInfo.userId,
-								tyreNum: this.number_a,
-								scanType: 2,
-								scanWay: 0,
-								longitude: this.coord.longitude,
-								latitude: this.coord.latitude,
-								scanAddress: this.address
-							}
-							console.log(data)
 				if (this.number_a.length != 0) {
 					request({
 							url: '/storeScan/storeScanGetTyre',
@@ -221,8 +210,8 @@
 								tyreNum: this.number_a,
 								scanType: 2,
 								scanWay: 0,
-								longitude: this.coord.longitude,
-								latitude: this.coord.latitude,
+								longitude: this.addd.lng,
+								latitude: this.addd.lat,
 								scanAddress: this.address
 							}
 						}).then(res => {
@@ -403,8 +392,8 @@
 							tyreNum: this.number_s,
 							scanType: 2,
 							scanWay: 1,
-							longitude: this.coord.longitude,
-							latitude: this.coord.latitude,
+							longitude: this.addd.lng,
+							latitude: this.addd.lat,
 							scanAddress: this.address
 						}
 					}).then(res => {