Commit eafffacb authored by xxx's avatar xxx

修改订单里程算法

parent 095d0478
...@@ -140,44 +140,21 @@ export default { ...@@ -140,44 +140,21 @@ export default {
} }
} }
//获取车辆坐标计算距离并返回给后台 //获取车辆坐标计算距离并返回给后台
// httpGet(carRealTimeLocationQuery2,{name:resSon1.data.content[0].equipmentName}).then((res2) => { httpGet(carRealTimeLocationQuery2,{name:resSon1.data.content[0].equipmentName}).then((res2) => {
// if(res2.data){ if(res2.data){
// if(this.oldxy.lat == 0 || this.oldxy.lng == 0){ if(this.oldxy.lat == 0 || this.oldxy.lng == 0){
// this.oldxy.lat = res2.data.location.y; this.oldxy.lat = res2.data.location.y;
// this.oldxy.lng = res2.data.location.x; this.oldxy.lng = res2.data.location.x;
// }else{ }else{
// let distance1 = this.getDistance(this.oldxy.lat,this.oldxy.lng,res2.data.location.y,res2.data.location.x) + parseFloat(res_1.data.content[0].mil); let distance1 = this.getDistance(this.oldxy.lat,this.oldxy.lng,res2.data.location.y,res2.data.location.x) + parseFloat(res_1.data.content[0].mil);
// putForJson(dingDanBiaoCaoZuo,{id:res_1.data.content[0].id,mil:distance1}).then((res) => {}); putForJson(dingDanBiaoCaoZuo,{id:res_1.data.content[0].id,mil:distance1}).then((res) => {});
// this.$nextTick(()=>{ this.$nextTick(()=>{
// this.oldxy.lat = res2.data.location.y; this.oldxy.lat = res2.data.location.y;
// this.oldxy.lng = res2.data.location.x; this.oldxy.lng = res2.data.location.x;
// }) })
// }
// }
// });
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
function(position) {
if(that.oldxy.lat == 0 || that.oldxy.lng == 0){
that.oldxy.lat = position.coords.latitude;
that.oldxy.lng = position.coords.longitude;
}else{
let distance1 = that.getDistance(that.oldxy.lat,that.oldxy.lng,position.coords.latitude,position.coords.longitude) + parseFloat(res_1.data.content[0].mil);
putForJson(dingDanBiaoCaoZuo,{id:res_1.data.content[0].id,mil:distance1}).then((res) => {});
that.$nextTick(()=>{
that.oldxy.lat = position.coords.latitude;
that.oldxy.lng = position.coords.longitude;
})
}
},
function(error) {
var errorType = ['您拒绝共享位置信息', '获取不到位置信息', '获取位置信息超时'];
console.log(errorType[error.code - 1]);
},{
enableHighAccuracy: false,
} }
); }
} });
} }
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment