carmore.jsp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
  4. <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
  5. <%
  6. String path = request.getContextPath();
  7. String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort() + path+"/";
  8. request.setAttribute("contextPath", basePath);
  9. String redirectUrl= request.getParameter("redirectUrl");
  10. request.setAttribute("redirectUrl", redirectUrl);
  11. %>
  12. <!DOCTYPE html>
  13. <html>
  14. <head>
  15. <base href="<%=basePath%>">
  16. <meta charset="UTF-8">
  17. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  18. <meta name="apple-mobile-web-app-capable" content="yes">
  19. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  20. <meta name="format-detection" content="telephone=no">
  21. <title>更多${flname }</title>
  22. <script src="<%=basePath %>app/lib/flexible.js"></script>
  23. <link rel="stylesheet" href="<%=basePath %>app/lib/flexible.css">
  24. <link rel="stylesheet" href="<%=basePath %>app/lib/swiper-4.3.2.min.css" />
  25. <link rel="stylesheet" href="<%=basePath %>app/css/basem.css">
  26. <link rel="stylesheet" href="<%=basePath %>app/css/public.css">
  27. <link rel="stylesheet" href="<%=basePath %>app/css/index.css">
  28. <link rel="stylesheet" href="<%=basePath %>app/css/logome.css">
  29. </head>
  30. <body>
  31. <div class="xzMore" style="overflow: hidden;">
  32. <div class="titbox blubg">
  33. <a class="titreturn fl" href="javascript:void(0)" onclick="back()"><img src="<%=basePath %>app/img/fanhui16@2x.png" alt=""></a>
  34. <h1 id="h1name"><c:if test="${!data.pager.isEmpty() }">${data.category[0].name }</c:if></h1>
  35. <a href="#" class="check">
  36. <img src="<%=basePath %>app/img/pil@2x.png" alt="">
  37. <span class="smtxt" num="1">多选推介</span>
  38. </a>
  39. <script type="text/javascript">
  40. function back(){
  41. window.history.go(-1);
  42. }
  43. </script>
  44. </div>
  45. <div class="top50">
  46. <div class="scrollNav">
  47. <ul class="kindul tabs">
  48. <c:forEach var="cg" varStatus="status" items="${data.category }">
  49. <li <c:if test="${status.index == 0 }">class="default"</c:if> ><!-- onclick="replace('${cg.id}', '${cg.num}', '${cg.type}', '${cg.twotype}', '2', '1', '${cg.name }')" -->
  50. <a href="javascript:void(0);">
  51. ${cg.name }
  52. <%-- <c:if test="${status.index == 0 }"><i></i></c:if> --%>
  53. </a>
  54. <input type="hidden" value="${cg.id}" id="categoryid" type="hidden"/>
  55. <input type="hidden" value="${cg.num}" id="num" type="hidden"/>
  56. <input type="hidden" value="${cg.name}" id="name" type="hidden"/>
  57. <input type="hidden" value="${cg.type}" id="type" type="hidden"/>
  58. <input type="hidden" value="${cg.twotype}" id="twotype" type="hidden"/>
  59. </li>
  60. </c:forEach>
  61. </ul>
  62. </div>
  63. <script type="text/javascript">
  64. function replace(categoryid, num, type, twotype, ismore, page, name){
  65. $('#h1name').text(name);
  66. var sslide = $('.swiper-container2 .swiper-wrapper .swiper-slide');
  67. var products = sslide.eq($('.tabs .default').index());
  68. var num = products.children('p').attr('num');
  69. if(num == '1'){
  70. $.ajax({
  71. type: "GET",
  72. url: "<%=basePath%>web/mgmProduct/now.cs",
  73. data: {
  74. categoryid:categoryid,
  75. num: num,
  76. type: type,
  77. twotype: twotype,
  78. ismore: ismore,
  79. page: page
  80. },
  81. dataType: "json",
  82. success: function(data){
  83. products.html("");
  84. var html="";
  85. data.forEach(function(value,index,array){
  86. html += "<div class='Section'>";
  87. html += "<span class='fl'>"+value.name+"</span>";
  88. html += "<a href='<%=basePath %>web/mgmProduct/more.cs?categoryid="+value.id+"&num="+value.num+"&type="+value.type+"&twotype="+value.twotype+"&ismore=2&page=1' class='fr'>更多 <img src='<%=basePath %>app/img/jinr@2x.png' class='jinr'> </a>";
  89. html += "</div>";
  90. html += "<ul>";
  91. value.pager.results.forEach(function(value,index,array){
  92. html += "<li>";
  93. html += "<a href='<%=basePath%>web/mgmProduct/detail.cs?productid="+value.id+"&plat=H5'>";
  94. html += "<label class='mycheck hide'>";
  95. html += "<input type='hidden' class='mid' value='"+value.id+"' />";
  96. html += "<input type='checkbox' name='checkid' value='1' value='' />";
  97. html += "<div class='option'></div>";
  98. html += "</label>";
  99. html += "<div class='referinfo'>";
  100. html += "<img src='"+value.productImg +"' alt=''>";
  101. html += "<div class='referCont'>";
  102. html += "<p class='refertit'>"+value.productName +"</p>";
  103. html += "<p>";
  104. html += "<span class='designation graytxt'>"+value.productRemark +"</span>";
  105. if(value.commissionRate != '0'){
  106. html += "<span class='commission'>佣金:"+value.commissionRate+ "%</span>";
  107. }
  108. html += "</p>";
  109. html += "<p>";
  110. html += "<span class='designation graytxt'>价格:</span>";
  111. html += "<span class='price'>"+value.productPrice +"</span>";
  112. html += "</p>";
  113. html += "<p>";
  114. html += "<span class='designation graytxt'>类型:</span>";
  115. html += "<span class='graytxt'>"+value.gc +"</span>";
  116. html += "</p>";
  117. html += "</div>";
  118. html += "</div>";
  119. html += "</a>";
  120. html += "<div class='buy'>";
  121. html += "<a href='<%=basePath %>web/mgmProduct/buyNow.cs?productId="+value.id +"' class='buygo'>立即购买</a>";
  122. html += "<a href='<%=basePath %>web/mgmProduct/recommend.cs?productids="+value.id+"' class='buyt'>我要推介</a>";
  123. html += "</div>";
  124. html += "</li>";
  125. });
  126. html += "</ul>";
  127. });
  128. products.html(html);
  129. $('.tabs .default').click();
  130. }
  131. });
  132. }
  133. }
  134. </script>
  135. </div>
  136. <!-- 房产推介 -->
  137. <div class="referrals swiper-container2" id="products">
  138. <div class="swiper-wrapper" style="height:auto">
  139. <div class="swiper-slide">
  140. <c:forEach var="p" varStatus="status" items="${data.pager}">
  141. <div class="Section">
  142. <span class="fl">${p.name}</span>
  143. <a href="<%=basePath %>web/mgmProduct/more.cs?categoryid=${p.id }&num=${p.num }&type=${p.type }&twotype=${p.twotype }&ismore=2&page=1" class="fr">更多 <img src="<%=basePath %>app/img/jinr@2x.png" class="jinr"> </a>
  144. </div>
  145. <ul>
  146. <c:forEach var="p1" varStatus="status" items="${p.pager.results }">
  147. <li>
  148. <a href="<%=basePath%>web/mgmProduct/detail.cs?productid=${p1.id }&plat=H5">
  149. <label class="mycheck hide">
  150. <input type="hidden" class="mid" value="${p1.id }" />
  151. <input type="checkbox" name="checkid" value="1" value="" />
  152. <div class="option"></div><!--该div盛放的是优化后的按钮图片-->
  153. </label>
  154. <div class="referinfo">
  155. <img src="${p1.productImg }" alt="">
  156. <div class="referCont">
  157. <p class="refertit">${p1.productName }</p>
  158. <p>
  159. <span class="designation graytxt">${p1.productRemark }</span>
  160. <c:if test="${p1.commissionRate != '0' }"><span class="commission">佣金:${p1.commissionRate }%</span></c:if>
  161. </p>
  162. <p>
  163. <span class="designation graytxt">价格:</span>
  164. <span class="price">${p1.productPrice }</span>
  165. </p>
  166. <p>
  167. <span class="designation graytxt">类型:</span>
  168. <span class="graytxt">${p1.gc }</span>
  169. </p>
  170. </div>
  171. </div>
  172. </a>
  173. <div class="buy">
  174. <a href="<%=basePath %>web/mgmProduct/buyNow.cs?productId=${p1.id }" class="buygo">立即购买</a>
  175. <a href="<%=basePath %>web/mgmProduct/recommend.cs?productids=${p1.id }" class="buyt">我要推介</a>
  176. </div>
  177. </li>
  178. </c:forEach>
  179. </ul>
  180. </c:forEach>
  181. </div>
  182. <c:forEach var="cg" varStatus="status" items="${data.category }">
  183. <c:if test="${status.index != 0 }">
  184. <div class="swiper-slide">
  185. <p style="text-align: center;" num='1'>正在加载中。。。</p>
  186. </div>
  187. </c:if>
  188. </c:forEach>
  189. </div>
  190. </div>
  191. </div>
  192. </body>
  193. <script src="<%=basePath %>app/lib/swiper-4.3.2.min.js"></script>
  194. <script type="text/javascript" src="<%=basePath %>res/js/jquery.min.js"></script>
  195. <script type="text/javascript" src="<%=basePath %>res/js/layer/layer.min.js"></script>
  196. <script type="text/javascript" src="<%=basePath %>app/js/public.js"></script>
  197. <script type="text/javascript">
  198. $(".check").click(function(){
  199. var num = $(this).find("span").attr("num");
  200. if(num == "1"){
  201. $(this).find("span").html("批量推介");
  202. $(this).find("span").attr("num", "2");
  203. $(".mycheck").removeClass("hide");
  204. }else if(num == "2"){
  205. var ids = "";
  206. var all = $('input:checkbox[name="checkid"]:checked');
  207. if(all.length == 0){
  208. layer.msg("请选择要推介的产品");
  209. return false;
  210. }
  211. all.each(function(index){
  212. if(index == 0){
  213. ids += $(this).parent().children('.mid').val();
  214. }else{
  215. ids += "," + $(this).parent().children('.mid').val();
  216. }
  217. });
  218. window.location.href = '<%=basePath%>web/mgmProduct/recommend.cs?productids=' + ids;
  219. }
  220. })
  221. var mySwiper2 = new Swiper('.xzMore .swiper-container2',{
  222. autoHeight: true,
  223. on:{
  224. slideChangeTransitionStart: function(){
  225. $(".tabs .default").removeClass('default');
  226. $(".tabs li").eq(mySwiper2.activeIndex).addClass('default');
  227. var iobj = $('.tabs .default');
  228. if(typeof(iobj) != "undefined"){
  229. var categoryid = iobj.children("#categoryid").val();
  230. var num = iobj.children("#num").val();
  231. var type = iobj.children("#type").val();
  232. var twotype = iobj.children("#twotype").val();
  233. var name = iobj.children("#name").val();
  234. //最后一个参数是1代表是城市首次检索
  235. replace(categoryid, num, type, twotype, "2", "1", name);
  236. }else{
  237. var name = iobj.children("#name").val();
  238. $("#h1name").text(name);
  239. }
  240. //每次滑动页面初始化多选按钮
  241. $("input:checkbox").removeAttr("checked");
  242. $(".mycheck").removeClass("hide");
  243. $(".mycheck").addClass("hide");
  244. $(".check").find("span").html("多选推介");
  245. $(".check").find("span").attr("num", "1");
  246. //上面导航列表同时滚动
  247. var w = 0;
  248. $(".tabs li").each(function(){
  249. w = w + $(this).width();
  250. if($(this).attr('class').indexOf('default') >= 0){
  251. return false;
  252. }
  253. });
  254. $(".scrollNav").scrollLeft(w);
  255. }
  256. }
  257. });
  258. $(".tabs li").click(function(e){
  259. e.preventDefault();
  260. $(".tabs .default").removeClass('default');
  261. $(this).addClass('default');
  262. mySwiper2.slideTo($(this).index());
  263. });
  264. $(".tabs li").click(function(e){
  265. e.preventDefault();
  266. });
  267. </script>
  268. </html>