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

+ 133 - 17
src/main/webapp/WEB-INF/views/web/display/CategoryGoodsListFormWeb.html

@@ -106,7 +106,7 @@
 											<strong>상의</strong>
 											<th:block th:each="oneData, status : ${filterSizeList}" th:if="${#strings.startsWith(oneData.filterCd,'T')}">
 												<label class="size_btn">
-													<input type="checkbox" group="filterValue" th:id="${'chkFilterTSize' + status.index}" name="size" th:vale="${oneData.filterNm}" th:data-id="${oneData.filterNm}" onclick="filterSel(this,'size','off','1');"><span th:text="${oneData.filterNm}">80</span>
+													<input type="checkbox" group="filterValue" th:id="${'chkFilterTSize' + status.index}" name="size" th:vale="${oneData.filterNm}" th:data-id="${oneData.filterNm}" data-idx="1" onclick="filterSel(this,'size','off','1');"><span th:text="${oneData.filterNm}">80</span>
 												</label>
 											</th:block>
 										</li>
@@ -114,7 +114,7 @@
 											<strong>하의</strong>
 											<th:block th:each="oneData, status : ${filterSizeList}" th:if="${#strings.startsWith(oneData.filterCd,'B')}">
 												<label class="size_btn">
-													<input type="checkbox" group="filterValue" th:id="${'chkFilterBSize' + status.index}" name="size" th:vale="${oneData.filterNm}" th:data-id="${oneData.filterNm}" onclick="filterSel(this,'size','off','2');"><span th:text="${oneData.filterNm}">80</span>
+													<input type="checkbox" group="filterValue" th:id="${'chkFilterBSize' + status.index}" name="size" th:vale="${oneData.filterNm}" th:data-id="${oneData.filterNm}" data-idx="2" onclick="filterSel(this,'size','off','2');"><span th:text="${oneData.filterNm}">80</span>
 												</label>
 											</th:block>
 										</li>
@@ -122,7 +122,7 @@
 											<strong>신발</strong>
 											<th:block th:each="oneData, status : ${filterSizeList}" th:if="${#strings.startsWith(oneData.filterCd,'S')}">
 												<label class="size_btn">
-													<input type="checkbox" group="filterValue" th:id="${'chkFilterSSize' + status.index}" name="size" th:vale="${oneData.filterNm}" th:data-id="${oneData.filterNm}" onclick="filterSel(this,'size','off','3');"><span th:text="${oneData.filterNm}">80</span>
+													<input type="checkbox" group="filterValue" th:id="${'chkFilterSSize' + status.index}" name="size" th:vale="${oneData.filterNm}" th:data-id="${oneData.filterNm}" data-idx="3" onclick="filterSel(this,'size','off','3');"><span th:text="${oneData.filterNm}">80</span>
 												</label>
 											</th:block>
 										</li>
@@ -134,8 +134,8 @@
 								<div class="sort tap04" id="priceFilterDiv">
 									<div class="range">
 										<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"/>
+										<input type="hidden" id="price_input_from" name="price_input_from" value="0"/>
+										<input type="hidden" id="price_input_to" name="price_input_to" value="0"/>
 									</div>
 									<a href="javascript:void(0)" class="tap_close">delete-btn</a>
 								</div>
