Files
front-pc/pages/mobile/transaction_record/index.vue
2025-09-03 17:06:39 +08:00

222 lines
4.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="transaction-record">
<!-- Balance Card -->
<div class="balance-card">
<div class="balance-title">
<span>我的余额 ()</span>
<span class="verify-text">🏅 资产保障中</span>
</div>
<div class="balance-amount">{{ balance.toFixed(2) }}</div>
<div class="action-buttons">
<div class="btn-recharge">充值</div>
<div class="btn-withdraw">提现</div>
</div>
</div>
<!-- Transaction Filter -->
<div class="transaction-filter">
<div class="filter-type">
<span>全部</span>
</div>
<div class="filter-date">
<label class="date-picker-trigger">
<span>当前时间: <span style="color:#4080ff">{{ currentMonth }}</span></span>
<input type="month" v-model="selectedMonth" @change="onMonthChange" />
</label>
</div>
</div>
<!-- Transaction List -->
<div class="transaction-list">
<div
v-for="(transaction, index) in transactions"
:key="index"
class="transaction-item"
>
<div class="transaction-info">
<span class="transaction-type">{{ transaction.type }}</span>
<span class="transaction-date">{{ transaction.date }}</span>
</div>
<div
class="transaction-amount"
:class="{ 'amount-positive': transaction.amount > 0 }"
>
<span>{{
transaction.amount > 0
? "+" + transaction.amount
: transaction.amount
}}</span>
<span class="transaction-reference">{{ transaction.reference }}</span>
</div>
</div>
</div>
<!-- Footer -->
<div class="transaction-footer">
<span>当前仅展示本月明细切换查看更多</span>
</div>
</div>
</template>
<script setup lang="ts">
definePageMeta({ layout: 'm' })
import { ref, onMounted } from 'vue'
const balance = ref(6357.0)
const selectedMonth = ref('')
const currentMonth = ref('')
const transactions = ref([
{ type: '转出到银行卡', date: '2024-03-10 15:38', amount: -3578, reference: '56784' },
{ type: '转出到银行卡', date: '2024-03-10 15:38', amount: 3578, reference: '56784' },
{ type: '转出到银行卡', date: '2024-03-10 15:38', amount: -3578, reference: '56784' },
{ type: '转出到银行卡', date: '2024-03-10 15:38', amount: -3578, reference: '56784' },
{ type: '转出到银行卡', date: '2024-03-10 15:38', amount: -3578, reference: '56784' },
{ type: '转出到银行卡', date: '2024-03-10 15:38', amount: -3578, reference: '56784' },
])
function onMonthChange(e: Event) {
const value = (e.target as HTMLInputElement).value // yyyy-mm
if (!value) return
const [y, m] = value.split('-')
currentMonth.value = `${y}.${m}`
}
onMounted(() => {
const now = new Date()
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
currentMonth.value = `${year}.${month}`
selectedMonth.value = `${year}-${month}`
})
</script>
<style>
.transaction-record {
background-color: #f5f5f5;
padding-bottom: 20px;
height: 100%;
}
.balance-card {
background-color: white;
padding: 20px;
margin-bottom: 10px;
border-radius: 8px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.balance-title {
display: flex;
justify-content: flex-start;
align-items: center;
color: #666;
font-size: 14px;
margin-bottom: 10px;
}
.verify-text {
color: #4080ff;
font-size: 12px;
border: 1px solid #4080ff;
border-radius: 10px;
padding: 0 5px;
margin-left: 10px;
}
.balance-amount {
font-size: 32px;
font-weight: bold;
margin-bottom: 15px;
}
.action-buttons {
display: flex;
justify-content: flex-start;
}
.btn-recharge,
.btn-withdraw {
border: none;
padding: 8px 60rpx;
border-radius: 5px;
margin-right: 30rpx;
font-size: 28rpx;
}
.btn-recharge {
background-color: #4080ff;
color: white;
}
.btn-withdraw {
background-color: white;
border: 1px solid #ddd;
color: #333;
}
.transaction-filter {
display: flex;
justify-content: space-between;
padding: 15px;
font-size: 14px;
color: #666;
}
.transaction-list {
background-color: white;
}
.transaction-item {
display: flex;
justify-content: space-between;
padding: 15px;
border-bottom: 1px solid #f0f0f0;
}
.transaction-type {
font-size: 14px;
color: #333;
margin-bottom: 5px;
display: block;
}
.transaction-date {
font-size: 12px;
color: #999;
display: block;
}
.transaction-amount {
font-size: 16px;
font-weight: bold;
color: #333;
text-align: right;
}
.amount-positive {
color: #4caf50;
}
.transaction-reference {
font-size: 12px;
color: #999;
font-weight: normal;
margin-top: 5px;
display: block;
}
.transaction-footer {
text-align: center;
color: #999;
font-size: 12px;
padding: 15px;
background-color: white;
border-top: 1px solid #f0f0f0;
}
.date-picker-trigger {
display: flex;
align-items: center;
}
</style>