From a8d8f2779654ab0768847298039cc7cd0615ebdd Mon Sep 17 00:00:00 2001 From: Kostya Date: Wed, 20 Dec 2023 16:29:03 +0300 Subject: [PATCH] added validation for check on true values and undisabled btn for withdraw --- luckydiamond/src/components/PaymentsModal.vue | 69 ++++++++++++------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/luckydiamond/src/components/PaymentsModal.vue b/luckydiamond/src/components/PaymentsModal.vue index f96c0b7..23c26c5 100644 --- a/luckydiamond/src/components/PaymentsModal.vue +++ b/luckydiamond/src/components/PaymentsModal.vue @@ -68,10 +68,10 @@
- +

Я согласен с пользовательским соглашением.

- +
@@ -109,8 +109,14 @@ export default { clickedBtn: "", url: "", offBtn: true, + offAgree: true, + completeValidtaion: { + amountsaving: true, + cardsaving: false, + agreesaving: false, + captchatokensaving: false + }, agreeUser: false, - showRecaptcha: false, PaymentsModalNumbers, }; }, @@ -132,18 +138,34 @@ export default { } }, amountWithdraw(newAmount) { + this.completeValidtaion.amountsaving = false if (newAmount > 0) { this.amountSave = newAmount - console.log(`save amount = ${this.amountSave}`) + this.completeValidtaion.amountsaving = true + console.log(this.completeValidtaion) } }, - captchaToken(newAmount) { - if (newAmount !== '' && this.amountSave > 0 && this.card !== '') { - this.offBtn = false + card(newAmount) { + this.completeValidtaion.cardsaving = false + const cardPattern = /^\d{5}$/; + if(cardPattern.test(newAmount)) { + this.offAgree = false + this.completeValidtaion.cardsaving = true } + }, + agreeUser(newAgree) { + this.completeValidtaion.agreesaving = false + if (newAgree !== false) { + this.completeValidtaion.agreesaving = true + } + }, + completeValidtaion: { + handler() { + this.completeValidationCheck() + }, + deep: true } }, - computed: { checkOffBtn() { return this.checkBtn(); @@ -153,8 +175,21 @@ export default { closeModal() { return this.$emit("closemodal"); }, + completeValidationCheck() { + this.offBtn = true + + if ( + this.completeValidtaion.amountsaving && + this.completeValidtaion.cardsaving && + this.completeValidtaion.agreesaving && + this.completeValidtaion.captchatokensaving + ) { + this.offBtn = false + } + }, claimCaptchaToken(Token) { this.captchaToken = Token + this.completeValidtaion.captchatokensaving = true }, RedirectedMethodDep() { console.log(`From /profile to - ${this.url} url`) @@ -175,11 +210,6 @@ export default { }, 4000) } }, - - onVerify: function (response) { - console.log(response); - }, - checkBtn() { if (this.offBtn === false) { if (this.agreeUser !== false) { @@ -192,19 +222,6 @@ export default { this.clickedBtn = index; this.amount = content; }, - // detectorMethod(method) { - // this.closeModal() - // if (method === 'dep') { - // return this.$emit('deposit', this.amount) - // } - // else if (method === 'with') { - // return this.$emit('withdraw', this.amount, this.card) - // } - // else { - // console.log('Произошла ошибка при взаимодействие') - // return - // } - // }, }, };