<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort() + path+"/";
	request.setAttribute("contextPath", basePath);
	
	String redirectUrl= request.getParameter("redirectUrl");
	request.setAttribute("redirectUrl", redirectUrl);
%>
<!DOCTYPE html>
<html>
	<head>
        <base href="<%=basePath%>">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no"><c:if test=""></c:if>
    <title><c:if test="${detail.productType == '1' }">房产详情</c:if><c:if test="${detail.productType == '2' }">产品详情</c:if></title>
    <script src="<%=basePath %>app/lib/flexible.js"></script>
        	<script type="text/javascript" src="<%=basePath %>res/js/jquery.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script type="text/javascript">
 		// 微信分享函数
    	$.ajax({ url:"<%=basePath%>web/wx_share/getwxconfig.cs",
      		data:{signaurl:location.href},
			dataType:'json',
			type:'post',
			success:function(data){
				var url = window.location.href;
		    	url = url.replace("detail","detailfx");
				
				wx.config({
					  debug: false,
					  appId:data.appid,
					  timestamp:data.timestamp,
					  nonceStr:data.noncestr,
					  signature:data.signature,
					  jsApiList:['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage']
				  });
			     wx.ready(function(){
			    	 
			    	 //获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
			    	wx.onMenuShareTimeline({
			    		    title: '${detail.productName }', // 分享标题
			    		    link:url, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
			    		    imgUrl:'${detail.productImg }', // 分享图标
			    		    success: function () {
			    		    	window.location.href=url;
			    		},
			    		cancel: function () {
			    		    // 用户取消分享后执行的回调函数
			    		    }
			    	});
			    	 //获取“分享给朋友”按钮点击状态及自定义分享内容接口
			    	wx.onMenuShareAppMessage({
			    		 title: '${detail.productName }', // 分享标题
			    		 desc: '${detail.productRemark }', // 分享描述
			    		 link:url, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
			    		 imgUrl: '${detail.productImg }', // 分享图标
			    		 type: '', // 分享类型,music、video或link，不填默认为link
			    		 dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
			    		 success: function () {
			    		 // 用户确认分享后执行的回调函数
			    			 window.location.href=url;
			    		 },
			    		 cancel: function () {
			    		 // 用户取消分享后执行的回调函数
			    		 }
    				});
						
				});
			}
		 });

    </script>
    
    <link rel="stylesheet" href="<%=basePath %>app/lib/flexible.css">
    <link rel="stylesheet" href="<%=basePath %>app/lib/swiper-4.3.2.min.css" />
    <link rel="stylesheet" href="<%=basePath %>app/css/basem.css">
    <link rel="stylesheet" href="<%=basePath %>app/css/public.css">
    <link rel="stylesheet" href="<%=basePath %>app/css/index.css">
	</head>
	<body>
        <div class="main">
            <!--导航 -->
            <div class="swiper-container" id="detail">
                <div class="swiper-wrapper">
                <c:forEach var="gi" varStatus="status" items="${groupimg }">
                    <div class="swiper-slide">
                        <img src="${gi }" alt="">
                    </div>
                </c:forEach>
                </div>
                <!-- 分页器 -->
                <div class="swiper-pagination"></div>

                <a href="javascript:void(0)" onclick="back()" class="back"><img src="<%=basePath %>app/img/fanh4@2x.png" alt=""></a>
                <%-- <a href="javascript:void(0)" onclick="wxShare()" class="share"><img src="<%=basePath %>app/img/fenx@2x.png" alt=""></a> --%>
                 <script type="text/javascript">
				function back(){
					window.history.go(-1);
				}
				</script>
            </div>
            <!-- 详情 -->
            <div class="houseinfo">
                <p class="houseName">
                <span class="houseN">${detail.productName } <c:if test="${detail.productState == '2' }">（产品已下架）</c:if></span>
               
                 <c:if test="${detail.productState == '1' }">
                <a href="<%=basePath %>web/mgmProduct/buyNow.cs?productId=${detail.id}" class="houseBuy fr">立即购买</a>
                </c:if>
                <c:if test="${detail.productState == '2' }">
                <a href="javascript:void(0)" style="background-color:#948682;" class="houseBuy fr">立即购买</a>
                </c:if>
                </p>
                <p class="houseprice"><span>价格：</span><span>${detail.productPrice }</span></p>
                <p class="housecom"><span class="blutxt">${detail.productRemark }</span><c:if test="${detail.commissionRate != '0' }"><span style="margin-left:0.6rem;color:#104d9f;">佣金：${detail.commissionRate }%</span></c:if></p>
                <p class="housePhone"><span>联系电话：</span><span>${detail.hotline }</span></p>
               
            </div>
            <!-- 产品参数tab切换 -->
            <div class="product ">
               <ul class="kindul productul">
                    <li class="current">
                        <a href="#" title="pdDet"> 
                            产品详情
                            <i></i>
                        </a>
                    </li>
                    <li>
                        <a href="#" title="pdNum"> 
                            产品参数
                        </a>
                    </li>
                    <li>
                        <a href="#" title="pdtPolicy"> 
                            激励政策
                        </a>
                    </li>
                  
                </ul> 

                <div class="productcont">
                    <div id="pdDet" class="hide show">
                    ${detail.productBody}
                        <!-- <p>
                            <span class="pdDetL">房产地址：</span>昆明东区经开区临湖
                        </p>
                        <div class="houseType">
                            <span class="pdDetL">户型：</span>
                            <div class="types">
                                <span>A户型（洋房）：3室2厅/188㎡</span>
                                <span>A户型（洋房）：3室2厅/188㎡</span>
                                <span>A户型（洋房）：3室2厅/188㎡</span>
                                <span>A户型（洋房）：3室2厅/188㎡</span>
                                <span>A户型（洋房）：3室2厅/188㎡</span>
                            </div>
                        </div>
                        <img src="./img/type.png" alt="" class="typePic">
                        <p><span class="pdDetL">商业配套:</span>沃尔玛、万达</p>
                        <div class="educ">
                            <p class="pdDetL">教育配套：</p>
                            <p class="pdcont">幼儿园、初中、高中、幼儿园、初中、高中、幼儿园、初中、高中、幼儿园、初中、高中、幼儿园、初中、高中、幼儿园、初中、高中、幼儿园、初中、高中、</p>
                        </div>
                        <p><span class="pdDetL">医院配套：</span>昆明医院、昆明医院、昆明医院、昆明医院/明医院、昆明医院</p>
                        <p><span class="pdDetL">资源配套：</span>公园、湖水、公园、湖水、公园、湖水公园、湖水</p> -->
                    </div>

                    <div id="pdNum" class="hide">
                     ${detail.productAttr}
                       <!--  <p>
                            <span class="pdDetL">开盘时间：</span>昆明东区经开区临湖
                        </p>
                         <p>
                            <span class="pdDetL">交房时间：</span>昆明东区经开区临湖
                        </p>
                         <p>
                            <span class="pdDetL">产权类型：</span>昆明东区经开区临湖
                        </p>
                         <p>
                            <span class="pdDetL">产权：</span>昆明东区经开区临湖
                        </p>
                         <p>
                            <span class="pdDetL">开发商：</span>昆明东区经开区临湖
                        </p>
                         <p>
                            <span class="pdDetL">物业公司：</span>昆明东区经开区临湖
                        </p>
                         <p>
                            <span class="pdDetL">占地面积：</span>昆明东区经开区临湖
                        </p>
                         <p>
                            <span class="pdDetL">容积率：</span>昆明东区经开区临湖
                        </p>
                         <p>
                            <span class="pdDetL">物业费：</span>昆明东区经开区临湖
                        </p>
                         <p>
                            <span class="pdDetL">建筑类型：</span>昆明东区经开区临湖
                        </p>

                         <p>
                            <span class="pdDetL">面积区间：</span>昆明东区经开区临湖
                        </p>
                         <p>
                            <span class="pdDetL">装修标准：</span>昆明东区经开区临湖
                        </p> -->
                    </div>
                    <div id="pdtPolicy" class="hide">
                        ${detail.policy}
                    </div>


                </div>



            </div>
            <!-- 关注推介 -->
                <div class="GT">
                   
                   <c:if test="${detail.productState == '1' }">
                    <a href="javascript:void(0);" id="a1" <c:if test="${detail.isFollow == 1 }">style="display:none;"</c:if> onclick="cgz('${detail.id}')" class="fl"><img src="<%=basePath %>app/img/xin.png"  alt="">关注</a>
                    <a href="javascript:void(0);" id="a2" <c:if test="${detail.isFollow == 0 }">style="display:none;"</c:if> onclick="uncgz('${detail.id}')" class="fl"><img src="<%=basePath %>app/img/xin-kong.png"  alt="">已关注</a>
	                </c:if>
	                <c:if test="${detail.productState == '2' }">
	                <a href="javascript:void(0);" id="a1" <c:if test="${detail.isFollow == 1 }">style="display:none;"</c:if> <c:if test="${detail.isFollow == 0 }">style="background-color:#948682;"</c:if>  class="fl"><img src="<%=basePath %>app/img/xin.png"  alt="">关注</a>
                    <a href="javascript:void(0);" id="a2" <c:if test="${detail.isFollow == 0 }">style="display:none;"</c:if> <c:if test="${detail.isFollow == 1 }">style="background-color:#948682;"</c:if> class="fl"><img src="<%=basePath %>app/img/xin-kong.png"  alt="">已关注</a>
	                </c:if>
                   
                   
                    <c:if test="${detail.productState == '1' }">
                    <a href="<%=basePath %>web/mgmProduct/recommend.cs?productids=${detail.id }" class="fr"><img src="<%=basePath %>app/img/tui.png" alt="">我要推介</a>
	                </c:if>
	                <c:if test="${detail.productState == '2' }">
	                <a href="javascript:void(0)" style="background-color:#948682;" class="fr"><img src="<%=basePath %>app/img/tui.png" alt="">我要推介</a>
	                </c:if>
                    
                </div>
                <script type="text/javascript">
                function cgz(id){
                	$.ajax({
       	             type: "POST",
       	             url: "<%=basePath%>web/mgmProduct/addFollow.cs",
       	             data: {
       	            	productid:id 
       	             },
       	             dataType: "json",
       	             success: function(data){
       	            	 if(data.ret == 0){
       	            		layer.msg(data.msg);
       	            	 }else if(data.ret == 1){
       	            		 $("#a1").css("display","none");
       	            		$("#a2").css("display","block");
       	            		layer.msg(data.msg); 
       	            	 }
       	              }
       	         });
                }
                	 function uncgz(id){
                     	$.ajax({
            	             type: "POST",
            	             url: "<%=basePath%>web/mgmProduct/delFollow.cs",
            	             data: {
            	            	 ids:id 
            	             },
            	             dataType: "json",
            	             success: function(data){
            	            	 if(data.ret == 0){
               	            		layer.msg(data.msg);
               	            	 }else if(data.ret == 1){
               	            		 $("#a1").css("display","block");
                	            	$("#a2").css("display","none");
               	            		layer.msg(data.msg); 
               	            	 }
            	             }
            	         });
                }
                </script>
        </div>

                  
  

		
    </body>
	<script src="<%=basePath %>app/lib/swiper-4.3.2.min.js"></script>

    <script type="text/javascript" src="<%=basePath %>res/js/layer/layer.min.js"></script>
    <script type="text/javascript" src="<%=basePath %>app/js/public.js"></script>
      <script>        
      var mySwiper = new Swiper ('.swiper-container', {
        autoplay:true,//等同于以下设置
        autoplay: {
            delay: 3000,
            stopOnLastSlide: false,
            disableOnInteraction: true,
            },
        loop: true,   
        // 分页器
        pagination: {
          el: '.swiper-pagination',
        }
        
      })        
  </script>

</html>
