yanghb
2023-04-21 0481353111afb43a2322e18530dde26f1d841ead
ManagementTravel/guns-admin/src/main/webapp/WEB-INF/view/system/tOrderPrivateCar/tOrderPrivateCar_add.html
@@ -2,479 +2,88 @@
<div class="ibox float-e-margins">
    <div class="ibox-content">
        <div class="form-horizontal">
            <input type="hidden" id="html" value="2">
            <input type="hidden" id="type" value="2">
            <div class="row">
                <div class="form-group">
                    <label class="control-label col-sm-2">起点:</label>
                    <div class="col-sm-3">
                        <input class="form-control" id="startAddress" autocomplete="off" onclick="TOrderPrivateCarInfoDlg.startAddress()">
                        <input type="hidden" id="startLon">
                        <input type="hidden" id="startLat">
                    </div>
                </div>
                <div class="form-group" id="startAddressModel" hidden>
                    <label class="control-label col-sm-2"></label>
                    <div class="col-sm-6" style="margin-left: 15px;height: 500px" id="startAddressBody">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2">终点:</label>
                    <div class="col-sm-3">
                        <input class="form-control" id="endAddress" autocomplete="off" onclick="TOrderPrivateCarInfoDlg.endAddress()">
                        <input type="hidden" id="endLon">
                        <input type="hidden" id="endLat">
                    </div>
                </div>
                <div class="form-group" id="endAddressModel" hidden>
                    <label class="control-label col-sm-2"></label>
                    <div class="col-sm-6" style="margin-left: 15px;height: 500px" id="endAddressBody">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2">用车时间:</label>
                    <div class="col-sm-3">
                        <input class="form-control"  autocomplete="off" id="travelTime">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2">乘车人姓名:</label>
                    <div class="col-sm-3">
                        <input class="form-control" id="passengers">
                    </div>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2">乘车人手机号:</label>
                    <div class="col-sm-3">
                        <input class="form-control" id="passengersPhone">
                    </div>
                <div class="col-sm-6 b-r">
                            <#input id="id" name="主键id" underline="true"/>
                            <#input id="type" name="类型(1=普通订单,2=摆渡订单)" underline="true"/>
                            <#input id="userId" name="用户id" underline="true"/>
                            <#input id="driverId" name="接单司机ID" underline="true"/>
                            <#input id="carId" name="车辆id" underline="true"/>
                            <#input id="orderNum" name="订单号" underline="true"/>
                            <#input id="placementLon" name="下单地点经度" underline="true"/>
                            <#input id="placementLat" name="下单地点纬度" underline="true"/>
                            <#input id="placementAddress" name="下单地点" underline="true"/>
                            <#input id="startLon" name="出发地经度值" underline="true"/>
                            <#input id="startLat" name="出发地纬度值" underline="true"/>
                            <#input id="endLon" name="目的地经度" underline="true"/>
                            <#input id="startAddress" name="出发地地点" underline="true"/>
                            <#input id="endLat" name="目的地纬度" underline="true"/>
                            <#input id="endAddress" name="目的地地点" underline="true"/>
                            <#input id="boardingLon" name="上车点经度" underline="true"/>
                            <#input id="boardingLat" name="上车点纬度" underline="true"/>
                            <#input id="boardingAddress" name="上车点" underline="true"/>
                            <#input id="boardingTime" name="上车时间" underline="true"/>
                            <#input id="getoffLon" name="下车点经度" underline="true"/>
                            <#input id="getoffLat" name="下车点纬度" underline="true"/>
                            <#input id="getoffAddress" name="下车地点" underline="true"/>
                            <#input id="getoffTime" name="下车时间" underline="true"/>
                            <#input id="mileage" name="行驶里程数(米)" underline="true"/>
                            <#input id="payManner" name="支付方式(1=OK平台支付,2=其他方式支付)" underline="true"/>
                            <#input id="payType" name="支付方式(1=微信,2=支付宝,3=其他)" underline="true"/>
                            <#input id="orderMoney" name="订单金额" underline="true"/>
                            <#input id="startMoney" name="起步价" underline="true"/>
                            <#input id="mileageMoney" name="里程费" underline="true"/>
                            <#input id="durationMoney" name="时长费" underline="true"/>
                            <#input id="longDistanceMoney" name="远途费" underline="true"/>
                            <#input id="parkMoney" name="停车费"/>
                </div>
                <div class="form-group">
                    <label class="control-label col-sm-2">车型:</label>
                    <div class="col-sm-3">
                        <select class="form-control " id="serverCarModelId">
                            @for(carModel in carModelList){
                            <option value="${carModel.id}">${carModel.name}</option>
                            @}
                        </select>
                    </div>
                <div class="col-sm-6">
                            <#input id="roadTollMoney" name="过路费" underline="true"/>
                            <#input id="redPacketMoney" name="红包抵扣金额" underline="true"/>
                            <#input id="couponMoney" name="优惠券抵扣金额" underline="true"/>
                            <#input id="redPacketId" name="红包记录id" underline="true"/>
                            <#input id="couponId" name="优惠券id" underline="true"/>
                            <#input id="discount" name="折扣" underline="true"/>
                            <#input id="discountMoney" name="折扣优惠金额" underline="true"/>
                            <#input id="activityId" name="折扣活动id" underline="true"/>
                            <#input id="companyId" name="公司id" underline="true"/>
                            <#input id="payMoney" name="支付金额" underline="true"/>
                            <#input id="substitute" name="是否是代下单(0:否,1:是)" underline="true"/>
                            <#input id="passengers" name="乘车人" underline="true"/>
                            <#input id="passengersPhone" name="乘车人电话" underline="true"/>
                            <#input id="state" name="状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中,12=取消待支付)" underline="true"/>
                            <#input id="insertTime" name="下单时间" underline="true"/>
                            <#input id="travelTime" name="出行时间" underline="true"/>
                            <#input id="snatchOrderTime" name="抢单时间" underline="true"/>
                            <#input id="setOutTime" name="司机点出发时间" underline="true"/>
                            <#input id="arriveTime" name="司机到达预约地点时间" underline="true"/>
                            <#input id="startServiceTime" name="开始服务时间" underline="true"/>
                            <#input id="endServiceTime" name="结束服务时间" underline="true"/>
                            <#input id="orderType" name="订单类型(1=普通,2=预约)" underline="true"/>
                            <#input id="orderSource" name="下单方式(1:APP下单,2:扫码下单,3:小程序下单,4:司机下单,5:调度下单)" underline="true"/>
                            <#input id="invoiceId" name="发票id" underline="true"/>
                            <#input id="isReassign" name="是否是改派单(1=否,2=是)" underline="true"/>
                            <#input id="reassignNotice" name="改派通知(0=没有改派,1=改派中,2=已改派)" underline="true"/>
                            <#input id="trackId" name="高德猎鹰上的轨迹id" underline="true"/>
                            <#input id="isDelete" name="是否删除  1=否 2=是" underline="true"/>
                            <#input id="oldState" name="状态(改派前订单状态)" underline="true"/>
                            <#input id="telX" name="移动小号" underline="true"/>
                            <#input id="bindId" name="移动小号绑定关系id" underline="true"/>
                            <#input id="serverCarModelId" name="专车车型ID  关联t_server_carmodel表" underline="true"/>
                </div>
            </div>
            <div class="row btn-group-m-t">
                <div class="col-sm-10">
                    <#button btnCss="info" name="保存" id="ensure" icon="fa-check"
                    clickFun="TOrderPrivateCarInfoDlg.addSubmit()"/>
                    <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="TOrderPrivateCarInfoDlg.addSubmit()"/>
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="TOrderPrivateCarInfoDlg.close()"/>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${ctxPath}/static/modular/system/tOrderPrivateCar/tOrderPrivateCar_info.js"></script>
<script type="text/javascript"
        src="https://webapi.amap.com/maps?v=1.4.10&key=e9d39125e614f2b22e9f366275877058&plugin=AMap.Autocomplete,AMap.PlaceSearch"></script>
