refactor code payments-modal

This commit is contained in:
Kostya
2024-02-10 20:14:54 +03:00
parent 2c928518a6
commit 8486f62054

View File

@@ -19,11 +19,11 @@
<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 in PaymentsModalNumbers" :key="number"> <li v-for="(number, index) in PaymentsModalNumbers" :key="index">
<button <button
@click="clickedBtnChoice(number, number.diamonds)" @click="clickedBtnChoice(index, number.diamonds)"
:class="{ :class="{
'btn-click': clickedBtn === number, 'btn-click': clickedBtn === index,
[number]: clickedBtn === number, [number]: clickedBtn === number,
}" }"
> >
@@ -132,7 +132,6 @@ export default {
amount: 0, amount: 0,
amountWithdraw: 0, amountWithdraw: 0,
balance: 0, balance: 0,
amountSave: 1,
card: '', card: '',
promocode: '', promocode: '',
promocodeBase: ['ANTI-GRIF'], promocodeBase: ['ANTI-GRIF'],
@@ -145,8 +144,6 @@ export default {
captchaToken: null, captchaToken: null,
clickedBtn: "", clickedBtn: "",
url: "", url: "",
offBtn: true,
offAgree: true,
completeValidtaion: { completeValidtaion: {
amountsaving: true, amountsaving: true,
cardsaving: false, cardsaving: false,
@@ -174,44 +171,36 @@ export default {
} }
}, },
watch: { watch: {
// amount(newAmount) { amount(DepositCount) {
// this.offBtn = true; console.log(DepositCount)
// if (this.amount > 0 && this.amount !== "") { if (![1, 5, 10, 50, 100, 1000].includes(DepositCount)) {
// setTimeout(() => { this.clickedBtn = null
// try { }
// GettingMoneyOperation(newAmount).then((response) => { else {
// console.log("Payments Modal Working!: ", response); let index
// this.url = response; switch (DepositCount) {
// this.offBtn = false; case 1:
// }); index = 0
// } catch (e) { break
// console.error("Error in PaymentModal!", e); case 5:
// } index = 1
// }, 2000); break
// } case 10:
// }, index = 2
// amountWithdraw(newAmount) { break
// this.completeValidtaion.amountsaving = false case 50:
// if (newAmount > 0) { index = 3
// this.amountSave = newAmount break
// this.completeValidtaion.amountsaving = true case 100:
// console.log(this.completeValidtaion) index = 4
// } break
// }, case 1000:
// card(newAmount) { index = 5
// this.completeValidtaion.cardsaving = false break
// const cardPattern = /^\d{5}$/; }
// if(cardPattern.test(newAmount)) { this.clickedBtnChoice(index, DepositCount)
// this.offAgree = false }
// this.completeValidtaion.cardsaving = true },
// }
// },
// agreeUser(newAgree) {
// this.completeValidtaion.agreesaving = false
// if (newAgree !== false) {
// this.completeValidtaion.agreesaving = true
// }
// },
completeValidtaion: { completeValidtaion: {
handler() { handler() {
this.completeValidationCheck() this.completeValidationCheck()
@@ -219,11 +208,6 @@ export default {
deep: true deep: true
} }
}, },
computed: {
checkOffBtn() {
return this.checkBtn();
},
},
methods: { methods: {
closeModal() { closeModal() {
return this.$emit("closemodal"); return this.$emit("closemodal");
@@ -279,17 +263,6 @@ export default {
} }
}, },
async RedirectedMethodTransferMoneyToSp() { async RedirectedMethodTransferMoneyToSp() {
// setTimeout(async () => {
// try {
// WithdrawMoneyOperation(this.amountSave, this.card.toString(), this.captchaToken).then((response) => {
// console.log(`work withdraw - ${response}`)
// })
// }
// catch (e) {
// console.error(`Error in wihdrawmoney operation - ${e}`)
// }
// await this.$emit('notifacetionmoney')
// }, 4000)
this.v$.$touch() this.v$.$touch()
if (this.v$.amountWithdraw.$error) { if (this.v$.amountWithdraw.$error) {
@@ -334,17 +307,10 @@ export default {
}) })
} }
}, },
// checkBtn() {
// if (this.offBtn === false) {
// if (this.agreeUser !== false) {
// return false;
// }
// }
// return true;
// },
clickedBtnChoice(index, content) { clickedBtnChoice(index, content) {
this.clickedBtn = index; this.clickedBtn = index;
this.amount = content; this.amount = content;
console.log(index)
}, },
}, },
}; };