|
|
@@ -0,0 +1,431 @@
|
|
|
+//****************상품목록 start **********************************
|
|
|
+var categoryGoodsList = [];
|
|
|
+var cnt = 1;
|
|
|
+var fnCreateGoodsList = function(result, ithrCd, contentLoc, searchGb) {
|
|
|
+ console.log('fnCreateGoodsList');
|
|
|
+ var specialPriceRate = result.specialPriceRate;
|
|
|
+ var tag = '';
|
|
|
+ $.each(result.dataList, function(idx, item) {
|
|
|
+ if (idx < 3) {
|
|
|
+ categoryGoodsList.push(item.goodsCd);
|
|
|
+ }
|
|
|
+
|
|
|
+ tag += '<li class="item">';
|
|
|
+ tag += '<a href="javascript:void(0);" onclick="cfnGoToGoodsDetail(\''+item.goodsCd+'\', \''+ithrCd+'\', \''+contentLoc+'\');" class="link">';
|
|
|
+ //--베스트 상품 start--//
|
|
|
+ if (typeof(bestPageNo) != 'undefined' && bestPageNo != ""){
|
|
|
+ var cnt = ((idx+1)+((bestPageNo-1)*30));
|
|
|
+ if(cnt<10){
|
|
|
+ cnt = "0"+cnt;
|
|
|
+ }
|
|
|
+ tag += '<span class="rank">'+cnt+'</span>';
|
|
|
+ }
|
|
|
+ //--베스트 상품 end--//
|
|
|
+ var imgPath = '';
|
|
|
+ var imgSize = '1000';
|
|
|
+ if(item.imgType=='A'){
|
|
|
+ imgPath = _uploadGoodsUrl;
|
|
|
+ imgSize = '300';
|
|
|
+ }
|
|
|
+
|
|
|
+ if(_frontGb != "P"){
|
|
|
+ tag += '<img class="dummy" src=\''+_uximgUrl+'/image/mob/global/dummy.gif\' alt="" />';
|
|
|
+ }
|
|
|
+ tag += '<span class="img">';
|
|
|
+ if(item.imgPath6!=null && item.imgPath6!=''){
|
|
|
+ tag += '<img class="lazy active" data-src="'+imgPath+item.imgPath6.replace('1000', imgSize)+'" onerror="this.src=\''+_uximgUrl+'/image/web/common/no.gif\';">';
|
|
|
+ if(item.imgPath1 && _frontGb == "P"){
|
|
|
+ tag += '<img class="lazy" data-src="'+imgPath+item.imgPath1.replace('1000', imgSize)+'" onerror="this.src=\''+_uximgUrl+'/image/web/common/no.gif\';">';
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ tag += '<img class="lazy active" data-src="'+imgPath+item.imgPath1.replace('1000', imgSize)+'" onerror="this.src=\''+_uximgUrl+'/image/web/common/no.gif\';">';
|
|
|
+ if(item.imgPath2 && _frontGb == "P"){
|
|
|
+ tag += '<img class="lazy" data-src="'+imgPath+item.imgPath2.replace('1000', imgSize)+'" onerror="this.src=\''+_uximgUrl+'/image/web/common/no.gif\';">';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ tag += '</span>';
|
|
|
+
|
|
|
+ if(_frontGb != "P"){
|
|
|
+ /*tag += '<div class="colors">';
|
|
|
+ if(item.colorGrpFile=='#FFFFFF'){
|
|
|
+ tag += '<span class="colorchip active" style="background-color:#FF0000"></span>';
|
|
|
+ }else{
|
|
|
+ tag += '<span class="colorchip active" style="background-color:'+item.colorGrpFile+'"></span>';
|
|
|
+ }
|
|
|
+ tag += '</div>';*/
|
|
|
+ tag += '<div class="info">';
|
|
|
+ }else{
|
|
|
+ tag += '<span class="info">';
|
|
|
+ }
|
|
|
+ tag += '<span class="brand">'+ item.brandGrpNm+'</span>';
|
|
|
+ tag += '<span class="title">'+item.goodsTnmFull+'</span>';
|
|
|
+ tag += '<span class="price">';
|
|
|
+ if(item.goodsType=='N'){
|
|
|
+ if(item.tagPrice>item.currPrice){
|
|
|
+ tag += '<span>'+item.dcRate+'% </span>';
|
|
|
+ tag += '<strong>'+item.currPrice.addComma()+'</strong>원';
|
|
|
+ tag += '<em>'+item.tagPrice.addComma()+'</em>';
|
|
|
+ }else{
|
|
|
+ tag += '<strong>'+item.currPrice.addComma()+'</strong>원';
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ tag += '<strong>'+item.currPrice.addComma()+'</strong>원 ~';
|
|
|
+ }
|
|
|
+ tag += '</span>';
|
|
|
+
|
|
|
+ if(_frontGb != "P"){
|
|
|
+ tag += '</div>';
|
|
|
+ tag += '<div class="icons">';
|
|
|
+
|
|
|
+ }else{
|
|
|
+ tag += '<span class="icons">';
|
|
|
+ }
|
|
|
+ if(item.spriceIcon > 0){
|
|
|
+ tag += '<img src="'+_uximgUrl+'/image/web/global/icon_sample3.gif" alt="특가" />';
|
|
|
+ }
|
|
|
+ if(item.bestIcon > 0){
|
|
|
+ tag += '<img src="'+_uximgUrl+'/image/web/global/icon_sample5.gif" alt="BEST" />';
|
|
|
+ }
|
|
|
+ if(item.newIcon < 5){
|
|
|
+ tag += '<img src="'+_uximgUrl+'/image/web/global/icon_sample2.gif" alt="NEW" />';
|
|
|
+ }
|
|
|
+ if(item.GoodsIconList!=null && typeof item.GoodsIconList!='undefined'){
|
|
|
+ $.each(item.GoodsIconList, function(idx2, icon) {
|
|
|
+ tag += '<img src="'+_imgUrl+ '/display/icon/' + icon.goodsIconImgPath + '" alt="" />';
|
|
|
+ });
|
|
|
+ }
|
|
|
+ tag += '</span>';
|
|
|
+
|
|
|
+ if(_frontGb != "P"){
|
|
|
+ tag += '</div>';
|
|
|
+ }else{
|
|
|
+ tag += '</span>';
|
|
|
+ }
|
|
|
+ tag += '</a>';
|
|
|
+ var wishActive = '';
|
|
|
+ if(item.wishYn=='Y'){
|
|
|
+ wishActive = 'active';
|
|
|
+ }
|
|
|
+ tag += '<button type="button" class="wish '+wishActive+'" goodsCd="'+item.goodsCd+'" onclick="cfnPutWishList(this)" planDtlSq="">찜</button>';
|
|
|
+ tag += '</li>';
|
|
|
+ });
|
|
|
+
|
|
|
+ if (cnt == 1) {
|
|
|
+ // <!-- Criteo 카테고리/리스팅 태그 -->
|
|
|
+ window.criteo_q = window.criteo_q || [];
|
|
|
+ var deviceType = /iPad/.test(navigator.userAgent) ? "t" : /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Silk/.test(navigator.userAgent) ? "m" : "d";
|
|
|
+ window.criteo_q.push(
|
|
|
+ {event: "setAccount", account: 26073}, // 이 라인은 업데이트하면 안됩니다
|
|
|
+ {event: "setEmail", email: email}, // 유저가 로그인이 안되 있는 경우 빈 문자열을 전달
|
|
|
+ {event: "setSiteType", type: deviceType},
|
|
|
+ {event: "viewList", item: categoryGoodsList} // 가장 위에있는 3개의 상품 ID를 전달
|
|
|
+ );
|
|
|
+ // <!-- END 카테고리/리스팅 태그 -->
|
|
|
+ cnt++;
|
|
|
+ }
|
|
|
+
|
|
|
+ return tag;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// 인피니트 스크롤 초기화
|
|
|
+var fnCategoryGoodsInfiniteScrollInit = function(){
|
|
|
+ sessionStorage.removeItem(document.location.href);
|
|
|
+ //History 초기화
|
|
|
+ $("#listBox").html("");
|
|
|
+}
|
|
|
+
|
|
|
+//****************상품목록 end **********************************
|
|
|
+
|
|
|
+//****************상품상세 start **********************************
|
|
|
+// 브랜드 인기상품 (모바일)
|
|
|
+var jfGoodsCustRecommendSearch = function(params) {
|
|
|
+ gagajf.ajaxSubmit("/goods/detail/goodsOther/frame", "html", "goodsCustRecommendArea", params);
|
|
|
+}
|
|
|
+
|
|
|
+//상품베너, 다른컬러, 함께본(카테고리 ) 상품
|
|
|
+var jfGoodsOtherSearch = function(params) {
|
|
|
+ gagajf.ajaxSubmit("/goods/detail/goodsOther/frame", "html", "goodsOtherArea", params);
|
|
|
+}
|
|
|
+
|
|
|
+//상품평
|
|
|
+var jfGoodsReviewSearch = function(params) {
|
|
|
+ gagajf.ajaxSubmit("/goods/detail/goodsReview/frame", "html", "goodsReviewArea", params);
|
|
|
+}
|
|
|
+
|
|
|
+//상품문의
|
|
|
+var jfGoodsQnaSearch = function(params) {
|
|
|
+ gagajf.ajaxSubmit("/goods/detail/goodsQna/frame", "html", "goodsQnaArea", params);
|
|
|
+}
|
|
|
+
|
|
|
+//재고수정시
|
|
|
+var jfStockChange = function(gb){
|
|
|
+
|
|
|
+ var obj = $("#goodsQty");
|
|
|
+ var objQty = parseInt($("#goodsQty").val());
|
|
|
+ if(gb == 'minus'){
|
|
|
+ if(gagajf.isNull($("#cartForm input[name=sizeCd]").val())){
|
|
|
+ mcxDialog.alert("사이즈를 선택하세요.");
|
|
|
+ } else if(objQty <= parseInt($("#cartForm input[name=minOrdQty]").val()) && !gagajf.isNull($("#cartForm input[name=sizeCd]").val())){
|
|
|
+ mcxDialog.alert("구매하실 수 있는 최소 수량입니다.");
|
|
|
+ } else {
|
|
|
+ obj.val(objQty-1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(gagajf.isNull($("#cartForm input[name=sizeCd]").val())){
|
|
|
+ mcxDialog.alert("사이즈를 선택하세요.");
|
|
|
+ }else if(objQty < parseInt($("#cartForm input[name=maxOrdQty]").val())){
|
|
|
+ obj.val(objQty+1);
|
|
|
+ }else{
|
|
|
+ mcxDialog.alert("구매하실 수 있는 최대 수량입니다.");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $("#cartForm input[name=ordQty]").val(obj.val());
|
|
|
+}
|
|
|
+
|
|
|
+//장바구니담기(단품)
|
|
|
+/**
|
|
|
+ * @type : function
|
|
|
+ * @access : public
|
|
|
+ * @desc : 바로구매, 장바구니 담기
|
|
|
+ * <pre>
|
|
|
+ * addCart(btnType,goodsType);
|
|
|
+ * </pre>
|
|
|
+ * @param : btnType - 장바구니. '' , 바로구매 : 'DIRECT'. 필수
|
|
|
+ * @param : layer - 레이어 여부. 딜상품일 경우 . '' : 본창, 'layer':레이어창
|
|
|
+ * @since : 2020/07/23
|
|
|
+ * @author : eskim
|
|
|
+ */
|
|
|
+var addCart = function(btnType, layer){
|
|
|
+ var params = [];
|
|
|
+ var goodsType = $("#cartForm input[name=goodsType]").val();
|
|
|
+
|
|
|
+ if (goodsType == 'N'){
|
|
|
+ if (gagajf.isNull($("#cartForm input[name=sizeCd]").val())) {
|
|
|
+ mcxDialog.alertC('사이즈를 선택해 주십시오.');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var obj = new Object();
|
|
|
+
|
|
|
+ obj.btnType = btnType;
|
|
|
+ obj.goodsType = $("#cartForm input[name=goodsType]").val();
|
|
|
+ obj.goodsCd = $("#cartForm input[name=goodsCd]").val();
|
|
|
+ obj.itemCd = $("#cartForm input[name=goodsCd]").val();
|
|
|
+ obj.sizeCd = $("#cartForm input[name=sizeCd]").val();
|
|
|
+ obj.goodsQty = $("#cartForm input[name=ordQty]").val();
|
|
|
+ obj.itemQty = 1;
|
|
|
+ obj.planDtlSq =$("#cartForm input[name=planDtlSq]").val();
|
|
|
+ params.push(obj);
|
|
|
+
|
|
|
+ }else if (goodsType == 'S'){
|
|
|
+ var target=$('.sizelistCart');
|
|
|
+ var targetSize=target.length;
|
|
|
+ var itemSize = target.find('.item').find('input[type=radio]:checked').length;
|
|
|
+ if (targetSize != itemSize){
|
|
|
+ mcxDialog.alert("구성상품들의 사이즈를 선택하세요.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ target.find('.item').find('input[type=radio]:checked').each(function() {
|
|
|
+
|
|
|
+ var arrInfo = $(this).val().split('|'); // 상품코드|사이즈|구성수량
|
|
|
+
|
|
|
+ var obj = new Object();
|
|
|
+ obj.btnType = btnType;
|
|
|
+ obj.goodsType = $("#cartForm input[name=goodsType]").val();
|
|
|
+ obj.goodsCd = $("#cartForm input[name=goodsCd]").val();
|
|
|
+ obj.itemCd = arrInfo[0];
|
|
|
+ obj.sizeCd = arrInfo[1];
|
|
|
+ obj.goodsQty = $("#cartForm input[name=ordQty]").val();
|
|
|
+ obj.itemQty = Number(arrInfo[2]);
|
|
|
+ obj.planDtlSq =$("#cartForm input[name=planDtlSq]").val();
|
|
|
+ params.push(obj);
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ }else{
|
|
|
+ if (layer == 'layer'){
|
|
|
+
|
|
|
+ var goodsSize = $("#optionListLayer").children('ul').length
|
|
|
+ if (goodsSize <= 0){
|
|
|
+ mcxDialog.alert("구성상품들의 사이즈를 선택하세요.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $('#optionListLayer > ul').each(function() {
|
|
|
+
|
|
|
+ var arrInfo = $(this).find('input[name="coption"]').val().split(':');
|
|
|
+
|
|
|
+ var obj = new Object();
|
|
|
+ obj.btnType = btnType;
|
|
|
+ obj.goodsType = $("#cartForm input[name=goodsType]").val();
|
|
|
+ obj.goodsCd = $("#cartForm input[name=goodsCd]").val();
|
|
|
+ obj.itemCd = arrInfo[0];
|
|
|
+ obj.sizeCd = arrInfo[1];
|
|
|
+ obj.goodsQty = $(this).find('input[name="cea"]').val();
|
|
|
+ obj.itemQty = 1;
|
|
|
+ obj.planDtlSq = $("#cartForm input[name=planDtlSq]").val();
|
|
|
+ params.push(obj);
|
|
|
+
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ if (_frontGb == "P"){
|
|
|
+ var goodsSize = $("#optionListDiv").children('ul').length
|
|
|
+ if (goodsSize <= 0){
|
|
|
+ mcxDialog.alert("구성상품들의 사이즈를 선택하세요.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $('#optionListDiv > ul').each(function() {
|
|
|
+
|
|
|
+ var arrInfo = $(this).find('input[name="coption"]').val().split(':');
|
|
|
+ $(this).find('input[name="coption"]').attr('goodsCd')
|
|
|
+
|
|
|
+ var obj = new Object();
|
|
|
+ obj.btnType = btnType;
|
|
|
+ obj.goodsType = $("#cartForm input[name=goodsType]").val();
|
|
|
+ obj.goodsCd = $("#cartForm input[name=goodsCd]").val();
|
|
|
+ obj.itemCd = arrInfo[0];
|
|
|
+ obj.sizeCd = arrInfo[1];
|
|
|
+ obj.goodsQty = $(this).find('input[name="cea"]').val();
|
|
|
+ obj.itemQty = 1;
|
|
|
+ obj.planDtlSq = $("#cartForm input[name=planDtlSq]").val();
|
|
|
+ params.push(obj);
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ var goodsSize = $("#optionListDiv").children('dl').length
|
|
|
+ if (goodsSize <= 0){
|
|
|
+ mcxDialog.alert("구성상품들의 사이즈를 선택하세요.");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ $('#optionListDiv > dl').each(function() {
|
|
|
+
|
|
|
+ var arrInfo = $(this).find('input[name="coption"]').val().split(':');
|
|
|
+ $(this).find('input[name="coption"]').attr('goodsCd')
|
|
|
+
|
|
|
+ var obj = new Object();
|
|
|
+ obj.btnType = btnType;
|
|
|
+ obj.goodsType = $("#cartForm input[name=goodsType]").val();
|
|
|
+ obj.goodsCd = $("#cartForm input[name=goodsCd]").val();
|
|
|
+ obj.itemCd = arrInfo[0];
|
|
|
+ obj.sizeCd = arrInfo[1];
|
|
|
+ obj.goodsQty = $(this).find('input[name="cea"]').val();
|
|
|
+ obj.itemQty = 1;
|
|
|
+ obj.planDtlSq = $("#cartForm input[name=planDtlSq]").val();
|
|
|
+ params.push(obj);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //DIRECT : 바로 구매. '' : 장바구니
|
|
|
+ cfnPutCartList(params);
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//url 복사
|
|
|
+var jfCopyLinkUrl = function(goodsCd){
|
|
|
+ cfnCopyLinkUrl(location.protocol + _PAGE_GOODS_DETAIL + goodsCd);
|
|
|
+}
|
|
|
+
|
|
|
+//SNS 연동
|
|
|
+var jfSendToSns = function(goodsCd, goodsNm, goodsImg, snsGb) {
|
|
|
+ var linkUrl = location.protocol + _PAGE_GOODS_DETAIL + goodsCd;
|
|
|
+
|
|
|
+ if (goodsImg.indexOf("http") <= -1 || goodsImg.indexOf("https") <= -1){
|
|
|
+ var _goodsImgUrl = _uploadGoodsUrl;
|
|
|
+ goodsImg = "https:"+goodsImg;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (snsGb == "FB"){
|
|
|
+ cfnSendToFaceBook(linkUrl,goodsNm ,goodsImg);
|
|
|
+ }else if (snsGb == "KK"){
|
|
|
+ if (_frontGb == "P"){
|
|
|
+ cfnSendToKakao(linkUrl,goodsNm ,goodsImg);
|
|
|
+ }else{
|
|
|
+ cfnSendToKakaoMob(linkUrl,goodsNm ,goodsImg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//****************상품상세 end **********************************
|
|
|
+
|
|
|
+//****************상품검색 start **********************************
|
|
|
+// 상품 정렬
|
|
|
+var fnSortChange = function(sortGb) {
|
|
|
+ if($("#searchForm input:hidden[name=sortGb]").val()==sortGb){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (_frontGb == "P"){
|
|
|
+ $('.productsection .filterbutton').html('필터 열기<span>현재 상태 : 닫힘</span>').removeClass('active');
|
|
|
+ $('.filterlist').css({'height':'0'});
|
|
|
+ }else{
|
|
|
+ areaClose();
|
|
|
+ }
|
|
|
+ $("#searchForm input[name=sortGb]").val(sortGb);
|
|
|
+ fnCategoryGoodsInfiniteScrollInit();
|
|
|
+ fnGoodsListSearch();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+var filterHtml = '';
|
|
|
+var filterStatHtml = '';
|
|
|
+// 필터 적용
|
|
|
+var fnFilterSearch = function() {
|
|
|
+ $(".filterstate .filter_div").empty();
|
|
|
+ fnCategoryGoodsInfiniteScrollInit();
|
|
|
+ filterHtml = '';
|
|
|
+ filterStatHtml = '';
|
|
|
+ gagaInfiniteScroll.pageStatus.filterHtml = filterHtml;
|
|
|
+ gagaInfiniteScroll.pageStatus.filterStatHtml = filterStatHtml;
|
|
|
+ fnFilterSet('brand');
|
|
|
+ fnFilterSet('size');
|
|
|
+ fnFilterSet('color');
|
|
|
+ fnFilterSet('price');
|
|
|
+ if (_frontGb == "P"){
|
|
|
+ $('.productsection .filterbutton').html('필터 열기<span>현재 상태 : 닫힘</span>').removeClass('active');
|
|
|
+ $('.filterlist').css({'height':'0'});
|
|
|
+ }else{
|
|
|
+ areaClose();
|
|
|
+ }
|
|
|
+ fnGoodsListSearch();
|
|
|
+}
|
|
|
+
|
|
|
+var fnFilterSet = function(searchId) {
|
|
|
+
|
|
|
+ $("#searchForm input:hidden[name="+searchId+"Search]").remove();
|
|
|
+ $(".filterstate li[name="+searchId+"Stat]").remove();
|
|
|
+ var tag = '';
|
|
|
+ $('#filterForm input[name='+searchId+']:checked').each(function(){
|
|
|
+ tag = '<input type="hidden" name="'+searchId+'Search" value="'+$(this).val()+'"/>\n';
|
|
|
+ $("#searchForm").append(tag);
|
|
|
+ filterHtml += tag;
|
|
|
+ if(_frontGb != "P"){
|
|
|
+ tag = '<button type="button" class="removefilter" onclick="fnFilterStatRemove(\''+searchId+'\', \''+$(this).val()+'\');">'+$(this).closest('li').children('label').text()+'</button>';
|
|
|
+ $(".filterstate .filter_div").append(tag);
|
|
|
+ }else{
|
|
|
+ tag = '<li name="'+searchId+'Stat">'+$(this).closest('li').children('label').text()+'<button type="button" onclick="fnFilterStatRemove(\''+searchId+'\', \''+$(this).val()+'\');">DELETE</button></li>';
|
|
|
+ $(".filterstate").append(tag);
|
|
|
+ }
|
|
|
+ filterStatHtml += tag;
|
|
|
+ });
|
|
|
+ gagaInfiniteScroll.pageStatus.filterHtml = filterHtml;
|
|
|
+ gagaInfiniteScroll.pageStatus.filterStatHtml = filterStatHtml;
|
|
|
+}
|
|
|
+
|
|
|
+var fnFilterStatRemove = function(searchId, val){
|
|
|
+ $('#filterForm input[name='+searchId+']:checked').each(function(){
|
|
|
+ if($(this).val()==val){
|
|
|
+ $(this).attr("checked", false);
|
|
|
+ $(this).parent().removeClass("active");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ fnFilterSearch();
|
|
|
+}
|
|
|
+
|
|
|
+// 필터 초기화
|
|
|
+var fnFilterReset = function() {
|
|
|
+ filterReset();
|
|
|
+}
|
|
|
+//****************상품검색 end **********************************
|