/**
 * Created by 刘丹 on 2017/10/16.
 */
(function(){
	var line_a="";
	var line_a_ulul="";
	var b4_font="";
	var slider3="";
	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]]=decodeURI(strs[i].split("=")[1]);
		}
	}
	_id=theRequest.id;
	realname=theRequest.housename;

	$.ajax({
		url: "/app.php/app/getShopDetails",
		data: {
			"id":1
		},
		type: "POST",
		dataType: "json",
		beforeSend: function () {},
		success: function (response) {
			var shang=" ";
			var  shanpu=' ';
			if(shang=="0"){
				 shanpu='<span class="a_fontd">进场费：'+response.data.slotting_fee+'元</span>';
			}else if(shang=="1"){
				 shanpu='<span class="a_fontd">转让费：'+response.data.transfer_fee+'元</span>';
			}
			line_a='<p class="a_fonta">'+response.data.title+'</p>'+
			'<p class="a_fontb">租金均价 :'+response.data.price+'元/月</p>'+
			'<span class="a_fontc">物业管理费：'+response.data.management_fee+'元/月</span>'+
			shanpu;
			$(".line_a").html(line_a);
			var shangpu_tag=response.data.shangpu_tags;
			if(shangpu_tag){
				shangpu_tags=shangpu_tag.split(",");
				for(var i=0;i<shangpu_tags.length;i++){
					line_a_ulul+='<li>'+shangpu_tags[i]+'</li>';
					$(".line_a_ulul").html(line_a_ulul);
				}
			}


			$(".balance_num").html(response.data.balance_num);
			$(".b1_span3").html(response.data.room_area_all);
			$(".b1_span4").html(response.data.business_area);
			$(".b3_span").html(response.data.shangpu_type_str);
			$(".b3_span2").html(response.data.yetai);
			$(".b3_span3").html(response.data.has_moved);
            $(".b4_font_p1").html(response.data.sellingpoint);
			$(".b5_font_p1").html(response.data.singn_rule);
			b4_font='<p  class="b4_font_p">详细信息</p>'+
			'<p class="b4_font2">营业时间:<span class="b4_span1 gw">'+response.data.business_date+'</span></p>'+
			'<p class="b4_font2">招商时间:<span class="b4_span1 gw">'+response.data.opentime+'</span></p>'+
			'<p class="b4_font2">开业时间:<span class="b4_span1 gw">'+response.data.start_business_date+'</span></p>'+
			'<p class="b4_font2">是否有煤气:<span class="b4_span1 gw">'+response.data.has_gas+'</span></p>'+
			'<p class="b4_font2"><span class="b3_font3 lp">地址:</span><span class="b3_span3 gw">'+response.data.address+'</span></p>'+
			'<p class="b4_font2"><span class="b3_font3 lp" >交通:</span><span class="b3_span3 gw">'+response.data.traffic+'</span></p>';
			$("#b4_font").html(b4_font);
			var lp_img=response.data.house_button_img;
			for(var n=0;n<lp_img.length;n++){
				slider3+='<div class="slide"><img src="'+response.data.house_button_img[n]+'"></div>'
				$(".slider3").html(slider3);
			}
			var longitude=response.data.longitude;
			var latitude=response.data.latitude;
// 百度地图API功能
//			var map = new BMap.Map("allmap");    // 创建Map实例
//			map.centerAndZoom(new BMap.Point(longitude, latitude), 11);  // 初始化地图,设置中心点坐标和地图级别
//			map.addControl(new BMap.MapTypeControl());   //添加地图类型控件
//			map.setCurrentCity("上海");          // 设置地图显示的城市 此项是必须设置的
//			map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放

		},
		error: function () {

		}
	});

	//添加下载app链接相关
	var _share = getUrlParam('share');
    if(_share == "1"){
    	$('.m_part3_w').hide();

    	var _fix_top = $(".public");
		_fix_top.show();
		$(".pbl_cha").click(function() {
			_fix_top.hide();
		});
		var _name = getUrlParam('user_name');
  		var _tel = getUrlParam('user_tel');
  		if(_name || _tel){
  			var _fix_bottom = $(".fix_area_bottom");
  			_fix_bottom.show();
  			$("#fix_name").html(_name);
  			$("#fix_tel").attr("href","tel:"+_tel).html(_tel);
  			$("#fix_area_bottom_btn").click(function(){
            	_fix_bottom.hide();
            });
  		};

		jumpEvent();//添加跳转app页面事件
    }
})();
