Просмотр исходного кода

상품리스트 필터 관련 수정

bin2107 5 лет назад
Родитель
Сommit
acc4a58327

+ 5 - 0
src/main/java/com/style24/persistence/domain/GoodsSearch.java

@@ -59,6 +59,11 @@ public class GoodsSearch extends TscBaseDomain {
     private String  filterCd;
     private String  filterNm;
 
+    private String priceHigh;
+    private String priceRow;
+    private String dcrateHigh;
+    private String dcrateRow;
+
     private TscPageRequest pageable;				// 페이징
     private int pageNo = 1;
     private int pageSize = 50;

+ 42 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsfDisplay.xml

@@ -83,7 +83,7 @@
 		    </when>
 		    <otherwise>
 		     , GTAB_SQ                                            /*GNB탭일련번호*/
-		     , CASE WHEN CONTENTS_TYPE = 'C' THEN (SELECT CONTENTS_TITLE FROM	TB_MAIN_LAYOUT WHERE CONTENTS_LOC = 'STAB003') ELSE '' END AS GTAB_BANNER_TITLE
+		     , CASE WHEN CONTENTS_TYPE = 'C' OR CONTENTS_TYPE = 'O' THEN (SELECT CONTENTS_TITLE FROM	TB_MAIN_LAYOUT WHERE CONTENTS_LOC = 'STAB003') ELSE '' END AS GTAB_BANNER_TITLE
 		FROM   TB_GNB_TAB A
 		    </otherwise>
 		</choose>
@@ -757,6 +757,19 @@
 		           AND    S.STOCK_QTY > 0 /*재고있는 상품*/
 		           AND    B.USE_YN = 'Y' /*사용하는 브랜드*/
 		           AND    BG.USE_YN = 'Y' /*사용하는 브랜드그룹*/
+		           <if test="priceHigh != null and priceHigh != ''">
+		           AND    G.CURR_PRICE <![CDATA[<=]]> #{priceHigh}
+		           </if>
+		           <if test="priceRow != null and priceRow != ''">
+		           AND    G.CURR_PRICE <![CDATA[>=]]> #{priceRow}
+		           </if>
+		           <if test="dcrateHigh != null and dcrateHigh != ''">
+		           AND    G.DC_RATE <![CDATA[<=]]> #{dcrateHigh}
+		           </if>
+		           <if test="dcrateRow != null and dcrateRow != ''">
+		           AND    G.DC_RATE <![CDATA[>=]]> #{dcrateRow}
+		           </if>
+		           <include refid="getCategoryGoodsList_sql"/>
 		) G
 		WHERE  1 = 1
 		)
@@ -908,6 +921,19 @@
 		                    AND    S.STOCK_QTY > 0 /*재고있는 상품*/
 		                    AND    B.USE_YN = 'Y' /*사용하는 브랜드*/
 		                    AND    BG.USE_YN = 'Y' /*사용하는 브랜드그룹*/
+		                <if test="priceHigh != null and priceHigh != ''">
+		                    AND    G.CURR_PRICE <![CDATA[<=]]> #{priceHigh}
+		                </if>
+		                <if test="priceRow != null and priceRow != ''">
+		                    AND    G.CURR_PRICE <![CDATA[>=]]> #{priceRow}
+		                </if>
+		                <if test="dcrateHigh != null and dcrateHigh != ''">
+		                    AND    G.DC_RATE <![CDATA[<=]]> #{dcrateHigh}
+		                </if>
+		                <if test="dcrateRow != null and dcrateRow != ''">
+		                    AND    G.DC_RATE <![CDATA[>=]]> #{dcrateRow}
+		                </if>
+		                <include refid="getCategoryGoodsList_sql"/>
 		                ) G
 		          WHERE  1 = 1
 		)
@@ -1131,6 +1157,21 @@
 		             AND O.GOODS_CD = G.GOODS_CD
 		     )
 		</if>
