/**
|
* 初始化小件物流订单详情对话框
|
*/
|
var language =$("#language").val()
|
var TOrderLogisticsInfoDlg = {
|
tOrderLogisticsInfoData : {}
|
};
|
|
/**
|
* 清除数据
|
*/
|
TOrderLogisticsInfoDlg.clearData = function() {
|
this.tOrderLogisticsInfoData = {};
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TOrderLogisticsInfoDlg.set = function(key, val) {
|
this.tOrderLogisticsInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TOrderLogisticsInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
TOrderLogisticsInfoDlg.close = function() {
|
parent.layer.close(window.parent.TOrderLogistics.layerIndex);
|
}
|
|
/**
|
* 收集数据
|
*/
|
TOrderLogisticsInfoDlg.collectData = function() {
|
this
|
.set('id')
|
.set('type')
|
.set('userId')
|
.set('driverId')
|
.set('carId')
|
.set('orderNum')
|
.set('cargoName')
|
.set('cargoNumber')
|
.set('remark')
|
.set('placementLon')
|
.set('placementLat')
|
.set('placementAddress')
|
.set('startLon')
|
.set('startLat')
|
.set('startAddress')
|
.set('endLon')
|
.set('endLat')
|
.set('endAddress')
|
.set('recipient')
|
.set('recipientPhone')
|
.set('boardingLon')
|
.set('boardingLat')
|
.set('boardingAddress')
|
.set('boardingTime')
|
.set('getoffLon')
|
.set('getoffLat')
|
.set('getoffAddress')
|
.set('getoffTime')
|
.set('mileage')
|
.set('payManner')
|
.set('payType')
|
.set('orderMoney')
|
.set('travelMoney')
|
.set('tipMoney')
|
.set('redPacketMoney')
|
.set('couponMoney')
|
.set('redPacketId')
|
.set('couponId')
|
.set('discount')
|
.set('discountMoney')
|
.set('activityId')
|
.set('companyId')
|
.set('payMoney')
|
.set('state')
|
.set('insertTime')
|
.set('travelTime')
|
.set('snatchOrderTime')
|
.set('setOutTime')
|
.set('arriveTime')
|
.set('startServiceTime')
|
.set('endServiceTime')
|
.set('orderSource')
|
.set('invoiceId')
|
.set('trackId')
|
.set('isDelete')
|
.set('telX')
|
.set('bindId');
|
}
|
|
/**
|
* 提交添加
|
*/
|
TOrderLogisticsInfoDlg.addSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tOrderLogistics/add", function(data){
|
Feng.success("添加成功!");
|
window.parent.TOrderLogistics.table.refresh();
|
TOrderLogisticsInfoDlg.close();
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tOrderLogisticsInfoData);
|
ajax.start();
|
}
|
|
/**
|
* 提交修改
|
*/
|
TOrderLogisticsInfoDlg.editSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tOrderLogistics/update", function(data){
|
Feng.success("修改成功!");
|
window.parent.TOrderLogistics.table.refresh();
|
TOrderLogisticsInfoDlg.close();
|
},function(data){
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tOrderLogisticsInfoData);
|
ajax.start();
|
}
|
|
|
|
let map;
|
|
function initMap() {
|
map = new google.maps.Map(document.getElementById("map"), {
|
zoom: 14,
|
center: { lat: 0, lng: -180 },
|
mapTypeId: "terrain",
|
});
|
}
|
|
|
$(function() {
|
window.initMap = initMap();
|
getTrajectory();
|
});
|
|
|
function getTrajectory() {
|
$.ajax({
|
url: Feng.ctxPath + '/tOrderPrivateCar/getOrderTrack',
|
type: 'POST',
|
data:{
|
orderDetailId: $("#id").val(),
|
orderType: 1
|
},
|
success: function (res) {
|
if(res.status == 200){
|
var data = res.data;
|
if(data.length > 0){
|
orderTrack(data);
|
}else{
|
if(language==1){
|
Feng.error("当前订单没有轨迹");
|
}else if(language==2){
|
Feng.error("There is no trajectory for the current order");
|
}else {
|
Feng.error("Tidak ada trajektori untuk perintah saat ini");
|
}
|
}
|
}else{
|
Feng.error(res.msg);
|
}
|
}
|
});
|
}
|
|
|
function orderTrack(data) {
|
//重新设置地图中心点
|
map.setCenter({ lat: parseFloat(data[0].lat), lng: parseFloat(data[0].lon) })
|
const image = {
|
url: "/car.png",
|
size: new google.maps.Size(50, 50),
|
origin: new google.maps.Point(0, 0),
|
anchor: new google.maps.Point(30, 40),
|
};
|
new google.maps.Marker({
|
map,
|
icon: image,
|
position: { lat: parseFloat(data[0].lat), lng: parseFloat(data[0].lon) },
|
title: "origin",
|
});
|
new google.maps.Marker({
|
map,
|
position: { lat: parseFloat(data[data.length - 1].lat), lng: parseFloat(data[data.length - 1].lon) },
|
title: "destination",
|
});
|
|
|
const flightPlanCoordinates = [];
|
for(var i in data){
|
var waypoints = [];
|
var lon = parseFloat(data[i].lon);
|
var lat = parseFloat(data[i].lat);
|
flightPlanCoordinates.push({
|
lat: lat,
|
lng: lon
|
})
|
}
|
const flightPath = new google.maps.Polyline({
|
path: flightPlanCoordinates,
|
geodesic: true,
|
strokeColor: "#FF0000",
|
strokeOpacity: 1.0,
|
strokeWeight: 5,
|
});
|
|
flightPath.setMap(map);
|
}
|