delete closo modal on captcha

This commit is contained in:
Hepatica
2024-03-01 10:19:00 +01:00
parent 90ce94172d
commit e8abe6046b

View File

@@ -16,7 +16,12 @@
> >
<h3>Сумма пополнения</h3> <h3>Сумма пополнения</h3>
<img src="@/assets/icons-games/saper-game/icon-diamond-ore-saper.png" /> <img src="@/assets/icons-games/saper-game/icon-diamond-ore-saper.png" />
<input :class="{ 'animate-start-btn' : errorDeposit }" class="deposit-amount__input" v-model="amount" type="number" /> <input
:class="{ 'animate-start-btn': errorDeposit }"
class="deposit-amount__input"
v-model="amount"
type="number"
/>
<div class="deposit-btns"> <div class="deposit-btns">
<ul class="display-btns btns-style-diamonds"> <ul class="display-btns btns-style-diamonds">
<li v-for="(number, index) in PaymentsModalNumbers" :key="index"> <li v-for="(number, index) in PaymentsModalNumbers" :key="index">
@@ -33,21 +38,36 @@
</ul> </ul>
</div> </div>
<div v-if="showPromocodeStatus" class="error-promocode"> <div v-if="showPromocodeStatus" class="error-promocode">
<h2 v-if="errorPromocode" class="error-text__promocode">{{ promoResponse }}</h2> <h2 v-if="errorPromocode" class="error-text__promocode">
<h2 v-else class="correct-text__promocode">Промокод успешно применён</h2> {{ promoResponse }}
</h2>
<h2 v-else class="correct-text__promocode">
Промокод успешно применён
</h2>
</div> </div>
<div class="deposit-promocode deposit-promocode__padding--input"> <div class="deposit-promocode deposit-promocode__padding--input">
<h3>Промокод</h3> <h3>Промокод</h3>
<div class="promokods"> <div class="promokods">
<input @focusout="checkValidationPromocode" v-model="promocode" class="promo-input" type="text" /> <input
<button class="vvod_promocoda" @click="handleApplyPromoCode">Ввод</button> @focusout="checkValidationPromocode"
v-model="promocode"
class="promo-input"
type="text"
/>
<button class="vvod_promocoda" @click="handleApplyPromoCode">
Ввод
</button>
</div> </div>
</div> </div>
<div class="error-checkbox" v-if="errorAgree"> <div class="error-checkbox" v-if="errorAgree">
<h2>Подтвердите согласие!</h2> <h2>Подтвердите согласие!</h2>
</div> </div>
<div class="deposit-checkbox checkbox-styles"> <div class="deposit-checkbox checkbox-styles">
<input @click="agreeUser = !agreeUser" type="checkbox" :class="{ 'animate-start-btn' : errorAgree }" /> <input
@click="agreeUser = !agreeUser"
type="checkbox"
:class="{ 'animate-start-btn': errorAgree }"
/>
<h3>Я согласен с пользовательским соглашением.</h3> <h3>Я согласен с пользовательским соглашением.</h3>
</div> </div>
<div <div
@@ -56,12 +76,7 @@
<p> <p>
Вы подтверждаете правильность введенных данных при создании вывода. Вы подтверждаете правильность введенных данных при создании вывода.
</p> </p>
<button <button type="submit" @click="RedirectedMethodDep">Пополнить</button>
type="submit"
@click="RedirectedMethodDep"
>
Пополнить
</button>
<p> <p>
Перед пополнение прочитайте политику конфиденциальности и Перед пополнение прочитайте политику конфиденциальности и
пользовательское соглашение. пользовательское соглашение.
@@ -76,14 +91,24 @@
<div class="count-withdraw deposit-icon-diamond"> <div class="count-withdraw deposit-icon-diamond">
<h3>Сумма вывода</h3> <h3>Сумма вывода</h3>
<img src="@/assets/icons-games/saper-game/icon-diamond-ore-saper.png" /> <img src="@/assets/icons-games/saper-game/icon-diamond-ore-saper.png" />
<input :class="{ 'animate-start-btn' : errorDeposit }" class="with-input" v-model="amountWithdraw" type="number" /> <input
:class="{ 'animate-start-btn': errorDeposit }"
class="with-input"
v-model="amountWithdraw"
type="number"
/>
</div> </div>
<div class="error-card" v-if="errorCard"> <div class="error-card" v-if="errorCard">
<h2>Ошибка с вводом карты</h2> <h2>Ошибка с вводом карты</h2>
</div> </div>
<div class="number-card deposit-promocode__padding--input"> <div class="number-card deposit-promocode__padding--input">
<h3>Введите номер карты</h3> <h3>Введите номер карты</h3>
<input :class="{ 'animate-start-btn' : errorCard }" class="with-input" v-model="card" type="text" /> <input
:class="{ 'animate-start-btn': errorCard }"
class="with-input"
v-model="card"
type="text"
/>
</div> </div>
<div class="error-checkbox" v-if="errorAgree"> <div class="error-checkbox" v-if="errorAgree">
<h2>Подтвердите согласие!</h2> <h2>Подтвердите согласие!</h2>
@@ -95,7 +120,11 @@
<div class="error-captcha" v-if="errorCaptcha && agreeUser === true"> <div class="error-captcha" v-if="errorCaptcha && agreeUser === true">
<h2>Пройдите проверку!</h2> <h2>Пройдите проверку!</h2>
</div> </div>
<captcha-component @captchatokendata="claimCaptchaToken" :showcaptcha="agreeUser" @captchadata="closeModal"></captcha-component> <captcha-component
@captchatokendata="claimCaptchaToken"
:showcaptcha="agreeUser"
></captcha-component>
<!-- <captcha-component @captchatokendata="claimCaptchaToken" :showcaptcha="agreeUser" @captchadata="closeModal"></captcha-component> -->
<div <div
class="btn-withdraw btn-text-style btn-display-deposit btn-style-payments" class="btn-withdraw btn-text-style btn-display-deposit btn-style-payments"
> >
@@ -117,14 +146,24 @@
<script> <script>
import "@/assets/css/ComponentsStyles/payments-modal.css"; import "@/assets/css/ComponentsStyles/payments-modal.css";
import PaymentsModalNumbers from "@/mocks/PaymentsModalNumbers"; import PaymentsModalNumbers from "@/mocks/PaymentsModalNumbers";
import { GettingMoneyOperation, WithdrawMoneyOperation } from "@/assets/js/moneyoperation/Claimmoney"; import {
GettingMoneyOperation,
WithdrawMoneyOperation,
} from "@/assets/js/moneyoperation/Claimmoney";
import CaptchaComponent from "@/components/CaptchaComponent.vue"; import CaptchaComponent from "@/components/CaptchaComponent.vue";
import { eventBus } from "@/main"; import { eventBus } from "@/main";
import { useVuelidate } from '@vuelidate/core' import { useVuelidate } from "@vuelidate/core";
import {maxValue, minValue, required, numeric, integer, minLength, maxLength} from "@vuelidate/validators"; import {
maxValue,
minValue,
required,
numeric,
integer,
minLength,
maxLength,
} from "@vuelidate/validators";
import { GetCurrentMoney } from "@/assets/js/rest/RestMethods"; import { GetCurrentMoney } from "@/assets/js/rest/RestMethods";
import { GetCookie } from "@/assets/js/storage/CookieStorage"; import { GetCookie } from "@/assets/js/storage/CookieStorage";
import { ApplyPromoCode } from "@/assets/js/rest/RestMethods.js"; // Замените на правильный путь к файлу с функцией ApplyPromoCode import { ApplyPromoCode } from "@/assets/js/rest/RestMethods.js"; // Замените на правильный путь к файлу с функцией ApplyPromoCode
@@ -137,9 +176,9 @@ export default {
amount: 0, amount: 0,
amountWithdraw: 0, amountWithdraw: 0,
balance: 0, balance: 0,
card: '', card: "",
promocode: '', promocode: "",
promocodeBase: ['ANTI-GRIF'], promocodeBase: ["ANTI-GRIF"],
errorPromocode: false, errorPromocode: false,
showPromocodeStatus: false, showPromocodeStatus: false,
errorAgree: false, errorAgree: false,
@@ -153,65 +192,77 @@ export default {
amountsaving: true, amountsaving: true,
cardsaving: false, cardsaving: false,
agreesaving: false, agreesaving: false,
captchatokensaving: false captchatokensaving: false,
}, },
agreeUser: false, agreeUser: false,
PaymentsModalNumbers, PaymentsModalNumbers,
}; };
}, },
created() { created() {
GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")) GetCurrentMoney(GetCookie("AUTHTOKEN"), GetCookie("SearchToken")).then(
.then(response => { (response) => {
this.balance = response.currentMoney this.balance = response.currentMoney;
}) }
);
}, },
setup() { setup() {
return { v$: useVuelidate() } return { v$: useVuelidate() };
}, },
validations() { validations() {
return { return {
amount: { required, numeric, minValue: minValue(1), integer }, amount: { required, numeric, minValue: minValue(1), integer },
amountWithdraw: { required, numeric, minValue: minValue(1), maxValue: maxValue(this.balance), integer }, amountWithdraw: {
card: { required, numeric, minLength: minLength(5), maxLength: maxLength(5), integer } required,
} numeric,
minValue: minValue(1),
maxValue: maxValue(this.balance),
integer,
},
card: {
required,
numeric,
minLength: minLength(5),
maxLength: maxLength(5),
integer,
},
};
}, },
watch: { watch: {
amount(DepositCount) { amount(DepositCount) {
console.log(DepositCount) console.log(DepositCount);
if (![1, 5, 10, 50, 100, 1000].includes(DepositCount)) { if (![1, 5, 10, 50, 100, 1000].includes(DepositCount)) {
this.clickedBtn = null this.clickedBtn = null;
} } else {
else { let index;
let index
switch (DepositCount) { switch (DepositCount) {
case 1: case 1:
index = 0 index = 0;
break break;
case 5: case 5:
index = 1 index = 1;
break break;
case 10: case 10:
index = 2 index = 2;
break break;
case 50: case 50:
index = 3 index = 3;
break break;
case 100: case 100:
index = 4 index = 4;
break break;
case 1000: case 1000:
index = 5 index = 5;
break break;
} }
this.clickedBtnChoice(index, DepositCount) this.clickedBtnChoice(index, DepositCount);
} }
}, },
completeValidtaion: { completeValidtaion: {
handler() { handler() {
this.completeValidationCheck() this.completeValidationCheck();
},
deep: true,
}, },
deep: true
}
}, },
methods: { methods: {
closeModal() { closeModal() {
@@ -222,7 +273,7 @@ export default {
// this.showPromocodeStatus = true // this.showPromocodeStatus = true
// }, // },
completeValidationCheck() { completeValidationCheck() {
this.offBtn = true this.offBtn = true;
if ( if (
this.completeValidtaion.amountsaving && this.completeValidtaion.amountsaving &&
@@ -230,68 +281,62 @@ export default {
this.completeValidtaion.agreesaving && this.completeValidtaion.agreesaving &&
this.completeValidtaion.captchatokensaving this.completeValidtaion.captchatokensaving
) { ) {
this.offBtn = false this.offBtn = false;
} }
}, },
claimCaptchaToken(Token) { claimCaptchaToken(Token) {
this.captchaToken = Token this.captchaToken = Token;
this.completeValidtaion.captchatokensaving = true this.completeValidtaion.captchatokensaving = true;
}, },
async handleApplyPromoCode() { async handleApplyPromoCode() {
const authToken = GetCookie("AUTHTOKEN"); const authToken = GetCookie("AUTHTOKEN");
const searchToken = GetCookie("SearchToken"); const searchToken = GetCookie("SearchToken");
try { try {
const response = await ApplyPromoCode(authToken, searchToken, this.promocode); const response = await ApplyPromoCode(
authToken,
searchToken,
this.promocode
);
console.log(response); console.log(response);
if (response === 'Promo dont exist.') if (response === "Promo dont exist.") {
{
this.showPromocodeStatus = true; this.showPromocodeStatus = true;
this.errorPromocode = true; this.errorPromocode = true;
this.promoResponse = 'Промокод не найден'; this.promoResponse = "Промокод не найден";
} } else if (response === "promotional code has expired") {
else if(response === 'promotional code has expired')
{
this.showPromocodeStatus = true; this.showPromocodeStatus = true;
this.errorPromocode = true; this.errorPromocode = true;
this.promoResponse = 'Не действителен'; this.promoResponse = "Не действителен";
} } else if (response === "User is alredy use the promo") {
else if(response === 'User is alredy use the promo')
{
this.showPromocodeStatus = true; this.showPromocodeStatus = true;
this.errorPromocode = true; this.errorPromocode = true;
this.promoResponse = 'Уже использован'; this.promoResponse = "Уже использован";
} } else {
else
{
this.showPromocodeStatus = true; this.showPromocodeStatus = true;
this.errorPromocode = false; this.errorPromocode = false;
this.promoResponse = response; this.promoResponse = response;
} }
} catch (error) {
}
catch (error)
{
console.error("Ошибка при применении промокода:", error); console.error("Ошибка при применении промокода:", error);
} }
}, },
async RedirectedMethodDep() { async RedirectedMethodDep() {
this.v$.$touch() this.v$.$touch();
if (this.v$.amount.$error) { if (this.v$.amount.$error) {
this.errorDeposit = true this.errorDeposit = true;
setTimeout(() => { setTimeout(() => {
this.errorDeposit = false this.errorDeposit = false;
}, 1500) }, 1500);
} }
if (this.agreeUser !== true) { if (this.agreeUser !== true) {
this.errorAgree = true this.errorAgree = true;
setTimeout(() => { setTimeout(() => {
this.errorAgree = false this.errorAgree = false;
}, 1500) }, 1500);
} }
if (!this.v$.amount.$error && this.agreeUser === true) { if (!this.v$.amount.$error && this.agreeUser === true) {
try { try {
@@ -300,7 +345,7 @@ export default {
this.url = response; this.url = response;
this.offBtn = false; this.offBtn = false;
window.location.href = this.url window.location.href = this.url;
}); });
} catch (e) { } catch (e) {
console.error("Error in PaymentModal!", e); console.error("Error in PaymentModal!", e);
@@ -308,54 +353,61 @@ export default {
} }
}, },
async RedirectedMethodTransferMoneyToSp() { async RedirectedMethodTransferMoneyToSp() {
this.v$.$touch() this.v$.$touch();
if (this.v$.amountWithdraw.$error) { if (this.v$.amountWithdraw.$error) {
this.errorDeposit = true this.errorDeposit = true;
setTimeout(() => { setTimeout(() => {
this.errorDeposit = false this.errorDeposit = false;
}, 1500) }, 1500);
} }
if (this.v$.card.$error) { if (this.v$.card.$error) {
this.errorCard = true this.errorCard = true;
setTimeout(() => { setTimeout(() => {
this.errorCard = false this.errorCard = false;
}, 1500) }, 1500);
} }
if (this.agreeUser !== true) { if (this.agreeUser !== true) {
this.errorAgree = true this.errorAgree = true;
setTimeout(() => { setTimeout(() => {
this.errorAgree = false this.errorAgree = false;
}, 1500) }, 1500);
} }
if (this.captchaToken === null) { if (this.captchaToken === null) {
this.errorCaptcha = true this.errorCaptcha = true;
setTimeout(() => { setTimeout(() => {
this.errorCaptcha = false this.errorCaptcha = false;
}, 1500) }, 1500);
} }
if (!this.v$.amountWithdraw.$error && !this.v$.card.$error && this.agreeUser === true && this.captchaToken !== null) { if (
WithdrawMoneyOperation(this.amountWithdraw, this.card.toString(), this.captchaToken) !this.v$.amountWithdraw.$error &&
.then(async response => { !this.v$.card.$error &&
this.agreeUser === true &&
this.captchaToken !== null
) {
WithdrawMoneyOperation(
this.amountWithdraw,
this.card.toString(),
this.captchaToken
).then(async (response) => {
try { try {
console.log('work', response) console.log("work", response);
} catch (e) {
console.error(e);
} }
catch (e) { await this.$emit("notifacetionmoney");
console.error(e) eventBus.emit("Updatebalance");
} });
await this.$emit('notifacetionmoney')
eventBus.emit('Updatebalance')
})
} }
}, },
clickedBtnChoice(index, content) { clickedBtnChoice(index, content) {
this.clickedBtn = index; this.clickedBtn = index;
this.amount = content; this.amount = content;
console.log(index) console.log(index);
}, },
}, },
}; };