diff --git a/src/api/lottery.js b/src/api/lottery.js index 67bfb92..272911b 100644 --- a/src/api/lottery.js +++ b/src/api/lottery.js @@ -1,7 +1,7 @@ import { get, post } from '../utils/http.js' // 获取排行榜 -export const ranklist = async (applicationId) => { +export const ranklist = async () => { try { const response = await get(`/activity/lottery/rank-list`) return response @@ -118,9 +118,9 @@ export const receiveTickets = async (data) => { } // 获取可提现金额 -export const withdrawableAmount = async () => { +export const withdrawableAmount = async (activityId) => { try { - const response = await get(`/activity/lottery/withdraw/amount`) + const response = await get(`/activity/lottery/withdraw/amount?activityId=${activityId}`) return response } catch (error) { console.error('Failed to fetch get my withdrawable amount:', error) diff --git a/src/views/Activities/Lottery/Lottery.vue b/src/views/Activities/Lottery/Lottery.vue index eb90239..fe40234 100644 --- a/src/views/Activities/Lottery/Lottery.vue +++ b/src/views/Activities/Lottery/Lottery.vue @@ -872,6 +872,7 @@ const barrageList = ref([]) // 活动详情 const activity = ref({}) //活动详情和奖池 +const activityCode = ref('') //活动码 const userInfo = ref({}) //用户信息 const userIdentity = ref({}) //用户身份 @@ -972,7 +973,7 @@ const searchPayee = () => { // 前往提现页 const goToWithdraw = () => { - router.push('/cash-out') + router.push({ path: '/cash-out', query: { activityCode: activityCode.value } }) } // 转账金币选项 @@ -1342,11 +1343,12 @@ const getRanking = async () => { //获取奖池 const getActivityDetail = async () => { const resvalidActivity = await validActivity() //活动是否有效 - console.log('id:', resvalidActivity.body?.id) - console.log('id2:', JSON.stringify(resvalidActivity.body)) if (resvalidActivity.body?.activityCode) { - const resDetail = await activityDetail(resvalidActivity.body?.activityCode) + activityCode.value = resvalidActivity.body.activityCode || '' + + getDrawableAmount() //获取可提现金额 + const resDetail = await activityDetail(activityCode.value) if (resDetail.status && resDetail.body) { activity.value = resDetail.body } else { @@ -1365,9 +1367,9 @@ const getTickets = async () => { } } -//获取拥有的抽奖券 +//可提现金额 const getDrawableAmount = async () => { - const resDrawableAmount = await withdrawableAmount() + const resDrawableAmount = await withdrawableAmount(activityCode.value) if (resDrawableAmount.status && resDrawableAmount.body) { currentAmount.value = resDrawableAmount.body } else { @@ -1391,7 +1393,7 @@ const getDrawRecords = async () => { } } -//获取中奖记录 +//获取中奖用户列表 const getWinners = async () => { const resWinners = await winnerHistory() if (resWinners.status && resWinners.body) { @@ -1423,7 +1425,6 @@ onMounted(() => { getActivityDetail() //获取奖池 getDrawRecords() // 获取中奖记录 getTickets() //获取拥有的抽奖券 - getDrawableAmount() //获取可提现金额 getTaskList() //获取任务列表 getWinners() //获取历史中奖用户 }) diff --git a/src/views/Wallet/CashOut/CashOut.vue b/src/views/Wallet/CashOut/CashOut.vue index 8a2635d..64cde87 100644 --- a/src/views/Wallet/CashOut/CashOut.vue +++ b/src/views/Wallet/CashOut/CashOut.vue @@ -194,8 +194,11 @@ import { } from '@/api/lottery' import { setApplyInfo, getApplyInfo } from '@/utils/applyStore.js' import { ref, onMounted, computed, onUnmounted } from 'vue' -import { useRouter } from 'vue-router' +import { useRouter, useRoute } from 'vue-router' const router = useRouter() +const route = useRoute() + +const activityCode = route.query.activityCode || '' const maskLayerShow = ref(false) const currentAmount = ref(0) //可提现金额 @@ -219,7 +222,7 @@ const gotoKYC = () => { const CashOut = () => { if (hasBankCard.value) { try { - const resApply = withdrawApply(getApplyInfo()) + const resApply = withdrawApply({ ...getApplyInfo(), activityId: activityCode }) if (resApply.status) { setApplyInfo() router.go(-1) @@ -237,9 +240,9 @@ const Receive = () => { maskLayerShow.value = false } -//获取拥有的抽奖券 +//获取可提现金额 const getDrawableAmount = async () => { - const resDrawableAmount = await withdrawableAmount() + const resDrawableAmount = await withdrawableAmount(activityCode) if (resDrawableAmount.status && resDrawableAmount.body) { currentAmount.value = resDrawableAmount.body } else {