@@ -316,15 +316,23 @@
 			//가격 슬라이드
 			//var custom_values = ['9,000원', '230,000원', '487,000원', '700,000원', '1,360,000원', '1,799,000원'];
 			if(!gagajf.isNull(filterPriceList)){
-
+				console.log('111');
 				$.each(filterPriceList, function (priceIdx, priceItem){
 					custom_values[priceIdx] = priceItem.filterNm;
 				});
 
-				var my_from = custom_values.indexOf(custom_values[0]); //custom_values.indexOf('9,000원');
-				var my_to = custom_values.indexOf(custom_values[5]); //custom_values.indexOf('230,000원');
-				var minValue = custom_values[0];
-				var maxValue = custom_values[5];
+				let my_from = custom_values.indexOf(custom_values[0]);
+				let my_to = custom_values.indexOf(custom_values[5]);
+				console.log('1>>priceFrom>>'+$("#filterData").find("input:hidden[name=priceFrom]").val());
+				console.log('1>>priceTo>>'+$("#filterData").find("input:hidden[name=priceTo]").val());
+				if(gagajf.isNull($("#filterForm input:hidden[name=priceFrom]").val())){
+					my_from = $("#filterForm input:hidden[name=priceFrom]").val();
+				}
+				if(gagajf.isNull($("#filterForm input:hidden[name=priceTo]").val())){
+					my_to = $("#filterForm input:hidden[name=priceTo]").val();
+				}
+				let minValue = custom_values[0];
+				let maxValue = custom_values[5];
 
 				$(".dp .js-range-slider01, .sch_result .js-range-slider01").ionRangeSlider({
 					type: "double",
@@ -339,7 +347,7 @@
 					values: custom_values,
 					min_interval: 1,
 					// onStart : function(data){
-					// 	fnCheckPrice(data);
+					//  	fnCheckPrice(data);
 					// },
 					// onChange : fnCheckPrice,
 					onFinish : function(data){
@@ -348,6 +356,7 @@
 				});
 			}
 
+			/*
 			//할인율
 			custom_values02 = ['0%', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'];
 			var my_from02 = custom_values02.indexOf('0%');
@@ -372,7 +381,7 @@
 				onFinish : function (data){
 					fnCheckDcRate(data);
 				}
-			});
+			});*/
 
 			fnCreateCategoryList();
 			
@@ -415,8 +424,8 @@
 			$("#searchGoodsForm input:hidden[name=priceTo]").remove();
 			let min = data.from;
 			let max = data.to;
-			// console.log('Price from>>'+custom_values[min]);
-			// console.log('Price to>>'+custom_values[max]);
+			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]);
 
@@ -715,7 +724,6 @@
 			var formTitle = "";
 			let tag = '';
 
