more.jsp 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  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.pager[0].name }</c:if></h1>
  35. <c:if test="${!data.pager.isEmpty() && data.pager[0].type == '2' }">
  36. <a href="#" class="check">
  37. <img src="<%=basePath %>app/img/pil@2x.png" alt="">
  38. <span class="smtxt" num="1">多选推介</span>
  39. </a>
  40. </c:if>
  41. <script type="text/javascript">
  42. function back(){
  43. window.history.go(-1);
  44. }
  45. </script>
  46. </div>
  47. <div class="top50">
  48. <c:if test="${fn:length(data.category) > 0 }">
  49. <div class="scrollNav">
  50. <ul class="kindul tabs">
  51. <c:forEach var="cg" varStatus="status" items="${data.category }">
  52. <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 }')" -->
  53. <a href="javascript:void(0);">
  54. ${cg.name }
  55. <%-- <c:if test="${status.index == 0 }"><i></i></c:if> --%>
  56. </a>
  57. <input type="hidden" value="${cg.id}" id="categoryid" type="hidden"/>
  58. <input type="hidden" value="${cg.num}" id="num" type="hidden"/>
  59. <input type="hidden" value="${cg.type}" id="type" type="hidden"/>
  60. <input type="hidden" value="${cg.twotype}" id="twotype" type="hidden"/>
  61. <input type="hidden" value="${cg.name}" id="name" type="hidden"/>
  62. </li>
  63. </c:forEach>
  64. </ul>
  65. </div>
  66. </c:if>
  67. <script type="text/javascript">
  68. function replace(categoryid, num, type, twotype, ismore, page, name, iscity){
  69. $("#h1name").text(name);
  70. var sslide = $('.swiper-container2 .swiper-wrapper .swiper-slide');
  71. var products = sslide.eq($('.tabs .default').index());
  72. var baseparam = products.children('.baseparam');
  73. var li = products.children('ul').children('li').eq(0);
  74. if(li.children('p').attr('num') == '1' || iscity == '1'){
  75. $.ajax({
  76. type: "GET",
  77. url: "<%=basePath%>web/mgmProduct/now.cs",
  78. data: {
  79. categoryid:categoryid,
  80. num: num,
  81. type: type,
  82. twotype: twotype,
  83. ismore: ismore,
  84. page: page,
  85. cityCode:$('#cityCode').val()
  86. },
  87. dataType: "json",
  88. success: function(data){
  89. products.children('ul').html("");
  90. var html="";
  91. data.forEach(function(value,index,array){
  92. baseparam.children(".categoryid").val(value.id);
  93. baseparam.children(".num").val(value.num);
  94. baseparam.children(".name").val(value.name);
  95. baseparam.children(".type").val(value.type);
  96. baseparam.children(".twotype").val(value.twotype);
  97. baseparam.children(".page").val(value.pager.page);
  98. baseparam.children(".pageTotal").val(value.pager.pageTotal);
  99. value.pager.results.forEach(function(value,index,array){
  100. html += "<li>";
  101. html += "<a href='<%=basePath%>web/mgmProduct/detail.cs?productid="+value.id+"&plat=H5'>";
  102. html += "<label class='mycheck hide'>";
  103. html += "<input type='hidden' class='mid' value='"+value.id+"' />";
  104. html += "<input type='checkbox' name='checkid' value='1' value='' />";
  105. html += "<div class='option'></div>";
  106. html += "</label>";
  107. html += "<div class='referinfo'>";
  108. html += "<img src='"+value.productImg +"' alt=''>";
  109. html += "<div class='referCont'>";
  110. html += "<p class='refertit'>"+value.productName +"</p>";
  111. html += "<p>";
  112. html += "<span class='designation graytxt'>"+value.productRemark +"</span>";
  113. if(value.commissionRate != '0'){
  114. html += "<span class='commission'>佣金:"+value.commissionRate+ "%</span>";
  115. }
  116. html += "</p>";
  117. html += "<p>";
  118. html += "<span class='designation graytxt'>价格:</span>";
  119. html += "<span class='price'>"+value.productPrice +"</span>";
  120. html += "</p>";
  121. html += "<p>";
  122. html += "<span class='designation graytxt'>类型:</span>";
  123. html += "<span class='graytxt'>"+value.gc +"</span>";
  124. html += "</p>";
  125. html += "</div>";
  126. html += "</div>";
  127. html += "</a>";
  128. html += "<div class='buy'>";
  129. html += "<a href='<%=basePath %>web/mgmProduct/buyNow.cs?productId="+value.id +"' class='buygo'>立即购买</a>";
  130. html += "<a href='<%=basePath %>web/mgmProduct/recommend.cs?productids="+value.id+"' class='buyt'>我要推介</a>";
  131. html += "</div>";
  132. html += "</li>";
  133. });
  134. });
  135. products.children('ul').html(html);
  136. $('.tabs .default').click();
  137. }
  138. });
  139. }
  140. }
  141. </script>
  142. </div>
  143. <!-- 房产推介 -->
  144. <div class="referrals swiper-container2">
  145. <div class="swiper-wrapper" style="height:auto">
  146. <div class="swiper-slide">
  147. <c:forEach var="p" varStatus="status" items="${data.pager}">
  148. <div class="baseparam">
  149. <input class="categoryid" type="hidden" value="${p.id }">
  150. <input class="num" type="hidden" value="${p.num }">
  151. <input class="name" type="hidden" value="${p.name }">
  152. <input class="type" type="hidden" value="${p.type }">
  153. <input class="twotype" type="hidden" value="${p.twotype }">
  154. <input class="page" type="hidden" value="${p.pager.page }">
  155. <input class="pageTotal" type="hidden" value="${p.pager.pageTotal }">
  156. </div>
  157. </c:forEach>
  158. <ul>
  159. <c:forEach var="p" varStatus="status" items="${data.pager}">
  160. <c:forEach var="p1" varStatus="status" items="${p.pager.results }">
  161. <li>
  162. <a href="<%=basePath%>web/mgmProduct/detail.cs?productid=${p1.id }&plat=H5">
  163. <label class="mycheck hide">
  164. <input type="hidden" class="mid" value="${p1.id }" />
  165. <input type="checkbox" name="checkid" value="1" value="" />
  166. <div class="option"></div><!--该div盛放的是优化后的按钮图片-->
  167. </label>
  168. <div class="referinfo">
  169. <img src="${p1.productImg }" alt="">
  170. <div class="referCont">
  171. <p class="refertit">${p1.productName }</p>
  172. <p>
  173. <span class="designation graytxt">${p1.productRemark }</span>
  174. <c:if test="${p1.commissionRate != '0' }"><span class="commission">佣金:${p1.commissionRate }%</span></c:if>
  175. </p>
  176. <p>
  177. <span class="designation graytxt">价格:</span>
  178. <span class="price">${p1.productPrice }</span>
  179. </p>
  180. <p>
  181. <span class="designation graytxt">类型:</span>
  182. <span class="graytxt">${p1.gc }</span>
  183. </p>
  184. </div>
  185. </div>
  186. </a>
  187. <div class="buy">
  188. <a href="<%=basePath %>web/mgmProduct/buyNow.cs?productId=${p1.id }" class="buygo">立即购买</a>
  189. <a href="<%=basePath %>web/mgmProduct/recommend.cs?productids=${p1.id }" class="buyt">我要推介</a>
  190. </div>
  191. </li>
  192. </c:forEach>
  193. </c:forEach>
  194. </ul>
  195. <div class="nomore">
  196. 没有更多了。。。
  197. </div>
  198. </div>
  199. <c:forEach var="cg" varStatus="status" items="${data.category }">
  200. <c:if test="${status.index != 0 }">
  201. <div class="swiper-slide">
  202. <div class="baseparam">
  203. <input class="categoryid" type="hidden" value="">
  204. <input class="num" type="hidden" value="">
  205. <input class="type" type="hidden" value="">
  206. <input class="twotype" type="hidden" value="">
  207. <input class="name" type="hidden" value="">
  208. <input class="page" type="hidden" value="">
  209. <input class="pageTotal" type="hidden" value="">
  210. </div>
  211. <ul>
  212. <li>
  213. <p style="text-align:center" num='1'>正在加载中。。。</p>
  214. </li>
  215. </ul>
  216. <div class="nomore">
  217. 没有更多了。。。
  218. </div>
  219. </div>
  220. </c:if>
  221. </c:forEach>
  222. </div>
  223. </div>
  224. <c:if test="${data.pager[0].type == '1' }">
  225. <a href="#" class="checkCity"><img src="<%=basePath %>app/img/xuanzecs@2x.png"></a>
  226. </c:if>
  227. <input id="cityCode" value="" type="hidden"/>
  228. </div>
  229. <!-- 城市弹窗 -->
  230. <div class="cityMask hide">
  231. <div class="titbox blubg">
  232. <a class="titreturn left" href="javascript:void(0)" onclick="backper()"><img src="<%=basePath %>app/img/fanhui16@2x.png" alt=""></a>
  233. <h1>选择城市</h1>
  234. </div>
  235. <div class="top50">
  236. <ul class="cityul">
  237. <li>
  238. <a href="#">
  239. 北京
  240. <img src="<%=basePath %>app/img/fanh3@2x.png" alt="">
  241. </a>
  242. </li>
  243. </ul>
  244. </div>
  245. </div>
  246. </body>
  247. <script src="<%=basePath %>app/lib/swiper-4.3.2.min.js"></script>
  248. <script type="text/javascript" src="<%=basePath %>res/js/jquery.min.js"></script>
  249. <script type="text/javascript" src="<%=basePath %>res/js/layer/layer.min.js"></script>
  250. <script type="text/javascript" src="<%=basePath %>app/js/public.js"></script>
  251. <script type="text/javascript">
  252. $(".check").click(function(){
  253. var num = $(this).find("span").attr("num");
  254. if(num == "1"){
  255. $(this).find("span").html("批量推介");
  256. $(this).find("span").attr("num", "2");
  257. $(".mycheck").removeClass("hide");
  258. }else if(num == "2"){
  259. var ids = "";
  260. var all = $('input:checkbox[name="checkid"]:checked');
  261. if(all.length == 0){
  262. layer.msg("请选择要推介的产品");
  263. return false;
  264. }
  265. all.each(function(index){
  266. if(index == 0){
  267. ids += $(this).parent().children('.mid').val();
  268. }else{
  269. ids += "," + $(this).parent().children('.mid').val();
  270. }
  271. });
  272. window.location.href = '<%=basePath%>web/mgmProduct/recommend.cs?productids=' + ids;
  273. }
  274. })
  275. $(function(){
  276. // 滚动刷新
  277. if(typeof(kindul) == "undefined"){
  278. var totalheight=0 ;
  279. var totalheight2=0 ;
  280. $(window).unbind('scroll').scroll(function(){
  281. totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
  282. totalheight2=parseInt($(document).height());
  283. // 页数,每页展示10个,请求的地址
  284. var url = '<%=basePath%>web/mgmProduct/now.cs';
  285. var sslide = $('.swiper-container2 .swiper-wrapper .swiper-slide');
  286. var products = sslide.eq($('.tabs .default').index());
  287. var baseparam = products.children('.baseparam');
  288. var categoryid = baseparam.children(".categoryid").val();
  289. var num = baseparam.children(".num").val();
  290. var type = baseparam.children(".type").val();
  291. var twotype = baseparam.children(".twotype").val();
  292. var page = baseparam.children(".page").val();
  293. var pageTotal = baseparam.children(".pageTotal").val();
  294. if(parseInt(page)>0 && parseInt(page) < parseInt(pageTotal)){
  295. products.children(".nomore").text("下拉加载更多");
  296. }else{
  297. products.children(".nomore").text("没有更多了。。。");
  298. }
  299. if( totalheight2 == parseInt(totalheight)){
  300. var li = products.children('ul').children('li').eq(0);
  301. if(li.children('p').attr('num') != '1'){
  302. if(parseInt(page)>0 && parseInt(page) < parseInt(pageTotal)){
  303. page = parseInt(page) + 1;
  304. products.children(".nomore").text("下拉加载更多");
  305. }else{
  306. products.children(".nomore").text("没有更多了。。。");
  307. return false;
  308. }
  309. $.ajax({
  310. type: 'POST',
  311. url: url + '?page=' + page + '&ismore=2&categoryid=' + categoryid + '&type='+type+'&num='+num+'&twotype='+twotype+'&cityCode='+$('#cityCode').val(),
  312. dataType: 'json',
  313. success: function (data) {
  314. var html="";
  315. data.forEach(function(value,index,array){
  316. baseparam.children(".categoryid").val(value.id);
  317. baseparam.children(".num").val(value.num);
  318. baseparam.children(".name").val(value.name);
  319. baseparam.children(".type").val(value.type);
  320. baseparam.children(".twotype").val(value.twotype);
  321. baseparam.children(".page").val(value.pager.page);
  322. baseparam.children(".pageTotal").val(value.pager.pageTotal);
  323. value.pager.results.forEach(function(value,index,array){
  324. html += "<li>";
  325. html += "<a href='<%=basePath%>web/mgmProduct/detail.cs?productid="+value.id+"&plat=H5'>";
  326. html += "<label class='mycheck hide'>";
  327. html += "<input type='hidden' class='mid' value='"+value.id+"' />";
  328. html += "<input type='checkbox' name='checkid' value='1' value='' />";
  329. html += "<div class='option'></div>";
  330. html += "</label>";
  331. html += "<div class='referinfo'>";
  332. html += "<img src='"+value.productImg +"' alt=''>";
  333. html += "<div class='referCont'>";
  334. html += "<p class='refertit'>"+value.productName +"</p>";
  335. html += "<p>";
  336. html += "<span class='designation graytxt'>"+value.productRemark +"</span>";
  337. if(value.commissionRate != '0'){
  338. html += "<span class='commission'>佣金:"+value.commissionRate+ "%</span>";
  339. }
  340. html += "</p>";
  341. html += "<p>";
  342. html += "<span class='designation graytxt'>价格:</span>";
  343. html += "<span class='price'>"+value.productPrice +"</span>";
  344. html += "</p>";
  345. html += "<p>";
  346. html += "<span class='designation graytxt'>类型:</span>";
  347. html += "<span class='graytxt'>"+value.gc +"</span>";
  348. html += "</p>";
  349. html += "</div>";
  350. html += "</div>";
  351. html += "</a>";
  352. html += "<div class='buy'>";
  353. html += "<a href='<%=basePath %>web/mgmProduct/buyNow.cs?productId="+value.id +"' class='buygo'>立即购买</a>";
  354. html += "<a href='<%=basePath %>web/mgmProduct/recommend.cs?productids="+value.id+"' class='buyt'>我要推介</a>";
  355. html += "</div>";
  356. html += "</li>";
  357. });
  358. });
  359. products.children('ul').html(products.children('ul').html() + html);
  360. $('.tabs .default').click();
  361. }
  362. });
  363. }
  364. }
  365. });
  366. }
  367. });
  368. $(".checkCity").click(function(){
  369. $(".cityul").html('');
  370. $.get('<%=basePath%>area/getProvice.cs',function(data){
  371. var html = "";
  372. for(var i in data){
  373. html += "<li onclick='proclick(\""+data[i].code+"\")'>";
  374. html += "<a href='javascript:void(0)'>";
  375. html += data[i].name;
  376. html += " <img src='<%=basePath %>app/img/fanh3@2x.png' alt=''>";
  377. html += "</a>";
  378. html += "</li>";
  379. }
  380. $(".cityul").html(html);
  381. });
  382. $(".xzMore").hide();
  383. $(".cityMask").show();
  384. })
  385. function proclick(code){
  386. var html = "";
  387. $.get('<%=basePath%>area/getByParentCode.cs',{'param': code}, function(data){
  388. for(var i in data){
  389. html += "<li onclick='cityclick(\""+data[i].code+"\")'>";
  390. html += "<a href='javascript:void(0)'>";
  391. html += data[i].name;
  392. html += " <img src='<%=basePath %>app/img/fanh3@2x.png' alt=''>";
  393. html += "</a>";
  394. html += "</li>";
  395. }
  396. $(".cityul").html(html);
  397. });
  398. }
  399. function cityclick(code){
  400. $(".xzMore").show();
  401. $(".cityMask").hide();
  402. $("#cityCode").val(code);
  403. var sslide = $('.swiper-container2 .swiper-wrapper .swiper-slide');
  404. var products = sslide.eq($('.tabs .default').index());
  405. var baseparam = products.children('.baseparam');
  406. var categoryid = baseparam.children(".categoryid").val();
  407. var num = baseparam.children(".num").val();
  408. var name = baseparam.children(".name").val();
  409. var type = baseparam.children(".type").val();
  410. var twotype = baseparam.children(".twotype").val();
  411. var page = baseparam.children(".page").val();
  412. var pageTotal = baseparam.children(".pageTotal").val();
  413. //最后一个参数是1代表是城市首次检索
  414. replace(categoryid, num, type, twotype, '2', '1', name, '1');
  415. }
  416. function backper(){
  417. $(".xzMore").show();
  418. $(".cityMask").hide();
  419. }
  420. var mySwiper2 = new Swiper('.xzMore .swiper-container2',{
  421. autoHeight: true,
  422. on:{
  423. slideChangeTransitionStart: function(){
  424. $(".tabs .default").removeClass('default');
  425. $(".tabs li").eq(mySwiper2.activeIndex).addClass('default');
  426. var iobj = $('.tabs .default');
  427. if(typeof(iobj) != "undefined"){
  428. var categoryid = iobj.children("#categoryid").val();
  429. var num = iobj.children("#num").val();
  430. var type = iobj.children("#type").val();
  431. var twotype = iobj.children("#twotype").val();
  432. var name = iobj.children("#name").val();
  433. //最后一个参数是1代表是城市首次检索
  434. replace(categoryid, num, type, twotype, "2", "1", name, '0');
  435. }else{
  436. var name = iobj.children("#name").val();
  437. $("#h1name").text(name);
  438. }
  439. //每次滑动页面初始化多选按钮
  440. $("input:checkbox").removeAttr("checked");
  441. $(".mycheck").removeClass("hide");
  442. $(".mycheck").addClass("hide");
  443. $(".check").find("span").html("多选推介");
  444. $(".check").find("span").attr("num", "1");
  445. //上面导航列表同时滚动
  446. var w = 0;
  447. $(".tabs li").each(function(){
  448. w = w + $(this).width();
  449. if($(this).attr('class').indexOf('default') >= 0){
  450. return false;
  451. }
  452. });
  453. $(".scrollNav").scrollLeft(w);
  454. }
  455. }
  456. });
  457. $(".tabs li").click(function(e){
  458. e.preventDefault();
  459. $(".tabs .default").removeClass('default');
  460. $(this).addClass('default');
  461. mySwiper2.slideTo($(this).index());
  462. });
  463. $(".tabs li").click(function(e){
  464. e.preventDefault();
  465. });
  466. </script>
  467. </html>