| | |
| | | <text>{{ duration || '' }}</text> |
| | | </view> |
| | | </view> |
| | | <view class="open-button" @click="awaken"><button type="default">跳转</button></view> |
| | | </view> |
| | | </template> |
| | | |
| | |
| | | { |
| | | 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', |
| | |
| | | { |
| | | 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, |
| | |
| | | } |
| | | ], |
| | | distance: null, |
| | | duration: null |
| | | duration: null, |
| | | fromLocation: {}, |
| | | toLocation: {} |
| | | }; |
| | | }, |
| | | methods: { |
| | |
| | | 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', |
| | |
| | | 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); |
| | |
| | | .toString() |
| | | .padStart(2, '0'); |
| | | return hours + ':' + minutes; |
| | | }, |
| | | // 唤醒 |
| | | awaken() { |
| | | uni.openLocation({ |
| | | latitude: this.markers[1].latitude, |
| | | longitude: this.markers[1].longitude, |
| | | name: '目的地位置', |
| | | address: '目的地位置' |
| | | }); |
| | | } |
| | | }, |
| | | onLoad(params) { |
| | |
| | | } |
| | | }, |
| | | onShow() { |
| | | if (this.orderType !== '转入' || this.orderType !== '转出') { |
| | | this.getLocation(); |
| | | } else { |
| | | } |
| | | this.getLocation(); |
| | | // this.awaken(); |
| | | } |
| | | }; |
| | | </script> |
| | |
| | | } |
| | | } |
| | | } |
| | | .open-button { |
| | | width: 200rpx; |
| | | margin: 10rpx 0; |
| | | } |
| | | </style> |