<script type="text/javascript" src="https://cache.amap.com/lbs/static/addToolbar.js"></script>
<script>
    laydate.render({
        elem: '#travelTime'
        , type: 'datetime'
        ,trigger: 'click' //采用click弹出
        , min:  new Date().toString()
    });
</script>
<script type="text/javascript">
    //起点地图加载
    var marker, map = new AMap.Map("startAddressBody", {
        resizeEnable: true,
        zoom: 15,
        zooms: [3, 20]
    }); //定位标注当前位置
    map.plugin('AMap.Geolocation', function () {
        geolocation = new AMap.Geolocation({
            enableHighAccuracy: true, //是否使用高精度定位,默认:true
            timeout: 10000, //超过10秒后停止定位,默认:无穷大
            maximumAge: 0, //定位结果缓存0毫秒,默认:0
            convert: true, //自动偏移坐标,偏移后的坐标为高德坐标,默认:true
            showButton: true, //显示定位按钮,默认:true
            showMarker: true, //定位成功后在定位到的位置显示点标记,默认:true
            showCircle: true, //定位成功后用圆圈表示定位精度范围,默认:true
            panToLocation: true, //定位成功后将定位到的位置作为地图中心点,默认:true
            buttonPosition: 'LB', //定位按钮的停靠位置  LB左下角、  RB右下角
            buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
            zoomToAccuracy: true, //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
        });
        map.addControl(geolocation);
        geolocation.getCurrentPosition();
        AMap.event.addListener(geolocation, 'complete', onComplete);
        //返回定位信息
        AMap.event.addListener(geolocation, 'error', onError);
        //返回定位出错信息
    }); //解析定位结果
    var city;
    map.on('click', function (e) {
        if (marker != null) {
            marker.setMap(null);
        }
        //添加标记点
        $("#startLon").val(e.lnglat.getLng());
        $("#startLat").val(e.lnglat.getLat());
         marker = new AMap.Marker({
            map: map,
            position: new AMap.LngLat(e.lnglat.getLng(), e.lnglat.getLat()),   // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
        });
        regeoCode(e.lnglat.getLng(),e.lnglat.getLat());
    });
    var infoWindow = new AMap.InfoWindow({
        autoMove: true,
        offset: {
            x: 0,
            y: -30
        }
    }); //回调函数
    //根据经纬度获取详细地址
    function regeoCode(lon,lat) {
        var lnglat = [];
        lnglat.push(lon);
        lnglat.push(lat);
        map.add(marker);
        marker.setPosition(lnglat);
        AMap.service('AMap.Geocoder', function() {
            geocoder = new AMap.Geocoder({});
            geocoder.getAddress(lnglat, function (status, result) {
                if (status === 'complete' && result.regeocode) {
                    var address = result.regeocode.formattedAddress;
                    $("#startAddress").val(address);
                } else {
                    Feng.error('根据经纬度查询地址失败')
                }
                var data={
                    "name":result.regeocode.addressComponent.neighborhood,
                    "location":{
                        "lat":lat,
                        "lng":lon
                    },
                    "address":address,
                    "tel":"",
                    "type":result.regeocode.addressComponent.neighborhoodType
                };
                infoWindow.setContent(createContent(data));
                infoWindow.open(map, marker.getPosition());
            });
        })
    }
    function onComplete(data) {
        var str = [];
        city = data.addressComponent.citycode;
        str.push('定位结果:' + data.position);
        str.push('定位类别:' + data.location_type);
        if (data.accuracy) {
            str.push('精度:' + data.accuracy + ' 米');
        }
        //如为IP精确定位结果则没有精度信息
        str.push('是否经过偏移:' + (data.isConverted ? '是' : '否'));
        var lnglatXY = [data.position.getLng(), data.position.getLat()];
        //地图上所标点的坐标
        AMap.service('AMap.Geocoder', function () {
            //回调函数
            geocoder = new AMap.Geocoder({});
            geocoder.getAddress(lnglatXY, function (status, result) {
                if (status === 'complete' && result.info === 'OK') {
                    //获得了有效的地址信息:                    //即,result.regeocode.formattedAddress
//                     console.log(result.regeocode.formattedAddress);
                    var address = result.regeocode.formattedAddress;
                    str.push('详细地址:' + address);
                    // todo 不弹出信息框
                    // alert(str.join(' | '));
                } else {
                    // alert(str.join(' | ')); //获取地址失败
                }
            });
        })
    } //解析定位错误信息
    function onError(data) {
        alert('定位失败,原因:' + data.message);
    }
    //输入搜索点信息
    var autoOptions = {
        city: city, //在规定城市搜索、默认全国
        input: "startAddress"
    };
    var auto = new AMap.Autocomplete(autoOptions);
    var placeSearch = new AMap.PlaceSearch({
        pageSize: 5, // 单页显示结果条数
        pageIndex: 1, // 页码
        children: 0, //不展示子节点数据
        city: city, // 兴趣点城市
        citylimit: true, //是否强制限制在设置的城市内搜索
        panel: "panel", // 结果列表将在此容器中进行展示。
        autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
        extensions: 'base', //返回基本地址信息  */
        map: map // 展现结果的地图实例
    }); //构造地点查询类
    AMap.event.addListener(auto, "select", select); //注册监听,当选中某条记录时会触发
    function select(e) {
        placeSearch.setCity(e.poi.adcode);
        placeSearch.search(e.poi.name); //关键字查询查询        //设置搜索位置定点标注
        if (e.poi && e.poi.location) {
            map.setZoom(15);
            map.setCenter(e.poi.location);
            var id = e.poi.id; //详情查询
            placeSearch.getDetails(id, function (status, result) {
                if (status === 'complete' && result.info === 'OK') {
                    placeSearch_CallBack(result);
                }
            });
        }
    }
    function placeSearch_CallBack(data) {
        if (marker != null) {
            marker.setMap(null);
        }
        var poiArr = data.poiList.pois; //添加marker
          marker = new AMap.Marker({
            map: map,
            position: poiArr[0].location
        });
        map.add(marker);
        marker.setPosition(marker.getPosition());
        infoWindow.setContent(createContent(poiArr[0]));
        infoWindow.open(map, marker.getPosition());
    }
    function createContent(poi) {
        console.log(poi);
        //信息窗体内容
        $("#startAddress").val(poi.address);
        $("#startLon").val(poi.location.lng);
        $("#startLat").val(poi.location.lat);
        $("#areaCode").val(poi.adcode);
        var s = [];
        s.push("<b>名称:" + poi.name + "</b>");
        s.push("地址:" + poi.address);
        s.push("电话:" + poi.tel);
        s.push("类型:" + poi.type);
        return s.join("<br>");
    }
