detail.vm 18.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540
  
 
 <link rel="stylesheet" href="/assets/css/map.css" />
	 
	 
							
							
<div class="page-content">
<div class="page-header">
    <span class="pull-right"><a href="/pick/list.do" class="btn btn-white btn-default">返回</a></span>
    <h1>
        <small>
            <i class="icon-double-angle-right"></i>
          	查看市场
        </small>
    </h1>
</div>
<!-- /.page-header -->

<div class="row">
<div class="col-xs-12">

<form class="form-horizontal bv-form" role="form" method="post" action="/pick/save.do" id="addForm" >

<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right" for="form-field-2"> 市场名称: </label>

    <div class="col-xs-12 col-sm-4">
        <span class="block input-icon input-icon-right">
        <input type="text" placeholder="市场名称" name="pickName"  value="$!{pickUp.pickName}" readonly="readonly" class="width-100">
        </span>
    </div>
</div>
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right" for="form-field-5"> 市场编码: </label>

    <div class="col-xs-12 col-sm-4">
        <span class="block input-icon input-icon-right">
        <input type="text" placeholder="市场编码" name="pickCode" value="$!{pickUp.pickCode}" readonly="readonly" class="width-100" >
        </span>
    
    </div>
</div>

<div class="form-group" id="add_position">
    <label class="col-sm-3 control-label no-padding-right" for="form-field-6"> 联系方式: </label>
	<input type="hidden" name="personName" id="contpId">
	<input type="hidden" name="personTel" id="contnId">
     <div class="col-xs-12 col-sm-4"  >
        <span class="block input-icon input-icon-right">
        	#foreach($per in $!{pickUp.personList})
		 <input type="text" placeholder="联系人姓名" readonly="readonly" id="personName0" value="$!{per.contactName}" class="col-sm-6" >
         <input type="text" placeholder="联系人姓名" readonly="readonly" id="personName0"  value="$!{per.contactPhone}" class="col-sm-6"  >
							#end
  
        </span>
    </div>
</div>
 

<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right" for="form-field-6"> 市场地址:  </label>

     <div class="col-xs-12 col-sm-4">
        <span class="block input-icon input-icon-right">   
        <input type="text" placeholder="精确到街道和门牌号"   value="$!{webUtils.getAddressText($!{pickUp.addressId.toString()})}$!{pickUp.addressTxt}" readonly="readonly" class="width-100" >
        </span>
    </div>
</div>

 <div class="form-group">
    <label class="col-sm-3 control-label no-padding-right"  for="form-field-6"> 坐标位置: </label>
    
       <div class="col-xs-12 col-sm-4">
        <span class="block input-icon input-icon-right">
  <input type="text" placeholder="市场简称" name="abbreviation"  readonly="readonly"   value="($!{pickUp.longitude},$!{pickUp.latitude})" class="form-control">
        </span>
    </div>
 

</div>

<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right" for="form-field-6"> 市场描述: </label>

    <div class="col-xs-12 col-sm-4">
        <span class="block input-icon input-icon-right">
        <textarea class="form-control limited" name="remark" style="height:100px"  readonly="readonly">$!{pickUp.remark}</textarea>
        </span>
    </div>
</div>

<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right" for="form-field-6"> 是否是市场: </label>
	<input type="hidden" name="isMarket" id="markId" value="1"> 
    <div class="col-xs-12 col-sm-4">
    	<label>
    	#if($!{pickUp.isMarket}==1)
    	 <span class="lbl">是</span>
    	#elseif($!{pickUp.isMarket}==2)
    	    	 <span class="lbl">否</span>
    	#end
           
        </label> 
        
        
    </div>
</div>

    <div class="form-group">
        <label class="col-sm-3 control-label no-padding-right" for="form-field-6"> 本公司市场: </label>
        <div class="col-xs-12 col-sm-4">
            <label>
                #if($!{pickUp.myself}==1)
                    <span class="lbl">是</span>
                #elseif($!{pickUp.myself}==2)
                    <span class="lbl">否</span>
                #end
            </label>
        </div>
    </div>

<div id="isPickup" #if($!{pickUp.isMarket}==1) style="display:none;" #end>
    <div class="form-group">
        <label class="col-sm-3 control-label no-padding-right" for="form-field-6"> 市场简称: </label>

       <div class="col-xs-12 col-sm-4">
            <span class="block input-icon input-icon-right">
            <select id="glsc" style="width:100%;" name="parentPickId" disabled>
                <option value="-1"></option>
                #if(${assetsUtils.equal($pickUp.relationMarket,1)})
                    #foreach($market in $marketList)
                    <option value="$market.id" #if(${assetsUtils.equal($pickUp.parentPickId,$market.id)}) selected #end>$market.pickName</option>
                    #end
                #end
            </select>
            </span>
        </div>
    </div>
