<div>       
    <div class='bdmapscript'></div>
    <div id='bdmap-store' style='height:400px;width:100%;'></div>
</div>

 

<script type='text/javascript'>
    $(document).ready(function(){

        var lbl_style={
　　        //color : "white", //字体颜色
　　        fontSize : "15px",//字体大小 　
　　        backgroundColor :"0.5", //文本标注背景颜色
　　        border :"1", 　
　　        fontWeight :"bold" //字体加粗
        };

        !function(mapInit) {
            var script = document.createElement("script");
            script.type = "text/javascript";
            script.src = "https://api.map.baidu.com/api?v=3.0&ak=ASl2xmUaYpjwdWy3GPBQbpUK&callback=mapinit";
            window['mapinit'] = function() {
                mapInit();
            };            
            $('#bg-modal .bdmapscript').html(script);
        }(function() {     
            map = new BMap.Map('bdmap-store'); 
            
            {% for s in stores %}            
                var p1 = new BMap.Point({{s.lnglat.0}}, {{s.lnglat.1}});
                marker = new BMap.Marker(p1);  // 创建标注
                var label=new BMap.Label('{{s.sn}}', {offset:new BMap.Size(20,0)});
                label.setStyle(lbl_style);
                marker.setLabel(label);                
                map.addOverlay(marker);   

                marker.addEventListener('click', function(){
                    this.openInfoWindow(new BMap.InfoWindow(
                        '<div>仓库编号：{{s.sn}}</div>'+
                        '<div>上报时间：{{s.tm}}</div>'+                        
                        '<div>核准时间：{{s.tm_checked}}</div>'                      
                    ));
                });   


            {% endfor %}

            map.centerAndZoom(new BMap.Point({{center.lng}},{{center.lat}}), {{zoom}});
            map.enableScrollWheelZoom(); //启用滚轮放大缩小，默认禁用
            map.enableContinuousZoom(); //启用地图惯性拖拽，默认禁用               

        });
        
    });

</script>


