//展開註冊欄位 function register() { $("#openregis").css('display','block'); thistop = $('#openregis').offset().top; $('html,body').animate({ scrollTop: thistop}, 600); } //登入 function loginUserCHK() { if( $("#login_number").val() == ""){ alert("請填入帳號!"); $("#login_number").focus(); return false; } if( $("#login_userpw").val() == ""){ alert("請填入密碼!"); $("#login_userpw").focus(); return false; } } //註冊 新增 欄位檢查 function checkjoin() { //設定帳號 if( $('#user_name').val() == ""){ alert( "請填入帳號!" ); $('#user_name').focus(); return false; }else if( $('#user_name').val().length >= 16){ alert( "您所輸入的帳號超過15位數!" ); $('#user_name').focus(); return false; }else if( $('#user_name').val().length <= 3){ alert( "您所輸入的帳號至少要4位數!" ); $('#user_name').focus(); return false; } //設定密碼 if( $('#user_pw').val() == ""){ alert( "請填入密碼!" ); $('#user_pw').focus(); return false; }else if( $('#user_pw').val().length >= 21){ alert( "您所輸入的密碼超過20位數!" ); $('#user_pw').focus(); return false; }else if( $('#user_pw').val().length <= 5){ alert( "您所輸入的密碼至少要6位數!" ); $('#user_pw').focus(); return false; }else{ if( $('#user_pw').val() != $('#re_pw').val() ){ alert( "您的密碼不一致!" ); $('#re_pw').focus(); return false; } } //姓名 if( $('#c_name').val() == ""){ alert("請填入會員姓名!"); $('#c_name').focus(); return false; } //生日 if( $('#birth_y').val() == "0000" | $('#birth_y').val() == ""){ alert("請選擇生日之西元年!"); $('#birth_y').focus(); return false; } if( $('#birth_m').val() == "00" | $('#birth_m').val() == "" ){ alert("請選擇生日之月份!"); $('#birth_m').focus(); return false; } if( $('#birth_d').val() == "00" | $('#birth_d').val() == "" ){ alert("請選擇生日之日期!"); $('#birth_d').focus(); return false; } if( !checkDate($('#birth_y').val()+"-"+$('#birth_m').val()+"-"+$('#birth_d').val() ) ){ alert("生日格式錯誤,請檢查!"); $('#birth_y').focus(); return false; } //聯絡電話 // if( $("#tel").val() != ""){ // if(!checkTel($("#tel").val())){ // alert("聯絡電話格式錯誤!\n格式為:02-1234567"); // $("#tel").focus(); // return false; // } // } //行動電話 if( $("#m_tel").val() == ""){ alert("請輸入行動電話!!"); $("#m_tel").focus(); return false; }else{ if(!checkMobile($("#m_tel").val())){ alert("行動電話格式錯誤!\n格式為:0912345678"); $("#m_tel").focus(); return false; } } //聯絡地址 //地址 if( $('#area_id').val() == ""){ alert("請選擇國家/地區!"); $('#area_id').focus(); return false; } else if($('#area_id').val() == "1"){ if( $('#City').val() == ""){ alert("請選擇聯絡地址之縣市!"); $('#City').focus(); return false; } if( $('#Canton').val() == ""){ alert("請選擇聯絡地址之鄉鎮市區!"); $('#Canton').focus(); return false; } if( $('#Zip').val() == ""){ alert("請填寫聯絡地址之郵遞區號!"); $('#Zip').focus(); return false; } if( $('#addr').val() == ""){ alert("請填寫聯絡地址!"); $('#addr').focus(); return false; } } else { if( $('#addr2').val() == ""){ alert("請填寫聯絡地址!"); $('#addr2').focus(); return false; } } //E-mail if( $("#email").val() != "" ){ var strEmail = $("#email").val(); if(!checkEmail(strEmail)){ alert("E-mail格式錯誤,請填寫正確E-mail格式!"); $("#email").focus(); return false; } }else{ alert("請填寫E-mail!"); $("#email").focus(); return false; } //委託 if( $("#trust").is(":checked") == false ){ alert("請勾選委託印製條款!"); $("#trust").focus(); return false; } //認證碼 //if( $('#auth_code').val() == ""){ // alert("請填入認證碼!"); // $('#auth_code').focus(); // return false; //} return true; } function chkRegJoin(){ if(checkjoin()){ $("#sendbtn").text("處理中"); $.ajax({ url: 'ajax/join.php?PHPSESSID=bfee2e955388ff8d1649dcc3039946be', type: 'POST', dataType: 'json', data: $("form#sendForm2").serialize(), }) .done(function(data) { $("#sendbtn").text("確定送出"); if(data['status'] == "false" ){ alert(data['msg']); reloadRePage(); }else{ openFancyboxByCloseClickFalse('join_lightbox.php',700,220); } }); } return false; } //忘記密碼 function checkforget(){ if( $('#user_name').val() == ""){ alert("請填入帳號!"); $('#user_name').focus(); return false; } //E-mail if( $("#user_email").val() != "" ){ var strEmail = $("#user_email").val(); if(!checkEmail(strEmail)){ alert("E-mail格式錯誤,請填寫正確E-mail格式!"); $("#user_email").focus(); return false; } }else{ alert("請填寫E-mail!"); $("#user_email").focus(); return false; } return true ; } function chkRegForget() { if(checkforget()){ $("#sendbtn").text("處理中"); $.ajax({ url: 'ajax/forget.php?PHPSESSID=bfee2e955388ff8d1649dcc3039946be', type: 'POST', dataType: 'json', data: $("form#sendForm").serialize(), }) .done(function(data) { $("#sendbtn").text("確定送出"); if(data['status'] == "false" ){ alert(data['msg']); }else{ openFancyboxByCloseClickFalse('forget_lightbox.php',700,160); } }); } return false; } function chkRegReset() { //密碼 if ( $('#user_pw').val().length >= 21 ){ alert( "您所輸入的新密碼超過20位數!" ); $('#user_pw').focus(); return false; }else if( $('#user_pw').val().length <= 5){ alert( "您所輸入的新密碼至少要6位數!" ); $('#user_pw').focus(); return false; }else if ( $('#user_pw').val() != $('#re_pw').val() ){ alert( "您的密碼不一致!" ); $('#re_pw').focus(); return false; } $("#sendbtn").text("處理中"); $.ajax({ url: 'ajax/forget_step2.php?PHPSESSID=bfee2e955388ff8d1649dcc3039946be', type: 'POST', dataType: 'json', data: $("form#sendForm").serialize(), }) .done(function(data) { $("#sendbtn").text("確定送出"); if(data['status'] == "false" ){ alert(data['msg']); }else{ location.href="login_complete.php"; } }); return false; } //變更 function change_area_id(){ $(".area_type_1").hide(); $(".area_type_2").hide(); if ($("#area_id").val() == "1") { $(".area_type_1").show(); $(".area_type_2").hide(); } else if ($("#area_id").val() != "1" && $("#area_id").val() != ""){ $(".area_type_1").hide(); $(".area_type_2").show(); } } //修改基本資料 function formDataCheck() { //密碼 if ( $('#user_pw').val() != "" ){ if ( $('#user_pw').val().length >= 21 ){ alert( "您所輸入的新密碼超過20位數!" ); $('#user_pw').focus(); return false; }else if( $('#user_pw').val().length <= 5){ alert( "您所輸入的新密碼至少要6位數!" ); $('#user_pw').focus(); return false; }else if ( $('#user_pw').val() != $('#re_pw').val() ){ alert( "您的密碼不一致!" ); $('#re_pw').focus(); return false; } } //姓名 if( $('#c_name').val() == "" ){ alert("請填寫姓名!"); $('#c_name').focus(); return false; } //生日 if( $('#birthday').val() == "" | $('#birthday').val() == "0000-00-00" ){ alert("請填寫生日!"); $('#birthday').focus(); return false; } //檢查格式 if( !checkDate($('#birthday').val()) ){ alert("生日格式錯誤,請檢查!"); $('#birth_y').focus(); return false; } //聯絡電話 20180308不要判斷格式 // if( $("#tel").val() != ""){ // if(!checkTel($("#tel").val())){ // alert("聯絡電話格式錯誤!\n格式為:02-1234567"); // $("#tel").focus(); // return false; // } // } //行動電話 if( $("#m_tel").val() == ""){ alert("請輸入行動電話!"); $("#m_tel").focus(); return false; }else{ if(!checkMobile($("#m_tel").val())){ alert("行動電話格式錯誤!\n格式為:0912345678"); $("#m_tel").focus(); return false; } } //地址 if( $('#area_id').val() == ""){ alert("請選擇國家/地區!"); $('#area_id').focus(); return false; } else if($('#area_id').val() == "1"){ if( $('#City').val() == ""){ alert("請選擇聯絡地址之縣市!"); $('#City').focus(); return false; } if( $('#Canton').val() == ""){ alert("請選擇聯絡地址之鄉鎮市區!"); $('#Canton').focus(); return false; } if( $('#Zip').val() == ""){ alert("請填寫聯絡地址之郵遞區號!"); $('#Zip').focus(); return false; } if( $('#addr').val() == "" ){ alert("請填寫地址!"); $('#addr').focus(); return false; } } else { if( $('#addr2').val() == "" ){ alert("請填寫地址!"); $('#addr2').focus(); return false; } } } //檢查日期判斷 function checkDate(strDate){ var re = /^\d{4}[-]\d{1,2}[-]\d{1,2}$/; if(re.test(strDate)) { return true; }else{ return false; } } //再次輸入密碼 function chkpasstrue(){ if($('#user_pw').val().length > 0 ){ if( $('#user_pw').val() != $('#re_pw').val() ){ $('#passtrue').css('display','none'); $('#passfalse').css('display','table-row'); }else{ $('#passtrue').css('display','table-row'); $('#passfalse').css('display','none'); } } } //再次輸入email function chkemailtrue(){ if($('#email').val().length > 0 ){ if( $('#email').val() != $('#re_email').val() ){ $('#emailtrue').css('display','none'); $('#emailfalse').css('display','table-row'); }else{ $('#emailtrue').css('display','table-row'); $('#emailfalse').css('display','none'); } } } function loginreload(){ parent.reloadRePage(); parent.$.fancybox.close(); } function loginreload2(){ parent.location.href="login.php"; parent.$.fancybox.close(); } //取消社群綁定 function unlink(type){ var aa = ""; if (type == "F") { aa = '確定取消綁定「Facebook」帳號?'; } else if(type == "L"){ aa = '確定取消綁定「Line」帳號?'; } else if(type == "G"){ aa = '確定取消綁定「Google」帳號?'; } if(confirm(aa)){ $.ajax({ type: "POST", url: "ajax/customer_login_unlink.php?PHPSESSID=bfee2e955388ff8d1649dcc3039946be", data: { 'type':type }, dataType: "json", cache: false }) .done(function(data) { if(data['status'] == "Y"){ alert(data['errormsg']); location.reload(); }else{ alert(data['errormsg']); cation.reload(); } }) } return false; }