aslan-h5/src/views/SellerRecordsView.vue
2025-08-13 18:28:28 +08:00

236 lines
4.2 KiB
Vue

<template>
<div class="seller-records gradient-background-circles">
<MobileHeader title="Seller records" />
<div class="content">
<div v-if="loading" class="loading-state">
<div class="loading-spinner"></div>
<p>Loading records...</p>
</div>
<div v-else class="records-list">
<div
v-for="record in records"
:key="record.id"
class="record-item"
>
<div class="record-info">
<div class="user-avatar">
<span>{{ record.userName.charAt(0) }}</span>
</div>
<div class="record-details">
<h4>{{ record.userName }}</h4>
<p>ID: {{ record.userId }}</p>
<div class="record-time">{{ record.time }}</div>
</div>
</div>
<div class="record-amount">
<span class="coins-amount">{{ record.amount }} coins</span>
</div>
</div>
</div>
<div v-if="!loading && records.length === 0" class="empty-state">
<div class="empty-icon">📋</div>
<p>No records found</p>
<span>No selling records yet</span>
</div>
</div>
</div>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import MobileHeader from '../components/MobileHeader.vue'
const router = useRouter()
const loading = ref(false)
const records = ref([])
// 模拟记录数据
const mockRecords = [
{
id: 1,
userName: 'User1033...',
userId: '452319866',
amount: '-10000',
time: '2025.08.01 10:59:59'
},
{
id: 2,
userName: 'User1033...',
userId: '452319866',
amount: '-10000',
time: '2025.08.01 10:59:59'
},
{
id: 3,
userName: 'User1033...',
userId: '452319866',
amount: '-10000',
time: '2025.08.01 10:59:59'
}
]
// 获取记录
const fetchRecords = async () => {
loading.value = true
try {
// 模拟API调用
setTimeout(() => {
records.value = mockRecords
loading.value = false
}, 800)
} catch (error) {
console.error('Failed to fetch records:', error)
loading.value = false
}
}
onMounted(() => {
fetchRecords()
})
</script>
<style scoped>
.seller-records {
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.content {
padding: 16px;
position: relative;
z-index: 2;
}
/* 加载状态 */
.loading-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 60px 20px;
color: #666;
}
.loading-spinner {
width: 32px;
height: 32px;
border: 3px solid #f3f3f3;
border-top: 3px solid #F59E0B;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 16px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.loading-state p {
margin: 0;
font-size: 14px;
}
/* 记录列表 */
.records-list {
display: flex;
flex-direction: column;
gap: 12px;
}
.record-item {
background-color: white;
padding: 16px;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
display: flex;
align-items: center;
justify-content: space-between;
}
.record-info {
display: flex;
align-items: center;
flex: 1;
}
.user-avatar {
width: 50px;
height: 50px;
border-radius: 25px;
background-color: #9CA3AF;
display: flex;
align-items: center;
justify-content: center;
color: white;
font-size: 18px;
font-weight: 600;
margin-right: 12px;
}
.record-details {
flex: 1;
}
.record-details h4 {
margin: 0 0 4px 0;
font-size: 16px;
font-weight: 600;
color: #333;
}
.record-details p {
margin: 0 0 4px 0;
font-size: 14px;
color: #666;
}
.record-time {
font-size: 12px;
color: #9ca3af;
}
.record-amount {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.coins-amount {
font-size: 14px;
font-weight: 600;
color: #EF4444;
}
/* 空状态 */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 60px 20px;
color: #666;
text-align: center;
}
.empty-icon {
font-size: 48px;
margin-bottom: 16px;
}
.empty-state p {
margin: 0 0 8px 0;
font-size: 16px;
font-weight: 500;
}
.empty-state span {
font-size: 14px;
color: #9ca3af;
}
</style>