BestMainFormMob.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <!DOCTYPE html>
  2. <html lang="ko"
  3. xmlns:th="http://www.thymeleaf.org"
  4. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  5. layout:decorator="mob/common/layout/DefaultLayoutMob">
  6. <!--
  7. *******************************************************************************
  8. * @source : BestMainFormMob.html
  9. * @desc : 베스트메인 Page
  10. *============================================================================
  11. * STYLE24
  12. * Copyright(C) 2020 TSIT, All rights reserved.
  13. *============================================================================
  14. * VER DATE AUTHOR DESCRIPTION
  15. * === =========== ========== =============================================
  16. * 1.0 2021.05.10 bin2107 최초 작성
  17. *******************************************************************************
  18. -->
  19. <body>
  20. <th:block layout:fragment="content">
  21. <main role="" id="" class="container dp">
  22. <section class="content dp_best">
  23. <div class="inner wide">
  24. <div class="category_nav">
  25. <ul id="cateListArea">
  26. <li class="" id="li0"><button type="button" onclick="fnBestListSearch(this,'');">전체</button></li>
  27. <th:block th:each="item, stat : ${bestCateList}">
  28. <li class="" th:id="${'li'+item.cateNo}"><button type="button" th:onclick="fnBestListSearch(this,[[${item.cateNo}]]);" th:text="${item.cateNm}">여성</button></li>
  29. </th:block>
  30. </ul>
  31. </div>
  32. </div>
  33. <div class="inner bg_gray">
  34. <div class="view_item">
  35. <div class="count_wrap">
  36. <div>
  37. <p>지금 많이 <span>보고 있어요</span></p>
  38. </div>
  39. <div>
  40. <ul class="dp_util">
  41. <li><a href="javascript:void(0);" id="researchBtn" class="refresh" th:text="${#calendars.format(#calendars.createNow(), 'HH:mm')+' 기준'}">17:30 기준</a></li>
  42. </ul>
  43. </div>
  44. </div>
  45. <div class="swiper-container item_list">
  46. <div class="swiper-wrapper" id="itemViewArea">
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <div class="inner">
  52. <div class="best_item">
  53. <h2 class="dp_subtitle">베스트 TOP 100</h2>
  54. <div class="item_list">
  55. <div class="count_wrap">
  56. <ul class="dp_util">
  57. <li>
  58. <div class="open_categori sex">
  59. <a id="filter">구매 성별 전체
  60. </a>
  61. </div>
  62. </li>
  63. <li>
  64. <div class="open_categori age">
  65. <a id="filter">구매 연령 전체
  66. </a>
  67. </div>
  68. </li>
  69. </ul>
  70. </div>
  71. <div class="list_content">
  72. <div class="itemsGrp" id="prodArea">
  73. </div>
  74. </div>
  75. <div class="list_last" id="divLastPage" style="display: none;">마지막페이지 입니다.</div>
  76. </div>
  77. </div>
  78. </div>
  79. </section>
  80. <!-- 카테고리 -->
  81. <div class="category_box">
  82. <div class="lap">
  83. <div class="category_close">카테고리닫기</div>
  84. <div class="category_list">
  85. <!-- 카테고리 선택 -->
  86. <div class="selcet_list">
  87. <ul>
  88. <li class="active"><a href="javascript:void(0)">구매성별 전체</a></li>
  89. <li><a href="javascript:void(0)">구매성별1</a></li>
  90. <li><a href="javascript:void(0)">구매성별2</a></li>
  91. <li><a href="javascript:void(0)">구매성별3</a></li>
  92. <li><a href="javascript:void(0)">구매성별4</a></li>
  93. </ul>
  94. </div>
  95. <!-- //카테고리 선택 -->
  96. </div>
  97. </div>
  98. </div>
  99. <!-- //카테고리 -->
  100. <!-- 210415_최신상품순 리스트 팝업 추가 -->
  101. <div id="odDatePop1" class="popup_box odDatePop">
  102. <div class="lap">
  103. <div class="popup_close">카테고리닫기</div>
  104. <div class="popup_head sr-only">
  105. <h2 class="">기간 선택 팝업</h2>
  106. </div>
  107. <div class="popup_con">
  108. <div class="button_list clear">
  109. <button type="button" class="on"><span>구매성별 전체</span></button>
  110. <button type="button"><span>구매성별1</span></button>
  111. <button type="button"><span>구매성별2</span></button>
  112. <button type="button"><span>구매성별3</span></button>
  113. <button type="button"><span>구매성별4</span></button>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <div id="odDatePop2" class="popup_box odDatePop">
  119. <div class="lap">
  120. <div class="popup_close">카테고리닫기</div>
  121. <div class="popup_head sr-only">
  122. <h2 class="">기간 선택 팝업</h2>
  123. </div>
  124. <div class="popup_con">
  125. <div class="button_list clear">
  126. <button type="button" class="on"><span>구매연령 전체</span></button>
  127. <button type="button"><span>구매연령1</span></button>
  128. <button type="button"><span>구매연령2</span></button>
  129. <button type="button"><span>구매연령3</span></button>
  130. <button type="button"><span>구매연령4</span></button>
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. </main>
  136. <form id="bestGoodsForm" name="bestGoodsForm">
  137. <input type="hidden" name="pageNo" id="pageNo" value ="1"/>
  138. <input type="hidden" name="pageSize" value ="50"/>
  139. <input type="hidden" name="cateNo" value=""/>
  140. <input type="hidden" name="sortGb"/>
  141. </form>
  142. <!-- 수동설정 + 추천솔루션 카운트 문제로 인해 인피티니스크롤 제거 협의 21-07-21 -->
  143. <!-- <script src="/ux/plugins/gaga/gaga.infinite.scrollSession.js"></script>-->
  144. <!-- <script src="/ux/plugins/jquery/jquery.history.min.js"></script>-->
  145. <!-- <script th:src="@{'/biz/goods.js?v=' + ${#calendars.format(#calendars.createNow(), 'yyyyMMddHHmmss')}}" src="/biz/goods.js"></script>-->
  146. <script th:inline="javascript">
  147. /*<![CDATA[*/
  148. var bestCateList = [[${bestCateList}]];
  149. $(document).ready(function(){
  150. $(document).on('click','.sub_category .more_btn',function(){
  151. $(this).toggleClass('on');
  152. $('.sub_category .cate_wrap').toggleClass('on');
  153. if($(this).hasClass('on')){
  154. $(this).find('span').text('접기');
  155. }else{
  156. $(this).find('span').text('더보기');
  157. }
  158. });
  159. //카테고리
  160. function category(){
  161. var categoryOpen=$(".open_categori .select_dress");
  162. var categoryClose=$(".category_box .category_close");
  163. var categoryPop=$(".category_box");
  164. categoryOpen.on("click",function(){
  165. categoryPop.show();
  166. categoryPop.addClass("active");
  167. $("body").css({"overflow":"hidden"});
  168. });
  169. categoryClose.on("click",function(){
  170. categoryPop.hide();
  171. $("body").css({"overflow":"visible"});
  172. });
  173. }
  174. category();
  175. // 210415_팝업관련 추가
  176. //기간 선택 팝업
  177. $(document).on("click", ".open_categori.sex", function(){
  178. $('#odDatePop1').show().addClass("active");
  179. $("body").css({"overflow":"hidden"});
  180. });
  181. $(document).on("click", ".open_categori.age", function(){
  182. $('#odDatePop2').show().addClass("active");
  183. $("body").css({"overflow":"hidden"});
  184. });
  185. //팝업_닫기
  186. $('.popup_close').on("click",function(){
  187. $('.popup_box').hide().removeClass('active');
  188. $("body").css({"overflow":"visible"});
  189. });
  190. //210510_수정 : 토스트 팝업 버튼 on 클래스 제어.
  191. $(document).on('click','.popup_box .button_list button',function(){
  192. $(this).siblings('.button_list button').removeClass('on');
  193. $(this).addClass('on');
  194. })
  195. //210510_추가 : 토스트 팝업 button 클릭 시 팝업 닫기.
  196. $(document).on('click','.popup_box.odDatePop .button_list button',function(){
  197. $(this).parents('.popup_box.odDatePop').hide().removeClass('active');
  198. $("body").css({"overflow":"visible"});
  199. })
  200. $(document).on('click','.popup_box.odDatePop .button_list button',function(){
  201. $(this).parents('.popup_box.odDatePop').hide().removeClass('active');
  202. $("body").css({"overflow":"visible"});
  203. })
  204. });
  205. var fnBestListSearch = function (obj, cateNo){
  206. $.each($("#cateListArea").find('li').find('button'), function() {
  207. $(this).removeClass();
  208. });
  209. if(gagajf.isNull(cateNo)){
  210. $("#li0").find("button").addClass('active');
  211. }else{
  212. $("#li"+cateNo).find("button").addClass('active');
  213. }
  214. $("#bestGoodsForm input[name=cateNo]").val(cateNo);
  215. // 카테고리별 실시간 베스트 상품 조회 getRealtimeViewBestGoodsList
  216. fnRealtimeViewBestList(cateNo);
  217. // TOP100 조회
  218. fnBestTop100List();
  219. }
  220. var fnRealtimeViewBestList = function (cateNo){
  221. if(gagajf.isNull(cateNo)){
  222. cateNo = "";
  223. }
  224. var data = {cateNo : cateNo};
  225. var html = '';
  226. $.getJSON('/display/realtime/best/list' , data, function (result, status){
  227. $("#itemViewArea").html('');
  228. console.log(result);
  229. if(result.length > 0){
  230. $.each(result, function (idx, item){
  231. // 2021.08.30 이미지 null 처리
  232. if (item.itemName != null) {
  233. var imgUrl = '';
  234. html += '<div class="swiper-slide">\n';
  235. html += ' <div class="item_prod">\n';
  236. html += ' <div class="item_state">\n';
  237. html += ' <a href="javascript:void(0);" class="itemLink" onclick="cfnGoToGoodsDetail(\''+item.itemId+'\')">\n';
  238. html += ' <div class="itemPic">\n';
  239. html += ' <img alt="BLACK-a" class=" vLHTC pd_img" src="' + item.imageUrl + '">\n';
  240. html += ' </div>\n';
  241. html += ' <div class="itemName">'+item.itemName+'</div>\n';
  242. if(item.count < 10){
  243. html += ' <div class="viewCount">10명 미만</div>\n';
  244. }else{
  245. html += ' <div class="viewCount">'+item.count.addComma()+'명 보는중</div>\n';
  246. }
  247. html += ' </a>\n';
  248. html += ' </div>\n';
  249. html += ' </div>\n';
  250. html += '</div>\n';
  251. }
  252. });
  253. }
  254. $("#itemViewArea").append(html);
  255. $("#researchBtn").attr("onclick","fnRealtimeViewBestList("+cateNo+");");
  256. /* SLIDE - 지금많이 보고있어요 */
  257. //210624_ 추가 : 슬라이드 속성 추가.
  258. var dp_viewitem_slide = new Swiper('.view_item .swiper-container', {
  259. slidesPerView: 'auto',
  260. slidesPerView: 3,
  261. spaceBetween: 8,
  262. speed: 1000,
  263. centerMode: true,
  264. a11y: {
  265. enabled: true,
  266. notificationClass: 'swiper-notification',
  267. prevSlideMessage: '이전 슬라이드',
  268. nextSlideMessage: '다음 슬라이드',
  269. firstSlideMessage: '첫번째 슬라이드 입니다',
  270. lastSlideMessage: '마지막 슬라이드 입니다',
  271. paginationBulletMessage: '슬라이드 {{index}}로 이동',
  272. },
  273. autoplay : {
  274. delay : 3000, // 시간 설정
  275. disableOnInteraction: true,
  276. },
  277. });
  278. });
  279. }
  280. var fnBestTop100List = function (){
  281. gagajf.ajaxFormSubmit("/display/best/main/goods/list", document.bestGoodsForm, fnCallbackBestTop100);
  282. }
  283. var fnCallbackBestTop100 = function (result){
  284. $("#prodArea").html('');
  285. var tag = '';
  286. if(result.dataList.length > 0){
  287. $.each(result.dataList, function (idx, item){
  288. tag += '<div class="item_prod">\n';
  289. tag += ' <div class="item_state">\n';
  290. tag += ' <button type="button" class="itemLike" onclick="wishlistDelete(this)" goodsCd="'+item.goodsCd+'" goodsNm="'+ item.goodsNm+'" ithrCd="" contentsLoc="IN10_01" planDtlSq="">관심상품 추가</button>\n';
  291. tag += ' <a href="javascript:void(0);" class="itemLink" onclick="cfnGoToGoodsDetail(\''+item.goodsCd+'\', \''+item.colorCd+'\')">\n';
  292. tag += '<div class="shape ';
  293. if(idx==0){
  294. tag += ' ranker';
  295. }
  296. tag += '"><span>'+(idx+1)+'</span></div>\n';
  297. tag += ' <div class="itemPic">\n';
  298. tag += ' <img alt="BLUE-a" class=" vLHTC pd_img" src="' + _uploadGoodsUrl + '/' + item.sysImgNm + '">\n';
  299. tag += ' </div>\n';
  300. tag += ' <p class="itemBrand">'+item.brandGroupNm+'</p>\n';
  301. if (item.goodsTnm != null && item.goodsTnm != '') {
  302. tag+=' <div class="itemComment">'+item.goodsTnm+'</div>\n';
  303. }
  304. tag += ' <div class="itemName">'+item.goodsFullNm+'</div>\n';
  305. tag += ' <p class="itemPrice">';
  306. if (item.currPrice != item.listPrice) {
  307. tag += ' <span class="itemPrice_original">' + item.listPrice.addComma() + '</span>\n';
  308. }
  309. tag += item.currPrice.addComma();
  310. if (item.currPrice != item.listPrice) {
  311. tag+=' <span class=" itemPercent">'+ Math.round((item.listPrice - item.currPrice) / (item.listPrice * 1.0) * 100) +'%</span>\n';
  312. }
  313. tag += ' </p>\n';
  314. tag += ' <div class="itemcolorchip">\n';
  315. if(!gagajf.isNull(item.colorChips)){
  316. var colorArr = item.colorChips.split(",");
  317. var colorCd = '';
  318. var rgbColor = '';
  319. for(let i=0; i<colorArr.length; i++){
  320. var colorInfo = colorArr[i].split(":");
  321. colorCd = colorInfo[0];
  322. rgbColor = colorInfo[1];
  323. if(rgbColor=='#FFFFFF'){
  324. tag += ' <span class="chip_color" style="background-color: '+rgbColor+';border:1px solid #aaa;" value="'+colorCd+'">'+colorCd+'</span>\n';
  325. }else{
  326. tag += ' <span class="chip_color" style="background-color: '+rgbColor+'" value="'+colorCd+'">'+colorCd+'</span>\n';
  327. }
  328. }
  329. }
  330. tag += ' </div>\n';
  331. if(!gagajf.isNull(item.icon)){
  332. var iconArr = item.icon.split(",");
  333. var iconGb = '';
  334. var iconNm = '';
  335. tag += ' <p class="itemBadge">\n';
  336. let arrCnt;
  337. if(iconArr.length > 2){
  338. arrCnt = 3;
  339. }else{
  340. arrCnt = iconArr.length;
  341. }
  342. for(let i=0; i<arrCnt; i++){
  343. var iconInfo = iconArr[i].split(":");
  344. iconGb = iconInfo[0];
  345. iconNm = iconInfo[1];
  346. tag += ' <span class="badge13" value="'+iconGb+'">'+iconNm+' </span>\n';
  347. }
  348. tag += ' </p>';
  349. }
  350. tag += ' </a>\n';
  351. tag += ' </div>\n';
  352. tag += '</div>\n';
  353. });
  354. $("#prodArea").append(tag);
  355. }
  356. }
  357. $(document).ready(function() {
  358. fnBestListSearch();
  359. });
  360. /*]]>*/
  361. </script>
  362. </th:block>
  363. </body>
  364. </html>