From a12ac4f4388672c62c6fb59c5ef975e5dff5fc06 Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期二, 16 五月 2023 11:08:45 +0800
Subject: [PATCH] 修改部分问题

---
 pages/public-page/mapRoute/mapRoute.vue |  102 +++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 75 insertions(+), 27 deletions(-)

diff --git a/pages/public-page/mapRoute/mapRoute.vue b/pages/public-page/mapRoute/mapRoute.vue
index f686e1c..24b8544 100644
--- a/pages/public-page/mapRoute/mapRoute.vue
+++ b/pages/public-page/mapRoute/mapRoute.vue
@@ -15,6 +15,7 @@
 				<text>{{ duration || '' }}</text>
 			</view>
 		</view>
+		<!-- <view class="" @click="awaken"><button type="default">璺宠浆</button></view> -->
 	</view>
 </template>
 
@@ -38,13 +39,13 @@
 				{
 					latitude: null,
 					longitude: null,
-					iconPath: '../../../static/image/banner/location.png',
+					iconPath: 'https://mx.jzeg.cn:9095/appimg/image/banner/location.png',
 					width: 23,
 					height: 33,
 					id: 0,
 					callout: {
 						content: '璧风偣', //鏂囨湰
-						color: '#ffffff', //鏂囧瓧棰滆壊
+						color: '#000000', //鏂囧瓧棰滆壊
 						fontSize: 14, //鏂囨湰澶у皬
 						borderRadius: 15, //杈规鍦嗚
 						borderWidth: '10',
@@ -55,7 +56,7 @@
 				{
 					latitude: null,
 					longitude: null,
-					iconPath: '../../../static/image/banner/location.png',
+					iconPath: 'https://mx.jzeg.cn:9095/appimg/image/banner/location.png',
 					width: 23,
 					height: 33,
 					id: 1,
@@ -81,7 +82,9 @@
 				}
 			],
 			distance: null,
-			duration: null
+			duration: null,
+			fromLocation: {},
+			toLocation: {}
 		};
 	},
 	methods: {
@@ -93,39 +96,45 @@
 			let qqmapsdk = new QQMapWX({
 				key: 'HTNBZ-LZGRQ-YDB5S-B4KAS-KLHJH-GHBUE' // 蹇呭~
 			});
-			const params = this.toFiledId ? { toFiledId: this.toFiledId } : { customerId: this.customerId, filedId: this.filedId };
-			this.$reqGet('getAppLocation', params).then(res => {
-				console.log(res, '鑵捐缁忕含搴�');
+			const params = this.toFiledId ? { filedId: this.filedId, toFiledId: this.toFiledId } : { customerId: this.customerId, filedId: this.filedId };
+			this.$reqGet('getAppLocation', params).then(result => {
+				console.log(result, '鑵捐缁忕含搴�');
 				let _this = this;
+				console.log(_this.orderType, '绫诲瀷');
 				let fromLocation;
 				let toLocation;
 				if (_this.orderType == '澶栬喘' || _this.orderType == '澶栭攢') {
-					_this.$set(_this.markers[0], 'longitude', res.data.customerLongitude);
-					_this.$set(_this.markers[0], 'latitude', res.data.customerLatitude);
 					fromLocation = {
-						longitude: res.data.customerLongitude,
-						latitude: res.data.customerLatitude
+						longitude: result.data.customerLongitude,
+						latitude: result.data.customerLatitude
 					};
-					_this.$set(_this.markers[1], 'longitude', res.data.filedLongitude);
-					_this.$set(_this.markers[1], 'latitude', res.data.filedLatitude);
 					toLocation = {
-						longitude: res.data.filedLongitude,
-						latitude: res.data.filedLatitude
+						longitude: result.data.filedLongitude,
+						latitude: result.data.filedLatitude
 					};
 				} else if (_this.orderType == '鍐呰喘' || _this.orderType == '鍐呴攢') {
-					_this.$set(_this.markers[0], 'longitude', res.data.filedLongitude);
-					_this.$set(_this.markers[0], 'latitude', res.data.filedLatitude);
 					fromLocation = {
-						longitude: res.data.filedLongitude,
-						latitude: res.data.filedLatitude
+						longitude: result.data.filedLongitude,
+						latitude: result.data.filedLatitude
 					};
-					_this.$set(_this.markers[1], 'longitude', res.data.customerLongitude);
-					_this.$set(_this.markers[1], 'latitude', res.data.customerLatitude);
 					toLocation = {
-						longitude: res.data.customerLongitude,
-						latitude: res.data.customerLatitude
+						longitude: result.data.customerLongitude,
+						latitude: result.data.customerLatitude
 					};
+				} else {
+					fromLocation = {
+						longitude: result.data.filedLongitude,
+						latitude: result.data.filedLatitude
+					};
+					toLocation = {
+						longitude: result.data.toFiledLongitude,
+						latitude: result.data.toFiledLatitude
+					};
+					_this.fromLocation = fromLocation;
+					_this.toLocation = toLocation;
 				}
+				_this.fromLocation = fromLocation;
+				_this.toLocation = toLocation;
 				//璋冪敤璺濈璁$畻鎺ュ彛
 				qqmapsdk.direction({
 					mode: 'driving',
@@ -158,6 +167,22 @@
 								arrowLine: true
 							}
 						];
+						if (_this.orderType == '澶栬喘' || _this.orderType == '澶栭攢') {
+							_this.$set(_this.markers[0], 'longitude', result.data.customerLongitude);
+							_this.$set(_this.markers[0], 'latitude', result.data.customerLatitude);
+							_this.$set(_this.markers[1], 'longitude', result.data.filedLongitude);
+							_this.$set(_this.markers[1], 'latitude', result.data.filedLatitude);
+						} else if (_this.orderType == '鍐呰喘' || _this.orderType == '鍐呴攢') {
+							_this.$set(_this.markers[0], 'longitude', result.data.filedLongitude);
+							_this.$set(_this.markers[0], 'latitude', result.data.filedLatitude);
+							_this.$set(_this.markers[1], 'longitude', result.data.customerLongitude);
+							_this.$set(_this.markers[1], 'latitude', result.data.customerLatitude);
+						} else {
+							_this.$set(_this.markers[0], 'longitude', result.data.filedLongitude);
+							_this.$set(_this.markers[0], 'latitude', result.data.filedLatitude);
+							_this.$set(_this.markers[1], 'longitude', result.data.toFiledLongitude);
+							_this.$set(_this.markers[1], 'latitude', result.data.toFiledLatitude);
+						}
 					},
 					fail: function(error) {
 						console.error(error);
@@ -185,6 +210,31 @@
 				.toString()
 				.padStart(2, '0');
 			return hours + ':' + minutes;
+		},
+		// 鍞ら啋
+		awaken() {
+			uni.getSystemInfo({
+				success: function(res) {
+					if (res.platform == 'android') {
+						uni.navigateTo({
+							url: `intent://map/routeplan?type=drive&fromcoord=&from=${_this.fromLocation}&tocoord=${_this.toLocation.latitude},${
+								_this.toLocation.longitude
+							}&to=name&policy=0&referer=myapp#Intent;scheme=qqmap;package=com.tencent.map;end`
+						});
+					} else if (res.platform == 'ios') {
+						uni.navigateTo({
+							url: `qqmap://map/routeplan?type=drive&fromcoord=&from=${_this.fromLocation}&tocoord=${_this.toLocation.latitude},${
+								_this.toLocation.longitude
+							}&to=name&policy=0&referer=myapp`
+						});
+					} else {
+						uni.showToast({
+							title: '褰撳墠璁惧涓嶆敮鎸佸湴鍥惧鑸�',
+							icon: 'none'
+						});
+					}
+				}
+			});
 		}
 	},
 	onLoad(params) {
@@ -196,10 +246,8 @@
 		}
 	},
 	onShow() {
-		if (this.orderType !== '杞叆' || this.orderType !== '杞嚭') {
-			this.getLocation();
-		} else {
-		}
+		this.getLocation();
+		// this.awaken();
 	}
 };
 </script>

--
Gitblit v1.9.1