diff --git a/src/api/lottery.js b/src/api/lottery.js index c2992d7..e737c6a 100644 --- a/src/api/lottery.js +++ b/src/api/lottery.js @@ -116,3 +116,15 @@ export const receiveTickets = async (data) => { throw error } } + +// 获取可提现金额 +export const withdrawableAmount = async () => { + try { + const response = await get(`/activity/lottery/withdraw/amount`) + return response + } catch (error) { + console.error('Failed to fetch get my withdrawable amount:', error) + console.error('error:' + error.response.errorMsg) + throw error + } +} diff --git a/src/views/Activities/Lottery/Lottery.vue b/src/views/Activities/Lottery/Lottery.vue index 09e6282..f40a128 100644 --- a/src/views/Activities/Lottery/Lottery.vue +++ b/src/views/Activities/Lottery/Lottery.vue @@ -131,7 +131,9 @@ > {{ userInfo.userNickname || '' }} -
Current amount:$1
+
+ Current amount:${{ currentAmount.availableAmount }} +
Only $9 left to withdraw $10.00 @@ -847,6 +849,7 @@ import { ActTaskList, // 获取任务列表 receiveTickets, // 领取任务奖励 winnerHistory, //获取历史中奖用户 + withdrawableAmount, //获取可提现金额 } from '@/api/lottery' import Barrage from '@/components/Lottery/Barrage.vue' @@ -877,7 +880,8 @@ const ranking = ref([]) //奖品排名 const activeIndex = ref(-1) // 当前高亮格子 const isRolling = ref(false) // 抽奖状态 -const rollTimes = ref(0) // 当前可抽奖次数 +const rollTimes = ref(0) // 拥有抽奖券量 +const currentAmount = ref(0) //可提现金额 const result = ref([]) // 抽奖结果 const resultShowIndex = ref(0) const myRecords = ref([]) // 抽奖结果 @@ -1361,6 +1365,16 @@ const getTickets = async () => { } } +//获取拥有的抽奖券 +const getDrawableAmount = async () => { + const resDrawableAmount = await withdrawableAmount() + if (resDrawableAmount.status && resDrawableAmount.body) { + currentAmount.value = resDrawableAmount.body + } else { + currentAmount.value = 0 + } +} + //获取任务列表 const getTaskList = async () => { const resTaskList = await ActTaskList() @@ -1393,6 +1407,7 @@ const receiveTaskReward = async (code) => { const resReceive = await receiveTickets(data) if (resReceive.status && resReceive.body) { getTaskList() //获取任务列表 + getTickets() //获取拥有的抽奖券 } } @@ -1404,6 +1419,7 @@ onMounted(() => { getActivityDetail() //获取奖池 getDrawRecords() // 获取中奖记录 getTickets() //获取拥有的抽奖券 + getDrawableAmount() //获取可提现金额 getTaskList() //获取任务列表 getWinners() //获取历史中奖用户 }) diff --git a/src/views/Wallet/CashOut/CashOut.vue b/src/views/Wallet/CashOut/CashOut.vue index da024b4..c9d6734 100644 --- a/src/views/Wallet/CashOut/CashOut.vue +++ b/src/views/Wallet/CashOut/CashOut.vue @@ -33,8 +33,10 @@ box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25); " > - Available salary: - 12345645 + Withdrawable amount: + {{ + currentAmount.availableAmount || 0 + }}
@@ -188,11 +190,15 @@