SocialMainFormWeb.html 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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 : SocialMainFormWeb.html
  9. * @desc : 소셜메인(핫딜메인) Page
  10. *============================================================================
  11. * Pastelmall
  12. * Copyright(C) 2020 TSIT, All rights reserved.
  13. *============================================================================
  14. * VER DATE AUTHOR DESCRIPTION
  15. * === =========== ========== =============================================
  16. * 1.0 2021.3.11 sowon 최초 작성
  17. *******************************************************************************
  18. -->
  19. <body>
  20. <th:block layout:fragment="content">
  21. <!-- container -->
  22. <div id="container" class="container dp">
  23. <div class="breadcrumb">
  24. <ul>
  25. <li class="bread_home"><a href="javascript:void(0);" onclick="cfnGoToPage(_PAGE_MAIN);">홈</a></li>
  26. <li class="bread_2depth">핫딜</li>
  27. </ul>
  28. </div>
  29. <div class="wrap">
  30. <div class="nodata" style="display: none;">
  31. <div class="txt_box">
  32. <p>진행하는 핫딜이 없습니다.</p>
  33. </div>
  34. <div class="btn_box">
  35. <button class="btn btn_default" onclick="cfnGoToPage(_PAGE_MAIN);">
  36. <span>홈으로 가기</span>
  37. </button>
  38. </div>
  39. </div>
  40. <th:block th:if="${socialInfo != null}">
  41. <div class="content wide dp_hotdeal"> <!-- 페이지특정 클래스 = dp_hotdeal -->
  42. <div class="cont_body">
  43. <div class="hotdeal">
  44. <img src="/images/pc/thumb/hotdeal_bg2.jpg" alt="핫한 아이템을 핫한 가격에 LAST DAY DEAL">
  45. <div id="countdown">
  46. <span id="h-hours"></span>
  47. <span id="h-minutes"></span>
  48. <span id="h-seconds"></span>
  49. </div>
  50. </div>
  51. <div class="list_content">
  52. <div class="itemsGrp rowtype"> <!-- itemsGrp rank hot deal --> <!-- rowtype 추가시 가로형태로 출력 -->
  53. <section id="infiniteContainer">
  54. <div id="listBoxOuter">
  55. <ul id="listBox">
  56. </ul>
  57. </div>
  58. </section>
  59. </div>
  60. <div class="last_page" id="divLastPage" style="display: none;">
  61. <span>마지막 페이지입니다.</span>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </th:block>
  67. </div>
  68. </div>
  69. <form id="socialForm" name="socialForm" action="#" th:action="@{'/social/list'}">
  70. <input type="hidden" name="pageNo" id="pageNo" value ="1"/>
  71. <input type="hidden" name="pageSize" value ="10"/>
  72. </form>
  73. <script src="/ux/plugins/gaga/gaga.infinite.scrollSession.js"></script>
  74. <script src="/ux/plugins/jquery/jquery.history.min.js"></script>
  75. <script th:inline="javascript">
  76. let socialInfo = [[${socialInfo}]];
  77. let goodsView =[[${@environment.getProperty('upload.goods.view')}]]
  78. var socialAddCart = function (obj) {
  79. let btnType = "C";
  80. let params = [];
  81. let cart = new Object();
  82. cart.goodsCd = $(obj).attr("goodsCd");
  83. cart.optCd = $(obj).attr("optCd");
  84. cart.goodsQty = $(obj).attr("minOrdQty");
  85. cart.goodsType = $(obj).attr("goodsType");
  86. cart.cartGb = btnType;
  87. cart.afLinkCd = $(obj).attr("afLinkCd");
  88. cart.ithrCd = "";
  89. cart.contentsLoc = "";
  90. cart.planDtlSq = "";
  91. params.push(cart);
  92. // 장바구니담기
  93. if (params.length > 0){
  94. cfnAddCart(params);
  95. }
  96. }
  97. let fnGetSocialList = function(result) {
  98. var html = '';
  99. $.each(result.dataList, function(idx, item) {
  100. html += ' <div class="item_prod"class="item_prod">';
  101. if (item.stockQtySum == 0) {
  102. html += ' <div class="item_state sold_out"> ';
  103. }else{
  104. html += ' <div class="item_state"> ';
  105. }
  106. if (item.likeIt == 'likeit') {
  107. html += ' <button type="button" class="itemLike active" onclick="cfnPutWishList(this);" onClick="cfnPutWishList(this);" goodsCd=\''+item.goodsCd+'\', ithrCd=\'\', contentsLoc=\'\', planDtlSq=\'\'>관심상품 추가</button>';
  108. }else{
  109. html += ' <button type="button" class="itemLike" onclick="cfnPutWishList(this);" onClick="cfnPutWishList(this);" goodsCd=\''+item.goodsCd+'\', ithrCd=\'\', contentsLoc=\'\', planDtlSq=\'\'>관심상품 추가</button>';
  110. }
  111. html += ' <a href="javascript:void(0);" class="itemLink" onclick="cfnGoToGoodsDetail(\''+item.goodsCd+'\')" >';
  112. html += ' <div class="itemPic">';
  113. html += ' <img alt="BLUE-a" class=" vLHTC pd_img" src="'+ goodsView +'/'+item.sysImgNm +'">';
  114. html += ' </div>';
  115. html += ' <div class="itemSpecialPrice"><span>특가</span></div>';
  116. html += ' <p class="itemBrand">'+item.brandGroupNm+'</p>';
  117. html += ' <div class="itemName">'+item.goodsNm+'</div>';
  118. html += ' <p class="itemPrice">';
  119. html += item.currPrice.addComma() +'원';
  120. if (item.currPrice != item.listPrice) {
  121. html += ' <span class="itemPrice_original">'+item.listPrice.addComma()+'원</span>';
  122. }
  123. if (item.dcRate != 0) {
  124. html += ' <span class=" itemPercent">'+item.dcRate.addComma()+'%</span>';
  125. }
  126. html += ' </p>';
  127. if(item.goodsTnm != null){
  128. html += ' <div class="itemComment">'+item.goodsTnm+'</div>';
  129. }
  130. html += ' </a>';
  131. html += ' <div class="shopBagBtn">';
  132. html += ' <button type="button" class="btn btn_defalt" onclick="socialAddCart(this)" goodsCd=\''+item.goodsCd+'\', minOrdQty=\''+item.minOrdQty+'\', goodsType=\''+item.goodsType+'\', optCd=\''+item.optCd+'\'">';
  133. html += ' <span>쇼핑백 담기</span>';
  134. html += ' </button>';
  135. html += ' </div>';
  136. html += ' </div>';
  137. html += '</div>';
  138. });
  139. return html;
  140. }
  141. var fnSocialListSearch = function() {
  142. fnSocialInfiniteScrollInit();
  143. gagaInfiniteScroll.getHistory();
  144. }
  145. // 인피니트 스크롤 초기화
  146. var fnSocialInfiniteScrollInit = function(){
  147. sessionStorage.removeItem(document.location.href);
  148. //History 초기화
  149. $("#listBox").html("");
  150. }
  151. //인피니트 스크롤 이벤트 발생 시 데이터 가져오기
  152. var fnGetInfiniteScrollDataList = function(pageNum) {
  153. $("#socialForm input[name=pageNo]").val(pageNum+1);
  154. gagajf.ajaxFormSubmit("/social/list",document.socialForm, gagaInfiniteScroll.jsonToHtml);
  155. }
  156. var fnDrawInfiniteScrollData = function (result){
  157. let totalCnt = result.totalCnt;
  158. gagaInfiniteScroll.pageStatus.totalCount = result.totalCnt;
  159. if (result.dataList != null && result.dataList.length > 0) {
  160. $(".nodata").hide();
  161. let lastPage = result.paging.pageable.pageNo;
  162. let endRow = result.endRow - result.paging.pageable.pageSize;
  163. var htm = fnGetSocialList(result, lastPage, endRow);
  164. gagaInfiniteScroll.draw(htm);
  165. }else{
  166. if($("#socialForm input[name=pageNo]").val()==1){
  167. $(".nodata").show();
  168. }
  169. $("#divLastPage").show();
  170. gagaInfiniteScroll.draw('not');
  171. }
  172. }
  173. $(function(){
  174. fnSocialListSearch();
  175. /* 핫딜 countDown */
  176. function hotdealTimer() {
  177. var endTime = new Date(socialInfo.socialEddt); // 남은시간 지정
  178. endTime = (Date.parse(endTime) / 1000);
  179. var now = new Date();
  180. now = (Date.parse(now) / 1000);
  181. var timeLeft = endTime - now;
  182. var days = Math.floor(timeLeft / 86400);
  183. var hours = Math.floor((timeLeft - (days * 86400)) / 3600);
  184. var minutes = Math.floor((timeLeft - (days * 86400) - (hours * 3600 )) / 60);
  185. var seconds = Math.floor((timeLeft - (days * 86400) - (hours * 3600) - (minutes * 60)));
  186. if (hours < '10') { hours = '0' + hours; }
  187. if (minutes < '10') { minutes = '0' + minutes; }
  188. if (seconds < '10') { seconds = '0' + seconds; }
  189. //$('#d-days').html(days);
  190. $('#h-hours').html(hours);
  191. $('#h-minutes').html(minutes);
  192. $('#h-seconds').html(seconds);
  193. }
  194. if (socialInfo != null) {
  195. setInterval(function() { hotdealTimer(); }, 1000);
  196. }
  197. /* countDown */
  198. });
  199. /* $(window).on("pageshow", function(event) {
  200. if ( (event.originalEvent && event.originalEvent.persisted) || (window.performance && window.performance.navigation.type == 2)) {
  201. var historyData = sessionStorage.getItem(document.location.href);
  202. if(historyData!=null){
  203. historyData = JSON.parse(historyData);
  204. }else{
  205. historyData = {};
  206. }
  207. fnSocialListSearch();
  208. }else{
  209. fnSocialListSearch();
  210. }
  211. });
  212. */
  213. </script>
  214. </th:block>
  215. </body>
  216. </html>