yyjg.js 3.04 KB
$(function () {
var latitude =undefined
var longitude =undefined
var orgname = undefined  
    layui.use('element', function () {
        let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
        //监听导航点击
        element.on('nav(demo)', function (elem) {
            layer.msg(elem.text());
        });
    });
    // 地图
    var map = new BMap.Map('container');
    var point = new BMap.Point(longitude, latitude);
    map.centerAndZoom(point, 15);
    // 创建点标记
    var marker = new BMap.Marker(point);
    map.addOverlay(marker);
    // 创建信息窗口
    var opts = {
        width: 200,
        height: 100,
        title: orgname
    };
    var infoWindow = new BMap.InfoWindow( orgname, opts);
    // 点标记添加点击事件
    map.openInfoWindow(infoWindow, point); // 开启信息窗口
    marker.addEventListener('click', function () {
        map.openInfoWindow(infoWindow, point); // 开启信息窗口
    });
    map.enableScrollWheelZoom();
    getAppointmentDetail()
});
// GET 根据预约信息标识码appointmentId查看预约详情
function getAppointmentDetail(){
  $.ajax({
    type: "get", //提交方式
    url:
      portal.api_url + "/portal/appointmentmh/getAppointmentDetail",
    data: {
      appointmentId: GetRequest(),
    },
    dataType: "json",
    //数据,这里使用的是Json格式进行传输
    success: function (result) {
      //返回数据根据结果进行相应的处理
      if (result.code == 200) {
        var renegeCounttotal =undefined
        console.log('ff',result)
        $('#username').text(result.data.username)
        $('#zjhm').text(result.data.zjhm)
        $('#orgName').text(result.data.orgName)
        $('#hbShortname').text(result.data.hbShortname)
        $('#reservationNumber').text(result.data.reservationNumber)
        console.log(result.data.bookingDate.substr(0,4)) 
        var year = result.data.bookingDate.substr(0,4) + '年'
        var month = result.data.bookingDate.substr(4,2) + '月'
        var day= result.data.bookingDate.substr(6,2) + '日'
        var startTime= result.data.startTime + '至'
        var endTime= result.data.endTime
        var yysjtotal = year + month + day + startTime + endTime
        $('#yysj').text(yysjtotal)
        if(result.data.renegeCount == null){
          renegeCounttotal = 0
        }else{
          renegeCounttotal = result.data.renegeCount
        }
        $('#renegeCount').html(renegeCounttotal)
        $('#renegeCount').css('color','red')

        longitude= result.data.longitude
        latitude= result.data.latitude
        orgname= result.data.orgName
      } 
    },
  });
}
function GetRequest() {
  var url = location.search; //获取url中"?"符后的字串
  var theRequest = new Object();
  if (url.indexOf("?") != -1) {
    var str = url.substr(1);
    strs = str.split("?");
    for (var i = 0; i < strs.length; i++) {
      theRequest[strs[i].split("=")[0]] = decodeURIComponent(
        strs[i].split("=")[1]
      );
    }
  }
  return theRequest.appointmentId;
}