+		<if test='seasonSearch != null and seasonSearch.length > 0'>
+		     AND G.SEASON_CD IN
+		    <foreach collection="seasonSearch" item="item" index="index"  open="(" close=")" separator=",">
+		         #{item}
+		    </foreach>
+		</if>
+		<if test='benefitSearch != null and benefitSearch.length > 0'>
+			AND EXISTS ( SELECT 1 FROM TB_GOODS_BENEFIT
+			WHERE GOODS_CD = G.GOODS_CD
+			AND BENEFIT_GB IN
+			<foreach collection="benefitSearch" item="item" index="index" open="(" close=")" separator=",">
+				#{item}
+			</foreach>
+			)
+		</if>
 	</sql>
 
 	<!-- 카테고리별 상품 총 리스트 -->

+ 3 - 3
src/main/webapp/WEB-INF/views/web/common/fragments/GnbWeb.html

@@ -678,11 +678,11 @@
 								});
 							} else if(item.contentsType == 'O'){
 								let outletCate = fnGetOutletCategory(item.gtabNm);
-
 								$('#divGnbTab').append(outletCate);
 								// $('#divGnbTab').append('<li><a href="' + item.linkUrl + '">' + item.gtabNm + '</a></li>');
 								$('#ulGnbTab').append('<li><a href="' + item.linkUrl + '">' + item.gtabNm + '</a></li>');
 								fnGetOutletLeafCategory();
+								fnGetGnbBanner('3000',item.gtabBannerTitle);
 							} else if (item.contentsType == 'L') { // 컨텐츠유형:링크
 								$('#divGnbTab').append('<li><a href="' + item.linkUrl + '">' + item.gtabNm + '</a></li>');
 								$('#ulGnbTab').append('<li><a href="' + item.linkUrl + '">' + item.gtabNm + '</a></li>');
@@ -715,8 +715,8 @@
 		tag += '				</ul>\n';
 		tag += '			</div>\n';
 		tag += '		</div>\n';
-		// tag += '	<div class="head_banner" id="outlet'+allCateItem.cate1No+'">\n';
-		// tag += '	</div>';
+		tag += '	<div class="head_banner" id="id3000">\n';
+		tag += '	</div>';
 		tag += '	</div>\n';
 		tag += '</li>\n';
 		return tag;

+ 78 - 20
src/main/webapp/WEB-INF/views/web/display/CategoryGoodsListFormWeb.html

@@ -113,7 +113,7 @@
 											<strong>하의</strong>
 											<th:block th:each="filterSizeData, filterSizeStat : ${filterSizeList}" th:if="${filterSizeData.filterCd == 'B'}">
 												<label class="size_btn">
-													<input type="checkbox" group="filterValue" th:id="${'chkFilterBSize'+filterSizeStat.count}" name="size2" th:vale="${filterSizeData.filterNm}" th:data-id="${filterSizeData.filterNm}" onclick="filterSel(this,'size','off','2');"><span th:text="${filterSizeData.filterNm}">80</span>
+													<input type="checkbox" group="filterValue" th:id="${'chkFilterBSize'+filterSizeStat.count}" name="size" th:vale="${filterSizeData.filterNm}" th:data-id="${filterSizeData.filterNm}" onclick="filterSel(this,'size','off','2');"><span th:text="${filterSizeData.filterNm}">80</span>
 												</label>
 											</th:block>
 										</li>
@@ -121,7 +121,7 @@
 											<strong>신발</strong>
 											<th:block th:each="filterSizeData, filterSizeStat : ${filterSizeList}" th:if="${filterSizeData.filterCd == 'S'}">
 												<label class="size_btn">
-													<input type="checkbox" group="filterValue" th:id="${'chkFilterSSize'+filterSizeStat.count}" name="size3" th:vale="${filterSizeData.filterNm}" th:data-id="${filterSizeData.filterNm}" onclick="filterSel(this,'size','off','3');"><span th:text="${filterSizeData.filterNm}">80</span>
+													<input type="checkbox" group="filterValue" th:id="${'chkFilterSSize'+filterSizeStat.count}" name="size" th:vale="${filterSizeData.filterNm}" th:data-id="${filterSizeData.filterNm}" onclick="filterSel(this,'size','off','3');"><span th:text="${filterSizeData.filterNm}">80</span>
 												</label>
 											</th:block>
 										</li>
@@ -132,7 +132,9 @@
 								<!-- 가격 -->
 								<div class="sort tap04" id="priceFilterDiv">
 									<div class="range">
-										<input type="text" class="js-range-slider01" name="my_range01" value="" />
+										<input type="text" class="js-range-slider01" name="" value="" />
+										<input type="hidden" id="price_input_from" value="0"/>
+										<input type="hidden" id="price_input_to" value="0"/>
 									</div>
 									<a href="javascript:void(0)" class="tap_close">delete-btn</a>
 								</div>
@@ -152,7 +154,9 @@
 										<li><input type="checkbox" id="percent10" name="range" value="100"><label for="percent10"><span></span><span>100%</span></label></li>
 									</ul>
 									<div class="range">
-										<input type="text" class="js-range-slider02" name="my_range02" value="" />
+										<input type="text" class="js-range-slider02" name="" value="" />
+										<input type="hidden" id="dcrate_input_from" value="0"/>
+										<input type="hidden" id="dcrate_input_to" value="0"/>
 									</div>
 									<a href="javascript:void(0)" class="tap_close">delete-btn</a>
 								</div>
@@ -229,7 +233,7 @@
 										<!--										</span>-->
 										<!-- 컬러 표시 -->
 									</div>
-									<button class="fillter_reset" onclick="fnFilterReset();"><span>전체 초기화</span></button>
+									<button type="button" class="fillter_reset" onclick="fnFilterReset();"><span>전체 초기화</span></button>
 								</div>
 								<!-- //필터 -->
 							</div>
@@ -299,13 +303,17 @@
 	<script th:inline="javascript">
 		/*<![CDATA[*/
 		var filterPriceList = [[${filterPriceList}]];
+		var custom_values = [];
+		var custom_values02  = [];
+		var currUrl = document.location.href;
+		console.log('currUrl>>'+currUrl);
 
 		// 컨텐츠 호출
 		$(document).ready( function() {
 			//가격 슬라이드
 			//var custom_values = ['9,000원', '230,000원', '487,000원', '700,000원', '1,360,000원', '1,799,000원'];
 			if(!gagajf.isNull(filterPriceList)){
-				var custom_values = [];
+
 				$.each(filterPriceList, function (priceIdx, priceItem){
 					custom_values[priceIdx] = priceItem.filterNm;
 				});
@@ -314,7 +322,6 @@
 				var my_to = custom_values.indexOf(custom_values[5]); //custom_values.indexOf('230,000원');
 				var minValue = custom_values[0];
 				var maxValue = custom_values[5];
-				console.log('my_from>>'+my_from);
 
 				$(".dp .js-range-slider01, .sch_result .js-range-slider01").ionRangeSlider({
 					type: "double",
@@ -326,14 +333,22 @@
 					skin: "round",
 					postfix: "원",
 					prettify_separator: ",",
-					values: custom_values
+					values: custom_values,
+					// onStart : function(data){
+					// 	fnCheckPrice(data);
+					// },
+					// onChange : fnCheckPrice,
+					onFinish : function(data){
+						fnCheckPrice(data);
+					}
 				});
 			}
 
 			//할인율
-			var custom_values02 = ['0%', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'];
+			custom_values02 = ['0%', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'];
 			var my_from02 = custom_values02.indexOf('0%');
-			var my_to02 = custom_values02.indexOf('10%');
+			var my_to02 = custom_values02.indexOf('100%');
+
 			$(".dp .js-range-slider02, .sch_result .js-range-slider02").ionRangeSlider({
 				type: "double",
 				min: 0,
@@ -344,22 +359,60 @@
 				skin: "round",
 				postfix: "%",
 				prettify_separator: ",",
-				values: custom_values02
+				values: custom_values02,
+				// onStart : function(data){
+				// 	fnCheckDcRate(data);
+				// },
+				// onChange : fnCheckDcRate,
+				onFinish : function (data){
+					fnCheckDcRate(data);
+				}
 			});
 
 			fnCreateCategoryList();
-
-			//fnGoodsListSearch();
 		});
 
+		// 필터 가격 확인
+		var fnCheckPrice = function (data){
+			$("#priceSpan").remove();
+			$("#searchGoodsForm input:hidden[name=priceRow]").remove();
+			$("#searchGoodsForm input:hidden[name=priceHigh]").remove();
+			let min = data.from;
+			let max = data.to;
+			// console.log('Price from>>'+custom_values[min]);
+			// console.log('Price to>>'+custom_values[max]);
+			$("#price_input_from").val(custom_values[0]);
+			$("#price_input_to").val(custom_values[5]);
+
+			fnFilterSlider('price' , custom_values[min], custom_values[max]);
+		}
+
+		// 필터 할인율 확인
+		var fnCheckDcRate = function (data){
+			$("#dcrateSpan").remove();
+			$("#searchGoodsForm input:hidden[name=dcrateRow]").remove();
+			$("#searchGoodsForm input:hidden[name=dcrateHigh]").remove();
+			let min = data.from;
+			let max = data.to;
+			console.log('DcRate from>>'+custom_values02[min].replace('%',''));
+			console.log('DcRate to>>'+custom_values02[max].replace('%',''));
+			$("#price_input_from").val(0);
+			$("#price_input_to").val(100);
+
+			fnFilterSlider('dcrate' , custom_values02[min].replace('%',''), custom_values02[max].replace('%',''));
+		}
+
 		var fnFilterReset = function (){
-			$("#searchGoodsForm input:hidden[name=brandSearch]").remove();
-			$("#searchGoodsForm input:hidden[name=sizeSearch]").remove();
-			$("#searchGoodsForm input:hidden[name=priceSearch]").remove();
-			$("#searchGoodsForm input:hidden[name=dcrateSearch]").remove();
-			$("#searchGoodsForm input:hidden[name=seasonSearch]").remove();
-			$("#searchGoodsForm input:hidden[name=colorSearch]").remove();
-			$("#searchGoodsForm input:hidden[name=benefitSearch]").remove();
+			document.location.href = currUrl;
+			// $("#searchGoodsForm input:hidden[name=brandSearch]").remove();
+			// $("#searchGoodsForm input:hidden[name=sizeSearch]").remove();
+			// $("#searchGoodsForm input:hidden[name=priceRow]").remove();
+			// $("#searchGoodsForm input:hidden[name=priceHigh]").remove();
+			// $("#searchGoodsForm input:hidden[name=dcrateRow]").remove();
+			// $("#searchGoodsForm input:hidden[name=dcrateHigh]").remove();
+			// $("#searchGoodsForm input:hidden[name=seasonSearch]").remove();
+			// $("#searchGoodsForm input:hidden[name=colorSearch]").remove();
+			// $("#searchGoodsForm input:hidden[name=benefitSearch]").remove();
 		}
 
 		var fnGoodsListSearch = function (){
@@ -380,6 +433,8 @@
 			var ithrCd = '';
 			var contentLoc = '';
 			if (result.dataList != null && result.dataList.length > 0) {
+				$('.list_content .list_defult').hide();
+				$('.list_content .count_wrap').show();
 				var goodsUrl = [[${@environment.getProperty('upload.goods.view')}]];;
 				let lastPage = result.paging.pageable.pageNo;
 				let endRow = result.endRow - result.paging.pageable.pageSize;
@@ -389,6 +444,9 @@
 			}else {
 				if($("#searchForm input[name=pageNo]").val()==1){
 					$('#listBox').html('<li class="none">상품정보가 존재하지 않습니다.</li>');
+				}else{
+					$('.list_content .list_defult').show();
+					$('.list_content .count_wrap').hide();
 				}
 				gagaInfiniteScroll.draw('not');
 			}

+ 89 - 0
src/main/webapp/biz/goods.js

@@ -404,4 +404,93 @@ var fnDeleteFilter = function (obj, gubun, staus, sizeGb){
 	$(obj).closest("span").remove();
 }
 
+var fnFilterSlider = function (gubun, min, max){
+	let tag = '';
+	let oriMin = '';
+	let oriMax = '';
+	if(gubun=='price'){
+		oriMin = $("#price_input_from").val();
+		oriMax = $("#price_input_to").val();
+	}else{
+		oriMin = $("#dcrate_input_from").val();
+		oriMax = $("#dcrate_input_to").val();
+	}
+
+	if(gubun=='price'){
+		if(min!=max){
+			tag += '<span id="priceSpan">'+ min +'원~'+max+'원';
+		}else{
+			tag += '<span id="priceSpan">'+max+'원';
+		}
+	}else{
+		if(min!=max){
+			tag += '<span id="dcrateSpan">'+ min +'~'+max+'%';
+		}else{
+			tag += '<span id="dcrateSpan">'+max+'%';
+		}
+	}
+	tag += '<a href="javascript:void(0);" class="filter_delete" onclick="fnDeleteFilterSlider(this,\''+gubun+'\', '+oriMin+', '+oriMax+');"></a >';
+	tag += '</span>';
+
+	$("#filterData").append(tag);
+
+	var tag2 = '';
+	if(gubun=='price'){
+		tag2 += '<input type="hidden" name="priceRow" value="'+min+'"/>\n';
+		tag2 += '<input type="hidden" name="priceHigh" value="'+max+'"/>\n';
+		$("#searchGoodsForm").append(tag2);
+		fnCategoryGoodsInfiniteScrollInit();
+	}else{
+		tag2 += '<input type="hidden" name="dcrateRow" value="'+min+'"/>\n';
+		tag2 += '<input type="hidden" name="dcrateHigh" value="'+max+'"/>\n';
+		$("#searchGoodsForm").append(tag2);
+		fnCategoryGoodsInfiniteScrollInit();
+	}
+
+	fnGoodsListSearch();
+}
+
+var fnDeleteFilterSlider = function (obj, gubun, minVal, maxVal){
+	if(gubun=='price'){
+		var $range = $(".dp .js-range-slider01, .sch_result .js-range-slider01");
+		var $inputFrom = $("#price_input_from");
+		var $inputTo = $("#price_input_to");
+		var instance;
+
+		instance = $range.data("ionRangeSlider");
+		instance.update({
+			from: 0
+		});
+		$inputFrom.val(minVal);
+
+		instance.update({
+			to: 5
+		});
+		$inputTo.prop("value",maxVal);
+		$("#searchGoodsForm input:hidden[name=priceRow]").remove();
+		$("#searchGoodsForm input:hidden[name=priceHigh]").remove();
+	}else{
+		var $range = $(".dp .js-range-slider02, .sch_result .js-range-slider02");
+		var $inputFrom = $("#dcrate_input_from");
+		var $inputTo = $("#dcrate_input_to");
+		var instance;
+
+		instance = $range.data("ionRangeSlider");
+		instance.update({
+			from: 0
+		});
+		$inputFrom.prop("value",minVal);
+
+		instance.update({
+			to: 10
+		});
+		$inputTo.prop("value",maxVal);
+		$("#searchGoodsForm input:hidden[name=dcrateRow]").remove();
+		$("#searchGoodsForm input:hidden[name=dcrateHigh]").remove();
+	}
+	$(obj).closest("span").remove();
+	fnCategoryGoodsInfiniteScrollInit();
+	fnGoodsListSearch();
+}
+
 //****************상품리스트  end **********************************