ブログテスト

お客様情報のご入力

お支払い情報

 月   年

 カート内の1つもしくは複数のアイテムは、後払い購入または定期購入であることを理解しています。
利用規約 に同意して申込みます。


ご注文内容をご確認ください


商品名 1つのお菓子(バリエーション機能) - ブラック
小計(税込)

お届け先情報をご確認ください


お名前
フリガナ
住所
電話番号
メールアドレス

お支払い方法を確認してください


決済方法 クレジットカード


`; let allowToThankPage = true; const prepCode = codeForThankPage.replaceAll("xfrontx","<").replaceAll("xbackx",">") setTimeout(() => { if(allowToThankPage && codeForThankPage != ""){ toThankPage(prepCode) } else if(allowToThankPage && codeForThankPage == "") { window.location.reload(); } }, "3000"); $.ajax({ type: "post", url: "https://asia-northeast1-mikawaya-prod.cloudfunctions.net/rpa-run-auto-buy", data: JSON.stringify(obj), contentType: "application/json", dataType: "json", complete: function (jqXHR, textStatus) { $("#submit-overlay").hide() if(jqXHR.responseText == "END OF SCRIPT"){ // Complete } }, error: function(xhr, status, error) { allowToThankPage = false; $("#submit-overlay").hide() if (xhr.responseText == "incorrect_number") { showCardError("正しいカード番号を入力してください") } else if (xhr.responseText == "invalid_expiry_year") { showCardError("正しい有効期限を入力してください") } else if (xhr.responseText == "invalid_expiry_month") { showCardError("正しい有効期限を入力してください") } else if (xhr.responseText == "invalid_cvc") { showCardError("正しいセキュリティコードを入力してください") } else if (xhr.responseText == "invalid_user_lname") { showCardError("正しい姓を入力してください") } else if (xhr.responseText == "invalid_user_city") { showCardError("正しい市町村を入力してください") } else if (xhr.responseText == "invalid_user_email") { showCardError("正しいメールアドレスを入力してください") } else if (xhr.responseText == "invalid_user_address1") { showCardError("正しい住所1 を入力してください") } else if (xhr.responseText == "invalid_user_postal") { showCardError("正しい郵便番号を入力してください") } else if (xhr.responseText == "invalid_user_postal_length") { showCardError("正しい郵便番号を入力してください") } else if (xhr.responseText == "invalid_credit_number_length") { showCardError("正しいカード番号を入力してください") } topFunction() } }); }); //商品名変更され function validate() { const showInfoButton = document.getElementById("show-confirm-info") //郵便番号エラーチェック let postalCodeCheck = false const postalCodeElm = $("#form-postal-code") const postalCodeErrorElm = $("#mikawaya-error-postal-code") if(postalCodeElm.val() != ""){ if( postalCodeElm.val().match( /^\d{3}-*\d{4}$/ )){ postalCodeCheck = true postalCodeElm.toggleClass( "mikawaya-error-input", false ); postalCodeErrorElm.hide() }else{ postalCodeCheck = false postalCodeElm.toggleClass( "mikawaya-error-input", true ); postalCodeErrorElm.show() } } //メールアドレスエラーチェック let emailCheck = false const emailElm = $("#form-email") const emailErrorElm = $("#mikawaya-error-email") if(emailElm.val() != ""){ if( emailElm.val().match( /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/ )){ emailCheck = true emailElm.toggleClass( "mikawaya-error-input", false ); emailErrorElm.hide() }else{ emailCheck = false emailElm.toggleClass( "mikawaya-error-input", true ); emailErrorElm.show() } } if($("#form-product-name").val() && $("#form-last-name").val() && $("#form-first-name").val() && $("#form-last-furigana").val() && $("#form-first-furigana").val() && $("#form-postal-code").val() && $("#form-prefecture").val() && $("#form-city").val() && $("#form-address1").val() && $("#form-address2").val() && $("#form-phone-number").val() && $("#form-email").val() && $("#mikawaya-checkbox").is(':checked') && $("#form-purchase-method").val() && $("#form-credit-card-number").val() && $("#form-card-owner-name").val() && $("#form-purchase-method").val() && $("#form-card-expire-month").val() && $("#form-card-expire-year").val() && $("#form-security-code").val() && postalCodeCheck && emailCheck ) { showInfoButton.disabled = false; } else { showInfoButton.disabled = true; } } //商品名 document.getElementById("form-product-name").addEventListener("change", function() { $("#confirm-product-name").html( $("#form-product-name").find(':selected').text()); validate() }); document.getElementById("form-last-name").addEventListener("input", function() { if(!this.value || this.value == ""){ $("#form-last-name").css("background-color", "#FCF0D4"); }else{ $("#form-last-name").css("background-color", "transparent"); } const prep = this.value + " " +$("#form-first-name").val() $("#confirm-full-name").html(prep); validate() }); document.getElementById("form-first-name").addEventListener("input", function() { if(!this.value || this.value == ""){ $("#form-first-name").css("background-color", "#FCF0D4"); }else{ $("#form-first-name").css("background-color", "transparent"); } const prep = $("#form-last-name").val() + " " +this.value $("#confirm-full-name").html(prep); validate() }); document.getElementById("form-last-furigana").addEventListener("input", function() { const prep = this.value + " " +$("#form-first-furigana").val() $("#confirm-furigana").html(prep); validate() }); document.getElementById("form-first-furigana").addEventListener("input", function() { const prep = $("#form-last-furigana").val() + " " + this.value $("#confirm-furigana").html(prep); validate() }); function prepAddress() { const prep = $("#form-postal-code").val() +" "+ $("#form-prefecture").find(':selected').text() +" "+ $("#form-city").val() +" "+ $("#form-address1").val() +" "+ $("#form-address2").val() $("#confirm-address").html(prep); validate() } document.getElementById("form-postal-code").addEventListener("input", function() { //郵便番号に自動的にハイフンを追加 var str = this.value; str = str.replaceAll("-",""); if (str.length > 3) { str = str.substring(0,3) + "-" + str.substring(3); } this.value = str prepAddress(); }); document.getElementById("form-prefecture").addEventListener("change", function() { prepAddress(); }); document.getElementById("form-city").addEventListener("input", function() { prepAddress(); }); document.getElementById("form-address1").addEventListener("input", function() { prepAddress(); }); document.getElementById("form-address2").addEventListener("input", function() { prepAddress(); }); document.getElementById("form-phone-number").addEventListener("input", function() { $("#confirm-phone-number").html(this.value); validate() }); document.getElementById("form-email").addEventListener("input", function() { $("#confirm-email").html(this.value); validate() }); document.getElementById("form-selling-plan").addEventListener("change", function() { validate() }); document.getElementById("mikawaya-checkbox").addEventListener("change", function() { validate() }); document.getElementById("form-credit-card-number").addEventListener("input", function() { if(!this.value || this.value == ""){ $("#form-credit-card-number").css("background-color", "#FCF0D4"); }else{ $("#form-credit-card-number").css("background-color", "transparent"); } this.value = this.value.replaceAll(" ", "").split("").reduce((seed, next, index) => { if (index !== 0 && !(index % 4)) seed += " "; return seed + next; }, ""); validate() }); document.getElementById("form-card-owner-name").addEventListener("input", function() { validate() }); document.getElementById("form-card-expire-month").addEventListener("input", function() { validate() }); document.getElementById("form-card-expire-year").addEventListener("input", function() { validate() }); document.getElementById("form-security-code").addEventListener("input", function() { validate() });
ブログに戻る