feat(历史提现页): 对接获取记录的接口

This commit is contained in:
hzj 2025-10-23 18:37:33 +08:00
parent bd51e0cc1f
commit bfc5650958
2 changed files with 39 additions and 11 deletions

View File

@ -128,3 +128,15 @@ export const withdrawableAmount = async () => {
throw error
}
}
// 查询提现记录
export const withdrawRecords = async () => {
try {
const response = await get(`/activity/lottery/withdraw/records`)
return response
} catch (error) {
console.error('Failed to fetch get my withdraw records:', error)
console.error('error:' + error.response.errorMsg)
throw error
}
}

View File

@ -9,7 +9,7 @@
<div style="padding: 16px; display: flex; flex-direction: column; gap: 12px">
<div
v-for="item in history"
v-for="record in records"
style="
padding: 12px;
border-radius: 12px;
@ -22,10 +22,12 @@
>
<div style="display: flex; justify-content: space-between; align-items: center">
<div style="font-weight: 600">Cash out</div>
<div style="font-weight: 600">${{ item.Amount }}</div>
<div style="font-weight: 600">${{ record.amount }}</div>
</div>
<div style="display: flex; justify-content: space-between; align-items: center">
<div style="color: rgba(0, 0, 0, 0.4); font-weight: 500">{{ item.date }}</div>
<div style="color: rgba(0, 0, 0, 0.4); font-weight: 500">
{{ formatUTCCustom(record.createTime) }}
</div>
<div
style="
font-weight: 510;
@ -35,14 +37,14 @@
"
:style="{
backgroundImage:
item.status == 0
record.status == 0
? 'linear-gradient(248deg, #759cff 5.66%, #3d73ff 42.49%)'
: item.status == 1
: record.status == 1
? 'linear-gradient(248deg, #75FF98 5.66%, #3DFF54 42.49%)'
: 'linear-gradient(248deg, #FF7578 5.66%, #FF3D40 42.49%)',
}"
>
{{ showStatus(item) }}
{{ showStatus(record) }}
</div>
</div>
</div>
@ -53,12 +55,12 @@
<script setup>
import GeneralHeader from '@/components/GeneralHeader.vue'
import { ref, onMounted, watch, computed } from 'vue'
import { formatUTCCustom } from '@/utils/utcFormat.js'
import {
withdrawRecords, //
} from '@/api/lottery'
const history = ref([
{ date: '21/10/2025 17:56', Amount: '10', status: 0 },
{ date: '21/10/2025 17:56', Amount: '20', status: 1 },
{ date: '21/10/2025 17:56', Amount: '10', status: 2 },
])
const records = ref([])
const showStatus = (item) => {
if (item.status == 0) {
@ -69,6 +71,20 @@ const showStatus = (item) => {
return 'Rejection'
}
}
//
const getRecords = async () => {
const resRecords = await withdrawRecords()
if (resRecords.status && resRecords.body) {
records.value = resRecords.body.records
} else {
records.value = []
}
}
onMounted(() => {
getRecords() //
})
</script>
<style lang="scss" scoped>