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

상품리스트 가격1개일때 수정

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

+ 27 - 9
src/main/webapp/WEB-INF/views/web/display/CategoryGoodsListFormWeb.html

@@ -315,22 +315,40 @@
 		$(document).ready( function() {
 			//가격 슬라이드
 			//var custom_values = ['9,000원', '230,000원', '487,000원', '700,000원', '1,360,000원', '1,799,000원'];
+			let priceLen;
 			if(!gagajf.isNull(filterPriceList)){
+				priceLen = filterPriceList.length-1;
 				$.each(filterPriceList, function (priceIdx, priceItem){
 					custom_values[priceIdx] = priceItem.filterNm;
+					if(priceLen==0){
+						custom_values[1] = priceItem.filterNm;
+					}
 				});
+				let my_from;
+				let my_to;
+				if(filterPriceList.length > 1){
+					my_from = custom_values.indexOf(custom_values[0]);
+					my_to = custom_values.indexOf(custom_values[priceLen]);
+				}else{
+					my_from = 0;
+					my_to = 1;
+				}
 
-				let my_from = custom_values.indexOf(custom_values[0]);
-				let my_to = custom_values.indexOf(custom_values[5]);
-				
 				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];
+				let minValue;
+				let maxValue;
+				if(filterPriceList.length > 1){
+					minValue = custom_values[0];
+					maxValue = custom_values[priceLen];
+				}else{
+					minValue = custom_values[0];
+					maxValue = custom_values[1];
+				}
 
 				$(".dp .js-range-slider01, .sch_result .js-range-slider01").ionRangeSlider({
 					type: "double",
@@ -348,8 +366,8 @@
 					//  	fnCheckPrice(data);
 					// },
 					// onChange : fnCheckPrice,
-					onFinish : function(data){
-						fnCheckPrice(data);
+					onFinish : function(data,priceLen){
+						fnCheckPrice(data,priceLen);
 					}
 				});
 			}
@@ -416,14 +434,14 @@
 		}
 
 		// 필터 가격 확인
-		var fnCheckPrice = function (data){
+		var fnCheckPrice = function (data,priceLen){
 			$("#priceSpan").remove();
 			$("#searchGoodsForm input:hidden[name=priceFrom]").remove();
 			$("#searchGoodsForm input:hidden[name=priceTo]").remove();
 			let min = data.from;
 			let max = data.to;
 			$("#price_input_from").val(custom_values[0]);
-			$("#price_input_to").val(custom_values[5]);
+			$("#price_input_to").val(custom_values[priceLen]);
 
 			fnFilterSlider('price' , custom_values[min].addComma(), custom_values[max].addComma());
 		}