-			console.log('cate1>>'+cate1.cate1No+ 'LL'+cate1.cate2List.length);
 			if (cate1 != null) {
 				tag += '<li';
 				if (cate1.cate1No == cate1No) {
@@ -925,15 +933,85 @@
 		$(window).on("pageshow", function(event) {
 			console.log('test1');
 			$('#filterForm input[name=brandGroup]:checked').each(function(){
-				console.log('test2');
+				let filterGb = 'brandGroup';
+				$(this).attr('onclick','filterSel(this,\''+filterGb+'\',\'on\');');
 				$(this).parent().addClass("active");
 			});
 			$('#filterForm input[name=size]:checked').each(function(){
+				let filterGb = 'size';
+				let rowNum = $(this).attr('data-idx');
+				$(this).attr('onclick','filterSel(this,\''+filterGb+'\',\'on\',\''+rowNum+'\');');
+				$(this).parent().addClass("active");
+			});
+			// $('#filterForm input[name=price]').each(function(){
+			// 	console.log('priceFrom>>'+ $("#searchGoodsForm input:hidden[name=priceFrom]").val() );
+			// 	console.log('priceTo>>'+ $("#searchGoodsForm input:hidden[name=priceTo]").val() );
+			// 	// $(this).parent().addClass("active");
+			// 	$("#priceSpan").remove();
+			// 	$("#searchGoodsForm input:hidden[name=priceFrom]").remove();
+			// 	$("#searchGoodsForm input:hidden[name=priceTo]").remove();
+			// 	let min = $("#searchGoodsForm input:hidden[name=priceFrom]").val();
+			// 	let max = $("#searchGoodsForm input:hidden[name=priceTo]").val();
+			// 	$("#price_input_from").val(custom_values[0]);
+			// 	$("#price_input_to").val(custom_values[5]);
+			//
+			// 	fnFilterSlider('price' , custom_values[min].addComma(), custom_values[max].addComma());
+			// });
+			// $('#filterForm input[name=range]:checked').each(function(){
+			// 	console.log('eeeeeeeeeeeeeee');
+			// 	$("#dcrateSpan").remove();
+			// 	//$("#searchGoodsForm input:hidden[name=dcRateFrom]").remove();
+			// 	//$("#searchGoodsForm input:hidden[name=dcRateTo]").remove();
+			// 	let min = $("#searchGoodsForm input:hidden[name=dcRateFrom]").val();
+			// 	let max =  $("#searchGoodsForm input:hidden[name=dcRateTo]").val();
+			// 	$("#price_input_from").val(0);
+			// 	$("#price_input_to").val(100);
+			//
+			// 	fnFilterSlider('dcrate' , custom_values02[min].replace('%',''), custom_values02[max].replace('%',''));
+			// });
+			$('#filterForm input[name=season]:checked').each(function(){
+				let filterGb = 'season';
+				$(this).attr('onclick','filterSel(this,\''+filterGb+'\',\'on\');');
+				$(this).parent().addClass("active");
+			});
+			$('#filterForm input[name=color]:checked').each(function(){
+				let filterGb = 'color';
+				$(this).attr('onclick','filterSel(this,\''+filterGb+'\',\'on\');');
 				$(this).parent().addClass("active");
 			});
-			$('#filterForm input[name=price]:checked').each(function(){
+			$('#filterForm input[name=benefit]:checked').each(function(){
+				let filterGb = 'benefit';
+				$(this).attr('onclick','filterSel(this,\''+filterGb+'\',\'on\');');
 				$(this).parent().addClass("active");
 			});
+
+			//할인율
+			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('100%');
+			if(gagajf.isNull($('#searchGoodsForm').find("input[name=dcRateFrom]").val())){
+				my_from02 = $('#searchGoodsForm').find("input[name=dcRateFrom]").val();
+			}
+			if(gagajf.isNull($('#searchGoodsForm').find("input[name=dcRateTo]").val())){
+				my_to02 = $('#searchGoodsForm').find("input[name=dcRateTo]").val();
+			}
+
+			$(".dp .js-range-slider02, .sch_result .js-range-slider02").ionRangeSlider({
+				type: "double",
+				min: 0,
+				max: 100,
+				from: my_from02,
+				to: my_to02,
+				grid: true,
+				skin: "round",
+				postfix: "%",
+				prettify_separator: ",",
+				values: custom_values02,
+				min_interval: 1,
+				onFinish : function (data){
+					fnCheckDcRate(data);
+				}
+			});
 			if ( (event.originalEvent && event.originalEvent.persisted) || (window.performance && window.performance.navigation.type == 2)) {
 				var historyData = sessionStorage.getItem(document.location.href);
 				if(historyData!=null){
@@ -958,11 +1036,49 @@
 				if(typeof historyData.totalCount!='undefined' && historyData.totalCount!=''){
 					$("#totCntId").text(historyData.totalCount);
 				}
+				if(!gagajf.isNull(filterPriceList)){
+					console.log('111');
+					$.each(filterPriceList, function (priceIdx, priceItem){
+						custom_values[priceIdx] = priceItem.filterNm;
+					});
+
+					let my_from = custom_values.indexOf(custom_values[0]);
+					let my_to = custom_values.indexOf(custom_values[5]);
+					console.log('1>>priceFrom>>'+$("#filterData").find("input:hidden[name=priceFrom]").val());
+					console.log('1>>priceTo>>'+$("#filterData").find("input:hidden[name=priceTo]").val());
+					if(gagajf.isNull($("#filterData").find("input:hidden[name=priceFrom]").val())){
+						my_from = $("#filterData").find("input:hidden[name=priceFrom]").val().addComma();
+					}
+					if(gagajf.isNull($("#filterData").find("input:hidden[name=priceTo]").val())){
+						my_to = $("#filterData").find("input:hidden[name=priceTo]").val().addComma();
+					}
+					let minValue = custom_values[0];
+					let maxValue = custom_values[5];
+
+					$(".dp .js-range-slider01, .sch_result .js-range-slider01").ionRangeSlider({
+						type: "double",
+						min: minValue,
+						max: maxValue,
+						from: my_from,
+						to: my_to,
+						grid: true,
+						skin: "round",
+						postfix: "원",
+						prettify_separator: ",",
+						values: custom_values,
+						min_interval: 1,
+						// onChange : fnCheckPrice,
+						onFinish : function(data){
+							fnCheckPrice(data);
+						}
+					});
+				}
 				if(typeof historyData.sortingType!='undefined' && historyData.sortingType!=''){
 					$("#sortSelect").val(historyData.sortingType);
 					$("#searchGoodsForm input:hidden[name=sortingType]").val(historyData.sortingType);
 					fnSortList(this,historyData.sortingType);
 				}else{
+					$(".fillter").show();
 					fnGoodsListSearch();
 				}
 			}else{

+ 2 - 2
src/main/webapp/biz/goods.js

@@ -496,8 +496,8 @@ var fnDeleteFilterSlider = function (obj, gubun, minVal, maxVal){
 			to: 5
 		});
 		$inputTo.prop("value",maxVal);
-		$("#searchGoodsForm input:hidden[name=priceFrom]").remove();
-		$("#searchGoodsForm input:hidden[name=priceTo]").remove();
+		$("#filterForm input:hidden[name=priceFrom]").remove();
+		$("#filterForm input:hidden[name=priceTo]").remove();
 	}else{
 		var $range = $(".dp .js-range-slider02, .sch_result .js-range-slider02");
 		var $inputFrom = $("#dcrate_input_from");