@{
    ViewBag.Title = "";
    Layout = "~/Views/Shared/_LayoutTable.cshtml";
}
@section head {
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html,#l-map{
            width: 100%;
            height: 100%;
            margin: 0;
            font-family: "微软雅黑";
        }

        #l-map {
            height: 100%;
            width: 100%;
        }
            #r-result {
        height: 100%;
        width: 20%;
        float: left;
    }
    </style>
}
<body>
    <div id="l-map"></div>
    <div id="r-result">
        <div id="result"></div>
    </div>
</body>
<script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("l-map");
    map.centerAndZoom(new BMap.Point(120.1025810000, 30.2765030000), 13);
    map.enableScrollWheelZoom(true);
    var index = 0;
    var myGeo = new BMap.Geocoder();
    var adds = "";
    function bdGEO() {
        for (var i in adds) {
            geocodeSearch(adds[i]["Latitude"], adds[i]["Longitude"], adds[i]["afullname"]);
            index++;
        }
    }
    function geocodeSearch(Latitude, Longitude, name) {
        if (Latitude) {
            var point = new BMap.Point(Longitude, Latitude);
            var myLabel = new BMap.Label(name, { offset: new BMap.Size(20, -10) });
            myLabel.setStyle({
                color: "red",
                fontSize: "12px",
                height: "20px",
                lineHeight: "20px",
                fontFamily: "微软雅黑",
                cursor: "pointer",
                position: "relative"
            });
            map.centerAndZoom(new BMap.Point(Longitude, Latitude), 13);
            addMarker(point, myLabel);
        }
    }
    // 编写自定义函数,创建标注
    function addMarker(point, label) {
        var marker = new BMap.Marker(point);
        map.addOverlay(marker);
        marker.setLabel(label);
    }
    $(function () {
        var id = parent.$("#parid").val();
        $.ajax({
            url: "../DataQuery/GetCustomerAdds?&parid=" + id,
            datatype: "text",
            type: "post",
            success: function (data) {
                adds = $.parseJSON(data);
                bdGEO();
            }
        })
    });
</script>