Commit f2cc07dc authored by zhangsan's avatar zhangsan

1

parent b080234a
......@@ -47,7 +47,7 @@
<div class="ultraman_card_bot">
<div class="ultraman_card_num">{{ userInfo?.q5 * price || "0.00" }}</div>
<div class="ultraman_card_btns">
<div class="ultraman_card_btn ultraman_mglt" @click="handleClick('/user/paoshou')">
<div class="ultraman_card_btn ultraman_mglt" @click="paoshou">
我要抛售
</div>
<div class="ultraman_card_btn" @click="handleClick('/user/paoshoudetail')">
......@@ -157,7 +157,16 @@ const functions = ref([
url: '/user/myteam'
}
])
const paoshou = () => {
if(userInfo.value?.extend1 != 3){
showToast('请在开户后进入交易所抛售')
setTimeout(() => {
router.push('/xbxz')
}, 1500)
return
}
router.push('/xbjys')
}
// Router
const router = useRouter()
......
......@@ -59,15 +59,47 @@ const getTeam = async () => {
loading.value = false
}
}
function calculateTimeDifference(startTime, periodInDays) {
// 获取当前时间
const now = new Date();
// 将开始时间转换为 Date 对象
const start = new Date(startTime);
// 计算目标时间(开始时间加上周期)
const targetTime = new Date(start.getTime() + periodInDays * 24 * 60 * 60 * 1000);
// 计算时间差(毫秒)
const timeDiff = targetTime - now;
if (timeDiff <= 0) {
return false;
}
// 计算天数、小时数和分钟数
const days = Math.floor(timeDiff / (24 * 60 * 60 * 1000));
const hours = Math.floor((timeDiff % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000));
const minutes = Math.floor((timeDiff % (60 * 60 * 1000)) / (60 * 1000));
// 返回格式化字符串
return `${days}${hours}小时`;
}
const gotx = (amount, type, name) => {
if (amount > 0) {
if (userInfo.value?.extend1 != 3) {
showToast('请在开户后进行转账')
showToast('请在开户后进行提现')
setTimeout(() => {
router.push('/xbxz')
}, 1500)
return
}
if(calculateTimeDifference(userInfo.extend3, 10)){
showToast('安全监管期结束可立即提现')
setTimeout(() => {
router.push('/xbjys')
}, 1500)
return
}
router.push(`/user/tixian?balance=${amount}&type=${type}&title=${name}`)
} else {
showFailToast('团队奖励余额不足')
......
......@@ -101,7 +101,31 @@ const handleAmountChange = () => {
const handleAddBank = () => {
router.push("/user/mybankCard");
};
function calculateTimeDifference(startTime, periodInDays) {
// 获取当前时间
const now = new Date();
// 将开始时间转换为 Date 对象
const start = new Date(startTime);
// 计算目标时间(开始时间加上周期)
const targetTime = new Date(start.getTime() + periodInDays * 24 * 60 * 60 * 1000);
// 计算时间差(毫秒)
const timeDiff = targetTime - now;
if (timeDiff <= 0) {
return false;
}
// 计算天数、小时数和分钟数
const days = Math.floor(timeDiff / (24 * 60 * 60 * 1000));
const hours = Math.floor((timeDiff % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000));
const minutes = Math.floor((timeDiff % (60 * 60 * 1000)) / (60 * 1000));
// 返回格式化字符串
return `${days}${hours}小时`;
}
// 抛售处理
const handleSell = () => {
if (!amount.value || amount.value <= 0) {
......@@ -125,7 +149,13 @@ const handleSell = () => {
}, 1500)
return;
}
showToast("抛售功能暂未开放");
if (calculateTimeDifference(userInfo.extend3, 10)) {
showToast('安全监管完毕后即可抛售')
setTimeout(() => {
router.push('/xbjys')
}, 1500)
return
}
};
// 获取价格信息
......
......@@ -12,7 +12,7 @@ const loading = ref(false);
const emptyTipsShow = ref(false);
// 下拉选项
const range = ref([{ text: "账户余额", value: 1 }]);
const range = ref([{ text: "我的习币", value: 5 }]);
// 获取路由参数中的tab
const active = ref(Number(route.query.tab) || 0);
......@@ -103,7 +103,7 @@ const handleClick = (item) => {
<div class="item-header">
<div class="type-info">
<span class="type-text">
{{ item.balanceType == 1 ? "账户余额" : "" }}
{{ item.balanceType == 5 ? "我的习币" : "" }}
</span>
</div>
......
......@@ -13,7 +13,7 @@ const loading = ref(false);
const emptyTipsShow = ref(false);
// 下拉选项
const range = ref([{ text: "账户余额", value: 5 },{ text: "现金钱包", value: 4 }, { text: "团队奖励", value: 6 }]);
const range = ref([{ text: "我的习币", value: 5 },{ text: "现金钱包", value: 4 }, { text: "团队奖励", value: 6 }]);
// 获取路由参数中的tab
const active = ref(Number(route.query.type) || 5);
......@@ -98,7 +98,7 @@ const handleClick = (item) => {
<div class="item-header">
<div class="type-info">
<span class="type-text">
{{ item.balanceType == 5 ? "账户余额" :
{{ item.balanceType == 5 ? "我的习币" :
item.balanceType == 4 ? "现金钱包" :
item.balanceType == 6 ? "团队奖励" : "" }}
</span>
......
......@@ -18,7 +18,7 @@
<div class="trading_btn" @click="handleTrading">抛售习币</div>
</van-cell-group>
<div class="trading_status">
<span>习币安全监管制度: {{ calculateTimeDifference(userInfo.extend3, 10) }}</span>
<span>习币安全监管剩余: {{ calculateTimeDifference(userInfo.extend3, 10) }}</span>
<span class="status_text">习币处于安全监管中</span>
</div>
</div>
......@@ -30,7 +30,7 @@
<img class="block_img" src="@/static/xbjys/3.png" alt="">
<div class="trading_info">
<van-cell-group inset>
<van-field readonly label="可提现余额" placeholder="">
<van-field readonly label="可提现余额" placeholder="">
<template #input>{{ userInfo.q4 || 0.00 }}</template>
</van-field>
<div class="trading_btn" @click="gotx(userInfo?.q4, 4, '现金钱包')">我要提现</div>
......@@ -47,7 +47,7 @@
<div class="bonus_item_value">12元</div>
</div>
<div class="bonus_item">
<div class="bonus_item_title">每日下发</div>
<div class="bonus_item_title">每日发放</div>
<div class="bonus_item_value">习币60个</div>
</div>
<div class="bonus_item">
......@@ -91,6 +91,10 @@ const popupType = ref('app')
const userInfo = ref({})
const handleTrading = () => {
if(calculateTimeDifference(userInfo.extend3, 10)){
showToast('安全监管完毕后即可抛售')
return
}
router.push('/user/paoshou')
}
const gomx = (type) => {
......@@ -113,7 +117,7 @@ function calculateTimeDifference(startTime, periodInDays) {
const timeDiff = targetTime - now;
if (timeDiff <= 0) {
return "已过期";
return false;
}
// 计算天数、小时数和分钟数
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment