From 05273ace3da665cb10c36ca0dac4413a8284302a Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期三, 17 五月 2023 18:10:36 +0800
Subject: [PATCH] 增加部分限制,增加新功能
---
pages/public-page/mapRoute/mapRoute.vue | 127 ++++++++++++++++++++++++++++++------------
1 files changed, 90 insertions(+), 37 deletions(-)
diff --git a/pages/public-page/mapRoute/mapRoute.vue b/pages/public-page/mapRoute/mapRoute.vue
index f686e1c..5671a6b 100644
--- a/pages/public-page/mapRoute/mapRoute.vue
+++ b/pages/public-page/mapRoute/mapRoute.vue
@@ -2,7 +2,16 @@
<view>
<view class="page-body" style="margin-top: 4rpx;">
<view class="page-section page-section-gap">
- <map style="width: 100%; height: 600px;" :latitude="latitude" :longitude="longitude" :markers="markers" :polyline="polyline"></map>
+ <map
+ style="width: 100%; height: 600px;"
+ :latitude="latitude"
+ :longitude="longitude"
+ :markers="markers"
+ :polyline="polyline"
+ @markertap="awaken"
+ @callouttap="awaken"
+ @tap="awaken"
+ ></map>
</view>
</view>
<view class="tip">
@@ -15,6 +24,7 @@
<text>{{ duration || '' }}</text>
</view>
</view>
+ <view class="open-button" @click="awaken"><u-button type="primary">浣跨敤鎵嬫満鍦板浘</u-button></view>
</view>
</template>
@@ -38,34 +48,34 @@
{
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', //鏂囧瓧棰滆壊
- fontSize: 14, //鏂囨湰澶у皬
- borderRadius: 15, //杈规鍦嗚
+ fontSize: 10, //鏂囨湰澶у皬
+ borderRadius: 12, //杈规鍦嗚
borderWidth: '10',
- bgColor: '#e51860', //鑳屾櫙棰滆壊
+ bgColor: '#08b078', //鑳屾櫙棰滆壊
display: 'ALWAYS' //甯告樉
}
},
{
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,
callout: {
content: '缁堢偣', //鏂囨湰
color: '#ffffff', //鏂囧瓧棰滆壊
- fontSize: 14, //鏂囨湰澶у皬
- borderRadius: 15, //杈规鍦嗚
+ fontSize: 10, //鏂囨湰澶у皬
+ borderRadius: 12, //杈规鍦嗚
borderWidth: '10',
- bgColor: '#e51860', //鑳屾櫙棰滆壊
+ bgColor: '#fc645c', //鑳屾櫙棰滆壊
display: 'ALWAYS' //甯告樉
}
}
@@ -81,7 +91,9 @@
}
],
distance: null,
- duration: null
+ duration: null,
+ fromLocation: {},
+ toLocation: {}
};
},
methods: {
@@ -93,39 +105,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',
@@ -153,11 +171,27 @@
_this.polyline = [
{
points: pl,
- color: '#FF0000DD',
+ color: '#04b474',
width: 4,
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 +219,15 @@
.toString()
.padStart(2, '0');
return hours + ':' + minutes;
+ },
+ // 鍞ら啋
+ awaken() {
+ uni.openLocation({
+ latitude: this.markers[1].latitude,
+ longitude: this.markers[1].longitude,
+ name: '鐩殑鍦颁綅缃�',
+ address: '鐩殑鍦颁綅缃�'
+ });
}
},
onLoad(params) {
@@ -196,28 +239,38 @@
}
},
onShow() {
- if (this.orderType !== '杞叆' || this.orderType !== '杞嚭') {
- this.getLocation();
- } else {
- }
+ this.getLocation();
+ // this.awaken();
}
};
</script>
<style lang="scss" scoped>
.tip {
- margin-top: 60rpx;
width: 94%;
- height: 40rpx;
font-size: 40rpx;
+ margin: vww(22) auto;
display: flex;
justify-content: space-around;
.first {
- color: #c78a64;
+ color: #515151;
text {
font-size: 45rpx;
color: #f81414;
}
}
}
+.open-button {
+ width: 100%;
+ margin: 40rpx 0;
+ display: flex;
+ justify-content: center;
+ /deep/.u-button {
+ width: 300rpx;
+ border: 1px solid #3b56eb;
+ border-radius: 37rpx 37rpx 37rpx 37rpx;
+ background-color: transparent;
+ color: #3b56eb;
+ }
+}
</style>
--
Gitblit v1.9.1