var hospitalId = GetRequest1("hospitalId");
new Vue({
	el: "#main",
	data: function() {
		return {
			activeTabIdx: 1,
			data: {}
		}
	},
	mounted: function() {
		EventBus.$emit("jump-step", {
			step: 4
		}); //step:跳转的步数
		this.querySimpleHospitalById();
	},
	methods: {
		activeTab: function(idx) {
			this.activeTabIdx = idx;
		},
		//获取医院详情
		querySimpleHospitalById: function() {
			var vm = this;
			appointmentAPI.querySimpleHospitalById({
				hospitalId: hospitalId
			}).then(function(res) {
				if(res.successFlg && res.obj.Code == "10000") {
					var obj = res.obj;
					vm.data = obj;
					vm.doLocate(obj.jd, obj.wd);
				}
			});
		},
		backPage: function() {
			window.location.href = "select-hospital.html?hospitalId="+hospitalId;
		},
		//根据经纬度定位
		doLocate: function(jd, wd) {
			// 百度地图API功能

			var map = new BMap.Map("div_map");
			// 创建Map实例
			map.enableScrollWheelZoom();
			//启用滚轮放大缩小
			map.centerAndZoom(new BMap.Point(jd, wd), 15);
			var point = new BMap.Point(jd, wd);
			var marker = new BMap.Marker(point);
			map.addOverlay(marker);
			// map.addOverlay(new BMap.Marker(point));
			//			marker.enableDragging(); //启用标注拖动

			//			marker.addEventListener('dragend', function(e) { //拖动标注结束
			//				var pointNew = e.point;
			//				console.log(pointNew);
			//				alert(pointNew.lng + '|' + pointNew.lat);
			//			});

			map.centerAndZoom(point, 15);
			// 初始化地图,设置中心点坐标和地图级别。
		}
	}
})