</script>
<script>
    //终点地图加载
    var marker1, mapp = new AMap.Map("endAddressBody", {
        resizeEnable: true,
        zoom: 15,
        zooms: [3, 20]
    }); //定位标注当前位置
    mapp.plugin('AMap.Geolocation', function () {
        geolocation = new AMap.Geolocation({
            enableHighAccuracy: true, //是否使用高精度定位,默认:true
            timeout: 10000, //超过10秒后停止定位,默认:无穷大
            maximumAge: 0, //定位结果缓存0毫秒,默认:0
            convert: true, //自动偏移坐标,偏移后的坐标为高德坐标,默认:true
            showButton: true, //显示定位按钮,默认:true
            showMarker: true, //定位成功后在定位到的位置显示点标记,默认:true
            showCircle: true, //定位成功后用圆圈表示定位精度范围,默认:true
            panToLocation: true, //定位成功后将定位到的位置作为地图中心点,默认:true
            buttonPosition: 'LB', //定位按钮的停靠位置  LB左下角、  RB右下角
            buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
            zoomToAccuracy: true, //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
        });
        mapp.addControl(geolocation);
        geolocation.getCurrentPosition();
        AMap.event.addListener(geolocation, 'complete', onComplete);
        //返回定位信息
        AMap.event.addListener(geolocation, 'error', onError);
        //返回定位出错信息
    }); //解析定位结果
    var cityy;
    mapp.on('click', function (e) {
        if (marker1 != null) {
            marker1.setMap(null);
        }
        //添加标记点
        $("#startLon").val(e.lnglat.getLng());
        $("#startLat").val(e.lnglat.getLat());
        marker1 = new AMap.Marker({
            map: mapp,
            position: new AMap.LngLat(e.lnglat.getLng(), e.lnglat.getLat()),   // 经纬度对象,也可以是经纬度构成的一维数组[116.39, 39.9]
        });
        regeoCode1(e.lnglat.getLng(),e.lnglat.getLat());
    });
    var infoWindow = new AMap.InfoWindow({
        autoMove: true,
        offset: {
            x: 0,
            y: -30
        }
    }); //回调函数
    //根据经纬度获取详细地址
    function regeoCode1(lon,lat) {
        var lnglat = [];
        lnglat.push(lon);
        lnglat.push(lat);
        mapp.add(marker1);
        marker1.setPosition(lnglat);
        AMap.service('AMap.Geocoder', function() {
            geocoder = new AMap.Geocoder({});
            geocoder.getAddress(lnglat, function (status, result) {
                if (status === 'complete' && result.regeocode) {
                    var address = result.regeocode.formattedAddress;
                    $("#endAddress").val(address);
                } else {
                    Feng.error('根据经纬度查询地址失败')
                }
                var data={
                    "name":result.regeocode.addressComponent.neighborhood,
                    "location":{
                        "lat":lat,
                        "lng":lon
                    },
                    "address":address,
                    "tel":"",
                    "type":result.regeocode.addressComponent.neighborhoodType
                };
                infoWindow.setContent(createContentt(data));
                infoWindow.open(mapp, marker1.getPosition());
            });
        })
    }
    function onComplete(data) {
        var str = [];
        cityy = data.addressComponent.citycode;
        str.push('定位结果:' + data.position);
        str.push('定位类别:' + data.location_type);
        if (data.accuracy) {
            str.push('精度:' + data.accuracy + ' 米');
        }
        //如为IP精确定位结果则没有精度信息
        str.push('是否经过偏移:' + (data.isConverted ? '是' : '否'));
        var lnglatXY = [data.position.getLng(), data.position.getLat()];
        //地图上所标点的坐标
        AMap.service('AMap.Geocoder', function () {
            //回调函数
            geocoder = new AMap.Geocoder({});
            geocoder.getAddress(lnglatXY, function (status, result) {
                if (status === 'complete' && result.info === 'OK') {
                    //获得了有效的地址信息:                    //即,result.regeocode.formattedAddress
                    //                     console.log(result.regeocode.formattedAddress);
                    var address = result.regeocode.formattedAddress;
                    str.push('详细地址:' + address);
// todo 不弹出信息框
// alert(str.join(' | '));
                } else {
// alert(str.join(' | ')); //获取地址失败
                }
            });
        })
    } //解析定位错误信息
    function onError(data) {
        alert('定位失败,原因:' + data.message);
    }
    //输入搜索点信息
    var autoOptionss = {
        city: cityy, //在规定城市搜索、默认全国
        input: "endAddress"
    };
    var autoo = new AMap.Autocomplete(autoOptionss);
    var placeSearchh = new AMap.PlaceSearch({
        pageSize: 5, // 单页显示结果条数
        pageIndex: 1, // 页码
        children: 0, //不展示子节点数据
        city: city, // 兴趣点城市
        citylimit: true, //是否强制限制在设置的城市内搜索
        panel: "panel", // 结果列表将在此容器中进行展示。
        autoFitView: true, // 是否自动调整地图视野使绘制的 Marker点都处于视口的可见范围
        extensions: 'base', //返回基本地址信息  */
        map: mapp // 展现结果的地图实例
    }); //构造地点查询类
    AMap.event.addListener(autoo, "select", selectt); //注册监听,当选中某条记录时会触发
    function selectt(e) {
        placeSearchh.setCity(e.poi.adcode);
        placeSearchh.search(e.poi.name); //关键字查询查询        //设置搜索位置定点标注
        if (e.poi && e.poi.location) {
            mapp.setZoom(15);
            mapp.setCenter(e.poi.location);
            var id = e.poi.id; //详情查询
            placeSearchh.getDetails(id, function (status, result) {
                if (status === 'complete' && result.info === 'OK') {
                    placeSearch_CallBackk(result);
                }
            });
        }
    }
    function placeSearch_CallBackk(data) {
        if (marker1 != null) {
            marker1.setMap(null);
        }
        var poiArr = data.poiList.pois; //添加marker
        marker1 = new AMap.Marker({
            map: mapp,
            position: poiArr[0].location
        });
        mapp.add(marker1);
        marker1.setPosition(marker1.getPosition());
        infoWindow.setContent(createContentt(poiArr[0]));
        infoWindow.open(mapp, marker1.getPosition());
    }
    function createContentt(poi) {
        console.log(poi);
        //信息窗体内容
        $("#endAddress").val(poi.address);
        $("#endLon").val(poi.location.lng);
        $("#endLat").val(poi.location.lat);
        $("#areaCode").val(poi.adcode);
        var ss = [];
        ss.push("<b>名称:" + poi.name + "</b>");
        ss.push("地址:" + poi.address);
        ss.push("电话:" + poi.tel);
        ss.push("类型:" + poi.type);
        return ss.join("<br>");
    }
</script>
@}