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

검색어 관련 상품 미노출

card007 4 лет назад
Родитель
Сommit
0b002d0d2e

+ 86 - 12
src/main/webapp/WEB-INF/views/mob/display/BrandSearchLayerMob.html

@@ -96,12 +96,24 @@
 				<!-- //3.지금 많이 보고 있어요 상품. -->
 
 				<!-- 4.검색어 타이핑 -->
-				<div class="inner searching_box" id="keyupArea" style="display:none;" th:if="${brandGroupNo==null}">
+				<div class="inner searching_box" id="keyupArea" style="display:none;">
 					<div class="filter-list store-list">
 					</div>
 					<div class="relative-list">
 					</div>
 				</div>
+				<div class="inner empty_box2" id="relateGoodsDiv" style="display:none;">
+					<div class="recommand_product">
+						<div class="store_product">
+							<div class="swiper-container recommand_slide">
+								<h3>관련상품</h3>
+								<div class="swiper-wrapper" id="relateArea">
+
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
 				<!-- //4.검색어 타이핑 -->
 
 				<!-- 3.검색결과 없을때 -->
@@ -212,6 +224,7 @@
 			$('.sch_result .default_box').hide();
 			$('.sch_result .searching_box').hide();
 			$('.sch_result .empty_box').show();
+			$('.sch_result .empty_box2').hide();
 			$("#noDataArea").find('#noDataKeyword').text($("#searchMainForm").find('input[name=keyword]').val());
 			// 검색어 연관 상품 추천
 			fnRecommendItemList($("#searchMainForm").find('input[name=keyword]').val());
@@ -221,8 +234,10 @@
 			$('.sch_result .default_box').hide();
 			$('.sch_result .searching_box').show();
 			$('.sch_result .empty_box').hide();
+			$('.sch_result .empty_box2').show();
 			// 자동완성 키워드
 			if(result.autoKeywords != null && result.autoKeywords.length > 0){
+				$("#keyupArea").show();
 				$("#keyupArea").find(".relative-list").html('');
 				let tag = '';
 				tag += '<ul>\n';
@@ -237,6 +252,7 @@
 				$("#keyupArea").find(".relative-list").append(tag);
 			}else{
 				$("#keyupArea").find(".relative-list").html('');
+				$("#keyupArea").hide();
 			}
 
 			// if(result.cateList != null && result.cateList.length > 0){
@@ -287,6 +303,58 @@
 			// }else{
 			// 	$("#keyupCateArea").find(".sch_category").html('');
 			// }
+			
+			if(!gagajf.isNull(result.goodsList)){
+				$("#relateGoodsDiv").show();
+				$("#relateArea").html('');
+				let tag = '';
+				$.each(result.goodsList, function (idx, item){
+					console.log(item);
+					if(idx<5) {
+						tag += '<div class="swiper-slide">\n';
+						tag += '	<div class="item_prod">\n';
+						tag += '		<div class="item_state">\n';
+						tag += '		<button type="button" class="itemLike';
+						if(item.likeIt == 'likeit'){
+							tag += ' likeit';
+						}
+						tag += '" onclick="cfnMoPutWishList(this);" goodsCd="'+item.goodsCd+'">관심상품 추가</button>\n';
+						//tag += '			<button type="button" class="itemLike">관심상품 추가</button>\n';
+						tag += '			<a href="javascript:void(0);" class="itemLink" onclick="cfnGoToGoodsDetail(\'' + item.goodsCd + '\',\'' + item.colorCd + '\');">\n';
+						tag += '				<div class="itemPic">\n';
+						tag += '					<img class="vLHTC pd_img" src="'+item.sysImgNm+'" alt="">\n';
+						tag += '				</div>\n';
+						tag += '				<p class="itemBrand">'+item.brandGroupNm+'</p>\n';
+						tag += '				<div class="itemName">'+item.goodsFullNm+'</div>\n';
+						tag += '				<p class="itemPrice">\n';
+						if(item.listPrice != item.currPrice) {
+							tag += '			<span class="itemPrice_original">'+ item.listPrice.addComma() +'</span>\n';
+						}
+						tag += item.currPrice.addComma() ;
+						if(item.listPrice != item.currPrice) {
+							tag += '			<span class="itemPercent">' + Math.round((item.listPrice - item.currPrice) / (item.listPrice * 1.0) * 100) + '%</span>\n';
+						}
+						tag += '				</p>\n';
+						tag += '			</a>\n';
+						tag += '		</div>\n';
+						tag += '	</div>\n';
+						tag += '</div>\n';
+					}
+				});
+				$("#relateArea").html(tag);
+				var swiperschProduct5 = new Swiper('.swiper-container.recommand_slide', {
+					slidesPerView: 2.2,
+					spaceBetween: 8,
+					autoplay: {
+						delay: 4000,
+					},
+					freeMode: true,
+					//centeredSlides: true,
+				});
+			}else{
+				$("#relateArea").html('');
+				$("#relateGoodsDiv").hide();
+			}
 		}
 	}
 