</div>

#if($!{pickUp.isMarket}==1)
<div id="notMarketId">
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right" for="form-field-6"> 市场简称: </label>

   <div class="col-xs-12 col-sm-4">
        <span class="block input-icon input-icon-right">
        <input type="text" placeholder="市场简称" name="abbreviation"  readonly="readonly"   value="$!{pickUp.abbreviation}" class="width-100">
        </span>
    </div>
</div>
<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right" for="form-field-6">  </label>

   <div class="col-xs-12 col-sm-4">
        <span class="block input-icon input-icon-right">
        用于分站运营切换城市时显示
        </span>
   </div>
</div>



<div class="form-group">
    <label class="col-sm-3 control-label no-padding-right" for="form-field-6"> 关联城市: </label>
	<input type="hidden" id="cityDetail" name="cityDetail">
    <div class="col-xs-12 col-sm-4">
    	<div style="height:250px; width:351px; border:#CCC solid 1px;">
        	<div style="height:250px; width:174px; border-right:#CCC solid 1px; float:left">
            	<div class="che_tit">选择省份</div>
                <div class="che_box">
                	<ul id="procityId">
                	#foreach($cty in $city)
                	#foreach($procty in $!{pickUp.cityList})
                	#if($procty.cityId==$cty.regionId)
                <li><label class="position-relative"><input type="checkbox" disabled checked="checked" class="ace" value="$!{cty.regionId}" ><span class="lbl" id="regId$!{cty.regionId}">&nbsp;$cty.regionName</span></label>  </li>
                	#else
             
                	#end
                	#end
                	#end
                        
                    </ul>
                </div>
            </div>
            <div style="height:250px; width:174px;float:right">
            	<div class="che_tit"><label class="position-relative"><input type="checkbox" class="ace" id="checkAllId" disabled onclick="checkAll()"><span class="lbl"></span></label> 城市全选</div>
                <div class="che_box">
                	<ul id="newLevlcityId">
                  </ul>
                </div>
            </div>
        </div>    
    </div>
</div>
</div>
  	#end

<div class="clearfix form-actions">
    <div class="col-md-offset-3 col-md-9">
	        <a href="/pick/list.do" class="btn">
	            <i class="icon-undo bigger-110"></i>
	          	  返回
	        </a>
    </div>
</div>
</form>
</div>
</div>
</div>



							<!-- PAGE CONTENT ENDS -->
						</div><!-- /.col -->
					</div><!-- /.row -->
				</div><!-- /.page-content -->
			</div><!-- /.main-content -->
		<!-- basic scripts -->
		
		<div id="modal-form" class="modal" tabindex="-1">

    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">选择位置
                <button type="button" class="close" data-dismiss="modal" style="font-size: 20px">×</button>
                <h4 id="xzml" class="blue bigger"></h4>
            </div>
                <div class="modal-body overflow-visible">
					                        <div id="preview">
					        <div id="float_search_bar">
					            <label>区域:</label>
					            <input type="text"  id="keyword" />
					            <button id="search_button">查找</button>
					            <span>点击地图获取坐标</span>
					        </div>
					        <div id="map_container"></div>
					    </div>
					    <div id="result" style="margin-top: 4px;"></div>
                </div>
                <div class="modal-footer">
                    <button class="btn btn-sm" data-dismiss="modal">
                        <i class="icon-remove"></i>
                        取消
                    </button>

                    <button id="qd"    class="btn btn-sm btn-primary" type="button" onclick="sure()"  >
                        <i class="icon-ok"></i>
                        确定
                    </button>
                </div>

        </div>
    </div>

</div>
<script src="/assets/js/selectCity/selectCity.js""></script> 
<link rel="stylesheet" href="$!{webUtils.getAssetsPath("/css/validator/bootstrapValidator.min.css")}" />
<script type="text/javascript" src="$!{webUtils.getAssetsPath("/js/validator/bootstrapValidator.min.js")}"></script>
<script type="text/javascript">
$(function (){
	var config = {
		box: "#begin"
		, names: {
			province : "province"
			, city: "city"
			, county: "addressId"
		}
	}
	var sCity = $.selectCity(config);
})
function changeMark(val){
	if(val==2){
		$("#notMarketId input").attr("disabled",true); 
		$("#notMarketId").css('display','none'); 
	}if(val==1){
		$("#notMarketId input").attr("disabled",false); 
		$("#notMarketId").css('display','block'); 
	}
	$("#markId").val(val);
}

