// ------------------------------------- 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ë¡œ 변경하면 í† ìš” ìˆ˜ë ¹ì—¬ë¶€ ê°•ì œë…¸ì¶œì„ ì¦‰ì‹œ ì ìš© ( ì„¤ì • 파ì¼ì—ì„œ ì„ ì–¸í•˜ëŠ”ê±¸ë¡œ ìˆ˜ì •), ì„¤ì •íŒŒì¼ì˜ 변수를 ìƒì„¸íŽ˜ì´ì§€ì—ì„œ 활용
var jsttmp = 202504041651;
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('[필수] ì˜µì…˜ì„ ì„ íƒí•´ 주세요.');;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") ){
//if ((($('#stcpidx').val() == stdsfreshcpidx_) || ($('#stcpidx').val()==stdelicpidx_)) && (saturday_receive_yn == "N") && (saturday_allways_view == "Y") ){
saturday_receive_yn = "Y";
}
if (($('#stcpidx').val()==stdelicpidx_) && (saturday_receive_yn == "N") && (salad_saturday_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('주문시ë„중 오류가 ë°œìƒí–ˆìŠµë‹ˆë‹¤.');
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";
}
if (stdeligsscnt_ >0 && (saturday_receive_yn == "N") && (salad_saturday_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';