BestMainFormWeb.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  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="web/common/layout/DefaultLayoutWeb">
  6. <!--
  7. *******************************************************************************
  8. * @source : BestMainFormWeb.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.04.13 bin2107 최초 작성
  17. *******************************************************************************
  18. -->
  19. <body>
  20. <th:block layout:fragment="content">
  21. <div id="container" class="container dp">
  22. <div class="breadcrumb">
  23. <ul>
  24. <li class="bread_home"><a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_MAIN);">홈</a></li>
  25. <li class="bread_2depth">베스트</li>
  26. </ul>
  27. </div>
  28. <div class="wrap">
  29. <div class="content wide dp_best"> <!-- 페이지특정 클래스 = dp_best -->
  30. <div class="cont_head">
  31. <div>
  32. <h3>베스트</h3>
  33. </div>
  34. </div>
  35. <div class="cont_body">
  36. <div class="taps">
  37. <div>
  38. <ul id="cateListArea">
  39. <li class="active" id="li0"><a href="javascript:void(0);" onclick="fnBestListSearch(this,'');">전체</a></li>
  40. <th:block th:each="item, stat : ${bestCateList}">
  41. <li class="" th:id="${'li'+item.cateNo}"><a href="javascript:void(0);" th:onclick="fnBestListSearch(this,[[${item.cateNo}]]);" th:text="${item.cateNm}"></a></li>
  42. </th:block>
  43. </ul>
  44. </div>
  45. </div>
  46. <!-- 지금 많이 보고 있어요 -->
  47. <div class="dp_best_live">
  48. <div class="sec_head">
  49. <p class="dp_live_txt"><img th:src="${@environment.getProperty('domain.uximage')} + '/images/pc/dp_best_livetxt.jpg'" alt="STYLE24 실시간 베스트 상품! "></p>
  50. <p class="displayH">지금 많이 <br> <span>보고 있어요</span></p>
  51. <button type="button" id="researchBtn"><span><em class="time" th:text="${#calendars.format(#calendars.createNow(), 'HH:mm')}">17:30</em> 기준</span></button>
  52. </div>
  53. <div class="sec_body" >
  54. <div class="swiper-container dp_live_slider">
  55. <div class="swiper-wrapper" id="itemViewArea">
  56. <!-- <th:block th:each="item, status : ${viewBestGoodsList}">-->
  57. <!-- <div class="swiper-slide">-->
  58. <!-- <div class="item_prod">-->
  59. <!-- <div class="item_state">-->
  60. <!-- <button type="button" class="itemLike" th:classappend="${item.wishCnt > 0} ? 'likeit active'" onclick="cfnPutWishList(this);" th:attr="goodsCd=${item.itemId}, goodsNm=${item.itemName}">관심상품 추가</button>-->
  61. <!-- <a th:href="${item.itemUrl}" class="itemLink">-->
  62. <!-- <div class="itemPic">-->
  63. <!-- <img alt="" class="vLHTC pd_img" th:src="${item.imageUrl}">-->
  64. <!-- </div>-->
  65. <!-- <div class="itemName" th:text="${item.itemName}"></div>-->
  66. <!-- <div class="viewCount">-->
  67. <!-- <span th:text="${item.count < 10 ? '10명 미만' : item.count + '명 보는중'}"></span>-->
  68. <!-- </div>-->
  69. <!-- </a>-->
  70. <!-- </div>-->
  71. <!-- </div>-->
  72. <!-- </div>-->
  73. <!-- </th:block>-->
  74. </div>
  75. <div class="swiper-controls">
  76. <div class="swiper-scrollbar"></div>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <!-- 지금 많이 보고 있어요 -->
  82. </div>
  83. </div>
  84. <div class="content dp_best_top100">
  85. <div class="cont_head">
  86. <div>
  87. <h3>베스트 TOP100</h3>
  88. </div>
  89. </div>
  90. <div class="cont_body">
  91. <div class="ui_row">
  92. <div class="ui_col_12">
  93. <form class="form_wrap">
  94. <div class="form_field">
  95. <div class="select_custom select_sex">
  96. <div class="combo">
  97. <div class="select">구매 성별 전체</div>
  98. <ul class="list">
  99. <!-- 선택처리 class="selected" / 선택불가 aria-disabled="true" 추가 -->
  100. <li class="selected" data-id="" onclick="fnGetEigenD002(this, 'gender');">전체</li>
  101. <li data-id="A" onclick="fnGetEigenD002(this, 'gender');">남성</li>
  102. <li data-id="B" onclick="fnGetEigenD002(this, 'gender');">여성</li>
  103. </ul>
  104. </div>
  105. </div>
  106. <div class="select_custom select_age">
  107. <div class="combo">
  108. <div class="select">구매 연령 전체</div>
  109. <ul class="list">
  110. <!-- 선택처리 class="selected" / 선택불가 aria-disabled="true" 추가 -->
  111. <li class="selected" data-id="" onclick="fnGetEigenD002(this, 'age');">전체</li>
  112. <li data-id="10" onclick="fnGetEigenD002(this, 'age');">10대</li>
  113. <li data-id="20" onclick="fnGetEigenD002(this, 'age');">20대</li>
  114. <li data-id="30" onclick="fnGetEigenD002(this, 'age');">30대</li>
  115. <li data-id="40" onclick="fnGetEigenD002(this, 'age');">40대</li>
  116. <li data-id="50" onclick="fnGetEigenD002(this, 'age');">50대 이상</li>
  117. </ul>
  118. </div>
  119. </div>
  120. </div>
  121. </form>
  122. </div>
  123. </div>
  124. <div class="list_content">
  125. <div class="itemsGrp" id="prodArea">
  126. </div>
  127. </div>
  128. </div>
  129. </div>
  130. <div class="last_page" id="divLastPage" style="display: none;">
  131. <span>마지막 페이지입니다.</span>
  132. </div>
  133. </div>
  134. </div>
  135. <form id="bestGoodsForm" name="bestGoodsForm">
  136. <input type="hidden" name="pageNo" id="pageNo" value ="1"/>
  137. <input type="hidden" name="pageSize" value ="50"/>
  138. <input type="hidden" name="cateNo" value=""/>
  139. <input type="hidden" name="sortGb"/>
  140. </form>
  141. <!-- 수동설정 + 추천솔루션 카운트 문제로 인해 인피티니스크롤 제거 협의 21-07-21 -->
  142. <!-- <script src="/ux/plugins/gaga/gaga.infinite.scrollSession.js"></script>-->
  143. <!-- <script src="/ux/plugins/jquery/jquery.history.min.js"></script>-->
  144. <!-- <script th:src="@{'/biz/goods.js?v=' + ${#calendars.format(#calendars.createNow(), 'yyyyMMddHHmmss')}}" src="/biz/goods.js"></script>-->
  145. <script th:inline="javascript">
  146. /*<![CDATA[*/
  147. var bestCateList = [[${bestCateList}]];
  148. $(document).ready( function() {
  149. // 베스트TOP100 정렬
  150. var select_sex = new sCombo('.select_sex.select_custom');
  151. var select_age = new sCombo('.select_age.select_custom');
  152. });
  153. var fnBestListSearch = function (obj, cateNo){
  154. $.each($("#cateListArea").find('li'), function() {
  155. $(this).removeClass();
  156. });
  157. if(gagajf.isNull(cateNo)){
  158. $("#li0").addClass('active');
  159. }else{
  160. $("#li"+cateNo).addClass('active');
  161. }
  162. $("#bestGoodsForm input[name=cateNo]").val(cateNo);
  163. // 카테고리별 실시간 베스트 상품 조회 getRealtimeViewBestGoodsList
  164. fnRealtimeViewBestList(cateNo);
  165. // TOP100 조회
  166. fnBestTop100List();
  167. }
  168. var fnRealtimeViewBestList = function (cateNo){
  169. if(gagajf.isNull(cateNo)){
  170. cateNo = "";
  171. }
  172. var data = {cateNo : cateNo};
  173. var html = '';
  174. $.getJSON('/display/realtime/best/list' , data, function (result, status){
  175. $("#itemViewArea").html('');
  176. if(result.length > 0){
  177. $.each(result, function (idx, item){
  178. // 2021.08.30 이미지 null 처리
  179. if (item.itemName != null) {
  180. var imgUrl = '';
  181. html += '<div class="swiper-slide">\n';
  182. html += ' <div class="item_prod">\n';
  183. html += ' <div class="item_state">\n';
  184. html += ' <button type="button" class="itemLike" onclick="cfnPutWishList(this)" goodsCd="'+item.itemId+'" goodsNm="'+ item.itemName+'" ithrCd="" contentsLoc="IN10_01" planDtlSq="">관심상품 추가</button>\n';
  185. html += ' <a href="javascript:void(0);" class="itemLink" onclick="cfnGoToGoodsDetail(\''+item.itemId+'\',\'\',\'IN10_01\')">\n';
  186. html += ' <div class="itemPic">\n';
  187. html += ' <img alt="" class="vLHTC pd_img" src="' + item.imageUrl + '">\n';
  188. html += ' </div>\n';
  189. html += ' <div class="itemName">'+item.itemName+'</div>\n';
  190. if(item.count < 10){
  191. html += '<div class="viewCount"><span>10명</span> 미만</div>\n';
  192. }else{
  193. html += ' <div class="viewCount"><span>'+item.count.addComma()+'</span>명 보는중</div>\n';
  194. }
  195. html += ' </a>\n';
  196. html += ' </div>\n';
  197. html += ' </div>\n';
  198. html += '</div>\n';
  199. }
  200. });
  201. }
  202. $("#itemViewArea").append(html);
  203. $("#researchBtn").attr("onclick","fnRealtimeViewBestList("+cateNo+");");
  204. /* SLIDE - 지금많이 보고있어요 */
  205. var dp_live_slide = new Swiper ('.dp_best_live .dp_live_slider', {
  206. slidesPerView: 6,
  207. spaceBetween: 20,
  208. speed : 1000,
  209. freeMode: true,
  210. autoplay: false,
  211. scrollbar: {
  212. el: '.dp_best_live .swiper-scrollbar',
  213. hide: false,
  214. },
  215. });
  216. });
  217. }
  218. var fnBestTop100List = function (){
  219. gagajf.ajaxFormSubmit("/display/best/main/goods/list", document.bestGoodsForm, fnCallbackBestTop100);
  220. }
  221. let bestCnt = 0;
  222. let eigenBestCnt = 0;
  223. var fnCallbackBestTop100 = function (result){
  224. $("#prodArea").html('');
  225. var tag = '';
  226. bestCnt = result.dataList.length;
  227. if(result.dataList.length > 0){
  228. $.each(result.dataList, function (idx, item){
  229. tag += '<div class="item_prod">\n';
  230. tag += ' <div class="item_state">\n';
  231. tag += ' <button type="button" class="itemLike" onclick="wishlistDelete(this)" goodsCd="'+item.goodsCd+'" goodsNm="'+ item.goodsNm+'" ithrCd="" contentsLoc="IN10_01" planDtlSq="">관심상품 추가</button>\n';
  232. tag += ' <a href="javascript:void(0);" class="itemLink" onclick="cfnGoToGoodsDetail(\''+item.goodsCd+'\', \''+item.mainColorCd+'\',\'IN10_01\')">\n';
  233. tag += '<div class="shape ';
  234. if(idx==0){
  235. tag += ' ranker';
  236. }
  237. tag += '"><span>'+(idx+1)+'</span></div>\n';
  238. tag += ' <div class="itemPic">\n';
  239. tag += ' <img alt="BLUE-a" class=" vLHTC pd_img" src="' + _uploadGoodsUrl + '/' + item.sysImgNm + '">\n';
  240. tag += ' </div>\n';
  241. tag += ' <p class="itemBrand">'+item.brandGroupNm+'</p>\n';
  242. if (item.goodsTnm != null && item.goodsTnm != '') {
  243. tag+=' <div class="itemComment">'+item.goodsTnm+'</div>\n';
  244. }
  245. tag += ' <div class="itemName">'+item.goodsFullNm+'</div>\n';
  246. tag += ' <p class="itemPrice">'+item.currPrice.addComma();
  247. if (item.currPrice != item.listPrice) {
  248. tag+=' <span class="itemPrice_original">'+item.listPrice.addComma()+'</span>\n';
  249. tag+=' <span class=" itemPercent">'+ Math.round((item.listPrice - item.currPrice) / (item.listPrice * 1.0) * 100) +'%</span>\n';
  250. }
  251. tag += ' </p>\n';
  252. tag += ' <div class="itemcolorchip">\n';
  253. if(!gagajf.isNull(item.colorChips)){
  254. var colorArr = item.colorChips.split(",");
  255. var colorCd = '';
  256. var rgbColor = '';
  257. for(let i=0; i<colorArr.length; i++){
  258. var colorInfo = colorArr[i].split(":");
  259. colorCd = colorInfo[0];
  260. rgbColor = colorInfo[1];
  261. if(rgbColor=='#FFFFFF'){
  262. tag += ' <span class="chip_color" style="background-color: '+rgbColor+';border:1px solid #aaa;" value="'+colorCd+'">'+colorCd+'</span>\n';
  263. }else{
  264. tag += ' <span class="chip_color" style="background-color: '+rgbColor+'" value="'+colorCd+'">'+colorCd+'</span>\n';
  265. }
  266. }
  267. }
  268. tag += ' </div>\n';
  269. if(!gagajf.isNull(item.icon)){
  270. var iconArr = item.icon.split(",");
  271. var iconGb = '';
  272. var iconNm = '';
  273. tag += ' <p class="itemBadge">\n';
  274. let arrCnt;
  275. if(iconArr.length > 2){
  276. arrCnt = 3;
  277. }else{
  278. arrCnt = iconArr.length;
  279. }
  280. for(let i=0; i<arrCnt; i++){
  281. var iconInfo = iconArr[i].split(":");
  282. iconGb = iconInfo[0];
  283. iconNm = iconInfo[1];
  284. tag += ' <span class="badge13" value="'+iconGb+'">'+iconNm+' </span>\n';
  285. }
  286. tag += ' </p>';
  287. }
  288. tag += ' </a>\n';
  289. tag += ' </div>\n';
  290. tag += '</div>\n';
  291. });
  292. $("#prodArea").append(tag);
  293. }
  294. // 수동설정이 100미만이면 추천솔루션 데이터 추가 조회
  295. if(bestCnt < 100){
  296. eigenBestCnt = 100 - bestCnt;
  297. fnGetEigenBestData(eigenBestCnt);
  298. }
  299. }
  300. // 추천솔루션 데이터 추가 조회
  301. var fnGetEigenBestData = function (cnt){
  302. var eigenUrl = '';
  303. var selectCateNo = $("#bestGoodsForm input[name=cateNo]").val();
  304. if(gagajf.isNull(selectCateNo)){
  305. /* cateNo 전체 일 때 */
  306. eigenUrl = 'https://api.eigene.io/rec/m061?size='+cnt+'&cuid=1252aed4-78dc-46e8-b784-94ac42e86dd4';
  307. }else{
  308. eigenUrl = 'https://api.eigene.io/rec/m060?size='+cnt+'&cuid=1252aed4-78dc-46e8-b784-94ac42e86dd4&incids='+selectCateNo;
  309. }
  310. var tag = '';
  311. $.getJSON(eigenUrl, function (result, status){
  312. if (status === 'success') {
  313. if (!gagajf.isNull(result.results)) {
  314. $.each(result.results, function (idx, item) {
  315. tag += '<div class="item_prod">\n';
  316. tag += ' <div class="item_state">\n';
  317. tag += ' <button type="button" class="itemLike" onclick="wishlistDelete(this)" goodsCd="'+item.product.itemId+'" goodsNm="'+ item.product.itemName+'" ithrCd="" contentsLoc="IN10_01" planDtlSq="">관심상품 추가</button>\n';
  318. tag += ' <a href="javascript:void(0);" class="itemLink" onclick="cfnGoToGoodsDetail(\''+item.product.itemId+'\', \'\',\'IN10_01\')">\n';
  319. tag += '<div class="shape ';
  320. if(cnt == 100 && idx==0){
  321. tag += ' ranker';
  322. }
  323. tag += '"><span>'+(bestCnt+idx+1)+'</span></div>\n';
  324. tag += ' <div class="itemPic">\n';
  325. tag += ' <img alt="BLUE-a" class=" vLHTC pd_img" src="'+ item.product.itemImage +'">\n';
  326. tag += ' </div>\n';
  327. tag += ' <p class="itemBrand">'+item.product.brandName+'</p>\n';
  328. tag += ' <div class="itemName">'+item.product.itemName+'</div>\n';
  329. tag += ' <p class="itemPrice">'+item.product.salePrice.addComma();
  330. if (item.product.originalPrice != item.product.salePrice) {
  331. tag+=' <span class="itemPrice_original">'+item.product.originalPrice.addComma()+'</span>\n';
  332. tag+=' <span class=" itemPercent">'+ Math.round((item.product.originalPrice - item.product.salePrice) / (item.product.originalPrice * 1.0) * 100) +'%</span>\n';
  333. }
  334. tag += ' </p>\n';
  335. tag += ' </a>\n';
  336. tag += ' </div>\n';
  337. tag += '</div>\n';
  338. });
  339. $("#prodArea").append(tag);
  340. }
  341. }
  342. });
  343. }
  344. // 구매 성별/연령 별 베스트 상품 추천
  345. var fnGetEigenD002 = function (obj, key){
  346. var gender = '';
  347. var age = '';
  348. if(key == 'gender'){
  349. gender = $(obj).attr("data-id");
  350. $('.select_age .list').find('li').each(function (){
  351. if($(this).hasClass("selected")){
  352. age = $(this).attr("data-id");
  353. }
  354. });
  355. }else{
  356. age = $(obj).attr("data-id");
  357. $('.select_sex .list').find('li').each(function (){
  358. if($(this).hasClass("selected")){
  359. gender = $(this).attr("data-id");
  360. }
  361. });
  362. }
  363. if(gagajf.isNull(gender) && gagajf.isNull(age)){
  364. $("#prodArea").html('');
  365. fnGetEigenBestData(100);
  366. }else{
  367. $("#prodArea").html('');
  368. var eigenUrl = 'https://api.eigene.io/rec/d002?size=100&cuid=1252aed4-78dc-46e8-b784-94ac42e86dd4&gender='+gender+'&age='+age;
  369. var tag = '';
  370. $.getJSON(eigenUrl, function (result, status){
  371. if (status === 'success') {
  372. if (!gagajf.isNull(result.results)) {
  373. $.each(result.results, function (idx, item) {
  374. tag += '<div class="item_prod">\n';
  375. tag += ' <div class="item_state">\n';
  376. tag += ' <button type="button" class="itemLike" onclick="wishlistDelete(this)" goodsCd="'+item.product.itemId+'" goodsNm="'+ item.product.itemName+'" ithrCd="" contentsLoc="IN10_01" planDtlSq="">관심상품 추가</button>\n';
  377. tag += ' <a href="javascript:void(0);" class="itemLink" onclick="cfnGoToGoodsDetail(\''+item.product.itemId+'\', \'\',\'IN10_01\')">\n';
  378. tag += '<div class="shape ';
  379. if(idx==0){
  380. tag += ' ranker';
  381. }
  382. tag += '"><span>'+(idx+1)+'</span></div>\n';
  383. tag += ' <div class="itemPic">\n';
  384. tag += ' <img alt="BLUE-a" class=" vLHTC pd_img" src="'+ item.product.itemImage +'">\n';
  385. tag += ' </div>\n';
  386. tag += ' <p class="itemBrand">'+item.product.brandName+'</p>\n';
  387. tag += ' <div class="itemName">'+item.product.itemName+'</div>\n';
  388. tag += ' <p class="itemPrice">'+item.product.salePrice.addComma();
  389. if (item.product.originalPrice != item.product.salePrice) {
  390. tag+=' <span class="itemPrice_original">'+item.product.originalPrice.addComma()+'</span>\n';
  391. tag+=' <span class=" itemPercent">'+ Math.round((item.product.originalPrice - item.product.salePrice) / (item.product.originalPrice * 1.0) * 100) +'%</span>\n';
  392. }
  393. tag += ' </p>\n';
  394. tag += ' </a>\n';
  395. tag += ' </div>\n';
  396. tag += '</div>\n';
  397. });
  398. $("#prodArea").append(tag);
  399. }
  400. }
  401. });
  402. }
  403. }
  404. $(document).ready(function() {
  405. fnBestListSearch();
  406. });
  407. /*]]>*/
  408. </script>
  409. </th:block>
  410. </body>
  411. </html>