Fix so it is not collapsing when value is 0, added withdraw

This commit is contained in:
Swino4ka
2024-04-07 18:28:43 +02:00
parent 82b32794b8
commit d342617a13
2 changed files with 85 additions and 13 deletions

View File

@@ -4,7 +4,6 @@ export async function GetReferralData () {
const myHeaders = new Headers(); const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json"); myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "ARRAffinity=a6e48b9e9d2653435be7b61998d8624b44115214104213d6c8b8c526cc56dc70; ARRAffinitySameSite=a6e48b9e9d2653435be7b61998d8624b44115214104213d6c8b8c526cc56dc70");
const userData = { const userData = {
searchToken: GetCookie("SearchToken"), searchToken: GetCookie("SearchToken"),
@@ -31,3 +30,32 @@ export async function GetReferralData () {
} }
export async function WithdrawReferralMoney () {
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
const userData = {
searchToken: GetCookie("SearchToken"),
authtoken: GetCookie("AUTHTOKEN"),
};
const raw = JSON.stringify({
"userCredentials": {
"searchToken": userData.searchToken,
"authtoken": userData.authtoken
}
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://spsystemcore20231122004605.azurewebsites.net/api/PromoCode/TakeMoneyReferral", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
}

View File

@@ -25,11 +25,19 @@
<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 <input
:class="{ 'animate-start-btn': errorDeposit }" readonly :class="{ 'animate-start-btn': errorDeposit }"
class="deposit-amount__input" readonly
v-if="referralData.avalibleAmount" class="deposit-amount__input"
:value="referralData.avalibleAmount" v-if="referralData.avalibleAmount !== 0"
/> :value="referralData.avalibleAmount"
/>
<input
:class="{ 'animate-start-btn': errorDeposit }"
readonly
class="deposit-amount__input"
v-else
:value="'0'"
/>
<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">
@@ -49,11 +57,19 @@
<h3>Всего привели рефералов</h3> <h3>Всего привели рефералов</h3>
<div class="promokods"> <div class="promokods">
<input <input
:class="{ 'animate-start-btn': errorDeposit }" readonly :class="{ 'animate-start-btn': errorDeposit }"
class="deposit-amount__input" readonly
v-if="referralData.activationsAmount" class="deposit-amount__input"
:value="referralData.activationsAmount" v-if="referralData.activationsAmount !== 0"
/> :value="referralData.activationsAmount"
/>
<input
:class="{ 'animate-start-btn': errorDeposit }"
readonly
class="deposit-amount__input"
v-else
:value="'0'"
/>
</div> </div>
</div> </div>
<div class="error-checkbox" v-if="errorAgree"> <div class="error-checkbox" v-if="errorAgree">
@@ -73,7 +89,7 @@
<p> <p>
Вы подтверждаете правильность введенных данных при создании вывода. Вы подтверждаете правильность введенных данных при создании вывода.
</p> </p>
<button type="submit" @click="RedirectedMethodDep">Вывести</button> <button type="submit" @click="handleWithdraw">Вывести</button>
<p> <p>
Перед пополнение прочитайте политику конфиденциальности и Перед пополнение прочитайте политику конфиденциальности и
пользовательское соглашение. пользовательское соглашение.
@@ -87,6 +103,7 @@
<script> <script>
import "@/assets/css/ComponentsStyles/payments-modal.css"; import "@/assets/css/ComponentsStyles/payments-modal.css";
import { GetReferralData } from "@/assets/js/Profile/Referrals"; import { GetReferralData } from "@/assets/js/Profile/Referrals";
import { WithdrawReferralMoney } from "@/assets/js/Profile/Referrals";
export default { export default {
data() { data() {
@@ -104,7 +121,34 @@ export default {
// При создании компонента загружаем данные о реферале // При создании компонента загружаем данные о реферале
this.referralData = await GetReferralData(); this.referralData = await GetReferralData();
}, },
computed: {
avalibleAmountValue() {
if (this.referralData.avalibleAmount !== 0) {
return this.referralData.avalibleAmount;
} else {
return '0';
}
},
activationsAmountValue() {
if (this.referralData.activationsAmount !== 0) {
return this.referralData.activationsAmount;
} else {
return '0';
}
}
},
methods: { methods: {
async handleWithdraw() {
try {
// Call the WithdrawReferralMoney function
await WithdrawReferralMoney();
// Handle success, e.g., show a success message or perform other actions
console.log("Withdrawal successful!");
} catch (error) {
// Handle errors, e.g., show an error message or perform other actions
console.error("Error withdrawing referral money:", error);
}
},
closeModal() { closeModal() {
return this.$emit("closemodal"); return this.$emit("closemodal");
}, },