// ------------------------------------- 210111 토요배송 여부 관련 내용 추가 let sttoday_ = new Date(); var stweek = ['일', '월', '화', '수', '목', '금', '토']; var stday = new Date(sttoday_).getDay(); var stdsfreshcpidx_ = 1685368;var staskdscpidx_ = 1089510; var stdelicpidx_ = 2884450; //다신쿨배송, 에스크다신, 저스트그린 cpidx 정의 var stdsfreshcnt_ = 0;var staskdscnt_ = 0; var stdeligsscnt_ = 0; //다신쿨배송, 에스크다신,저스트그린 상품 카운트 //토요일배송 플래그 default : N var flg_stdaydlv = "N"; var saturday_receive_yn ="N"; //알럿창 노출 여부(상품에 및 시간에 따라) var saturday_ui_view = "Y"; //알럿창 노출 여부(상품 시간 상관없이 노출여부처리) //var timf_saturday_ui_open_yn ="N"; //팀프레시 토요배송여부 목요일 9시부터 노출여부 ( 설정 파일에서 선언하는걸로 수정) //var saturday_allways_view = "Y"; // 이값을 Y로 변경하면 토요 수령여부 강제노출을 즉시 적용 ( 설정 파일에서 선언하는걸로 수정), 설정파일의 변수를 상세페이지에서 활용 function stgetYMD(fdate) { var d = new Date(fdate);month = '' + (d.getMonth() + 1);day = '' + d.getDate();year = d.getFullYear(); if (month.length < 2) {month = '0' + month;} if (day.length < 2) {day = '0' + day;} return [year, month, day].join('-'); } function stgetHMS(fdate) { var d = new Date(fdate);Hour_ = '' + d.getHours();Min_ = '' + d.getMinutes();Sec_ = '' + d.getSeconds(); if (Hour_.length < 2) {Hour_ = '0' + Hour_;} if (Min_.length < 2) {Min_ = '0' + Min_;} if (Sec_.length < 2) {Sec_ = '0' + Sec_;} return Hour_+Min_+Sec_; } // ------------------------------------- 210111 //상세페이지의 NPay구매버튼 function buy_nc(url){ if($('[id^=adop]:visible').length == 0){ alert(decodeURIComponent('%5B%ED%95%84%EC%88%98%5D %EC%98%B5%EC%85%98%EC%9D%84 %EC%84%A0%ED%83%9D%ED%95%B4 %EC%A3%BC%EC%84%B8%EC%9A%94'));;return false; }else{ //------------------------------------------------------------------ //---- 토요일 배송 여부 체크 210111 //이상품이 다신쿨배송, 또는 에스크다신 상품이다. //211126 토요배송 무조건 보이게 처리 임시. stday sttoday_ 조건문 주석처리 두군데다. 211209 해제 flg_stdaydlv = "N"; saturday_receive_yn ="N"; let nowhis = parseInt(stgetHMS(sttoday_)); if ( stday==4 && nowhis>=90000 && nowhis <160000){ if (timf_saturday_ui_open_yn == "N"){ if ($('#stcpidx').val()==stdelicpidx_){ saturday_receive_yn ="Y"; } }else{ if ( ($('#stcpidx').val()==stdsfreshcpidx_) || ($('#stcpidx').val()==staskdscpidx_) || ($('#stcpidx').val()==stdelicpidx_) ){ saturday_receive_yn ="Y"; } } }else if ((stday==4 && nowhis>=160000) || (stday==5 && nowhis<90000) ){ //다신쿨배송 상품 또는 에스크기획_다신 상품이 있을 경우 조건 추가 if ( ($('#stcpidx').val()==stdsfreshcpidx_) || ($('#stcpidx').val()==staskdscpidx_) || ($('#stcpidx').val()==stdelicpidx_) ){ saturday_receive_yn ="Y"; } }else if (stday==5 && nowhis>=90000 && nowhis <160000){ if (($('#stcpidx').val()==stdsfreshcpidx_) || ($('#stcpidx').val()==staskdscpidx_)){ saturday_receive_yn ="Y"; } } //토요 수령여부 강제노출 if (($('#stcpidx').val() == stdsfreshcpidx_) && (saturday_receive_yn == "N") && (saturday_allways_view == "Y") ){ saturday_receive_yn = "Y"; } //saturday_receive_yn ="N"; //토요배송 강제 미노출(2023.09.25) if ( saturday_receive_yn =="Y" && saturday_ui_view == "Y" ){ if(confirm("주문하시는 상품을 '토요일'에 수령 가능하신가요?\n - 가능하시면 “확인”버튼을,\n - 수령이 어려우시면 “취소”를 선택주세요. \n(취소 선택시 평일에 수령하실 수 있도록 발송해드립니다.)")) { flg_stdaydlv = "Y"; //확인의 경우 } else { flg_stdaydlv = "P"; //취소의 경우 } } //------------------------------------------------------------------ //special Option select limit if(!$.OptSelLimit()){return;} //210414 구매, 장바구니담기 시 기 본 옵션 선택 여부 체크 if($.OptTypecnt()==0){$.OptBlock("buy");return;} //------------------------------------------------------- //insert cart_list var cartSels_ = "";var loc_param = ""; $('.sel3ul > tr').each(function(){//div:first > span:first > span //if($(this).data('activeyn') == "Y"){cartSels_ += this.id.replace("adop", "") +":"+ $(this).find('span:[id=curcnt]').text() +",";} if($(this).data('activeyn') == "Y"){ // change get option count if ($.browser.msie == true && (parseInt($.browser.version, 10) < 10 )){ cartSels_ += this.id.replace("adop", "") +":"+ $('input:[data-idx='+this.id.replace("adop", "")+']').val() +","; }else{ cartSels_ += this.id.replace("adop", "") +":"+ $(this).find('span:[id=curcnt]').find('input[type=number]').val() +","; } } }); cartSels_ = cartSels_.substr(0, cartSels_.length-1);loc_param = "g="+$('input[name=g]').val()+"&mySels="+cartSels_; var cartresult = 'N'; var viewnewcartidx = 0; jQuery.ajax({ url:"/api/goods/api_cart_wb.asp",type:'POST',data: loc_param,async: false,dataType:'json',error:function(request,status,error){ //alert('Error'+ '\ncode:'+request.status +'\n'+'message:'+request.responseText); alert(decodeURIComponent('%EC%A3%BC%EB%AC%B8%EB%8F%84%EC%A4%91 %EC%98%A4%EB%A5%98%EA%B0%80 %EB%B0%9C%EC%83%9D%ED%96%88%EC%8A%B5%EB%8B%88%EB%8B%A4')); return; }, success:function(obj){if(obj.result == "Y"){cartresult = 'Y';viewnewcartidx=obj.rtncidx;}else{} } }); if (cartresult == 'N'){ return; } //----------------------------- 20190508 add script gtag('event','클릭',{'event_category':'네이버페이구매','event_label': $('.v_top_name').text() }); //----------------------------- // 구글애즈 네이버페이버튼 클릭 설치 201103 ---- var gtag_naverpay_button_url = 'https://dshop.dietshin.com/goods/view.asp?g='+$('input[name=g]').val(); gtag_report_conversion(gtag_naverpay_button_url); // 구글애즈 네이버페이버튼 클릭 설치 201103 ---- var opt1_selector = $('[id^=adop]:visible'); if(opt1_selector.length == 0 ){ alert('error : goods selecting');return; }else{ var this_optsCnt = opt1_selector.length; opt_selector = opt1_selector; } //200310 add to cpidx check var dsfreshflag = "N"; dsfreshflag = $("#dsfresh").val(); //200428 dsdashin flag var dsdashinflag = "N"; dsdashinflag = $("#dsdashin").val(); //var this_optsCnt = opt_selector.length; //210111 stdaydlv 토요일 배송여부 추가 //210930 uncp (통합용실제CP idx), uncpfee(통합용실제CP 배송비), bundleyn 추가 var cartinfo_ = "{\"goodsCnt\": 1, \"odkind\": \"e\", \"stdaydlv\":\""+ flg_stdaydlv +"\", \"goodsdata\":[{\"cartidx\": "+viewnewcartidx+",\"goodsidx\": "+$('input[name=g]').val()+" ,\"cartoptCnt\": "+this_optsCnt +",\"cartdelivfee\": 0, \"dsfresh\":\""+ dsfreshflag +"\", \"dsdashin\":\""+ dsdashinflag +"\", \"uncp\": "+($('#stcpidx').val())+", \"uncpfee\": \""+($('#uncpfee').val())+"\", \"bundleyn\": \""+($('#unbundleyn').val())+"\", \"optdata\":["; var optdata_ = ""; for (j=0;j=90000 && nowhis <160000){ if (timf_saturday_ui_open_yn == "N"){ if ($('#stcpidx').val()==stdelicpidx_){ saturday_receive_yn ="Y"; } }else{ if ( stdsfreshcnt_+staskdscnt_+stdeligsscnt_ > 0 ){ saturday_receive_yn ="Y"; } } }else if ((stday==4 && nowhis>=160000) || (stday==5 && nowhis<90000) ){ //다신쿨배송 상품 또는 에스크기획_다신 상품이 있을 경우 조건 추가 if ( stdsfreshcnt_+staskdscnt_+stdeligsscnt_>0 ){ saturday_receive_yn ="Y"; } }else if(stday==5 && nowhis>=90000 && nowhis <160000){ if (stdsfreshcnt_+staskdscnt_ > 0){ saturday_receive_yn ="Y"; } } //토요 수령여부 강제노출 if ((stdsfreshcnt_ > 0) && (saturday_receive_yn == "N") && (saturday_allways_view == "Y") ){ saturday_receive_yn = "Y"; } //saturday_receive_yn ="N"; //토요배송 강제 미노출(2023.09.25) if ( saturday_receive_yn == "Y" && saturday_ui_view == "Y" ){ if(confirm("주문하시는 상품을 '토요일'에 수령 가능하신가요?\n - 가능하시면 “확인”버튼을,\n - 수령이 어려우시면 “취소”를 선택주세요. \n(취소 선택시 평일에 수령하실 수 있도록 발송해드립니다.)")) { flg_stdaydlv = "Y"; //확인의 경우 } else { flg_stdaydlv = "P"; //취소의 경우 } } //----------------------------- 20190508 add script gtag('event','클릭',{'event_category':'네이버페이구매','event_label': '장바구니 - 유선' }); //----------------------------- // 구글애즈 네이버페이버튼 클릭 설치 201103 ---- var gtag_naverpay_button_url = 'https://dshop.dietshin.com/goods/cart_list.asp'; gtag_report_conversion(gtag_naverpay_button_url); // 구글애즈 네이버페이버튼 클릭 설치 201103 ---- //var totaloptions = jQuery('li[id^=cartop][data-activeyn=Y]').length; var goodsinfo_ = "{\"goodsCnt\":"+totalgoods+",\"odkind\": \"c\", \"stdaydlv\":\""+ flg_stdaydlv +"\", \"goodsdata\":["; var cartinfo_ = "";var cartoptinfo_ = ""; var goodsinfo_end_ = "]}"; for (j=0;j< totalgoods;j++ ) { //var this_cart_ = jQuery('div[id^=cartgoods][data-activeyn=Y]').eq(j); var this_cart_ = jQuery('input[id^=chko][data-flg=Y]').eq(j).parent().parent().parent(); var this_bundledeliv_ = jQuery('input[id^=chko][data-flg=Y]').eq(j).data('bundledeliv'); var this_cart_idx_ = this_cart_.data("cartidx"); var this_goods_idx_ = this_cart_.data("goodsidx"); var this_options_ = jQuery('#cartgoods'+this_cart_idx_+' li[id^=cartop][data-activeyn=Y]').length; //210930 var this_uncp = this_cart_.data("uncp"); var this_uncpfee = this_cart_.data("uncpfee"); var this_bundleyn = this_cart_.data("bundleyn"); var this_cart_optinfo_ = ""; //200310 add to cpidx check //200428 add to check free delivery bundle dashin goods var parenttable_id = this_cart_.parent().parent().prop('id'); var dsfreshflag = "N"; var dsdashinflag = "N"; if((parenttable_id.substr(0, 15)==='SellerBundleDiv') && ((this_cart_.parent().parent().data('cpidx')*1)===(1685368)*1) && chkfreshFreegoods() ){ dsfreshflag = "Y"; }else{ dsfreshflag = "N"; } if( ((this_cart_.parent().parent().data('cpidx')*1)===(205013)*1) && chkdashinFreegoods() ){ dsdashinflag = "Y"; }else{ dsdashinflag = "N"; }//20200428 //cartdelivfee //200310 add fresh free flag //200428 add dashin free flag //200428 add CP idx //210930 add uncp, uncpfee cartinfo_ += "{\"cartidx\":"+ this_cart_idx_ +", \"cpidx\":"+ this_cart_.parent().parent().data('cpidx') +", \"goodsidx\":"+ this_goods_idx_ +", \"cartoptCnt\":"+ this_options_ +", \"cartdelivfee\":"+ this_bundledeliv_ +", \"dsfresh\":\""+ dsfreshflag +"\", \"dsdashin\":\""+ dsdashinflag +"\", \"uncp\": "+this_uncp+", \"uncpfee\": \""+this_uncpfee+"\", \"bundleyn\": \""+this_bundleyn+"\", \"optdata\":["; for (k=0;k tr > td> ul > li[id^=cartop][data-activeyn=Y]').eq(k); var this_cart_option_ = jQuery('#cartgoods'+this_cart_idx_).find('li[id^=cartop][data-activeyn=Y]').eq(k); var this_cart_option_idx_ = this_cart_option_.data("optidx"); //var this_cart_option_Cnt_ = this_cart_option_.find("span[id=curcnt]").text(); // change get option count if ($.browser.msie == true && (parseInt($.browser.version, 10) < 10 )){ var this_cart_option_Cnt_ = $('input:[data-idx='+this_cart_option_idx_+']').val(); var this_option_uc_ = $('input:[data-idx='+this_cart_option_idx_+']').data('uc'); }else{ var this_cart_option_Cnt_ = this_cart_option_.find("span[id=curcnt]").find('input[type=number]').val(); var this_option_uc_ = this_cart_option_.find("span[id=curcnt]").find('input[type=number]').data('uc'); } if(k == this_options_-1){ this_cart_optinfo_ += "{\"optidx\":"+this_cart_option_idx_+", \"optCnt\": "+this_cart_option_Cnt_+", \"optuc\": "+this_option_uc_+"}"; //this_cart_optinfo_ += "{"+k +'-'+ (k == this_options_-1) +"}"; }else{ this_cart_optinfo_ += "{\"optidx\":"+this_cart_option_idx_+", \"optCnt\": "+this_cart_option_Cnt_+", \"optuc\": "+this_option_uc_+"}, "; //this_cart_optinfo_ += "{"+k +'-'+ (k == this_options_-1) +"},"; } } cartinfo_ += this_cart_optinfo_; if(j == totalgoods-1){ cartinfo_ += goodsinfo_end_; }else{ cartinfo_ += goodsinfo_end_ +", "; } } $('#cartdata').val(goodsinfo_ + cartinfo_ + goodsinfo_end_); //--- 210111 ---------------------------------------------------------- //console.log('naver- '+ $('#cartdata').val() ); //alert('test ('+ flg_stdaydlv +') ['+ $('#cartdata').val() +']'); //return; //--- 210111 ---------------------------------------------------------- window.open('', 'NChk'); $('#cartform').attr('action', '/NVPayment/nvchk_od_wb.asp');$('#cartform').attr('target','NChk');$('#cartform').attr('method','POST'); $('#cartform').submit(); //location.reload(); //location.href='http://dshop.dietshin.com'; //------------------------------ return; } var script_saturday_delivery_flag_ = 'Y';