function nameOption(){ defaultNname(); //console.log('ÃʱâÈ­'); var nameoption = $('#name_options'); //if(nameoption.css('display') == 'none'){ if($('#name_chk').prop('checked')){ nameoption.css({ display:'block' }); }else{ nameoption.css({ display:'none' }); } } function defaultNname(){ //ÀÚ¼ö½Åû ¼ÂÆðªµé ÃʱâÈ­ $('#n_name_price').val(0); $('#n_name_point').val(0); $('#n_line_price').val(0); $('#n_line_point').val(0); gform.n_name.value =''; gform.n_line.value = ''; $('#n_name_select option:eq(0)').prop('selected',true); $('#n_name_select').selectmenu('refresh', true); $('#n_line_select option:eq(0)').prop('selected',true); $('#n_line_select').selectmenu('refresh', true); $('#n_color_select option:eq(0)').prop('selected',true); $('#n_color_select').selectmenu('refresh', true); $('#n_content').val(''); priceSet(); } function nameOptionChange(kind,opt){ optionv = opt.split('@'); //¿É¼Ç º¯°æ½Ã ÀÌ Àü ¼±ÅÃÇÑ ¿É¼ÇÀÇ °¡°ÝÀº »©¾ßµÊ if(!optionv[1] || optionv[1] == undefined || optionv[1] == null){ optionv[1] = 0; } if(!optionv[2] || optionv[2] == undefined || optionv[2] == null){ optionv[2] = 0; } var cprice = parseInt(optionv[1]); var cpoint = parseInt(optionv[2]); if(kind == 'name'){ gform.n_name.value = optionv[0]; }else{ gform.n_line.value = optionv[0]; } //console.log($('#pricev').html()+'__'+cprice); if(kind == 'name'){ $('#n_name_price').val(parseInt(optionv[1])); $('#n_name_point').val(parseInt(optionv[2])); }else{ $('#n_line_price').val(parseInt(optionv[1])); $('#n_line_point').val(parseInt(optionv[2])); } priceSet(); } function commastring(x){ return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } function numChu(val){ return parseInt(val.replace(/[^0-9]/g,'')); } function priceSet(){ var optprice = 0, pricev = 0; for(l=1; l<=cnt; l++){ if(document.getElementById('option'+l) != null){ if(document.getElementById('option'+l).value){ pricev = document.getElementById('amount'+l).value * document.getElementById('optvalue'+l).value; optprice = optprice + pricev; document.getElementById('tprice'+l).innerHTML = commastring(String(pricev)) + '¿ø'; } } } optprice = optprice + parseInt($('#n_name_price').val()) + parseInt($('#n_line_price').val()); document.getElementById('pricev').innerHTML = commastring(String(optprice)) + '¿ø'; } var cnt = 0; function addLine(fvalue) { option = fvalue.split(','); for(i=1; i<= cnt; i++){ if(document.getElementById('option'+i).value == option[0]){ //¼±ÅÃÇÑ ¿É¼ÇÀÌ ¸ñ·Ï¿¡ ÀÖÀ»°æ¿ì if(document.getElementById("tr" + i).style.display == "none"){ //Áö¿ü´ø ¿É¼ÇÀÌ ÀÖÀ¸¸é ´Ù½Ã »ì¸² document.getElementById("tr" + i).style.display = ""; document.getElementById('amount'+i).value = 1; }else{ alert('¼±ÅÃÇÑ ¸ñ·Ï¿¡ ÀÖ½À´Ï´Ù..'); } priceSet(); return false; } } cnt++; tab_tr = "
  • "; tab_tr += "(»óÀÇ)"+option[0]+""; oprice = parseInt(gform.price.value) + parseInt(option[1]); opoint = parseInt(gform.point.value) + parseInt(option[2]); tab_tr += ""; tab_tr += "»óÇ°»èÁ¦ ¹öÆ°"; $('#tbl').append(tab_tr); gform.optcnt.value = cnt; gform.esscnt.value++; priceSet(); } function addLine1(fvalue) { option = fvalue.split(','); for(i=1; i<= cnt; i++){ if(document.getElementById('option'+i).value == option[0]){ if(document.getElementById("tr" + i).style.display == "none"){ document.getElementById("tr" + i).style.display = ""; document.getElementById('amount'+i).value = 1; }else{ alert('¼±ÅÃÇÑ ¸ñ·Ï¿¡ ÀÖ½À´Ï´Ù..'); } priceSet(); return false; } } cnt++; tab_tr = "
  • "; tab_tr += ""+option[0]+""; tab_tr += ""; tab_tr += "»óÇ°»èÁ¦ ¹öÆ°"; $('#tbl').append(tab_tr); gform.optcnt.value = cnt; priceSet(); } //¶óÀλèÁ¦ function deleteLine(n, d) { document.getElementById('amount'+n).value = 0; priceSet(); document.getElementById("tr" + n).style.display = "none"; if(d) { gform.esscnt.value--; $('#essential option:eq(0)').prop('selected',true); $('#essential').selectmenu('refresh', true); }else{ $('#addop option:eq(0)').prop('selected',true); $('#addop').selectmenu('refresh', true); } } function commastring(fvalue){ // , Ãß°¡ // fvaluenum=fvalue.length; if(fvaluenum>3){ comma=Math.ceil(fvaluenum/3)-1; substart = 0; for(x=comma; x>=0; x--){ sublast = fvaluenum-(x*3); val=fvalue.substring(substart, sublast); substart = sublast; if(x==comma){ vall = val + ','; } else if(x==0){ vall = vall + val; } else { vall = vall + val + ','; } } return vall; } else { return fvalue; } } function wishAdd(){ var form = document.gform; $.ajax({ url:'../inc/wishadd.php', type:'POST', dataType:'text', cache:false, data:{ mid:form.mid.value, barcode:form.barcode.value }, success:function(result){ if(result == "e"){ alert("ÀÌ¹Ì Âò¸ñ·Ï¿¡ ÀÖ´Â »óÇ°ÀÔ´Ï´Ù."); }else if(result == "s"){ if(confirm("ÇØ´ç »óÇ°À» Âò¸ñ·Ï¿¡ µî·ÏÇÏ¿´½À´Ï´Ù. \n\nÂò¸ñ·ÏÀ¸·Î À̵¿ÇϽðڽÀ´Ï±î?")){ location.href = "../mypage/wishlist.html"; } } }, error:function(xhr,status,error){ alert(xhr.responseText); } }); } function addCart(channel,mg,ar){ //mg : Á¦Á¶»óÇ°ÀÎÁö ¿©ºÎ, ar : Á¦Á¶»óÇ°À̶ó¸é ±¸¸Åµ¿ÀÇÀÎÁö ¾Æ´ÑÁö form = document.gform; var mr=''; if(channel != "wish"){ //2018-06-14 //Á¦Á¶»óÇ°ÀÏ °æ¿ì ±¸¸Åµ¿ÀÇ¿©ºÎ ÆÇ´ÜÇϱâ if(mg == 'Y'){ mr = gform.sell_accept[0].checked?'Y':'N'; if(mr == 'N'){ alert('´çÀÏÃâ°í »óÇ° ¿Ü ÁÖ¹® ÈÄ Á¦ÀÛ»óÇ°Àº \n\n±³È¯/¹ÝÇ°ÀÌ ºÒ°¡ÇÕ´Ï´Ù.\n\n(»óÇ°ÇÏ´Ü¿¡ \'ÁÖ¹®Àü ²À È®ÀÎÇØÁÖ¼¼¿ä\' ¹Ýµå½Ã ÀоîÁÖ¼¼¿ä)\n\nÁÖ¹®½Ã ±¸¸Åµ¿ÀÇ Ã¼Å©ÇÏ¼Å¾ß ±¸¸Å°¡ ¿Ï·áµË´Ï´Ù.'); return false; } //alert('´çÀÏÃâ°í »óÇ° ¿Ü ÁÖ¹® ÈÄ Á¦ÀÛ»óÇ°Àº \n\n±³È¯/¹ÝÇ°ÀÌ ºÒ°¡ÇÕ´Ï´Ù.\n\n(»óÇ°ÇÏ´Ü¿¡ \'ÁÖ¹®Àü ²À È®ÀÎÇØÁÖ¼¼¿ä\' ¹Ýµå½Ã ÀоîÁÖ¼¼¿ä)'); } chk = 0; for(i=1; i<= cnt; i++){ if(document.getElementById('tr' + i).style.display != 'none'){ if(!form.amount.value){ form.amount.value = document.getElementById('amount'+i).value; }else{ form.amount.value = form.amount.value + ','+document.getElementById('amount'+i).value; } if(!form.option.value){ form.option.value = document.getElementById('option'+i).value; }else{ form.option.value = form.option.value + ','+document.getElementById('option'+i).value; } if(!form.optvalue.value){ form.optvalue.value = document.getElementById('optvalue'+i).value; }else{ form.optvalue.value = form.optvalue.value + ','+document.getElementById('optvalue'+i).value; } if(!form.optpoint.value){ form.optpoint.value = document.getElementById('optpoint'+i).value; }else{ form.optpoint.value = form.optpoint.value + ','+document.getElementById('optpoint'+i).value; } } } if(!form.amount.value){alert('¼±ÅÃÇÑ ¿É¼ÇÀÌ ¾ø½À´Ï´Ù..');return false;} if(gform.esscnt.value == 0){alert('Çʼö¼±Åà ¿É¼ÇÀÌ ¾ø½À´Ï´Ù..');gform.essential.focus();return false;} if($('#name_chk').prop('checked')){ if(!$('#n_name_select').val()){ alert('ÀÚ¼ö¿É¼ÇÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.'); return false; } if(!$('#n_line_select').val()){ alert('À̸§ÀÚ¼ö¶óÀÎÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.'); return false; } if(!$('#n_color_select').val()){ alert('À̸§ÀÚ¼ö»ö»óÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.'); return false; } /*ÀÚ¼ö¿É¼Ç n_name_select À̸§ÀÚ¼ö¶óÀÎ n_line_select À̸§ÀÚ¼ö»ö»ó n_color_select À̸§ÀÚ¼ö ³»¿ë n_content*/ } } form.channel.value = channel; form.submit(); } function goodsZoom(barcode){ window.open('./open.htm?barcode='+barcode, 'goodsZoom', 'width=600, height=700'); }