BrandSearchLayerMob.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <!DOCTYPE html>
  2. <html lang="ko"
  3. xmlns:th="http://www.thymeleaf.org">
  4. <!--
  5. *******************************************************************************
  6. * @source : BrandSearchLayerMob.html
  7. * @desc : 검색 레이어 Page
  8. *============================================================================
  9. * STYLE24
  10. * Copyright(C) 2020 TSIT, All rights reserved.
  11. *============================================================================
  12. * VER DATE AUTHOR DESCRIPTION
  13. * === =========== ========== =============================================
  14. * 1.0 2021.07.12 bin2107 최초 작성
  15. *******************************************************************************
  16. -->
  17. <body>
  18. <div class="modal-dialog" role="document">
  19. <div class="modal-content">
  20. <div class="modal-header htop">
  21. <h5 class="modal-title sr-only" id="schPopLabel">통합검색</h5>
  22. </div>
  23. <div class="modal-body">
  24. <section class="sch_result">
  25. <!-- 1.통합검색 default -->
  26. <div class="inner">
  27. <form id="searchMainForm" name="searchMainForm">
  28. <input type="hidden" name="brandGroupNo" th:value="${brandGroupNo}"/>
  29. <div class="sch_title">
  30. <input type="text" class="form_control" name="keyword" placeholder="브랜드 검색어를 입력하세요." autocomplete="off" onkeyup="fnOnkeyupKeyword(this);">
  31. <button type="button" class="btn_x" id="deleteKeyword" style="display:none;">X</button>
  32. <button type="button" class="btn_sch" id="btnSearchKeyword"><img th:src="${@environment.getProperty('domain.uximage')} + '/images/mo/ico_btn_search.png'" alt=""></button>
  33. </div>
  34. </form>
  35. </div>
  36. <div class="inner default_box" id="defaultArea">
  37. <div class="filter-list">
  38. <div class="f_left">
  39. <h3>최근 검색어</h3>
  40. </div>
  41. <div class="f_right">
  42. </div>
  43. </div>
  44. <div class="search-list" th:classappend="${#lists.isEmpty(recentlyKeywordList)?'nodata':''}"> <!-- 검색데이터 없을시 nodata 클래스 추가. -->
  45. <ul>
  46. <li th:if="${recentlyKeywordList}" th:each="oneData, status : ${recentlyKeywordList}">
  47. <a href="javascript:void(0);" th:onclick="fnSearchKeyword([[${oneData}]])">
  48. <p th:text="${oneData}"></p>
  49. </a>
  50. <button type="button" class="xBtn" th:onclick="fnDeleteCookie(this,[[${oneData}]]);"><span>삭제</span></button>
  51. </li>
  52. </ul>
  53. <p class="nodata_txt" th:if="${#lists.isEmpty(recentlyKeywordList)}">최근 검색어가 없습니다.</p>
  54. </div>
  55. <h3 class="hot-key" th:if="${brandGroupNo==null}">STYLE24에서 검색되고 있어요</h3>
  56. <div class="related_keyword" th:if="${brandGroupNo==null}">
  57. <div class="sub_category">
  58. <div class="cate_wrap" id="popularKeyArea">
  59. <!-- <a href="javascript:;" class="on">전체</a>-->
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. <!-- //1.통합검색 default -->
  65. <!-- 3.지금 많이 보고 있어요 상품. -->
  66. <div class="inner default_box" id="popularArea">
  67. <div class="now_view">
  68. <div class="store_product">
  69. <div class="allresult-tit">
  70. <h3>지금 많이 보고 있어요</h3>
  71. <button class="btn_refresh" onclick="fnRealtimeGoodsList();"><span th:text="${#calendars.format(#calendars.createNow(), 'HH:mm')}">17:30</span> 기준</button>
  72. </div>
  73. <div class="swiper-container sch_product">
  74. <div class="swiper-wrapper" id="itemViewArea">
  75. <th:block th:each="item, status : ${realtimeGoodsList}">
  76. <div class="swiper-slide">
  77. <div class="item_prod">
  78. <button type="button" class="itemLike" th:classappend="${item.wishCnt > 0}? 'likeit' : ''" onclick="cfnMoPutWishList(this);" th:attr="goodsCd=${item.itemId}">관심상품 추가</button>
  79. <a th:href="${item.itemUrl}">
  80. <img th:src="${item.imageUrl}" alt="">
  81. <div class="s-text">
  82. <div class="itemName" th:text="${item.itemName}"></div>
  83. <p class="itemTag" th:text="${item.count < 10 ? '10명 미만' : item.count + '명 보는중'}">508명 보는중</p>
  84. </div>
  85. </a>
  86. </div>
  87. </div>
  88. </th:block>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <!-- //3.지금 많이 보고 있어요 상품. -->
  95. <!-- 4.검색어 타이핑 -->
  96. <div class="inner searching_box" id="keyupArea" style="display:none;" th:if="${brandGroupNo==null}">
  97. <div class="filter-list store-list">
  98. </div>
  99. <div class="relative-list">
  100. </div>
  101. </div>
  102. <!-- //4.검색어 타이핑 -->
  103. <!-- 3.검색결과 없을때 -->
  104. <div class="inner empty_box" id="noDataArea" style="display:none;">
  105. <div class="relative-list nodata"> <!-- 검색결과 없을 시 nodata 클래스 추가 -->
  106. <p class="nodata_txt">&lsquo;<span id="noDataKeyword"></span>&rsquo; 에 맞는 상품을 찾지 못했습니다.<br>검색어를 변경해 보세요.</p>
  107. </div>
  108. <h3 class="hot-key">STYLE24에서 검색되고 있어요</h3>
  109. <div class="related_keyword">
  110. <div class="sub_category">
  111. <div class="cate_wrap" id="noDataRelatedKeyword">
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="inner empty_box" id="recommandArea" style="display:none;">
  117. <div class="recommand_product">
  118. <div class="store_product">
  119. <div class="swiper-container recommand_slide">
  120. <h3>이런 상품은 어떤가요?</h3>
  121. <div class="swiper-wrapper" id="recommendItemArea">
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <!-- //3.검색결과 없을때 -->
  128. </section>
  129. </div>
  130. </div>
  131. </div>
  132. <script src="/ux/plugins/gaga/gaga.paging.js"></script>
  133. <script th:inline="javascript">
  134. /*<![CDATA[*/
  135. var swiperschProduct = new Swiper('.swiper-container.sch_product', {
  136. slidesPerView: 3,
  137. spaceBetween: 7,
  138. autoplay: {
  139. delay: 4000,
  140. },
  141. freeMode: true,
  142. //centeredSlides: true,
  143. });
  144. var swiperschProduct = new Swiper('.swiper-container.recommand_slide', {
  145. slidesPerView: 2.2,
  146. spaceBetween: 8,
  147. autoplay: {
  148. delay: 4000,
  149. },
  150. freeMode: true,
  151. //centeredSlides: true,
  152. });
  153. $(".itemLike").click(function () {
  154. $(this).toggleClass("likeit");
  155. });
  156. var ckKeyword = "st24ck_today_keyword";
  157. var fnSetKeywordCookie = function(keyword) {
  158. var arrKeyword = new Array;
  159. var arrTempKeyword = new Array;
  160. var j = 0;
  161. arrKeyword = gagajf.getCookie(ckKeyword).split(",");
  162. if (arrKeyword.length > 0) {
  163. for (var i = 0; i < arrKeyword.length; i++) {
  164. // 쿠키에 없으면
  165. if (arrKeyword[i] != keyword && arrKeyword[i] != "") {
  166. arrTempKeyword[j++] = arrKeyword[i];
  167. }
  168. }
  169. arrTempKeyword[j++] = keyword;
  170. } else {
  171. gagajf.setCookie(ckKeyword, keyword, 1);
  172. }
  173. gagajf.setCookie(ckKeyword, arrTempKeyword, 1);
  174. }
  175. // 키워드 검색
  176. $('#btnSearchKeyword').on('click', function() {
  177. if (!gagajf.validation($('#searchMainForm'))) {
  178. return false;
  179. }
  180. let keyword = encodeURIComponent($('#searchMainForm input[name=keyword]').val());
  181. // 쿠키 세팅
  182. fnSetKeywordCookie(keyword);
  183. let actionUrl = _PAGE_BRAND_SEARCH_GOODS + '?keyword=' + keyword + '&brandGroupNo=' + $('#searchMainForm input[name=brandGroupNo]').val();
  184. cfnGoToPage(actionUrl);
  185. });
  186. // 검색어 찾기
  187. var fnGetAutoSearch = function (){
  188. gagajf.ajaxFormSubmit("/display/search/auto/complete", document.searchMainForm, fnAutoCompleteList);
  189. }
  190. // 검색어 찾기 결과
  191. var fnAutoCompleteList = function (result){
  192. if(result.autoKeywords.length==0 && gagajf.isNull(result.goodsList)){
  193. $('.sch_result .default_box').hide();
  194. $('.sch_result .searching_box').hide();
  195. $('.sch_result .empty_box').show();
  196. $("#noDataArea").find('#noDataKeyword').text($("#searchMainForm").find('input[name=keyword]').val());
  197. // 검색어 연관 상품 추천
  198. fnRecommendItemList($("#searchMainForm").find('input[name=keyword]').val());
  199. // 인기검색어
  200. fnTrendKeywordList();
  201. }else{
  202. $('.sch_result .default_box').hide();
  203. $('.sch_result .searching_box').show();
  204. $('.sch_result .empty_box').hide();
  205. // 자동완성 키워드
  206. if(result.autoKeywords != null && result.autoKeywords.length > 0){
  207. $("#keyupArea").find(".relative-list").html('');
  208. let tag = '';
  209. tag += '<ul>\n';
  210. $.each(result.autoKeywords, function (idx,item){
  211. tag += '<li>\n';
  212. tag += ' <a href="javascript:void(0);">\n';
  213. tag += ' <p><span>'+result.autoKeywords[idx]+'</span></p>\n';
  214. tag += ' </a>\n';
  215. tag += '</li>\n';
  216. });
  217. tag += '</ul>\n';
  218. $("#keyupArea").find(".relative-list").append(tag);
  219. }else{
  220. $("#keyupArea").find(".relative-list").html('');
  221. }
  222. // if(result.cateList != null && result.cateList.length > 0){
  223. // $("#keyupCateArea").find(".sch_category").html('');
  224. // let tag = '';
  225. // tag += '<h3>카테고리</h3>\n';
  226. // tag += '<ul>\n';
  227. // $.each(result.cateList, function (idx, item){
  228. // tag +='<li>\n';
  229. // tag +=' <a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'G032_101\' ';
  230. // if(item.cate1No != null){
  231. // tag += ', '+item.cate1No;
  232. // }
  233. // if(item.cate2No != null){
  234. // tag += ', '+item.cate2No;
  235. // }
  236. // if(item.cate3No != null){
  237. // tag += ', '+item.cate3No;
  238. // }
  239. // if(item.cate4No != null){
  240. // tag += ', '+item.cate4No;
  241. // }
  242. // if(item.cate5No != null){
  243. // tag += ', '+item.cate5No;
  244. // }
  245. // tag += ');">\n';
  246. // if(item.cate1Nm != null){
  247. // tag += ' <span>'+item.cate1Nm+'</span>\n';
  248. // }
  249. // if(item.cate2Nm != null){
  250. // tag += ' <span>'+item.cate2Nm+'</span>\n';
  251. // }
  252. // if(item.cate3Nm != null){
  253. // tag += ' <span>'+item.cate3Nm+'</span>\n';
  254. // }
  255. // if(item.cate4Nm != null){
  256. // tag += ' <span>'+item.cate4Nm+'</span>\n';
  257. // }
  258. // if(item.cate5Nm != null){
  259. // tag += ' <span>'+item.cate5Nm+'</span>\n';
  260. // }
  261. // tag +=' </a>\n';
  262. // tag +='</li>\n';
  263. // });
  264. // tag += '</ul>\n';
  265. //
  266. // $("#keyupCateArea").find(".sch_category").append(tag);
  267. // }else{
  268. // $("#keyupCateArea").find(".sch_category").html('');
  269. // }
  270. }
  271. }
  272. // 검색어 입력
  273. var fnOnkeyupKeyword = function (obj){
  274. var searchValue = $(obj).val();
  275. if(searchValue.length > 0){
  276. fnGetAutoSearch();
  277. }else{
  278. $('.sch_result .default_box').show();
  279. $('.sch_result .searching_box').hide();
  280. $('.sch_result .empty_box').hide();
  281. }
  282. }
  283. document.getElementById("deleteKeyword").onclick = function (){
  284. $("#searchMainForm").find("input[name=keyword]").val('');
  285. fnOnkeyupKeyword($("#searchMainForm").find("input[name=keyword]"));
  286. }
  287. $(document).ready( function() {
  288. $("#keyupArea").hide();
  289. $("#keyupCateArea").hide();
  290. $("#deleteKeyword").hide();
  291. $("#noDataArea").hide();
  292. $("#recommandArea").hide();
  293. });
  294. // 선택 단어 검색
  295. var fnSearchKeyword = function (obj){
  296. $("#searchMainForm").find("input[name=keyword]").val(obj);
  297. $('#btnSearchKeyword').trigger('click');
  298. }
  299. // 선택 단어 삭제
  300. var fnDeleteCookie = function (obj, keyword){
  301. $(obj).closest('li').remove();
  302. gagajf.setCookie('st24ck_today_keyword',keyword, -1);
  303. }
  304. // 인기검색어 조회
  305. var fnTrendKeywordList = function (){
  306. $("#noDataRelatedKeyword").html('');
  307. var html = '';
  308. $.getJSON('/display/search/trend/keyword/list', function (result){
  309. if(result.trendList.length > 0){
  310. $.each(result.trendList, function (idx, item){
  311. html += '<a href="javascript:void(0);" onclick="fnSearchKeyword(\''+item.keyword+'\');"><span>#</span>'+item.keyword+'</a>';
  312. });
  313. }
  314. $("#noDataRelatedKeyword").append(html);
  315. });
  316. }
  317. // 검색어 연관 상품 추천
  318. var fnRecommendItemList = function (keyword){
  319. if(gagajf.isNull(keyword)){
  320. keyword = "";
  321. }
  322. var data = {keyword : keyword.trim()};
  323. var html = '';
  324. $.getJSON('/display/recommend/item/list', data, function (result){
  325. $("#recommendItemArea").html('');
  326. if(result.length > 0){
  327. $.each(result, function (idx, item){
  328. html += '<div class="swiper-slide">\n';
  329. html += ' <div class="item_prod">\n';
  330. html += ' <div class="item_state">\n';
  331. html += ' <button type="button" class="itemLike">관심상품 추가</button>\n';
  332. html += ' <a href="'+item.product.itemUrl+'" class="itemLink">\n';
  333. html += ' <div class="itemPic">\n';
  334. html += ' <img class="vLHTC pd_img" src="'+item.product.itemImage+'" alt="">\n';
  335. html += ' </div>\n';
  336. html += ' <p class="itemBrand">'+item.product.brandName+'</p>\n';
  337. html += ' <div class="itemName">'+item.product.itemName+'</div>\n';
  338. html += ' <p class="itemPrice">\n';
  339. if(item.product.salePrice < item.product.originalPrice) {
  340. html += ' <span class="itemPrice_original">'+ item.product.originalPrice.addComma() +'</span>\n';
  341. }
  342. html += item.product.salePrice.addComma() ;
  343. if(item.product.salePrice < item.product.originalPrice) {
  344. html += ' <span class="itemPercent">' + Math.round((item.product.originalPrice - item.product.salePrice) / (item.product.originalPrice * 1.0) * 100) + '%</span>\n';
  345. }
  346. html += ' </p>\n';
  347. html += ' </a>\n';
  348. html += ' </div>\n';
  349. html += ' </div>\n';
  350. html += '</div>\n';
  351. });
  352. }
  353. $("#recommendItemArea").append(html);
  354. var swiperschProduct4 = new Swiper('.swiper-container.recommand_slide', {
  355. slidesPerView: 2.2,
  356. spaceBetween: 8,
  357. autoplay: {
  358. delay: 4000,
  359. },
  360. freeMode: true,
  361. //centeredSlides: true,
  362. });
  363. });
  364. }
  365. /*]]>*/
  366. </script>
  367. </body>
  368. </html>