feat(新接口): 获取可提现的活动美元

This commit is contained in:
hzj 2025-10-23 18:20:21 +08:00
parent 00b79cdcc8
commit bd51e0cc1f
3 changed files with 52 additions and 4 deletions

View File

@ -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
}
}

View File

@ -131,7 +131,9 @@
>
{{ userInfo.userNickname || '' }}
</div>
<div style="font-weight: 600">Current amount:$1</div>
<div style="font-weight: 600">
Current amount:${{ currentAmount.availableAmount }}
</div>
</div>
<div style="text-align: end; font-weight: 400; font-size: 0.8em">
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() //
})

View File

@ -33,8 +33,10 @@
box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.25);
"
>
<span style="font-weight: 510; font-size: 0.8em">Available salary: </span>
<span style="font-weight: 700; color: #333">12345645</span>
<span style="font-weight: 510; font-size: 0.8em">Withdrawable amount: </span>
<span style="font-weight: 700; color: #333">{{
currentAmount.availableAmount || 0
}}</span>
</div>
</div>
@ -188,11 +190,15 @@
<script setup>
import GeneralHeader from '@/components/GeneralHeader.vue'
import maskLayer from '@/components/MaskLayer.vue'
import {
withdrawableAmount, //
} from '@/api/lottery'
import { ref, onMounted, computed } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const maskLayerShow = ref(false)
const currentAmount = ref(0) //
const bankCardInfo = ref({
// id: '',
@ -223,6 +229,20 @@ const CashOut = () => {
const Receive = () => {
maskLayerShow.value = false
}
//
const getDrawableAmount = async () => {
const resDrawableAmount = await withdrawableAmount()
if (resDrawableAmount.status && resDrawableAmount.body) {
currentAmount.value = resDrawableAmount.body
} else {
currentAmount.value = 0
}
}
onMounted(() => {
getDrawableAmount() //
})
</script>
<style lang="scss" scoped>