first commit
This commit is contained in:
10
src/pages/finance/Finance.vue
Normal file
10
src/pages/finance/Finance.vue
Normal file
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<div class="finance-page">
|
||||
<h1 class="text-3xl font-bold mb-6">发票管理</h1>
|
||||
<p class="text-gray-600 mb-8">发票管理页面 - 待开发</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// 发票管理页面 - 待开发
|
||||
</script>
|
||||
1576
src/pages/finance/Invoice.vue
Normal file
1576
src/pages/finance/Invoice.vue
Normal file
File diff suppressed because it is too large
Load Diff
492
src/pages/finance/Transactions.vue
Normal file
492
src/pages/finance/Transactions.vue
Normal file
@@ -0,0 +1,492 @@
|
||||
<template>
|
||||
<ListPageLayout title="消费记录" subtitle="查看您的钱包消费历史记录">
|
||||
<template #filters>
|
||||
<FilterSection>
|
||||
<FilterItem label="交易ID">
|
||||
<el-input
|
||||
v-model="filters.transaction_id"
|
||||
placeholder="输入交易ID"
|
||||
clearable
|
||||
@input="handleFilterChange"
|
||||
class="w-full"
|
||||
/>
|
||||
</FilterItem>
|
||||
|
||||
<FilterItem label="产品名称">
|
||||
<el-input
|
||||
v-model="filters.product_name"
|
||||
placeholder="输入产品名称"
|
||||
clearable
|
||||
@input="handleFilterChange"
|
||||
class="w-full"
|
||||
/>
|
||||
</FilterItem>
|
||||
|
||||
<FilterItem label="金额范围">
|
||||
<div class="flex gap-2">
|
||||
<el-input
|
||||
v-model="filters.min_amount"
|
||||
placeholder="最小金额"
|
||||
clearable
|
||||
@input="handleFilterChange"
|
||||
class="flex-1"
|
||||
/>
|
||||
<span class="text-gray-400 self-center">-</span>
|
||||
<el-input
|
||||
v-model="filters.max_amount"
|
||||
placeholder="最大金额"
|
||||
clearable
|
||||
@input="handleFilterChange"
|
||||
class="flex-1"
|
||||
/>
|
||||
</div>
|
||||
</FilterItem>
|
||||
|
||||
<FilterItem label="时间范围">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="datetimerange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
@change="handleDateRangeChange"
|
||||
class="w-full"
|
||||
/>
|
||||
</FilterItem>
|
||||
|
||||
<template #stats> 共找到 {{ total }} 条消费记录 </template>
|
||||
|
||||
<template #buttons>
|
||||
<el-button @click="resetFilters">重置筛选</el-button>
|
||||
<el-button type="primary" @click="loadTransactions">应用筛选</el-button>
|
||||
</template>
|
||||
</FilterSection>
|
||||
</template>
|
||||
|
||||
<template #table>
|
||||
<div v-if="loading" class="flex justify-center items-center py-12">
|
||||
<el-loading size="large" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="transactions.length === 0" class="text-center py-12">
|
||||
<el-empty description="暂无消费记录">
|
||||
<el-button type="primary" @click="$router.push('/finance/wallet')">
|
||||
前往钱包充值
|
||||
</el-button>
|
||||
</el-empty>
|
||||
</div>
|
||||
|
||||
<div v-else class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
|
||||
<el-table
|
||||
:data="transactions"
|
||||
style="width: 100%"
|
||||
:header-cell-style="{
|
||||
background: '#f8fafc',
|
||||
color: '#475569',
|
||||
fontWeight: '600',
|
||||
fontSize: '14px',
|
||||
}"
|
||||
:cell-style="{
|
||||
fontSize: '14px',
|
||||
color: '#1e293b',
|
||||
}"
|
||||
>
|
||||
<el-table-column prop="transaction_id" label="交易ID" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<span class="font-mono text-sm text-gray-700">{{ row.transaction_id }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="product_name" label="产品名称" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<span class="text-sm text-blue-600">{{ row.product_name || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="amount" label="消费金额" width="120">
|
||||
<template #default="{ row }">
|
||||
<span class="font-semibold text-red-600">¥{{ formatPrice(row.amount) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="created_at" label="消费时间" width="160">
|
||||
<template #default="{ row }">
|
||||
<div class="text-sm">
|
||||
<div class="text-gray-900">{{ formatDate(row.created_at) }}</div>
|
||||
<div class="text-gray-500">{{ formatTime(row.created_at) }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #pagination>
|
||||
<el-pagination
|
||||
v-if="total > 0"
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<!-- 交易详情弹窗 -->
|
||||
<el-dialog v-model="detailDialogVisible" title="消费详情" width="600px" class="detail-dialog">
|
||||
<div v-if="selectedTransaction" class="space-y-6">
|
||||
<div class="grid grid-cols-2 gap-6">
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">记录ID</label>
|
||||
<span class="detail-value">{{ selectedTransaction.id }}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">交易ID</label>
|
||||
<span class="detail-value font-mono text-blue-600">{{
|
||||
selectedTransaction.transaction_id
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">产品名称</label>
|
||||
<span class="detail-value">{{ selectedTransaction.product_name || '-' }}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">用户ID</label>
|
||||
<span class="detail-value">{{ selectedTransaction.user_id }}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">消费金额</label>
|
||||
<span class="detail-value">
|
||||
<span class="text-red-600 font-semibold"
|
||||
>¥{{ formatPrice(selectedTransaction.amount) }}</span
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">创建时间</label>
|
||||
<span class="detail-value">{{ formatDateTime(selectedTransaction.created_at) }}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<label class="detail-label">更新时间</label>
|
||||
<span class="detail-value">{{ formatDateTime(selectedTransaction.updated_at) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="transaction-info">
|
||||
<h4 class="info-title">交易说明</h4>
|
||||
<div class="info-content">
|
||||
<p class="text-gray-700">
|
||||
此交易记录记录了API调用产生的费用扣除。每次API调用成功后,系统会根据接口定价自动从您的钱包余额中扣除相应费用。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
</ListPageLayout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { financeApi } from '@/api'
|
||||
import FilterItem from '@/components/common/FilterItem.vue'
|
||||
import FilterSection from '@/components/common/FilterSection.vue'
|
||||
import ListPageLayout from '@/components/common/ListPageLayout.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false)
|
||||
const transactions = ref([])
|
||||
const total = ref(0)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(10)
|
||||
const detailDialogVisible = ref(false)
|
||||
const selectedTransaction = ref(null)
|
||||
const dateRange = ref([])
|
||||
|
||||
// 统计数据
|
||||
const stats = ref({
|
||||
total_transactions: 0,
|
||||
total_amount: 0,
|
||||
})
|
||||
|
||||
// 筛选条件
|
||||
const filters = reactive({
|
||||
min_amount: '',
|
||||
max_amount: '',
|
||||
start_time: '',
|
||||
end_time: '',
|
||||
transaction_id: '',
|
||||
product_name: '',
|
||||
})
|
||||
|
||||
// 搜索防抖
|
||||
let searchTimer = null
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
loadTransactions()
|
||||
loadStats()
|
||||
})
|
||||
|
||||
// 加载钱包交易记录
|
||||
const loadTransactions = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const params = {
|
||||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
...filters,
|
||||
}
|
||||
|
||||
const response = await financeApi.getUserWalletTransactions(params)
|
||||
transactions.value = response.data?.items || []
|
||||
total.value = response.data?.total || 0
|
||||
} catch (error) {
|
||||
console.error('加载钱包交易记录失败:', error)
|
||||
ElMessage.error('加载钱包交易记录失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 加载统计数据
|
||||
const loadStats = async () => {
|
||||
try {
|
||||
// 计算统计数据
|
||||
const totalAmount = transactions.value.reduce((sum, transaction) => {
|
||||
return sum + Number(transaction.amount || 0)
|
||||
}, 0)
|
||||
|
||||
stats.value = {
|
||||
total_transactions: total.value,
|
||||
total_amount: totalAmount,
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载统计数据失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化价格
|
||||
const formatPrice = (price) => {
|
||||
if (!price) return '0.00'
|
||||
return Number(price).toFixed(2)
|
||||
}
|
||||
|
||||
// 格式化日期
|
||||
const formatDate = (date) => {
|
||||
if (!date) return '-'
|
||||
return new Date(date).toLocaleDateString('zh-CN')
|
||||
}
|
||||
|
||||
// 格式化时间
|
||||
const formatTime = (date) => {
|
||||
if (!date) return '-'
|
||||
return new Date(date).toLocaleTimeString('zh-CN', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
})
|
||||
}
|
||||
|
||||
// 格式化日期时间
|
||||
const formatDateTime = (date) => {
|
||||
if (!date) return '-'
|
||||
return new Date(date).toLocaleString('zh-CN')
|
||||
}
|
||||
|
||||
// 处理筛选变化
|
||||
const handleFilterChange = () => {
|
||||
currentPage.value = 1
|
||||
loadTransactions()
|
||||
}
|
||||
|
||||
// 处理时间范围变化
|
||||
const handleDateRangeChange = (range) => {
|
||||
if (range && range.length === 2) {
|
||||
filters.start_time = range[0]
|
||||
filters.end_time = range[1]
|
||||
} else {
|
||||
filters.start_time = ''
|
||||
filters.end_time = ''
|
||||
}
|
||||
currentPage.value = 1
|
||||
loadTransactions()
|
||||
}
|
||||
|
||||
// 重置筛选
|
||||
const resetFilters = () => {
|
||||
Object.keys(filters).forEach((key) => {
|
||||
filters[key] = ''
|
||||
})
|
||||
dateRange.value = []
|
||||
currentPage.value = 1
|
||||
loadTransactions()
|
||||
}
|
||||
|
||||
// 处理分页大小变化
|
||||
const handleSizeChange = (size) => {
|
||||
pageSize.value = size
|
||||
currentPage.value = 1
|
||||
loadTransactions()
|
||||
}
|
||||
|
||||
// 处理当前页变化
|
||||
const handleCurrentChange = (page) => {
|
||||
currentPage.value = page
|
||||
loadTransactions()
|
||||
}
|
||||
|
||||
// 查看详情
|
||||
const handleViewDetail = (transaction) => {
|
||||
selectedTransaction.value = transaction
|
||||
detailDialogVisible.value = true
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 统计项样式 */
|
||||
.stat-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 16px 24px;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border: 1px solid rgba(226, 232, 240, 0.6);
|
||||
border-radius: 12px;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: #1e293b;
|
||||
line-height: 1;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 详情弹窗样式 */
|
||||
.detail-dialog :deep(.el-dialog) {
|
||||
border-radius: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.detail-dialog :deep(.el-dialog__header) {
|
||||
background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
|
||||
border-bottom: 1px solid rgba(226, 232, 240, 0.6);
|
||||
padding: 20px 24px;
|
||||
}
|
||||
|
||||
.detail-dialog :deep(.el-dialog__title) {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
}
|
||||
|
||||
.detail-dialog :deep(.el-dialog__body) {
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.detail-dialog :deep(.el-dialog__footer) {
|
||||
background: rgba(248, 250, 252, 0.5);
|
||||
border-top: 1px solid rgba(226, 232, 240, 0.4);
|
||||
padding: 16px 24px;
|
||||
}
|
||||
|
||||
/* 详情项样式 */
|
||||
.detail-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.detail-label {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.detail-value {
|
||||
font-size: 16px;
|
||||
color: #1e293b;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 交易信息样式 */
|
||||
.transaction-info {
|
||||
background: rgba(248, 250, 252, 0.8);
|
||||
border: 1px solid rgba(226, 232, 240, 0.6);
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.info-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #1e293b;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.info-content {
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
border: 1px solid rgba(226, 232, 240, 0.4);
|
||||
border-radius: 6px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
/* 表格样式优化 */
|
||||
:deep(.el-table) {
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.el-table th) {
|
||||
background: #f8fafc !important;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
:deep(.el-table td) {
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
:deep(.el-table tr:hover > td) {
|
||||
background: #f8fafc !important;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 768px) {
|
||||
.stat-item {
|
||||
padding: 12px 16px;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.detail-item {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.detail-label {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.detail-value {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
1164
src/pages/finance/Wallet.vue
Normal file
1164
src/pages/finance/Wallet.vue
Normal file
File diff suppressed because it is too large
Load Diff
274
src/pages/finance/WalletFail.vue
Normal file
274
src/pages/finance/WalletFail.vue
Normal file
@@ -0,0 +1,274 @@
|
||||
<template>
|
||||
<div class="list-page-container">
|
||||
<div class="list-page-card">
|
||||
<div class="list-page-wrapper">
|
||||
<!-- 充值失败内容 -->
|
||||
<div class="fail-content">
|
||||
<div class="fail-icon">
|
||||
<el-icon size="64" color="#F56C6C">
|
||||
<CircleCloseFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
|
||||
<h1 class="fail-title">充值失败</h1>
|
||||
<p class="fail-subtitle">{{ getFailReason() }}</p>
|
||||
|
||||
<div class="fail-details">
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">订单号:</span>
|
||||
<span class="detail-value">{{ outTradeNo }}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">失败原因:</span>
|
||||
<span class="detail-value reason">{{ getFailReasonText() }}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">失败时间:</span>
|
||||
<span class="detail-value">{{ formatTime(new Date()) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fail-actions">
|
||||
<el-button type="primary" size="large" @click="retryRecharge">
|
||||
重新充值
|
||||
</el-button>
|
||||
<el-button size="large" @click="goToWallet">
|
||||
返回钱包
|
||||
</el-button>
|
||||
<el-button size="large" @click="contactSupport">
|
||||
联系客服
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 温馨提示 -->
|
||||
<div class="fail-tips">
|
||||
<el-alert
|
||||
title="温馨提示"
|
||||
type="warning"
|
||||
:closable="false"
|
||||
show-icon
|
||||
>
|
||||
<template #default>
|
||||
<ul class="tips-list">
|
||||
<li>如果您的银行卡已扣款但充值失败,请保留支付凭证并联系客服</li>
|
||||
<li>建议使用支付宝余额或绑定的银行卡进行充值</li>
|
||||
<li>如遇网络问题,请稍后重试</li>
|
||||
</ul>
|
||||
</template>
|
||||
</el-alert>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { CircleCloseFilled } from '@element-plus/icons-vue'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
// 响应式数据
|
||||
const outTradeNo = ref('')
|
||||
const failReason = ref('')
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
// 从URL参数获取失败信息
|
||||
outTradeNo.value = route.query.out_trade_no || ''
|
||||
failReason.value = route.query.reason || ''
|
||||
})
|
||||
|
||||
// 获取失败原因
|
||||
const getFailReason = () => {
|
||||
switch (failReason.value) {
|
||||
case 'TRADE_CLOSED':
|
||||
return '支付已关闭'
|
||||
case 'TRADE_CANCELED':
|
||||
return '支付已取消'
|
||||
case 'TRADE_FAILED':
|
||||
return '支付失败'
|
||||
default:
|
||||
return '充值失败'
|
||||
}
|
||||
}
|
||||
|
||||
// 获取失败原因详细说明
|
||||
const getFailReasonText = () => {
|
||||
switch (failReason.value) {
|
||||
case 'TRADE_CLOSED':
|
||||
return '订单已超时关闭,请重新发起充值'
|
||||
case 'TRADE_CANCELED':
|
||||
return '您取消了本次支付'
|
||||
case 'TRADE_FAILED':
|
||||
return '支付过程中发生错误,请重试'
|
||||
default:
|
||||
return '支付过程中发生未知错误'
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化时间
|
||||
const formatTime = (date) => {
|
||||
return date.toLocaleString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit'
|
||||
})
|
||||
}
|
||||
|
||||
// 重新充值
|
||||
const retryRecharge = () => {
|
||||
router.push('/finance/wallet')
|
||||
}
|
||||
|
||||
// 返回钱包
|
||||
const goToWallet = () => {
|
||||
router.push('/finance/wallet')
|
||||
}
|
||||
|
||||
// 联系客服
|
||||
const contactSupport = () => {
|
||||
// 这里可以跳转到客服页面或打开客服对话框
|
||||
window.open('https://support.example.com', '_blank')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fail-content {
|
||||
text-align: center;
|
||||
padding: 60px 20px;
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.fail-icon {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.fail-title {
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #F56C6C;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.fail-subtitle {
|
||||
font-size: 18px;
|
||||
color: #606266;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.fail-details {
|
||||
background: #f8f9fa;
|
||||
border-radius: 12px;
|
||||
padding: 24px;
|
||||
margin-bottom: 40px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.detail-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 0;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.detail-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.detail-label {
|
||||
font-size: 16px;
|
||||
color: #606266;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.detail-value {
|
||||
font-size: 16px;
|
||||
color: #303133;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.detail-value.reason {
|
||||
color: #F56C6C;
|
||||
max-width: 300px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.fail-actions {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
justify-content: center;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.fail-actions .el-button {
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.fail-tips {
|
||||
max-width: 500px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.tips-list {
|
||||
margin: 0;
|
||||
padding-left: 20px;
|
||||
line-height: 1.6;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tips-list li {
|
||||
margin-bottom: 8px;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.tips-list li:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 768px) {
|
||||
.fail-content {
|
||||
padding: 40px 16px;
|
||||
}
|
||||
|
||||
.fail-title {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.fail-subtitle {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.fail-details {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.detail-item {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.detail-value.reason {
|
||||
max-width: none;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.fail-actions {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.fail-actions .el-button {
|
||||
width: 100%;
|
||||
max-width: 200px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
415
src/pages/finance/WalletProcessing.vue
Normal file
415
src/pages/finance/WalletProcessing.vue
Normal file
@@ -0,0 +1,415 @@
|
||||
<template>
|
||||
<div class="min-h-screen bg-gray-50 flex items-center justify-center py-12 px-4 sm:px-6 lg:px-8">
|
||||
<div class="max-w-md w-full space-y-8">
|
||||
<!-- 处理中状态 -->
|
||||
<div v-if="isProcessing" class="text-center">
|
||||
<div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-blue-100">
|
||||
<svg
|
||||
class="animate-spin h-6 w-6 text-blue-600"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<circle
|
||||
class="opacity-25"
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="10"
|
||||
stroke="currentColor"
|
||||
stroke-width="4"
|
||||
></circle>
|
||||
<path
|
||||
class="opacity-75"
|
||||
fill="currentColor"
|
||||
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="mt-6 text-3xl font-extrabold text-gray-900">支付处理中</h2>
|
||||
<p class="mt-2 text-sm text-gray-600">正在确认您的支付结果,请稍候...</p>
|
||||
|
||||
<!-- 订单信息 -->
|
||||
<div class="mt-8 bg-white shadow rounded-lg p-6">
|
||||
<div class="space-y-4">
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-500">订单号:</span>
|
||||
<span class="font-medium">{{ orderInfo.out_trade_no }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-500">金额:</span>
|
||||
<span class="font-medium text-green-600">¥{{ orderInfo.amount }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-500">创建时间:</span>
|
||||
<span class="font-medium">{{ formatTime(orderInfo.created_at) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 轮询状态 -->
|
||||
<div class="mt-4 text-xs text-gray-500">
|
||||
<p>正在查询支付状态... ({{ pollCount }}/{{ maxPollCount }})</p>
|
||||
</div>
|
||||
|
||||
<!-- 提示信息 -->
|
||||
<div class="mt-6 p-4 bg-blue-50 rounded-lg">
|
||||
<div class="flex">
|
||||
<div class="flex-shrink-0">
|
||||
<svg
|
||||
class="h-5 w-5 text-blue-400"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-3">
|
||||
<p class="text-sm text-blue-700">
|
||||
支付完成后会自动到账,您可以关闭此页面。如有问题,请联系客服。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 联系客服 -->
|
||||
<div class="mt-4">
|
||||
<button
|
||||
@click="contactService"
|
||||
class="inline-flex items-center px-4 py-2 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
>
|
||||
<svg class="h-4 w-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"
|
||||
></path>
|
||||
</svg>
|
||||
联系客服
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 成功状态 -->
|
||||
<div v-else-if="orderStatus === 'success'" class="text-center">
|
||||
<div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-green-100">
|
||||
<svg class="h-6 w-6 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M5 13l4 4L19 7"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="mt-6 text-3xl font-extrabold text-gray-900">支付成功!</h2>
|
||||
<p class="mt-2 text-sm text-gray-600">您的充值已成功到账,资金已自动转入您的钱包</p>
|
||||
|
||||
<!-- 成功信息 -->
|
||||
<div class="mt-8 bg-white shadow rounded-lg p-6">
|
||||
<div class="space-y-4">
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-500">订单号:</span>
|
||||
<span class="font-medium">{{ orderInfo.out_trade_no }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-500">支付宝交易号:</span>
|
||||
<span class="font-medium">{{ orderInfo.trade_no || '暂无' }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-500">付费金额:</span>
|
||||
<span class="font-medium text-green-600">¥{{ orderInfo.amount }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-500">支付时间:</span>
|
||||
<span class="font-medium">{{
|
||||
formatTime(orderInfo.notify_time || orderInfo.updated_at)
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 提示信息 -->
|
||||
<div class="mt-6 p-4 bg-green-50 rounded-lg">
|
||||
<div class="flex">
|
||||
<div class="flex-shrink-0">
|
||||
<svg
|
||||
class="h-5 w-5 text-green-400"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="ml-3">
|
||||
<p class="text-sm text-green-700">
|
||||
支付成功!资金已自动转入您的钱包,您可以继续使用平台服务。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<div class="mt-8 space-y-3">
|
||||
<button
|
||||
@click="goToWallet"
|
||||
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
>
|
||||
查看钱包余额
|
||||
</button>
|
||||
<!-- <button
|
||||
@click="goToRechargeRecords"
|
||||
class="w-full flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
>
|
||||
查看充值记录
|
||||
</button> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 失败状态 -->
|
||||
<div v-else-if="orderStatus === 'failed'" class="text-center">
|
||||
<div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-red-100">
|
||||
<svg class="h-6 w-6 text-red-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M6 18L18 6M6 6l12 12"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="mt-6 text-3xl font-extrabold text-gray-900">支付失败</h2>
|
||||
<p class="mt-2 text-sm text-gray-600">
|
||||
{{ orderInfo.error_message || '支付过程中出现错误' }}
|
||||
</p>
|
||||
|
||||
<!-- 失败信息 -->
|
||||
<div class="mt-8 bg-white shadow rounded-lg p-6">
|
||||
<div class="space-y-4">
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-500">订单号:</span>
|
||||
<span class="font-medium">{{ orderInfo.out_trade_no }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-500">金额:</span>
|
||||
<span class="font-medium text-red-600">¥{{ orderInfo.amount }}</span>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<span class="text-gray-500">错误码:</span>
|
||||
<span class="font-medium">{{ orderInfo.error_code || '无' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<div class="mt-8 space-y-3">
|
||||
<button
|
||||
v-if="orderInfo.can_retry"
|
||||
@click="retryPayment"
|
||||
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
>
|
||||
重新支付
|
||||
</button>
|
||||
<button
|
||||
@click="goToWallet"
|
||||
class="w-full flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
>
|
||||
返回钱包
|
||||
</button>
|
||||
<button
|
||||
@click="contactService"
|
||||
class="w-full flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
>
|
||||
<svg class="h-4 w-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"
|
||||
></path>
|
||||
</svg>
|
||||
联系客服
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 其他状态 -->
|
||||
<div v-else class="text-center">
|
||||
<div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-yellow-100">
|
||||
<svg
|
||||
class="h-6 w-6 text-yellow-600"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="mt-6 text-3xl font-extrabold text-gray-900">订单状态异常</h2>
|
||||
<p class="mt-2 text-sm text-gray-600">订单状态:{{ orderInfo.status }}</p>
|
||||
|
||||
<div class="mt-8">
|
||||
<button
|
||||
@click="goToWallet"
|
||||
class="w-full flex justify-center py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||
>
|
||||
返回钱包
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { financeApi } from '@/api'
|
||||
|
||||
export default {
|
||||
name: 'WalletProcessing',
|
||||
setup() {
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const orderInfo = ref({})
|
||||
const orderStatus = ref('processing')
|
||||
const isProcessing = ref(true)
|
||||
const pollCount = ref(0)
|
||||
const maxPollCount = ref(30) // 最多轮询30次
|
||||
const pollInterval = ref(null)
|
||||
|
||||
// 获取URL参数
|
||||
const outTradeNo = route.query.out_trade_no
|
||||
const amount = route.query.amount
|
||||
|
||||
// 初始化订单信息
|
||||
orderInfo.value = {
|
||||
out_trade_no: outTradeNo,
|
||||
amount: amount,
|
||||
}
|
||||
|
||||
// 格式化时间
|
||||
const formatTime = (timeStr) => {
|
||||
if (!timeStr) return '暂无'
|
||||
return new Date(timeStr).toLocaleString('zh-CN')
|
||||
}
|
||||
|
||||
// 查询订单状态
|
||||
const queryOrderStatus = async () => {
|
||||
try {
|
||||
const response = await financeApi.getAlipayOrderStatus({ out_trade_no: outTradeNo })
|
||||
orderInfo.value = response.data
|
||||
// 根据状态更新页面
|
||||
if (response.data.status === 'success') {
|
||||
orderStatus.value = 'success'
|
||||
isProcessing.value = false
|
||||
stopPolling()
|
||||
} else if (response.data.status === 'failed') {
|
||||
orderStatus.value = 'failed'
|
||||
isProcessing.value = false
|
||||
stopPolling()
|
||||
} else if (response.data.status === 'pending') {
|
||||
// 继续轮询,轮询次数在setInterval中已经增加
|
||||
if (pollCount.value >= maxPollCount.value) {
|
||||
// 超过最大轮询次数,停止轮询
|
||||
stopPolling()
|
||||
// 可以显示超时提示
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('查询订单状态失败:', error)
|
||||
// 查询失败时继续轮询,不要停止
|
||||
}
|
||||
}
|
||||
|
||||
// 开始轮询
|
||||
const startPolling = () => {
|
||||
// 立即查询一次
|
||||
queryOrderStatus()
|
||||
|
||||
// 每3秒查询一次
|
||||
pollInterval.value = setInterval(() => {
|
||||
pollCount.value++ // 增加轮询次数
|
||||
queryOrderStatus()
|
||||
}, 3000)
|
||||
}
|
||||
|
||||
// 停止轮询
|
||||
const stopPolling = () => {
|
||||
if (pollInterval.value) {
|
||||
clearInterval(pollInterval.value)
|
||||
pollInterval.value = null
|
||||
}
|
||||
}
|
||||
|
||||
// 页面跳转
|
||||
const goToWallet = () => {
|
||||
router.push('/finance/wallet')
|
||||
}
|
||||
|
||||
const goToRechargeRecords = () => {
|
||||
router.push('/finance/wallet/recharge-records')
|
||||
}
|
||||
|
||||
const retryPayment = () => {
|
||||
// 重新创建支付订单
|
||||
router.push({
|
||||
path: '/finance/wallet',
|
||||
query: { retry: 'true', amount: amount },
|
||||
})
|
||||
}
|
||||
|
||||
const contactService = () => {
|
||||
// 打开客服聊天窗口或跳转到客服页面
|
||||
// 这里可以根据实际需求实现
|
||||
window.open('https://wpa.qq.com/msgrd?v=3&uin=123456789&site=qq&menu=yes', '_blank')
|
||||
// 或者使用其他客服系统
|
||||
// window.open('/customer-service', '_blank')
|
||||
}
|
||||
|
||||
// 组件挂载时开始轮询
|
||||
onMounted(() => {
|
||||
if (outTradeNo) {
|
||||
startPolling()
|
||||
} else {
|
||||
// 没有订单号,跳转到钱包页面
|
||||
router.push('/finance/wallet')
|
||||
}
|
||||
})
|
||||
|
||||
// 组件卸载时停止轮询
|
||||
onUnmounted(() => {
|
||||
stopPolling()
|
||||
})
|
||||
|
||||
return {
|
||||
orderInfo,
|
||||
orderStatus,
|
||||
isProcessing,
|
||||
pollCount,
|
||||
maxPollCount,
|
||||
formatTime,
|
||||
goToWallet,
|
||||
goToRechargeRecords,
|
||||
retryPayment,
|
||||
contactService,
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
203
src/pages/finance/WalletSuccess.vue
Normal file
203
src/pages/finance/WalletSuccess.vue
Normal file
@@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<div class="list-page-container">
|
||||
<div class="list-page-card">
|
||||
<div class="list-page-wrapper">
|
||||
<!-- 充值成功内容 -->
|
||||
<div class="success-content">
|
||||
<div class="success-icon">
|
||||
<el-icon size="64" color="#67C23A">
|
||||
<CircleCheckFilled />
|
||||
</el-icon>
|
||||
</div>
|
||||
|
||||
<h1 class="success-title">充值成功</h1>
|
||||
<p class="success-subtitle">您的钱包已成功充值</p>
|
||||
|
||||
<div class="success-details">
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">付费金额:</span>
|
||||
<span class="detail-value amount">¥{{ formatPrice(amount) }}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">订单号:</span>
|
||||
<span class="detail-value">{{ outTradeNo }}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">支付宝交易号:</span>
|
||||
<span class="detail-value">{{ tradeNo }}</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">充值时间:</span>
|
||||
<span class="detail-value">{{ formatTime(new Date()) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="success-actions">
|
||||
<el-button type="primary" size="large" @click="goToWallet">
|
||||
返回钱包
|
||||
</el-button>
|
||||
<el-button size="large" @click="goToTransactions">
|
||||
查看交易记录
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { CircleCheckFilled } from '@element-plus/icons-vue'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
// 响应式数据
|
||||
const amount = ref('0.00')
|
||||
const outTradeNo = ref('')
|
||||
const tradeNo = ref('')
|
||||
|
||||
// 初始化
|
||||
onMounted(() => {
|
||||
// 从URL参数获取充值信息
|
||||
amount.value = route.query.amount || '0.00'
|
||||
outTradeNo.value = route.query.out_trade_no || ''
|
||||
tradeNo.value = route.query.trade_no || ''
|
||||
})
|
||||
|
||||
// 格式化价格
|
||||
const formatPrice = (price) => {
|
||||
if (!price) return '0.00'
|
||||
return Number(price).toFixed(2)
|
||||
}
|
||||
|
||||
// 格式化时间
|
||||
const formatTime = (date) => {
|
||||
return date.toLocaleString('zh-CN', {
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
second: '2-digit'
|
||||
})
|
||||
}
|
||||
|
||||
// 返回钱包
|
||||
const goToWallet = () => {
|
||||
router.push('/finance/wallet')
|
||||
}
|
||||
|
||||
// 查看交易记录
|
||||
const goToTransactions = () => {
|
||||
router.push('/finance/transactions')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.success-content {
|
||||
text-align: center;
|
||||
padding: 60px 20px;
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.success-icon {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.success-title {
|
||||
font-size: 32px;
|
||||
font-weight: 700;
|
||||
color: #67C23A;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.success-subtitle {
|
||||
font-size: 18px;
|
||||
color: #606266;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.success-details {
|
||||
background: #f8f9fa;
|
||||
border-radius: 12px;
|
||||
padding: 24px;
|
||||
margin-bottom: 40px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.detail-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 0;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.detail-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.detail-label {
|
||||
font-size: 16px;
|
||||
color: #606266;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.detail-value {
|
||||
font-size: 16px;
|
||||
color: #303133;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.detail-value.amount {
|
||||
color: #67C23A;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.success-actions {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.success-actions .el-button {
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 768px) {
|
||||
.success-content {
|
||||
padding: 40px 16px;
|
||||
}
|
||||
|
||||
.success-title {
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.success-subtitle {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.success-details {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.detail-item {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.success-actions {
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.success-actions .el-button {
|
||||
width: 100%;
|
||||
max-width: 200px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
357
src/pages/finance/recharge-records/index.vue
Normal file
357
src/pages/finance/recharge-records/index.vue
Normal file
@@ -0,0 +1,357 @@
|
||||
<template>
|
||||
<ListPageLayout
|
||||
title="充值记录"
|
||||
subtitle="查看您的所有充值记录"
|
||||
>
|
||||
<template #filters>
|
||||
<FilterSection>
|
||||
<FilterItem label="充值类型">
|
||||
<el-select
|
||||
v-model="filters.recharge_type"
|
||||
placeholder="选择充值类型"
|
||||
clearable
|
||||
@change="handleFilterChange"
|
||||
class="w-full"
|
||||
>
|
||||
<el-option label="支付宝充值" value="alipay" />
|
||||
<el-option label="对公转账" value="transfer" />
|
||||
<el-option label="赠送" value="gift" />
|
||||
</el-select>
|
||||
</FilterItem>
|
||||
|
||||
<FilterItem label="充值状态">
|
||||
<el-select
|
||||
v-model="filters.status"
|
||||
placeholder="选择充值状态"
|
||||
clearable
|
||||
@change="handleFilterChange"
|
||||
class="w-full"
|
||||
>
|
||||
<el-option label="待处理" value="pending" />
|
||||
<el-option label="成功" value="success" />
|
||||
<el-option label="失败" value="failed" />
|
||||
<el-option label="已取消" value="cancelled" />
|
||||
</el-select>
|
||||
</FilterItem>
|
||||
|
||||
<FilterItem label="开始时间">
|
||||
<el-date-picker
|
||||
v-model="filters.start_time"
|
||||
type="datetime"
|
||||
placeholder="选择开始时间"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
@change="handleFilterChange"
|
||||
class="w-full"
|
||||
/>
|
||||
</FilterItem>
|
||||
|
||||
<FilterItem label="结束时间">
|
||||
<el-date-picker
|
||||
v-model="filters.end_time"
|
||||
type="datetime"
|
||||
placeholder="选择结束时间"
|
||||
format="YYYY-MM-DD HH:mm:ss"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
@change="handleFilterChange"
|
||||
class="w-full"
|
||||
/>
|
||||
</FilterItem>
|
||||
|
||||
<template #stats>
|
||||
共找到 {{ total }} 条充值记录
|
||||
</template>
|
||||
|
||||
<template #buttons>
|
||||
<el-button @click="resetFilters">重置筛选</el-button>
|
||||
<el-button type="primary" @click="loadRecords">应用筛选</el-button>
|
||||
</template>
|
||||
</FilterSection>
|
||||
</template>
|
||||
|
||||
<template #table>
|
||||
<div v-if="loading" class="flex justify-center items-center py-12">
|
||||
<el-loading size="large" />
|
||||
</div>
|
||||
|
||||
<div v-else-if="records.length === 0" class="text-center py-12">
|
||||
<el-empty description="暂无充值记录" />
|
||||
</div>
|
||||
|
||||
<div v-else class="bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden">
|
||||
<el-table
|
||||
:data="records"
|
||||
style="width: 100%"
|
||||
:header-cell-style="{
|
||||
background: '#f8fafc',
|
||||
color: '#475569',
|
||||
fontWeight: '600',
|
||||
fontSize: '14px'
|
||||
}"
|
||||
:cell-style="{
|
||||
fontSize: '14px',
|
||||
color: '#1e293b'
|
||||
}"
|
||||
>
|
||||
<el-table-column prop="alipay_order_id" label="订单号">
|
||||
<template #default="{ row }">
|
||||
<div class="space-y-1">
|
||||
<div v-if="row.alipay_order_id" class="text-sm">
|
||||
<span class="text-gray-500">支付宝订单:</span>
|
||||
<span class="font-mono">{{ row.alipay_order_id }}</span>
|
||||
</div>
|
||||
<div v-if="row.transfer_order_id" class="text-sm">
|
||||
<span class="text-gray-500">转账订单:</span>
|
||||
<span class="font-mono">{{ row.transfer_order_id }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="amount" label="充值金额" width="180">
|
||||
<template #default="{ row }">
|
||||
<span class="font-medium text-green-600">
|
||||
¥{{ formatMoney(row.amount) }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="recharge_type" label="充值类型" width="180">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="getRechargeTypeTagType(row.recharge_type)"
|
||||
size="small"
|
||||
>
|
||||
{{ getRechargeTypeText(row.recharge_type) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="status" label="状态" width="160">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="getStatusTagType(row.status)"
|
||||
size="small"
|
||||
>
|
||||
{{ getStatusText(row.status) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="notes" label="备注" min-width="150">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.notes" class="text-sm text-gray-600">
|
||||
{{ row.notes }}
|
||||
</span>
|
||||
<span v-else class="text-sm text-gray-400">-</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column prop="created_at" label="充值时间" width="180">
|
||||
<template #default="{ row }">
|
||||
<div class="text-sm">
|
||||
<div class="text-gray-900">{{ formatDate(row.created_at) }}</div>
|
||||
<div class="text-gray-500">{{ formatTime(row.created_at) }}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #pagination>
|
||||
<el-pagination
|
||||
v-if="total > 0"
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</template>
|
||||
</ListPageLayout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { financeApi } from '@/api'
|
||||
import FilterItem from '@/components/common/FilterItem.vue'
|
||||
import FilterSection from '@/components/common/FilterSection.vue'
|
||||
import ListPageLayout from '@/components/common/ListPageLayout.vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false)
|
||||
const records = ref([])
|
||||
const total = ref(0)
|
||||
const currentPage = ref(1)
|
||||
const pageSize = ref(20)
|
||||
|
||||
// 筛选条件
|
||||
const filters = reactive({
|
||||
recharge_type: '',
|
||||
status: '',
|
||||
start_time: '',
|
||||
end_time: ''
|
||||
})
|
||||
|
||||
// 搜索防抖定时器
|
||||
let searchTimer = null
|
||||
|
||||
// 加载充值记录
|
||||
const loadRecords = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const params = {
|
||||
page: currentPage.value,
|
||||
page_size: pageSize.value,
|
||||
...filters
|
||||
}
|
||||
|
||||
const response = await financeApi.getUserRechargeRecords(params)
|
||||
records.value = response.data?.items || []
|
||||
total.value = response.data?.total || 0
|
||||
} catch (error) {
|
||||
console.error('加载充值记录失败:', error)
|
||||
ElMessage.error('加载充值记录失败')
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 格式化金额
|
||||
const formatMoney = (amount) => {
|
||||
if (!amount) return '0.00'
|
||||
const num = parseFloat(amount)
|
||||
if (isNaN(num)) return '0.00'
|
||||
return num.toFixed(2)
|
||||
}
|
||||
|
||||
// 格式化日期
|
||||
const formatDate = (date) => {
|
||||
if (!date) return '-'
|
||||
return new Date(date).toLocaleDateString('zh-CN')
|
||||
}
|
||||
|
||||
// 格式化时间
|
||||
const formatTime = (date) => {
|
||||
if (!date) return '-'
|
||||
return new Date(date).toLocaleTimeString('zh-CN', {
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取充值类型标签样式
|
||||
const getRechargeTypeTagType = (type) => {
|
||||
const typeMap = {
|
||||
alipay: 'primary',
|
||||
transfer: 'warning',
|
||||
gift: 'success'
|
||||
}
|
||||
return typeMap[type] || 'info'
|
||||
}
|
||||
|
||||
// 获取充值类型文本
|
||||
const getRechargeTypeText = (type) => {
|
||||
const typeMap = {
|
||||
alipay: '支付宝充值',
|
||||
transfer: '对公转账',
|
||||
gift: '赠送'
|
||||
}
|
||||
return typeMap[type] || type
|
||||
}
|
||||
|
||||
// 获取状态标签样式
|
||||
const getStatusTagType = (status) => {
|
||||
const statusMap = {
|
||||
pending: 'warning',
|
||||
success: 'success',
|
||||
failed: 'danger',
|
||||
cancelled: 'info'
|
||||
}
|
||||
return statusMap[status] || 'info'
|
||||
}
|
||||
|
||||
// 获取状态文本
|
||||
const getStatusText = (status) => {
|
||||
const statusMap = {
|
||||
pending: '待处理',
|
||||
success: '成功',
|
||||
failed: '失败',
|
||||
cancelled: '已取消'
|
||||
}
|
||||
return statusMap[status] || status
|
||||
}
|
||||
|
||||
// 处理筛选变化
|
||||
const handleFilterChange = () => {
|
||||
currentPage.value = 1
|
||||
loadRecords()
|
||||
}
|
||||
|
||||
// 重置筛选
|
||||
const resetFilters = () => {
|
||||
Object.keys(filters).forEach(key => {
|
||||
filters[key] = ''
|
||||
})
|
||||
currentPage.value = 1
|
||||
loadRecords()
|
||||
}
|
||||
|
||||
// 处理分页大小变化
|
||||
const handleSizeChange = (size) => {
|
||||
pageSize.value = size
|
||||
currentPage.value = 1
|
||||
loadRecords()
|
||||
}
|
||||
|
||||
// 处理当前页变化
|
||||
const handleCurrentChange = (page) => {
|
||||
currentPage.value = page
|
||||
loadRecords()
|
||||
}
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
loadRecords()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 表格样式优化 */
|
||||
:deep(.el-table) {
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:deep(.el-table th) {
|
||||
background: #f8fafc !important;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
:deep(.el-table td) {
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
:deep(.el-table tr:hover > td) {
|
||||
background: #f8fafc !important;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 768px) {
|
||||
.stat-item {
|
||||
padding: 12px 16px;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user