@@ -313,6 +381,7 @@
 		$("#deleteKeyword").hide();
 		$("#noDataArea").hide();
 		$("#recommandArea").hide();
+		$("#relateGoodsDiv").hide();
 	});
 
 	// 선택 단어 검색
@@ -350,6 +419,7 @@
 		var html = '';
 
 		$.getJSON('/display/recommend/item/list', data, function (result){
+			$("#recommandArea").show();
 			$("#recommendItemArea").html('');
 			if(result.length > 0){
 				$.each(result, function (idx, item){
@@ -377,18 +447,22 @@
 					html += '	</div>\n';
 					html += '</div>\n';
 				});
+				$("#recommendItemArea").append(html);
+				
+				var swiperschProduct4 = new Swiper('.swiper-container.recommand_slide', {
+					slidesPerView: 2.2,
+					spaceBetween: 8,
+					autoplay: {
+						delay: 4000,
+					},
+					freeMode: true,
+					//centeredSlides: true,
+				});
+			}else{
+				$("#recommendItemArea").html('');
+				$("#recommandArea").hide();
 			}
-			$("#recommendItemArea").append(html);
-
-			var swiperschProduct4 = new Swiper('.swiper-container.recommand_slide', {
-				slidesPerView: 2.2,
-				spaceBetween: 8,
-				autoplay: {
-					delay: 4000,
-				},
-				freeMode: true,
-				//centeredSlides: true,
-			});
+			
 		});
 	}
 

+ 75 - 2
src/main/webapp/WEB-INF/views/mob/display/SearchLayerMob.html

@@ -106,6 +106,18 @@
 					<div class="sch_category">
 					</div>
 				</div>
+				<div class="inner empty_box2" id="relateArea" style="display:none;">
+					<div class="recommand_product">
+						<div class="store_product">
+							<div class="swiper-container recommand_slide">
+								<h3>관련상품</h3>
+								<div class="swiper-wrapper" id="relateItemArea">
+
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
 				<!-- //4.검색어 타이핑 -->
 
 				<!-- 3.검색결과 없을때 -->
@@ -227,6 +239,7 @@
 			$('.sch_result .default_box').hide();
 			$('.sch_result .searching_box').show();
 			$('.sch_result .empty_box').hide();
