修复bug
This commit is contained in:
@@ -1,326 +0,0 @@
|
||||
<template>
|
||||
<view class="finance-balance-record">
|
||||
<!-- 筛选卡片 -->
|
||||
<view class="filter-card border-shadow">
|
||||
<view class="filter-row">
|
||||
<view class="filter-item search-wrap">
|
||||
<text class="filter-label">流水搜索:</text>
|
||||
<input class="search-input" v-model="searchKeyword" placeholder="订单号/昵称/电话/用户ID" @confirm="handleQuery" />
|
||||
</view>
|
||||
<view class="filter-item">
|
||||
<text class="filter-label">交易类型:</text>
|
||||
<uni-data-select v-model="typeValue" :localdata="typeOptions" class="data-select" @change="handleQuery" />
|
||||
</view>
|
||||
<view class="btn-query" @click="handleQuery">
|
||||
<text class="btn-txt">查询</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表表格 -->
|
||||
<view class="table-container border-shadow">
|
||||
<view class="table-header">
|
||||
<view class="th col-id"><text class="th-txt">序号</text></view>
|
||||
<view class="th col-order"><text class="th-txt">关联单据</text></view>
|
||||
<view class="th col-time"><text class="th-txt">交易时间</text></view>
|
||||
<view class="th col-amount"><text class="th-txt">交易金额</text></view>
|
||||
<view class="th col-user"><text class="th-txt">用户</text></view>
|
||||
<view class="th col-type"><text class="th-txt">业务类型</text></view>
|
||||
<view class="th col-remark"><text class="th-txt">备注</text></view>
|
||||
<view class="th col-op"><text class="th-txt">操作</text></view>
|
||||
</view>
|
||||
|
||||
<view class="table-body">
|
||||
<view v-if="loading" class="table-loading" style="padding: 40px; text-align: center;">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
<view v-else-if="tableData.length === 0" class="table-empty" style="padding: 40px; text-align: center;">
|
||||
<text>暂无记录</text>
|
||||
</view>
|
||||
<view class="table-row" v-for="(item, index) in tableData" :key="item.id">
|
||||
<view class="td col-id"><text class="td-txt">{{ (page - 1) * pageSize + index + 1 }}</text></view>
|
||||
<view class="td col-order text-left"><text class="td-txt">{{ item.link_id || '-' }}</text></view>
|
||||
<view class="td col-time"><text class="td-txt">{{ item.created_at.substring(0, 16).replace('T', ' ') }}</text></view>
|
||||
<view class="td col-amount">
|
||||
<text :class="['td-txt', item.pm === 1 ? 'red-txt' : 'green-txt']">
|
||||
{{ item.pm === 1 ? '+' : '-' }}{{ item.number.toFixed(2) }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="td col-user">
|
||||
<view class="u-info-box">
|
||||
<text class="u-name">{{ item.user_name || '未知' }}</text>
|
||||
<text class="u-id">UID:{{ item.uid.substring(0, 8) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="td col-type"><text class="td-txt">{{ getBillTypeText(item.type) }}</text></view>
|
||||
<view class="td col-remark text-left"><text class="td-txt">{{ item.mark || '-' }}</text></view>
|
||||
<view class="td col-op">
|
||||
<text class="btn-link">详情</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分页区域 -->
|
||||
<view class="pagination-footer">
|
||||
<view class="page-total">
|
||||
<text class="total-txt">共 {{ total }} 条</text>
|
||||
</view>
|
||||
<view class="page-btns">
|
||||
<view class="p-btn" :class="{ disabled: page <= 1 }" @click="prevPage">
|
||||
<text><</text>
|
||||
</view>
|
||||
<view class="p-btn active">
|
||||
<text>{{ page }}</text>
|
||||
</view>
|
||||
<view class="p-btn" :class="{ disabled: page >= totalPages }" @click="nextPage">
|
||||
<text>></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page-jump">
|
||||
<text class="jump-txt">前往</text>
|
||||
<input class="jump-input" v-model="jumpPage" type="number" @confirm="goToJumpPage" />
|
||||
<text class="jump-txt">页</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { fetchUserBillList } from '@/services/admin/financeService.uts'
|
||||
import { UserBillRecord } from '@/types/admin/finance.uts'
|
||||
|
||||
const typeValue = ref<string>('all')
|
||||
const searchKeyword = ref('')
|
||||
const page = ref(1)
|
||||
const pageSize = ref(15)
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
const jumpPage = ref('')
|
||||
|
||||
const typeOptions = [
|
||||
{ value: 'all', text: '全部类型' },
|
||||
{ value: 'recharge', text: '充值' },
|
||||
{ value: 'extract', text: '提现' },
|
||||
{ value: 'pay', text: '支付' },
|
||||
{ value: 'refund', text: '退款' },
|
||||
{ value: 'system_add', text: '系统增加' },
|
||||
{ value: 'system_sub', text: '系统减少' }
|
||||
]
|
||||
|
||||
const tableData = ref<UserBillRecord[]>([])
|
||||
|
||||
const totalPages = computed(() : number => {
|
||||
if (pageSize.value <= 0) return 1
|
||||
return Math.ceil(total.value / pageSize.value)
|
||||
})
|
||||
|
||||
async function loadList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const type = typeValue.value == 'all' ? null : typeValue.value
|
||||
|
||||
const res = await fetchUserBillList(
|
||||
page.value,
|
||||
pageSize.value,
|
||||
'balance', // 余额明细
|
||||
type,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
searchKeyword.value || null
|
||||
)
|
||||
tableData.value = res.items
|
||||
total.value = res.total
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '加载余额记录失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadList()
|
||||
})
|
||||
|
||||
const handleQuery = () => {
|
||||
page.value = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
const prevPage = () => {
|
||||
if (page.value > 1) {
|
||||
page.value--
|
||||
loadList()
|
||||
}
|
||||
}
|
||||
|
||||
const nextPage = () => {
|
||||
if (page.value < totalPages.value) {
|
||||
page.value++
|
||||
loadList()
|
||||
}
|
||||
}
|
||||
|
||||
const goToJumpPage = () => {
|
||||
const targetPage = parseInt(jumpPage.value)
|
||||
if (!isNaN(targetPage) && targetPage >= 1 && targetPage <= totalPages.value) {
|
||||
page.value = targetPage
|
||||
loadList()
|
||||
jumpPage.value = ''
|
||||
} else {
|
||||
uni.showToast({ title: '页码无效', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
function getBillTypeText(type : string) : string {
|
||||
const found = typeOptions.find(opt => opt.value === type)
|
||||
return found != null ? found.text : type
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.finance-balance-record {
|
||||
padding: 20px;
|
||||
background-color: #f5f7fa;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.border-shadow {
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.filter-card { padding: 24px; margin-bottom: 20px; }
|
||||
.filter-row { display: flex; flex-direction: row; align-items: center; }
|
||||
.filter-item { display: flex; flex-direction: row; align-items: center; margin-right: 28px; }
|
||||
.filter-label { font-size: 14px; color: #333; margin-right: 12px; white-space: nowrap; }
|
||||
|
||||
.search-wrap { flex: 1; }
|
||||
.search-input { flex: 1; height: 32px; border: 1px solid #dcdfe6; border-radius: 4px; padding: 0 12px; font-size: 13px; }
|
||||
|
||||
.data-select { width: 160px; }
|
||||
|
||||
.btn-query {
|
||||
background-color: #1890ff;
|
||||
border-radius: 4px;
|
||||
height: 32px;
|
||||
padding: 0 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn-txt { color: #fff; font-size: 14px; }
|
||||
|
||||
/* 表格样式 */
|
||||
.table-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.table-header {
|
||||
background-color: #e6f0ff;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.th {
|
||||
padding: 12px 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.th-txt {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.table-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.table-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
min-height: 60px;
|
||||
}
|
||||
|
||||
.table-row:hover {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.td {
|
||||
padding: 12px 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.td-txt {
|
||||
font-size: 13px;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.u-info-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
.u-name { font-size: 13px; color: #303133; font-weight: 500; }
|
||||
.u-id { font-size: 11px; color: #909399; }
|
||||
}
|
||||
|
||||
/* 列宽分配 */
|
||||
.col-id { width: 70px; }
|
||||
.col-order { width: 200px; justify-content: flex-start; }
|
||||
.col-time { width: 160px; }
|
||||
.col-amount { width: 120px; }
|
||||
.col-user { width: 160px; }
|
||||
.col-type { width: 140px; }
|
||||
.col-remark { flex: 1; min-width: 180px; justify-content: flex-start; }
|
||||
.col-op { width: 80px; }
|
||||
|
||||
.text-left { justify-content: flex-start; text-align: left; }
|
||||
|
||||
/* 颜色 */
|
||||
.red-txt { color: #f5222d; font-weight: bold; }
|
||||
.green-txt { color: #52c41a; font-weight: bold; }
|
||||
.btn-link { color: #1890ff; font-size: 13px; cursor: pointer; }
|
||||
|
||||
/* 分页 */
|
||||
.pagination-footer {
|
||||
padding: 24px 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
}
|
||||
.total-txt { font-size: 14px; color: #606266; }
|
||||
.page-btns { display: flex; flex-direction: row; gap: 8px; }
|
||||
.p-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.p-btn.active { background-color: #2d8cf0; border-color: #2d8cf0; color: #fff; }
|
||||
.p-btn.disabled { color: #c0c4cc; background-color: #f5f7fa; cursor: not-allowed; }
|
||||
|
||||
.page-jump { display: flex; flex-direction: row; align-items: center; gap: 8px; }
|
||||
.jump-txt { font-size: 14px; color: #606266; }
|
||||
.jump-input { width: 40px; height: 32px; border: 1px solid #dcdfe6; text-align: center; border-radius: 4px; font-size: 14px; }
|
||||
</style>
|
||||
@@ -1,286 +0,0 @@
|
||||
<template>
|
||||
<view class="finance-commission">
|
||||
<!-- 筛选卡片 -->
|
||||
<view class="filter-card border-shadow">
|
||||
<view class="filter-row">
|
||||
<view class="filter-item search-wrap">
|
||||
<text class="filter-label">佣金搜索:</text>
|
||||
<input class="search-input" v-model="searchKeyword" placeholder="关联单据/用户昵称/UID" @confirm="handleQuery" />
|
||||
</view>
|
||||
<view class="filter-item">
|
||||
<text class="filter-label">收支类型:</text>
|
||||
<uni-data-select v-model="pmValue" :localdata="pmOptions" class="data-select" @change="handleQuery" />
|
||||
</view>
|
||||
<view class="btn-query" @click="handleQuery">
|
||||
<text class="btn-txt">查询</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 列表表格 -->
|
||||
<view class="table-card border-shadow">
|
||||
<view class="action-bar">
|
||||
<view class="btn-export">
|
||||
<text class="export-txt">导出</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="table-container">
|
||||
<view class="table-header">
|
||||
<view class="th col-id"><text class="th-txt">序号</text></view>
|
||||
<view class="th col-order"><text class="th-txt">关联单据</text></view>
|
||||
<view class="th col-time"><text class="th-txt">时间</text></view>
|
||||
<view class="th col-amount"><text class="th-txt">变动金额</text></view>
|
||||
<view class="th col-user"><text class="th-txt">用户信息</text></view>
|
||||
<view class="th col-type"><text class="th-txt">业务类型</text></view>
|
||||
<view class="th col-remark"><text class="th-txt">备注</text></view>
|
||||
</view>
|
||||
|
||||
<view class="table-body">
|
||||
<view v-if="loading" class="table-loading" style="padding: 40px; text-align: center;">
|
||||
<text>加载中...</text>
|
||||
</view>
|
||||
<view v-else-if="tableData.length === 0" class="table-empty" style="padding: 40px; text-align: center;">
|
||||
<text>暂无佣金记录</text>
|
||||
</view>
|
||||
<view v-else class="table-row" v-for="(item, index) in tableData" :key="item.id">
|
||||
<view class="td col-id"><text class="td-txt">{{ (page - 1) * pageSize + index + 1 }}</text></view>
|
||||
<view class="td col-order"><text class="td-txt">{{ item.link_id || '-' }}</text></view>
|
||||
<view class="td col-time"><text class="td-txt">{{ item.created_at.substring(0, 16).replace('T', ' ') }}</text></view>
|
||||
<view class="td col-amount">
|
||||
<text :class="['td-txt', item.pm === 1 ? 'red-txt' : 'green-txt']">
|
||||
{{ item.pm === 1 ? '+' : '-' }}{{ item.number.toFixed(2) }}
|
||||
</text>
|
||||
</view>
|
||||
<view class="td col-user">
|
||||
<view class="u-info-box">
|
||||
<text class="u-name">{{ item.user_name || '未知' }}</text>
|
||||
<text class="u-id">UID:{{ item.uid.substring(0, 8) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="td col-type"><text class="td-txt">{{ getBillTypeText(item.type) }}</text></view>
|
||||
<view class="td col-remark"><text class="td-txt">{{ item.mark || '-' }}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 分页区域 -->
|
||||
<view class="pagination-footer">
|
||||
<view class="page-total">
|
||||
<text class="total-txt">共 {{ total }} 条</text>
|
||||
</view>
|
||||
<view class="page-btns">
|
||||
<view class="p-btn" :class="{ disabled: page <= 1 }" @click="prevPage">
|
||||
<text><</text>
|
||||
</view>
|
||||
<view class="p-btn active">
|
||||
<text>{{ page }}</text>
|
||||
</view>
|
||||
<view class="p-btn" :class="{ disabled: page >= totalPages }" @click="nextPage">
|
||||
<text>></text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="page-jump">
|
||||
<text class="jump-txt">前往</text>
|
||||
<input class="jump-input" v-model="jumpPage" type="number" @confirm="goToJumpPage" />
|
||||
<text class="jump-txt">页</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { fetchUserBillList } from '@/services/admin/financeService.uts'
|
||||
import { UserBillRecord } from '@/types/admin/finance.uts'
|
||||
|
||||
const pmValue = ref<string>('all')
|
||||
const searchKeyword = ref('')
|
||||
const page = ref(1)
|
||||
const pageSize = ref(15)
|
||||
const total = ref(0)
|
||||
const loading = ref(false)
|
||||
const jumpPage = ref('')
|
||||
|
||||
const pmOptions = [
|
||||
{ value: 'all', text: '全部收支' },
|
||||
{ value: '1', text: '获得佣金' },
|
||||
{ value: '0', text: '佣金支出' }
|
||||
]
|
||||
|
||||
const tableData = ref<UserBillRecord[]>([])
|
||||
|
||||
const totalPages = computed(() : number => {
|
||||
if (pageSize.value <= 0) return 1
|
||||
return Math.ceil(total.value / pageSize.value)
|
||||
})
|
||||
|
||||
async function loadList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const pm = pmValue.value == 'all' ? null : parseInt(pmValue.value)
|
||||
|
||||
const res = await fetchUserBillList(
|
||||
page.value,
|
||||
pageSize.value,
|
||||
'brokerage', // 佣金明细
|
||||
null,
|
||||
pm,
|
||||
null,
|
||||
null,
|
||||
searchKeyword.value || null
|
||||
)
|
||||
tableData.value = res.items
|
||||
total.value = res.total
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '加载佣金记录失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadList()
|
||||
})
|
||||
|
||||
const handleQuery = () => {
|
||||
page.value = 1
|
||||
loadList()
|
||||
}
|
||||
|
||||
const prevPage = () => {
|
||||
if (page.value > 1) {
|
||||
page.value--
|
||||
loadList()
|
||||
}
|
||||
}
|
||||
|
||||
const nextPage = () => {
|
||||
if (page.value < totalPages.value) {
|
||||
page.value++
|
||||
loadList()
|
||||
}
|
||||
}
|
||||
|
||||
const goToJumpPage = () => {
|
||||
const targetPage = parseInt(jumpPage.value)
|
||||
if (!isNaN(targetPage) && targetPage >= 1 && targetPage <= totalPages.value) {
|
||||
page.value = targetPage
|
||||
loadList()
|
||||
jumpPage.value = ''
|
||||
} else {
|
||||
uni.showToast({ title: '页码无效', icon: 'none' })
|
||||
}
|
||||
}
|
||||
|
||||
function getBillTypeText(type : string) : string {
|
||||
if (type == 'extract') return '提现扣除'
|
||||
if (type == 'brokerage') return '分销返佣'
|
||||
if (type == 'refund') return '退款扣除'
|
||||
return type
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.finance-commission {
|
||||
padding: 20px;
|
||||
background-color: #f5f7fa;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.border-shadow {
|
||||
background-color: #fff;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.filter-card { padding: 24px; margin-bottom: 20px; }
|
||||
.filter-row { display: flex; flex-direction: row; align-items: center; }
|
||||
.filter-item { display: flex; flex-direction: row; align-items: center; margin-right: 28px; }
|
||||
.filter-label { font-size: 14px; color: #333; margin-right: 12px; white-space: nowrap; }
|
||||
|
||||
.search-wrap { flex: 1; }
|
||||
.search-input { flex: 1; height: 36px; border: 1px solid #dcdfe6; border-radius: 4px; padding: 0 12px; font-size: 14px; }
|
||||
|
||||
.data-select { width: 160px; }
|
||||
|
||||
.btn-query {
|
||||
background-color: #1890ff;
|
||||
border-radius: 4px;
|
||||
height: 36px;
|
||||
padding: 0 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn-txt { color: #fff; font-size: 14px; }
|
||||
|
||||
/* 表格区域 */
|
||||
.table-card { padding: 0; }
|
||||
.action-bar { padding: 15px 20px; }
|
||||
.btn-export { width: 60px; height: 32px; background-color: #e6f7ff; border: 1px solid #91d5ff; border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
|
||||
.export-txt { color: #1890ff; font-size: 14px; }
|
||||
|
||||
.table-container { display: flex; flex-direction: column; }
|
||||
.table-header { background-color: #e6f0ff; display: flex; flex-direction: row; }
|
||||
.th { padding: 14px 10px; display: flex; align-items: center; justify-content: center; }
|
||||
.th-txt { font-size: 13px; font-weight: 600; color: #303133; }
|
||||
|
||||
.table-body { display: flex; flex-direction: column; }
|
||||
.table-row { display: flex; flex-direction: row; border-bottom: 1px solid #f0f0f0; min-height: 60px; }
|
||||
.table-row:hover { background-color: #f9f9f9; }
|
||||
.td { padding: 12px 10px; display: flex; align-items: center; justify-content: center; }
|
||||
.td-txt { font-size: 13px; color: #606266; }
|
||||
|
||||
.u-info-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
.u-name { font-size: 13px; color: #303133; font-weight: 500; }
|
||||
.u-id { font-size: 11px; color: #909399; }
|
||||
}
|
||||
|
||||
.red-txt { color: #f5222d; font-weight: bold; }
|
||||
.green-txt { color: #52c41a; font-weight: bold; }
|
||||
|
||||
/* 列宽分配 */
|
||||
.col-id { width: 70px; }
|
||||
.col-order { width: 180px; }
|
||||
.col-time { width: 160px; }
|
||||
.col-amount { width: 120px; }
|
||||
.col-user { width: 180px; justify-content: flex-start; }
|
||||
.col-type { width: 120px; }
|
||||
.col-remark { flex: 1; min-width: 150px; justify-content: flex-start; }
|
||||
|
||||
/* 分页 */
|
||||
.pagination-footer {
|
||||
padding: 24px 0;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
}
|
||||
.total-txt { font-size: 14px; color: #606266; }
|
||||
.page-btns { display: flex; flex-direction: row; gap: 8px; }
|
||||
.p-btn {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 1px solid #dcdfe6;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.p-btn.active { background-color: #2d8cf0; border-color: #2d8cf0; color: #fff; }
|
||||
.p-btn.disabled { color: #c0c4cc; background-color: #f5f7fa; cursor: not-allowed; }
|
||||
|
||||
.page-jump { display: flex; flex-direction: row; align-items: center; gap: 8px; }
|
||||
.jump-txt { font-size: 14px; color: #606266; }
|
||||
.jump-input { width: 40px; height: 32px; border: 1px solid #dcdfe6; text-align: center; border-radius: 4px; font-size: 14px; }
|
||||
</style>
|
||||
@@ -201,8 +201,10 @@ async function loadData() {
|
||||
const endTime = new Date().toISOString()
|
||||
const startTime = getStartTime()
|
||||
|
||||
// 各区块独立 try-catch,单个接口失败不影响其他数据展示
|
||||
|
||||
// 1. 获取财务概况
|
||||
try {
|
||||
// 1. 获取财务概况
|
||||
const finRes = await fetchFinanceOverview(startTime, endTime)
|
||||
if (finRes != null) {
|
||||
stats.rechargeAmount = finRes.recharge_amount.toFixed(2)
|
||||
@@ -212,8 +214,12 @@ async function loadData() {
|
||||
stats.balancePay = finRes.total_user_balance.toFixed(2)
|
||||
stats.commissionPay = finRes.total_user_brokerage.toFixed(2)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[finance-stats] 财务概况加载失败', e)
|
||||
}
|
||||
|
||||
// 2. 获取订单统计
|
||||
// 2. 获取订单统计(与订单统计页共用同一 RPC,此处独立请求)
|
||||
try {
|
||||
const orderRes = await fetchOrderStats(startTime, endTime)
|
||||
if (orderRes != null) {
|
||||
stats.revenue = orderRes.total_amount.toFixed(2)
|
||||
@@ -221,15 +227,19 @@ async function loadData() {
|
||||
stats.orderCount = String(orderRes.order_count)
|
||||
stats.refundAmount = orderRes.refund_amount.toFixed(2)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('[finance-stats] 订单统计加载失败', e)
|
||||
}
|
||||
|
||||
// 3. 获取趋势数据驱动图表
|
||||
// 3. 获取趋势数据驱动图表
|
||||
try {
|
||||
const trendRes = await fetchFinanceBillSummary(startTime, endTime, 'day')
|
||||
updateChart(trendRes)
|
||||
} catch (e) {
|
||||
uni.showToast({ title: '加载统计失败', icon: 'none' })
|
||||
} finally {
|
||||
loading.value = false
|
||||
console.error('[finance-stats] 趋势图加载失败', e)
|
||||
}
|
||||
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
function handleDateTabChange(index : number) {
|
||||
|
||||
Reference in New Issue
Block a user