mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 04:09:29 +02:00
Polished referrals, now they are done!
This commit is contained in:
@@ -104,53 +104,63 @@
|
|||||||
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";
|
import { WithdrawReferralMoney } from "@/assets/js/Profile/Referrals";
|
||||||
|
import { eventBus } from "@/main";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
referralData: {}, // Добавляем пустой объект для данных о реферале
|
referralData: {},
|
||||||
errorDeposit: false, // Добавляем флаг для отслеживания ошибок
|
errorDeposit: false,
|
||||||
errorAgree: false, // Добавляем флаг для отслеживания ошибок
|
errorAgree: false,
|
||||||
agreeUser: false, // Добавляем флаг для отслеживания согласия пользователя
|
agreeUser: false,
|
||||||
amount: 0, // Устанавливаем начальное значение суммы
|
amount: 0,
|
||||||
PaymentsModalNumbers: [], // Добавляем массив для номеров платежей (если он используется)
|
PaymentsModalNumbers: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: ["payments"],
|
props: ["payments"],
|
||||||
async created() {
|
async created() {
|
||||||
// При создании компонента загружаем данные о реферале
|
|
||||||
this.referralData = await GetReferralData();
|
this.referralData = await GetReferralData();
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
avalibleAmountValue() {
|
avalibleAmountValue() {
|
||||||
if (this.referralData.avalibleAmount !== 0) {
|
return this.referralData.avalibleAmount !== 0 ? this.referralData.avalibleAmount : '0';
|
||||||
return this.referralData.avalibleAmount;
|
|
||||||
} else {
|
|
||||||
return '0';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
activationsAmountValue() {
|
activationsAmountValue() {
|
||||||
if (this.referralData.activationsAmount !== 0) {
|
return this.referralData.activationsAmount !== 0 ? this.referralData.activationsAmount : '0';
|
||||||
return this.referralData.activationsAmount;
|
|
||||||
} else {
|
|
||||||
return '0';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async handleWithdraw() {
|
async handleWithdraw() {
|
||||||
try {
|
try {
|
||||||
// Call the WithdrawReferralMoney function
|
if (!this.agreeUser) {
|
||||||
await WithdrawReferralMoney();
|
this.errorAgree = true;
|
||||||
// Handle success, e.g., show a success message or perform other actions
|
setTimeout(() => {
|
||||||
console.log("Withdrawal successful!");
|
this.errorAgree = false;
|
||||||
|
}, 1500);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.referralData.avalibleAmount == 0) {
|
||||||
|
window.alert("У вас нет денег на вывод :(");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await WithdrawReferralMoney().then(async (response) => {
|
||||||
|
try {
|
||||||
|
console.log("work", response);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
await this.$emit("notifacetionmoney");
|
||||||
|
eventBus.emit("Updatebalance");
|
||||||
|
this.$emit("closemodal");
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Handle errors, e.g., show an error message or perform other actions
|
|
||||||
console.error("Error withdrawing referral money:", error);
|
console.error("Error withdrawing referral money:", error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
closeModal() {
|
closeModal() {
|
||||||
return this.$emit("closemodal");
|
this.$emit("closemodal");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user