+			$('.sch_result .empty_box2').hide();
 			// 자동완성 키워드
 			if(result.autoKeywords != null && result.autoKeywords.length > 0){
 				$("#keyupArea").find(".relative-list").html('');
@@ -261,6 +274,7 @@
 			}
 
 			if(result.cateList != null && result.cateList.length > 0){
+				$("#keyupCateArea").show();
 				$("#keyupCateArea").find(".sch_category").html('');
 				let tag = '';
 				tag += '<h3>카테고리</h3>\n';
@@ -307,6 +321,58 @@
 				$("#keyupCateArea").find(".sch_category").append(tag);
 			}else{
 				$("#keyupCateArea").find(".sch_category").html('');
+				$("#keyupCateArea").hide();
+			}
+			
+			if(!gagajf.isNull(result.goodsList)){
+				$("#relateArea").show();
+				$("#relateItemArea").html('');
+				let tag = '';
+				$.each(result.goodsList, function (idx, item){
+					if(idx<5) {
+						tag += '<div class="swiper-slide">\n';
+						tag += '	<div class="item_prod">\n';
+						tag += '		<div class="item_state">\n';
+						tag += '		<button type="button" class="itemLike';
+						if(item.likeIt == 'likeit'){
+							tag += ' likeit';
+						}
+						tag += '" onclick="cfnMoPutWishList(this);" goodsCd="'+item.goodsCd+'">관심상품 추가</button>\n';
+						//tag += '			<button type="button" class="itemLike">관심상품 추가</button>\n';
+						tag += '			<a href="javascript:void(0);" class="itemLink" onclick="cfnGoToGoodsDetail(\'' + item.goodsCd + '\',\'' + item.colorCd + '\');">\n';
+						tag += '				<div class="itemPic">\n';
+						tag += '					<img class="vLHTC pd_img" src="'+item.sysImgNm+'" alt="">\n';
+						tag += '				</div>\n';
+						tag += '				<p class="itemBrand">'+item.brandGroupNm+'</p>\n';
+						tag += '				<div class="itemName">'+item.goodsFullNm+'</div>\n';
+						tag += '				<p class="itemPrice">\n';
+						if(item.listPrice != item.currPrice) {
+							tag += '			<span class="itemPrice_original">'+ item.listPrice.addComma() +'</span>\n';
+						}
+						tag += item.currPrice.addComma() ;
+						if(item.listPrice != item.currPrice) {
+							tag += '			<span class="itemPercent">' + Math.round((item.listPrice - item.currPrice) / (item.listPrice * 1.0) * 100) + '%</span>\n';
+						}
+						tag += '				</p>\n';
+						tag += '			</a>\n';
+						tag += '		</div>\n';
+						tag += '	</div>\n';
+						tag += '</div>\n';
+					}
+				});
+				$("#relateItemArea").html(tag);
+				var swiperschProduct4 = new Swiper('.swiper-container.recommand_slide', {
+					slidesPerView: 2.2,
+					spaceBetween: 8,
+					autoplay: {
+						delay: 4000,
+					},
+					freeMode: true,
+					//centeredSlides: true,
+				});
+			}else{
+				$("#relateItemArea").html('');
+				$("#relateArea").hide();
 			}
 		}
 	}
@@ -320,6 +386,7 @@
 			$('.sch_result .default_box').show();
 			$('.sch_result .searching_box').hide();
 			$('.sch_result .empty_box').hide();
+			$('.sch_result .empty_box2').hide();
 		}
 	}
 
@@ -342,12 +409,13 @@
 		}else{
 			$("#popularKeyArea").html('');
 		}
-
+		
 		$("#keyupArea").hide();
 		$("#keyupCateArea").hide();
 		$("#deleteKeyword").hide();
 		$("#noDataArea").hide();
 		$("#recommandArea").hide();
+		$("#relateArea").hide();
 	});
 
 	// 선택 단어 검색
@@ -444,7 +512,12 @@
 					html += '<div class="swiper-slide">\n';
 					html += '	<div class="item_prod">\n';
 					html += '		<div class="item_state">\n';
-					html += '			<button type="button" class="itemLike">관심상품 추가</button>\n';
+					html += '		<button type="button" class="itemLike';
+					if(item.product.wishCnt > 0){
+						html += ' likeit';
+					}
+					html += '" onclick="cfnMoPutWishList(this);" goodsCd="'+item.product.itemId+'">관심상품 추가</button>\n';
+					//html += '			<button type="button" class="itemLike">관심상품 추가</button>\n';
 					html += '			<a href="'+item.product.itemUrl+'" class="itemLink">\n';
 					html += '				<div class="itemPic">\n';
 					html += '					<img class="vLHTC pd_img" src="'+item.product.itemImage+'" alt="">\n';

+ 56 - 56
src/main/webapp/WEB-INF/views/web/display/BrandSearchLayerWeb.html