function chosePosition(){
	var address = $(".address_city").find("option:selected").text(); 
	var pro = $(".address_province").find("option:selected").text(); 
	var addressTxt="北京";
	if(address=="市"){
		if(pro=="省"){
			addressTxt="北京";
		}else{
			addressTxt=pro;
		}
	}else{
		  addressTxt = pro+address;
	}
	$("#modal-form").modal();
	 $("#keyword").val(addressTxt);
	  local.search(addressTxt);
	  
}
//posiotion
 </script>
 <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>
    <script type="text/javascript">
        function getUrlParas(){
            var hash = location.hash,
                para = {},
                tParas = hash.substr(1).split("&");
            for(var p in tParas){
                if(tParas.hasOwnProperty(p)){
                    var obj = tParas[p].split("=");
                    para[obj[0]] = obj[1];
                }
            }
            return para;
        }
        var para = getUrlParas(),
            center = para.address?decodeURIComponent(para.address) : "北京",
            city = para.city?decodeURIComponent(para.city) : "北京";
    
//         document.getElementById("keyword").value = center;
    
        var marker_trick = false;
        var map = new BMap.Map("map_container");
        map.enableScrollWheelZoom();
    
        var marker = new BMap.Marker(new BMap.Point(116.404, 39.915), {
            enableMassClear: false,
            raiseOnDrag: true
		 });
        marker.enableDragging();
        map.addOverlay(marker);
    
        map.addEventListener("click", function(e){
            if(!(e.overlay)){
                map.clearOverlays();
                marker.show();
                marker.setPosition(e.point);
                setResult(e.point.lng, e.point.lat);
            }
        });
        marker.addEventListener("dragend", function(e){
            setResult(e.point.lng, e.point.lat);
        });
    
        var local = new BMap.LocalSearch(map, {
            renderOptions:{map: map},
			 pageCapacity: 1
        });
        local.setSearchCompleteCallback(function(results) {
            if(local.getStatus() !== BMAP_STATUS_SUCCESS) {
//                 alert("无结果");
            } else {
			     marker.hide();
			}
        });
        local.setMarkersSetCallback(function(pois) {
            for(var i=pois.length; i--; ) {
                var marker = pois[i].marker;
                marker.addEventListener("click", function(e) {
                    marker_trick = true;
                    var pos = this.getPosition();
                    setResult(pos.lng, pos.lat);
                });
            }
        });
    
        window.onload = function() {
          
            document.getElementById("search_button").onclick = function() {
                local.search(document.getElementById("keyword").value);
            };
            document.getElementById("keyword").onkeyup = function(e) {
                var me = this;
                e = e || window.event;
                var keycode = e.keyCode;
                if(keycode === 13){
                    local.search(document.getElementById("keyword").value);
                }
            };
        };
        
        /*
         * setResult : 定义得到标注经纬度后的操作
         * 请修改此函数以满足您的需求
         * lng: 标注的经度
         * lat: 标注的纬度
         */
        function setResult(lng, lat){
//             document.getElementById("result").innerHTML = lng + ", " + lat;
            $("#longitudeId").val(lng);
            $("#latitudeId").val(lat);
        }
       function sure(){
	if($("#longitudeId").val()==""){
		alert("请选择城市地址!");
	}else{
		$('#modal-form').modal('hide');
        $("#positionTxt").val("("+$("#longitudeId").val()+","+ $("#latitudeId").val()+")");
	}
    	   
       }
       function getcity(cityId,e){
    	   if(e.checked){
    			$.ajax({
        			type : 'post',
        			url :  "/city/getCityInfo.do?parentId="+cityId,
        			success : function(data) {
        				var html="";
        				for(key in data){
        					html+="<li id=licity"+cityId+"><label class='position-relative'><input type='checkbox' value="+data[key].regionId+" class='ace'><span class='lbl'>"+data[key].regionName+"</span></label>  </li>"
                        	
        				}
        				$("#newLevlcityId").append(html);
        			},
        			error : function() {
        				alert("网络超时!");
        			}
        		});
    	   }else{
    		    $("#newLevlcityId li").remove("li[id=licity"+cityId+"]");
    	   }
    	
       }
       function checkAll(){
    		var check = $("#newLevlcityId li label input[type=checkbox]");
    		for(var i=0;i<check.length;i++){
    			if($("#checkAllId").is(':checked')){
    				 if(!check[i].disabled){
    					 check[i].checked=true;
    				 }				
    			} else{
    				check[i].checked=false;
    			}
    			
    		}
       }
   </script>
   <script type="text/javascript">
   var tag=1;
   $(function(){
		
	 
		$("#add_contact").on("click",function(){
			var contact_con =  '<div class="form-group"><label class="col-sm-3 control-label no-padding-right" for="form-field-6"> </label><div class="col-xs-12 col-sm-4"> <span class="block input-icon input-icon-right">'
				+'<input type="text" placeholder="联系人姓名"  id=personName'+tag+' name=l"xrxm"'+tag+' required data-bv-message="必须填写!" data-bv-stringlength-message="超出了最大范围!" data-bv-stringlength="" data-bv-stringlength-max="125" maxlength="125" class="col-sm-6" value="" data-bv-field="cfg.configCode" >'
		        +'<input type="text" placeholder="联系电话" id=personTel'+tag+' name=l"xrxm"'+tag+' required data-bv-message="必须填写!" data-bv-stringlength-message="超出了最大范围!" data-bv-stringlength="" data-bv-stringlength-max="125" maxlength="125" class="col-sm-6" value="" data-bv-field="cfg.configCode" >'
		        +'</span>  '     
		        +'</div><div> <a href="javascript:void(0);" class="remove_contact">  <i class="fa fa-minus " style=" line-height: 25px; margin-top: 5px;  "></i></a></div></div>';
	        var html = $(contact_con);
	        tag = parseInt(tag)+1;
			$("#add_position").after(html);
	        $(html).find(".remove_contact").on("click",function(){
	        	tag = tag-1;
	            $(this).parents(".form-group").remove();
	        });
		});	
	});
   $(document).ready(function() {
	   var citList = "$!{pickUp.cityList}";
	 	 var proId="";
			var procheck = $("#procityId li label input[type=checkbox]");
			for(var i=0;i<procheck.length;i++){
				if(procheck[i].checked==true){
					proId=procheck[i].value;
					$.ajax({
						type : 'post',
						url :  "/city/getCityInfo.do?parentId="+proId,
						async:false,
						success : function(data) {
							var html="";
							var cityName = $("#regId"+proId).text();
						 	for(key in data){
						 		#foreach($cit in $!{pickUp.cityList}) 
							if(data[key].regionId==$cit.cityId){
								html+="<li id=licity"+data[key].parentId+" ><label class='position-relative'><input type='checkbox' disabled checked='checked'   value="+data[key].regionId+" class='ace'><span class='lbl'>"+data[key].regionName+"("+cityName+")"+"</span></label>  </li>";
							continue;
							}
						 		#end
						 		#foreach($selectCity in $selectCity)
						 		if($selectCity.cityId==data[key].regionId){
	        						continue;
	        					}
	        					#end

							}
						
						$("#newLevlcityId").append(html);
						},
						error : function() {
							alert("网络超时!");
						}
						
					});
	
				}
			}
		
	   
	   
   $('#addForm').bootstrapValidator({submitHandler: function(validator, form, submitButton) {
		var name="";
		var tel="";
		for(var i=0;i<tag;i++){
			if(i==tag-1){
				name+=$("#personName"+i).val();
				tel+=$("#personTel"+i).val();
			}else{
				name+=$("#personName"+i).val()+",";
				tel+=$("#personTel"+i).val()+",";
			}
		}
 	 $("#contpId").val(name);
 	 $("#contnId").val(tel);
	   var id="";
		var check = $("#newLevlcityId li label input[type=checkbox]");
		for(var i=0;i<check.length;i++){
			if(check[i].checked==true){
					id+=check[i].value+',';
			}
		}
		$("#cityDetail").val(id);
 	  var data = $('#addForm').serializeArray();
 	 $.ajax({
			url: "/pick/save.do",
			type : "post",
			data : data,
			success : function (data){ 
				console.info(data);
				window.location = "$!{webUtils.getLocalPath("pick/list.do")}";
			}
		});
// // 	   $("#addForm").submit();
// 	   return true;
   }});
   	
   });
   </script>
</div>