$.NewbundleDeliverySet = function(){ //alert(jQuery('[id^=SellerBundleDiv]').length +' - '+ jQuery('[id^=SellerEachDiv]').length); //return; //사용하지않는 변수와 함수의 중복동작으로 중지 //var dsbundleprice_ = jQuery.setbundledeliveryfee("DSShopBundleDiv"); var totalgroupdeliveryfee = 0; var dsgroupcnt_ = jQuery('[id=DSShopBundleDiv]').length; var dseagroupcnt_ = jQuery('[id^=DSShopEachDiv]').length; var sellergroupcnt_ = jQuery('[id^=SellerBundleDiv]').length; var sellereagroupcnt_ = jQuery('[id^=SellerEachDiv]').length; //dsshopbundle if (dsgroupcnt_ > 0) { jQuery.setbundledeliveryfee("DSShopBundleDiv"); //200428 add to calcurate dashin goods deliveryfee (bundle) if( chkdashinFreegoods() ){ totalgroupdeliveryfee = 0; }else{ totalgroupdeliveryfee = ($('#DSShopBundleDiv').find("span[id=groupdeliveryfee]").data('price'))*1; } } //console.log(' dsshop - '+ totalgroupdeliveryfee ); for (i=0;i em > span').text(FormatNumber(totalgroupdeliveryfee)); var totalorderprice = ($('#orderprice').data('orderprice'))*1; $('#totalprice').attr('data-totalprice', totalgroupdeliveryfee+totalorderprice).data('totalprice', totalgroupdeliveryfee+totalorderprice); $('#totalprice > em > span').text(FormatNumber(totalgroupdeliveryfee+totalorderprice)); //예약 배송 안내 출력세팅 20160525 $.checkReservd(); } jQuery.seteadeliveryfee = function(divid_){ var totaldelivfee_ = 0; var totalgoods = jQuery('#'+divid_).find('input[id^=chko][data-flg=Y]').length; //if totalgoods over 0 then calculating delivery fee if (totalgoods > 0){ for(d=0;d span > input').val())*1; var this_opt_price = (visibleGoodDiv.find('li[id^=cartop]:visible').eq(e).find('span:nth-child(3)').data('price'))*1; this_goods_total_ += this_opt_cnt*this_opt_price; //210323 할인금액 추가 할인금액 UI 작업 var this_opt_prcdiff = (visibleGoodDiv.find('li[id^=cartop]:visible').eq(e).data('prcdiff'))*1; this_goods_prcdiff_total_ += this_opt_cnt*this_opt_prcdiff; } //console.log(divid_ +'this_opt_cnt - '+ this_opt_cnt +'\n this_opt_price - '+ this_opt_price); if(this_deliverytype == "P"){ if(this_goods_total_ >= this_deliverycon){ this_rldeliverfee_ = 0; }else{ if (this_goods_total_ > 0){ this_rldeliverfee_ = this_deliveryfee; }else{ this_rldeliverfee_ = 0; } } }else if(this_deliverytype == "A"){ this_rldeliverfee_ = this_deliveryfee; }else{ this_rldeliverfee_ = 0; } totaldelivfee_ += this_rldeliverfee_; } //console.log(divid_ +'this_goods_total_ - '+ this_goods_total_ +'\n totaldelivfee_ - '+ totaldelivfee_); //alert('test - '+ divid_ +'\n length - '+ visibleGoodDiv.length); //set this selector data-bundledeliv //jQuery('#'+divid_).data('bundledeliv', totaldelivfee_).attr('data-bundledeliv', totaldelivfee_); jQuery('#'+divid_).find('input[id^=chko][data-flg=Y]').eq(0).data('bundledeliv', totaldelivfee_).attr('data-bundledeliv', totaldelivfee_); //set delivery fee of this goods in div element //$('#'+divid_).find('span[id=groupdeliveryfee]').attr('data-price', totaldelivfee_).data('price', totaldelivfee_).text(FormatNumber(totaldelivfee_)); $('#'+divid_).find('span[id=groupdeliveryfee]').attr('data-price', totaldelivfee_).data('price', totaldelivfee_).addClass('order_price_1').removeClass('order_price_2').html(FormatNumber(totaldelivfee_)+''); if(totaldelivfee_==0){$('#'+divid_).find('span[id=groupdeliveryfee]').addClass('order_price_2').removeClass('order_price_1').html('무료배송');} //set order price of this goods in div element $('#'+divid_).find('span[id=grouporderprice]').attr('data-price', this_goods_total_).data('price', this_goods_total_).text(FormatNumber(this_goods_total_)); //console.log('grouporderprice1 - ['+ divid_ +'] ['+ this_goods_total_ +']'); //set product price of this goods in div element 210323 할인금액 UI 작업 $('#'+divid_).find('span[id=grouppdtprice]').attr('data-pdtprice', this_goods_total_+this_goods_prcdiff_total_).data('pdtprice', this_goods_total_+this_goods_prcdiff_total_).text(FormatNumber(this_goods_total_+this_goods_prcdiff_total_)); //set order prcdiff price of this goods in div element 210323 할인금액 UI 작업 $('#'+divid_).find('span[id=groupdcprice]').attr('data-dcprice', this_goods_prcdiff_total_).data('dcprice', this_goods_prcdiff_total_).text(FormatNumber(this_goods_prcdiff_total_)); //20200707 $('#'+divid_).find('span[id=grouporderdeliveryfee]').attr('data-price', (this_goods_total_+totaldelivfee_)).data('price', (this_goods_total_+totaldelivfee_)).text(FormatNumber((this_goods_total_+totaldelivfee_))); }else{ this_goods_total_ = 0; this_goods_prcdiff_total_ = 0; this_rldeliverfee_ = 0; totaldelivfee_ += this_rldeliverfee_; //set this selector data-bundledeliv //jQuery('#'+divid_).data('bundledeliv', totaldelivfee_).attr('data-bundledeliv', totaldelivfee_); jQuery('#'+divid_).find('input[id^=chko][data-flg=Y]').eq(0).data('bundledeliv', totaldelivfee_).attr('data-bundledeliv', totaldelivfee_); //set delivery fee of this goods in div element //$('#'+divid_).find('span[id=groupdeliveryfee]').attr('data-price', totaldelivfee_).data('price', totaldelivfee_).text(FormatNumber(totaldelivfee_)); $('#'+divid_).find('span[id=groupdeliveryfee]').attr('data-price', totaldelivfee_).data('price', totaldelivfee_).addClass('order_price_1').removeClass('order_price_2').html('0'); //set order price of this goods in div element $('#'+divid_).find('span[id=grouporderprice]').attr('data-price', this_goods_total_).data('price', this_goods_total_).text(FormatNumber(this_goods_total_)); //console.log('grouporderprice2 - ['+ divid_ +'] ['+ this_goods_total_ +']'); //set product price of this goods in div element 210323 할인금액 UI 작업 $('#'+divid_).find('span[id=grouppdtprice]').attr('data-pdtprice', this_goods_total_).data('pdtprice', this_goods_total_).text(FormatNumber(this_goods_total_)); //set order prcdiff price of this goods in div element 210323 할인금액 UI 작업 $('#'+divid_).find('span[id=groupdcprice]').attr('data-dcprice', this_goods_prcdiff_total_).data('dcprice', this_goods_prcdiff_total_).text(FormatNumber(this_goods_prcdiff_total_)); //20200707 $('#'+divid_).find('span[id=grouporderdeliveryfee]').attr('data-price', (this_goods_total_+totaldelivfee_)).data('price', (this_goods_total_+totaldelivfee_)).text(FormatNumber((this_goods_total_+totaldelivfee_))); } return totaldelivfee_; } //예약 배송 상품 활성/비활성 체크 20160525 20190730 jQuery.checkReservd = function(){ // if ($('input[id^=chko][data-flg=Y][data-reservd=Y]').length > 0){ // $('#reservation_info').show();$('#firstbread_reservation_info').hide(); // }else if ($('input[id^=chko][data-flg=Y][data-reservd=F]').length > 0){ //add first buy bread condition 20190730 // $('#reservation_info').hide();$('#firstbread_reservation_info').show(); // }else{ // $('#reservation_info').hide();$('#firstbread_reservation_info').hide(); // } //add selector name for funnym seller 20190424 if( $('#DSShopBundleDiv').find('input[id^=chko][data-flg=Y][data-reservd=Y]').length > 0) { $('#DSShopBundleDiv').find('div[id$=reservation_info').hide();$('#reservation_info').show(); }else if( $('#DSShopBundleDiv').find('input[id^=chko][data-flg=Y][data-reservd=G]').length > 0) { $('#DSShopBundleDiv').find('div[id$=reservation_info').hide();$('#yogurt_reservation_info').show(); }else if( $('#DSShopBundleDiv').find('input[id^=chko][data-flg=Y][data-reservd=M]').length > 0){ $('#DSShopBundleDiv').find('div[id$=reservation_info').hide();$('#morningbread_reservation_info').show(); }else if( $('#DSShopBundleDiv').find('input[id^=chko][data-flg=Y][data-reservd=F]').length > 0){ $('#DSShopBundleDiv').find('div[id$=reservation_info').hide();$('#firstbread_reservation_info').show(); }else if( $('#DSShopBundleDiv').find('input[id^=chko][data-flg=Y][data-reservd=D]').length > 0) { $('#DSShopBundleDiv').find('div[id$=reservation_info').hide();$('#dessert_reservation_info').show(); }else{ $('#DSShopBundleDiv').find('div[id$=reservation_info').hide(); } //During changing yogurt company 20190424 if( $('table[id^=SellerBundleDiv]').find('input[id^=chko][data-flg=Y][data-reservd=G]').length > 0){ $('#yogurt_reservation_info2').show(); }else{ $('#yogurt_reservation_info2').hide(); } } jQuery.setbundledeliveryfee = function(divid_){ //210223 var dsbundlegoodstotalprice = 0; var dsbundlegoodstotalprcdiffprice = 0;var dsbundlegoodstotalproductprice = 0; var dsshopbundlegoodsCnt = jQuery('#'+divid_).find('input[id^=chko][data-flg=Y]').length; var dsshopbundlebasefee = jQuery('#'+divid_).data('basedeliveryfee'); var dsshopbundlefreefee = jQuery('#'+divid_).data('freedeliveryfee'); //if (dsshopbundlegoodsCnt == 1) //{ // return jQuery.seteadeliveryfee(divid_); //}else{ for(d=0;d span > input').val())*1; var this_opt_price = (visibleGoodDiv.find('li[id^=cartop]:visible').eq(e).find('span:nth-child(3)').data('price'))*1; this_goods_total_ += this_opt_cnt*this_opt_price; //210323 할인금액 추가 할인금액 UI 작업 var this_opt_prcdiff = (visibleGoodDiv.find('li[id^=cartop]:visible').eq(e).data('prcdiff'))*1; //console.log('bundle ['+divid_+'] this_opt_prcdiff - '+ this_opt_prcdiff); this_goods_prcdiff_total_ += this_opt_cnt*this_opt_prcdiff; //console.log('bundle this_goods_prcdiff_total_1 - '+ this_goods_prcdiff_total_); }else{ this_goods_total_ += 0; } } dsbundlegoodstotalprice += this_goods_total_; //210223 dsbundlegoodstotalprcdiffprice += this_goods_prcdiff_total_; dsbundlegoodstotalproductprice += (this_goods_total_+this_goods_prcdiff_total_); } var rldeliveryfee = 0; //20200708 var rldeliverydifference = 0; if ((dsbundlegoodstotalprice*1) >= (dsshopbundlefreefee*1)){ //set group price and group delivery fee var resetgroupfee = 0; //$('#'+divid_).find('span[id=groupdeliveryfee]').attr('data-price', resetgroupfee).data('price', resetgroupfee).text(FormatNumber(resetgroupfee)); $('#'+divid_).find('span[id=groupdeliveryfee]').attr('data-price', resetgroupfee).data('price', resetgroupfee).addClass('order_price_2').removeClass('order_price_1').html('무료배송'); rldeliveryfee = resetgroupfee; }else{ rldeliverydifference = (dsshopbundlefreefee*1) - (dsbundlegoodstotalprice*1); if ((dsbundlegoodstotalprice*1) > 0){ //200310 if( (($('#'+divid_).data('cpidx'))*1===(1685368*1)) && chkfreshFreegoods() ) {dsshopbundlebasefee = 0;} //200428 if( divid_==="DSShopBundleDiv" && chkdashinFreegoods() ) {dsshopbundlebasefee = 0;} //$('#'+divid_).find('span[id=groupdeliveryfee]').attr('data-price', dsshopbundlebasefee).data('price', dsshopbundlebasefee).text(FormatNumber(dsshopbundlebasefee)); $('#'+divid_).find('span[id=groupdeliveryfee]').attr('data-price', dsshopbundlebasefee).data('price', dsshopbundlebasefee).addClass('order_price_1').removeClass('order_price_2').html(FormatNumber(dsshopbundlebasefee)+''); if(dsshopbundlebasefee==0){$('#'+divid_).find('span[id=groupdeliveryfee]').addClass('order_price_2').removeClass('order_price_1').html('무료배송');} rldeliveryfee = dsshopbundlebasefee; }else{ //$('#'+divid_).find('span[id=groupdeliveryfee]').attr('data-price', 0).data('price', 0).text(FormatNumber(0)); $('#'+divid_).find('span[id=groupdeliveryfee]').attr('data-price', 0).data('price', 0).addClass('order_price_1').removeClass('order_price_2').html('0'); rldeliveryfee = 0; } } //console.log('id ('+divid_+') compare ('+ (($('#'+divid_).data('cpidx'))*1===(1685368*1)) +') freeyn - '+ chkfreshFreegoods() +' / cpid - '+ $('#'+divid_).data('cpidx') +' / dsbundlegoodstotalprice - '+ dsbundlegoodstotalprice +' / rldeliveryfee - '+ rldeliveryfee ); //set this selector data-bundledeliv ////jQuery('#'+divid_).data('bundledeliv', totaldelivfee_).attr('data-bundledeliv', totaldelivfee_); //200429 add to reset dashin bundle goods delivery fee if ((divid_=="DSShopBundleDiv") || (divid_.substring(0, 15)=="SellerBundleDiv" && $('#'+divid_).data("cpidx")=="1685368") ){ //reset jQuery('#'+divid_).find('input[id^=chko][data-flg=Y]').data('bundledeliv', 0).attr('data-bundledeliv', 0); if (divid_=="DSShopBundleDiv"){ //console.log('Dashin bundle'); }else{ //console.log('Fresh bundle'); } } jQuery('#'+divid_).find('input[id^=chko][data-flg=Y]').eq(0).data('bundledeliv', rldeliveryfee).attr('data-bundledeliv', rldeliveryfee); //console.log(divid_ +'('+ jQuery('#'+divid_).find('a[id^=chko][data-flg=Y]').eq(0).prop('id') +')에 '+rldeliveryfee+'으로 세팅'); //set order price of this goods in div element $('#'+divid_).find('span[id=grouporderprice]').attr('data-price', dsbundlegoodstotalprice).data('price', dsbundlegoodstotalprice).text(FormatNumber(dsbundlegoodstotalprice)); //console.log('grouporderprice 3 - ['+ divid_ +'] ['+ dsbundlegoodstotalprice +']'); //set order product price of this goods in div element 210323 할인금액 UI 작업 $('#'+divid_).find('span[id=grouppdtprice]').attr('data-pdtprice', dsbundlegoodstotalproductprice).data('pdtprice', dsbundlegoodstotalproductprice).text(FormatNumber(dsbundlegoodstotalproductprice)); //set order prcdiff price of this goods in div element 210323 할인금액 UI 작업 $('#'+divid_).find('span[id=groupdcprice]').attr('data-dcprice', dsbundlegoodstotalprcdiffprice).data('dcprice', dsbundlegoodstotalprcdiffprice).text(FormatNumber(dsbundlegoodstotalprcdiffprice)); //20200707 add orderprice + deliveryfee $('#'+divid_).find('span[id=grouporderdeliveryfee]').attr('data-price', (dsbundlegoodstotalprice+rldeliveryfee)).data('price', (dsbundlegoodstotalprice+rldeliveryfee)).text(FormatNumber((dsbundlegoodstotalprice+rldeliveryfee))); if (rldeliveryfee > 0 ){ jQuery('#'+divid_).find('#deliveryfee_ui').show(); jQuery('#'+divid_).find('#deliverydiffrence').text(FormatNumber(rldeliverydifference)); //console.log('['+dsshopbundlefreefee+'] ['+dsbundlegoodstotalprice+'] ['+(1*dsbundlegoodstotalprice >= 1*dsshopbundlefreefee)+'] ['+(100*(dsbundlegoodstotalprice/dsshopbundlefreefee))+']'); //220304 if($('#deliverydiffAio').length==1){ $('#deliverydiffAio').text(FormatNumber(rldeliverydifference)+"원") ; if (1*dsbundlegoodstotalprice == 0){ $('.aio_blue').css('width', '0%'); }else if(1*dsbundlegoodstotalprice < 1*dsshopbundlefreefee){ $('.aio_blue').css('width', 100*(dsbundlegoodstotalprice/dsshopbundlefreefee) +'%'); }else{ $('.aio_blue').css('width', '100%'); } } $('#deliveryfeeAio_ui').show(); }else{ jQuery('#'+divid_).find('#deliveryfee_ui').hide();jQuery('#'+divid_).find('#deliverydiffrence').text(FormatNumber(0)); //220304 if (1*dsshopbundlegoodsCnt > 0) { $('.aio_blue').css('width', '100%');$('#deliverydiffAio').text(FormatNumber(0));$('#deliveryfeeAio_ui').hide(); }else{ $('.aio_blue').css('width', '0%');$('#deliveryfeeAio_ui').show();$('#deliverydiffAio').text(FormatNumber(dsshopbundlefreefee)+"원"); } } return dsbundlegoodstotalprice; //} } $.PutDeliveryFe = function(){ $.NewbundleDeliverySet();return; var totaldelivfee_ = 0; //var totalgoods = jQuery('div[id^=cartgoods][data-activeyn=Y]').length; var totalgoods = jQuery('input[id^=chko][data-flg=Y]').length; var ttt = "";var tat =""; for(d=0;d span > input').val)*1; var this_opt_price = (visibleGoodDiv.find('li[id^=cartop]:visible').eq(e).find('span:nth-child(3)').data('price'))*1; this_goods_total_ += this_opt_cnt*this_opt_price; } if(this_deliverytype == "P"){ if(this_goods_total_ >= this_deliverycon){ this_rldeliverfee_ = 0; }else{ this_rldeliverfee_ = this_deliveryfee; } }else if(this_deliverytype == "A"){ this_rldeliverfee_ = this_deliveryfee; }else{ this_rldeliverfee_ = 0; } if (this_rldeliverfee_ > 0){ visibleGoodDiv.find('.pdelivpay').show();visibleGoodDiv.find('.pdelivfree').hide(); }else{ visibleGoodDiv.find('.pdelivpay').hide();visibleGoodDiv.find('.pdelivfree').show(); } totaldelivfee_ += this_rldeliverfee_; //console.log(this_goods_total_); //ttt += d +':'+visibleGoodDiv.prop('id') +'-'+ thisgoods_options_ +'-'+ this_rldeliverfee_ +'-'+this_deliverytype+'-'+ visibleGoodDiv.prop('id') +'\n'; } $('#totaldeliveryfee').data('totaldeliveryfee', totaldelivfee_);$('#totaldeliveryfee > em > span').text(FormatNumber(totaldelivfee_)); } $.SumInit = function(){ $.PutDeliveryFe(); $.PutMlgSuma(); var now_order_price_ = (jQuery('#orderprice').data("orderprice"))*1; var now_total_price_ = 0; var now_deliveryfee_ = (jQuery('#totaldeliveryfee').data("totaldeliveryfee"))*1; now_total_price_ = now_order_price_ + now_deliveryfee_; jQuery('#orderprice').data('orderprice', now_order_price_); jQuery('#orderprice').attr('data-orderprice', now_order_price_);jQuery('#orderprice > em > span').text(FormatNumber(now_order_price_)); jQuery('#totalprice').data('totalprice', now_total_price_); jQuery('#totalprice').attr('data-totalprice', now_total_price_);jQuery('#totalprice > em > span').text(FormatNumber(now_total_price_)); } //금액초기화 $.SumInit(); $.tttt = function(){ jQuery.setbundledeliveryfee("DSShopBundleDiv"); } //현재 선택 값들 구하기 $.getMychecked = function(){ check_vals = ""; $("input[id^=chko]").each(function() { if($(this).data('flg')=='Y'){ check_vals = check_vals+','+this.id; }else{ } }); check_vals = check_vals.substring(1, check_vals.length); return check_vals; } //현재 선택 값의 개수 $.getMycheckedCnt = function(){ check_cnt = 0; $("input[id^=chko]:visible").each(function() { if($(this).data('flg')=='Y'){ check_cnt ++; }else{ } }); //check_vals = check_vals.substring(1, check_vals.length); return check_cnt; } $.allchecked = function(){ var flg_allcheck = true; $('input[id^=chko]:visible').each(function(){ if($(this).data('flg') == 'Y'){ return true; }else{ flg_allcheck = false;return false; } }); return flg_allcheck; } //checkbox setting jQuery('input[id^=chk]').on('click', function(){ //DSShopBundleDiv, SellerBundleDiv1, SellerBundleDiv2, SellerBundleDiv3 var this_flg_ = $(this).data('flg'); if($(this).attr('id') == "chkall"){ if(this_flg_ == 'N'){ jQuery.CheckboxChked('input[id^=chk]'); }else{ jQuery.CheckboxUnChked('input[id^=chk]'); } }else{ // if(this_flg_ == 'N'){ jQuery.CheckboxChked('#'+ $(this).prop('id') ); if($.allchecked()){ jQuery.CheckboxChked('#chkall'); } }else{ jQuery.CheckboxUnChked('#'+ $(this).prop('id') ); if($('#chkall').data('flg') == 'Y'){ jQuery.CheckboxUnChked('#chkall'); } } //20200707 bundle group check all control //chkbundleseller1 SellerBundleDiv1 var this_bundlegroup_id = $(this).closest('table').prop('id'); if(!checkUndefined(this_bundlegroup_id)){ var mygroup_chkbox_count = $(this).closest('table').find('input[type=checkbox][id^=chko]').length; var mygroup_checked_count = $(this).closest('table').find('input[type=checkbox][id^=chko][data-flg=Y]').length; if((mygroup_chkbox_count>0) && (mygroup_checked_count>0) && (mygroup_chkbox_count==mygroup_checked_count)){ this_bundlegroup_id == 'DSShopBundleDiv' ? jQuery.CheckboxChked('#chkbundledsshop') : jQuery.CheckboxChked("#chkbundleseller"+this_bundlegroup_id.replace('SellerBundleDiv', '')); }else{ this_bundlegroup_id == 'DSShopBundleDiv' ? jQuery.CheckboxUnChked('#chkbundledsshop') : jQuery.CheckboxUnChked("#chkbundleseller"+this_bundlegroup_id.replace('SellerBundleDiv', '')); } } } jQuery(".checkCnt").text($.getMycheckedCnt()); $.PutTotalp(); // //------------------------------------------------------------------------------- //211203 each checkbox delete button change if($('#chkall').next('span').is(':visible')){ $('.btn_delselgoods').hide();$('.btn_delallgoods').show(); }else{ $('.btn_delselgoods').show();$('.btn_delallgoods').hide(); } //------------------------------------------------------------------------------- }); //20200707 each checkbox checked/unchecked jQuery.CheckboxChked = function(str_selector){ $(str_selector).next().show();$(str_selector).attr('data-flg', 'Y').data('flg', 'Y'); if(!checkUndefined($(str_selector).prop('id'))){ //console.log('id - '+ $(str_selector).prop('id') ); //console.log( 'on ('+$(str_selector).prop('id')+') [('+ $(str_selector).prop('id').replace('chko', '') +')]- '+ $(str_selector).prop('id').indexOf('chko') ); if($(str_selector).prop('id').indexOf('chko')==0){ $('#cartgoods'+ $(str_selector).prop('id').replace('chko', '')).find('input[type=number]').removeAttr("readonly"); } } } jQuery.CheckboxUnChked = function(str_selector){ $(str_selector).next().hide();$(str_selector).attr('data-flg', 'N').data('flg', 'N'); if(!checkUndefined($(str_selector).prop('id'))){ if($(str_selector).prop('id').indexOf('chko')==0){ $('#cartgoods'+ $(str_selector).prop('id').replace('chko', '')).find('input[type=number]').attr("readonly", true); } } } //20200707 when object is 'undefined' return true function checkUndefined(obj) {return obj === void 0;}; //bundle title checkbox setting jQuery('input[id^=chkbundle]').on('click', function(){ var this_flg = $(this).data('flg');var bundle_group_ = ""; if($(this).prop('id')=="chkbundledsshop"){ bundle_group_ = "DSShopBundleDiv"; }else{ bundle_group_ = "SellerBundleDiv"+ $(this).prop('id').replace("chkbundleseller", ""); } if (this_flg == "Y"){ $('#'+bundle_group_).find('input[type=checkbox][id^=chko]').each(function(index){ jQuery.CheckboxChked('#'+ $(this).prop('id')); }); }else{ $('#'+bundle_group_).find('input[type=checkbox][id^=chko]').each(function(index){ jQuery.CheckboxUnChked('#'+ $(this).prop('id')); }); } var document_chkbox_count = $('input[type=checkbox][id^=chk]').length; var document_checked_count = $('input[type=checkbox][id^=chk][data-flg=Y]').length; if(document_chkbox_count==document_checked_count+1){ jQuery.CheckboxChked('#chkall'); } $.PutTotalp(); //------------------------------------------------------------------------------- //211203 chkbundledsshop delete button change if($('#chkall').next('span').is(':visible')){ $('.btn_delselgoods').hide();$('.btn_delallgoods').show(); }else{ $('.btn_delselgoods').show();$('.btn_delallgoods').hide(); } //------------------------------------------------------------------------------- }); $('#ggg').on('click', function(){ var coptidx = $('#gg').val(); var ttt = $.optcalc(coptidx, 'p'); alert('coptidx - '+ coptidx +'\n ttt - '+ ttt); }); //thisi sD Bu pdat escriptfun ction $.optcalc = function(coptidx, calctype){ var ccartidx = $('#cartop'+coptidx).parent().parent().parent().prop('id').replace('c'+'a'+'r'+'t'+'g'+'o'+'o'+'d'+'s',''); var calcre = "Y"; //location.href="/api/goods/api_optcalc.asp?o="+coptidx+"&c="+ccartidx+"&t="+calctype; //return; $.ajax({url:"/api/goods/api_optcalc_wb.asp",type:'POST',data: {o: coptidx , c: ccartidx, t: calctype}, dataType:'json', error:function(request,status,error){alert('Error'+ '\ncode:'+request.status +'\n'+'message:'+request.responseText);}, success:function(obj){if(obj.result == "Y"){calcre="Y";}else{calcre="N";}}}); //console.log('optcalc - '+ calcre); return calcre; alert(calcre); }; //thisi sD Bu pdat escriptfun ction for input order $.optinputcalc = function(coptidx, odcount){ var ccartidx = $('#cartop'+coptidx).parent().parent().parent().prop('id').replace('c'+'a'+'r'+'t'+'g'+'o'+'o'+'d'+'s',''); var calcre = "Y"; //location.href="/api/goods/api_optinputcalc_wb.asp?o="+coptidx+"&c="+ccartidx+"&t="+odcount; //return; $.ajax({url:"/api/goods/api_optinputcalc_wb.asp",type:'POST',data: {o: coptidx , c: ccartidx, t: odcount}, dataType:'json', error:function(request,status,error){alert('Error'+ '\ncode:'+request.status +'\n'+'message:'+request.responseText);}, success:function(obj){if(obj.result == "Y"){calcre="Y";}else{calcre="N";}}}); //console.log('optinputcalf - '+ calcre); return calcre; alert(calcre); }; //갯수 증가 와 가격 설정 (갯수x 가격) $.plsGoods = function(opt_idx){ if ($.optcalc(opt_idx, 'p') == "N"){return;} if($('#cartop'+opt_idx).parent().parent().parent().find('input[id^=chko]').data('flg') == 'Y'){ //var curent_no_ = (jQuery('#cartop'+opt_idx).find('span[id=curcnt]').text())*1; var curent_no_ = (jQuery('#cartop'+opt_idx).find('span[id=curcnt] > span > input').val())*1; var t_order_price_ = jQuery('#orderprice').data("orderprice"); var t_total_price_ = jQuery('#totalprice').data("totalprice"); if ((curent_no_*1) < 9999){ var this_price_ = (jQuery('#cartop'+opt_idx+' > span:nth-child(3)').data('price'))*1; //210323 할인금액 UI 작업 var this_product_price_ = this_price_+((jQuery('#cartop'+opt_idx).data('prcdiff'))*1); //jQuery('#cartop'+opt_idx).find('span[id=curcnt]').text(curent_no_ +1); jQuery('#cartop'+opt_idx).find('span[id=curcnt] > span > input').val(curent_no_ +1); jQuery('#cartop'+opt_idx+' > span:nth-child(3) > em').text(FormatNumber((curent_no_+1)*this_price_)); var this_goodsidx_ = $('li[id=cartop'+opt_idx+']:visible').closest('tr[id^=cartgoods]').data('goodsidx'); AW_INOUT(this_goodsidx_+"_"+opt_idx,curent_no_ +1); $.SumPrice(this_price_, this_product_price_, 'p'); } } } //갯수 감소 와 가격 설정 (갯수x 가격) $.mnsGoods = function(opt_idx){ if ($.optcalc(opt_idx, 'm') == "N"){return;} if($('#cartop'+opt_idx).parent().parent().parent().find('input[id^=chko]').data('flg') == 'Y'){ //var curent_no_ = (jQuery('#cartop'+opt_idx).find('span[id=curcnt]').text())*1; var curent_no_ = (jQuery('#cartop'+opt_idx).find('span[id=curcnt] > span > input').val())*1; var t_order_price_ = jQuery('#orderprice').data("orderprice"); var t_total_price_ = jQuery('#totalprice').data("totalprice"); if (curent_no_ > 1){ var this_price_ = (jQuery('#cartop'+opt_idx+' > span:nth-child(3)').data('price'))*1; //210323 할인금액 UI 작업 var this_product_price_ = this_price_+((jQuery('#cartop'+opt_idx).data('prcdiff'))*1); //jQuery('#cartop'+opt_idx).find('span[id=curcnt]').text(curent_no_ -1); jQuery('#cartop'+opt_idx).find('span[id=curcnt] > span > input').val(curent_no_ -1); jQuery('#cartop'+opt_idx+' > span:nth-child(3) > em').text(FormatNumber((curent_no_-1)*this_price_)); //2024.04.30 에이스카운터 때문에 추가 var this_goodsidx_ = $('li[id=cartop'+opt_idx+']:visible').closest('tr[id^=cartgoods]').data('goodsidx'); AW_INOUT(this_goodsidx_+"_"+opt_idx,curent_no_ -1); //2024.04.30 에이스카운터 때문에 추가 $.SumPrice(this_price_, this_product_price_, 'm'); } } } //옵션삭제 후 갯수 가격 리셋 $.optDel = function(opt_idx){ var visibleOpt_Cnt = $('#cartop'+opt_idx).parent().find('li[id^=cartop][data-activeyn=Y]').length; var parent_cart_idx = $('#cartop'+opt_idx).parent().parent().parent().prop("id").replace('cartgoods', ''); var this_quantt_ = $('#cartop'+opt_idx).find('.inputno2').val(); var this_goodsidx_ = $('li[id=cartop'+opt_idx+']:visible').closest('tr[id^=cartgoods]').data('goodsidx'); jQuery.ajax({ url:"/api/goods/api_optdel_wb.asp", type:'POST', data: {vCnt: visibleOpt_Cnt , cartidx: parent_cart_idx, optidx: opt_idx}, dataType:'json', error:function(request,status,error){ alert('Error'+ '\ncode:'+request.status +'\n'+'message:'+request.responseText); }, success:function(obj){ if(obj.result == "Y"){ //2024.04.30 에이스카운터 때문에 추가 AW_DEL(this_goodsidx_+"_"+opt_idx,this_quantt_); //2024.04.30 에이스카운터 때문에 추가 //location.replace("/goods/cart_list.asp"); location.reload(); }else{ //alert(obj.result_msg); } } }); } //input 수량 입력에 따른 가격 설정 (갯수x 가격) $.inputcalGoods = function(opt_idx){ //var curent_no_ = (jQuery('#cartop'+opt_idx).find('span[id=curcnt]').text())*1; var curent_no_ = (jQuery('#cartop'+opt_idx).find('span[id=curcnt] > span > input').val())*1; if ($.optinputcalc(opt_idx, curent_no_) == "N"){return;} if($('#cartop'+opt_idx).parent().parent().parent().find('input[id^=chko]').data('flg') == 'Y'){ var t_order_price_ = jQuery('#orderprice').data("orderprice"); var t_total_price_ = jQuery('#totalprice').data("totalprice"); if ((curent_no_*1) < 10000){ var this_price_ = (jQuery('#cartop'+opt_idx+' > span:nth-child(3)').data('price'))*1; //jQuery('#cartop'+opt_idx).find('span[id=curcnt]').text(curent_no_ +1); jQuery('#cartop'+opt_idx).find('span[id=curcnt] > span > input').val(curent_no_); jQuery('#cartop'+opt_idx+' > span:nth-child(3) > em').text(FormatNumber((curent_no_)*this_price_)); //2024.04.30 에이스카운터 때문에 추가 var this_goodsidx_ = $('li[id=cartop'+opt_idx+']:visible').closest('tr[id^=cartgoods]').data('goodsidx'); AW_INOUT(this_goodsidx_+"_"+opt_idx,curent_no_); //2024.04.30 에이스카운터 때문에 추가 $.SumPriceinput(this_price_); } } } $('input[type=number]').on("keypress", function(evt){ if(evt.which == 13){ var checkVal = $(this).val(); var num_check=/^[0-9]*$/; var maxlimitsel = 9999; if (!num_check.test(checkVal)){$(this).val(1);}else{ if((checkVal)*1>maxlimitsel){$(this).val(''); $(this).val(maxlimitsel);}else if((checkVal)*1 < 1){$(this).val(1);} } $.inputcalGoods($(this).data('idx'), $(this).val()); } else if(evt.which != 8 && evt.which != 0 && evt.which < 48 || evt.which > 57){evt.preventDefault();} }).on('blur', function(){ var checkVal = $(this).val(); var num_check=/^[0-9]*$/; var maxlimitsel = 9999; if (!num_check.test(checkVal)){$(this).val(1);}else{ if((checkVal)*1>maxlimitsel){$(this).val(''); $(this).val(maxlimitsel);}else if((checkVal)*1 < 1){$(this).val(1);} } $.inputcalGoods($(this).data('idx'), $(this).val()); }); $.soldOutDel = function(cartidx){ jQuery.ajax({ url:"/api/goods/api_cartdel_wb.asp", type:'POST', data: {cidxs:cartidx}, dataType:'json', error:function(request,status,error){ alert('Error'+ '\ncode:'+request.status +'\n'+'message:'+request.responseText); }, success:function(obj){ if(obj.result == "Y"){ //alert(obj.result_msg); jQuery(".checkCnt").next().text((jQuery(".checkCnt").next().text())-1); $('#cartgoods'+cartidx).hide(); // if(jQuery(".checkCnt").next().text() == 0){$('.cart_numb_wrap').hide();} else{$('.cart_numb').text((jQuery(".checkCnt").next().text()));} location.replace("/goods/cart_list.asp"); }else{ alert(obj.result_msg); } } }); } $.cartDelNew = function(){ var mychecks_ = $.getMychecked(); mychecks_ = mychecks_.replace(/chko/g, ''); mychecks_arr = mychecks_.split(','); //선택 상품- 옵션 쌍으로 삭제 loop for(i=0;itr').filter(function(){ if($.isNumeric($(this).data('cartidx'))){ icnt++; icnt==1 ? mychecks_ = $(this).data('cartidx') : mychecks_ = mychecks_ + ','+ $(this).data('cartidx'); }else{} }); if(String(mychecks_).indexOf(",") < 0){ mychecks_arr = mychecks_; }else{ mychecks_arr = mychecks_.split(','); } //-------------------------------------------------------------------- delete_info_head = "%EC%A0%84%EC%B2%B4%20"; }else{ var mychecks_ = $.getMychecked(); mychecks_ = mychecks_.replace(/chko/g, ''); mychecks_arr = mychecks_.split(','); delete_info_head = "%EC%84%A0%ED%83%9D%ED%95%9C%20"; } //console.log('mychecks_arr ['+tmp+'] \n mychecks_ ['+mychecks_+'] \n mychecks_arr ['+mychecks_arr+']'); return; //alert(mychecks_);return; if(mychecks_ == "" || mychecks_arr.length < 1){ alert( decodeURIComponent('%EC%82%AD%EC%A0%9C%ED%95%A0%20%EC%83%81%ED%92%88%EC%9D%84%20%EC%84%A0%ED%83%9D%ED%95%B4%EC%A3%BC%EC%84%B8%EC%9A%94.') ); return; }else{ if(confirm( decodeURIComponent(delete_info_head+'%EC%83%81%ED%92%88%EC%9D%84%20%EC%82%AD%EC%A0%9C%ED%95%98%EC%8B%9C%EA%B2%A0%EC%8A%B5%EB%8B%88%EA%B9%8C%3F') )){ var deltotalPrice = 0; //location.href="/api/goods/api_cartdel.asp?cidxs="+mychecks_; //return; jQuery.ajax({ url:"/api/goods/api_cartdel_wb.asp", type:'POST', data: {cidxs:mychecks_}, dataType:'json', error:function(request,status,error){ alert('Error'+ '\ncode:'+request.status +'\n'+'message:'+request.responseText); }, success:function(obj){ if(obj.result == "Y"){ if (tmp==1){ //2024.04.30 에이스카운터 때문에 추가 AW_CARTDEL(); //2024.04.30 에이스카운터 때문에 추가 } alert(obj.result_msg); $.cartDelNew(); location.replace("/goods/cart_list.asp"); }else{ alert(obj.result_msg); } } }); } } } //210323 $.SumPrice = function(repr, reproductpr, flg){ $.PutDeliveryFe(); $.PutMlgSuma(); var now_order_price_ = (jQuery('#orderprice').data("orderprice"))*1; //210323 할인금액 UI 작업 var now_product_price_ = (jQuery('#productprice').data("productprice"))*1; var now_total_price_ = 0; var now_deliveryfee_ = (jQuery('#totaldeliveryfee').data("totaldeliveryfee"))*1; if (flg == 'm') { now_order_price_ = (now_order_price_*1)-(repr); now_total_price_ = now_order_price_ + now_deliveryfee_; //210323 할인금액 UI 작업 now_product_price_ = (now_product_price_*1)-(reproductpr); }else{ now_order_price_ = (now_order_price_*1)+(repr); now_total_price_ = now_order_price_ + now_deliveryfee_; //210323 할인금액 UI 작업 now_product_price_ = (now_product_price_*1)+(reproductpr); } //210323 할인금액 UI 작업 $.SetPrice(now_order_price_,now_product_price_); } $.SumPriceinput = function(incPrice){ $.PutDeliveryFe(); $.PutMlgSuma(); var now_order_price_ = (jQuery('#orderprice').data("orderprice"))*1; var now_total_price_ = 0; var now_deliveryfee_ = (jQuery('#totaldeliveryfee').data("totaldeliveryfee"))*1; var groupordercnt = $('[id=grouporderprice]').length; var groupproductcnt = $('[id=grouppdtprice]').length; var now_order_price_ = 0; //console.log('groupordercnt - '+ groupordercnt); //210323 할인금액 UI 작업 var now_product_price_ = 0; for(g=0;g em > span').text(0);} var delivfee = (jQuery('#totaldeliveryfee').data("totaldeliveryfee"))*1; jQuery('#orderprice').data('orderprice', orpc); jQuery('#orderprice').attr('data-orderprice', orpc);jQuery('#orderprice > em > span').text(FormatNumber(orpc)); //210323 할인금액 UI 작업 jQuery('#productprice').data('productprice', pdtpc); jQuery('#productprice').attr('data-productprice', pdtpc);jQuery('#productprice > em > span').text(FormatNumber(pdtpc)); //210616 '총 00,000원을 할인 받으셨어요!' 영역 제거 //jQuery('#discountprice').data('discountprice', (pdtpc-orpc)); //jQuery('#discountprice').attr('data-discountprice', (pdtpc-orpc));jQuery('#discountprice > em > span').text(FormatNumber((pdtpc-orpc))); jQuery('#totalprice').data('totalprice', orpc+delivfee); jQuery('#totalprice').attr('data-totalprice', orpc+delivfee);jQuery('#totalprice > em > span').text(FormatNumber(orpc+delivfee)); } $.PutTotalp = function(){ var selgoodsCnt = $.getMycheckedCnt(); var totalCnt_ = 0;var totalPrice_ = 0; //210323 할인금액 UI 작업 var totalProductPrice_ = 0; var tempstr = ""; for(g=0;g span > input').val())*1; var v_thisprice = (vthisDiv.find('li[id^=cartop]').eq(v).find('span:nth-child(3)').data('price'))*1; //210323 할인금액 UI 작업 var v_thisproductprice = v_thisprice+((vthisDiv.find('li[id^=cartop]').eq(v).data('prcdiff'))*1); }else{ var v_thiscnt = 0; var v_thisprice = 0; //210323 할인금액 UI 작업 var v_thisproductprice = 0; } totalCnt_ += v_thiscnt; totalPrice_ += v_thiscnt*v_thisprice; //210323 할인금액 UI 작업 totalProductPrice_ += v_thiscnt*v_thisproductprice; } } $.PutDeliveryFe(); $.PutMlgSuma(); //210323 할인금액 UI 작업 $.SetPrice(totalPrice_, totalProductPrice_); if (parseInt($('#orderprice').data('orderprice'), 10) == 0){ //alert('주문 할 상품이 없습니다.'); //history.go(-1); //return; } }