@@ -179,7 +179,7 @@
 
 	// 검색어 찾기 결과
 	var fnAutoCompleteList = function (result){
-		if(result.autoKeywords.length==0 && result.cateList.length == 0 && gagajf.isNull(result.goodsList)){
+		if(result.autoKeywords.length==0 && gagajf.isNull(result.goodsList)){
 			$('.common_search .area_result .default_box').hide();
 			$('.common_search .area_result .searching_box').hide();
 			$('.common_search .area_result .empty_box').show();
@@ -210,62 +210,62 @@
 				$(".autokeyword_blk").append(tag);
 			}
 
-			if(result.brand != null && !gagajf.isNull(result.brand.brandGroupNo)){
-				$(".find_brand").html('');
-				let tag = '';
-				tag += '<h3><a href="javascript:void(0);" onclick="cfnGoToBrandMain('+result.brand.brandGroupNo+');">'+result.brand.brandGroupNm+' 샵 바로가기</a></h3>\n';
-				$(".find_brand").append(tag);
-			}else{
-				$(".find_brand").html('');
-			}
+			//if(result.brand != null && !gagajf.isNull(result.brand.brandGroupNo)){
+			//	$(".find_brand").html('');
+			//	let tag = '';
+			//	tag += '<h3><a href="javascript:void(0);" onclick="cfnGoToBrandMain('+result.brand.brandGroupNo+');">'+result.brand.brandGroupNm+' 샵 바로가기</a></h3>\n';
+			//	$(".find_brand").append(tag);
+			//}else{
+			//	$(".find_brand").html('');
+			//}
 
-			if(result.cateList != null && result.cateList.length > 0){
-				$(".find_category").html('');
-				let tag = '';
-				tag += '<ul>\n';
-				$.each(result.cateList, function (idx, item){
-					tag += '<li>\n';
-					tag += '	<span class="category_txt">카테고리</span>\n';
-					tag += '	<a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'G032_101\' ';
-					if(item.cate1No != null){
-						tag += ', '+item.cate1No;
-					}
-					if(item.cate2No != null){
-						tag += ', '+item.cate2No;
-					}
-					if(item.cate3No != null){
-						tag += ', '+item.cate3No;
-					}
-					if(item.cate4No != null){
-						tag += ', '+item.cate4No;
-					}
-					if(item.cate5No != null){
-						tag += ', '+item.cate5No;
-					}
-					tag += ');">\n';
-					if(item.cate1Nm != null){
-						tag += '		<span>'+item.cate1Nm+'</span>\n';
-					}
-					if(item.cate2Nm != null){
-						tag += '		<span>'+item.cate2Nm+'</span>\n';
-					}
-					if(item.cate3Nm != null){
-						tag += '		<span>'+item.cate3Nm+'</span>\n';
-					}
-					if(item.cate4Nm != null){
-						tag += '		<span>'+item.cate4Nm+'</span>\n';
-					}
-					if(item.cate5Nm != null){
-						tag += '		<span>'+item.cate5Nm+'</span>\n';
-					}
-					tag += '	</a>\n';
-					tag += '</li>\n';
-				});
-				tag += '</ul>\n';
-				$(".find_category").append(tag);
-			}else{
-				$(".find_category").html('');
-			}
+			//if(result.cateList != null && result.cateList.length > 0){
+			//	$(".find_category").html('');
+			//	let tag = '';
+			//	tag += '<ul>\n';
+			//	$.each(result.cateList, function (idx, item){
+			//		tag += '<li>\n';
+			//		tag += '	<span class="category_txt">카테고리</span>\n';
+			//		tag += '	<a href="javascript:void(0);" onclick="cfnGoToGoodsList(0,\'G032_101\' ';
+			//		if(item.cate1No != null){
+			//			tag += ', '+item.cate1No;
+			//		}
+			//		if(item.cate2No != null){
+			//			tag += ', '+item.cate2No;
+			//		}
+			//		if(item.cate3No != null){
+			//			tag += ', '+item.cate3No;
+			//		}
+			//		if(item.cate4No != null){
+			//			tag += ', '+item.cate4No;
+			//		}
+			//		if(item.cate5No != null){
+			//			tag += ', '+item.cate5No;
+			//		}
+			//		tag += ');">\n';
+			//		if(item.cate1Nm != null){
+			//			tag += '		<span>'+item.cate1Nm+'</span>\n';
+			//		}
+			//		if(item.cate2Nm != null){
+			//			tag += '		<span>'+item.cate2Nm+'</span>\n';
+			//		}
+			//		if(item.cate3Nm != null){
+			//			tag += '		<span>'+item.cate3Nm+'</span>\n';
+			//		}
+			//		if(item.cate4Nm != null){
+			//			tag += '		<span>'+item.cate4Nm+'</span>\n';
+			//		}
+			//		if(item.cate5Nm != null){
+			//			tag += '		<span>'+item.cate5Nm+'</span>\n';
+			//		}
+			//		tag += '	</a>\n';
+			//		tag += '</li>\n';
+			//	});
+			//	tag += '</ul>\n';
+			//	$(".find_category").append(tag);
+			//}else{
+			//	$(".find_category").html('');
+			//}
 			if(!gagajf.isNull(result.goodsList)){
 				$("#relateGoodsDiv").show();
 				$(".pd_list .realtime_wrap .itemsGrp").html('');