feat(admin): 用户管理新增用户明细抽屉,聚合资金与交易全链路数据

- 用户管理操作列新增「明细」入口,抽屉按权限提供 5 个 Tab:钱包流水、订单记录、提现记录、邀请返利、支付记录
- 后端:后台订单列表新增 user_id 精确过滤(owner_id / renter_id),邀请关系与返利流水新增 inviter_id / invitee_id 过滤
- 修复:返利流水的「被邀请人手机号」筛选此前后端未实现,一直无效
- 资金流水页、支付记录页支持 ?user_id= 预填,可从明细直达
- 顺带将 invitation/dto.go、repository.go 中两处既有缩进错位按 gofmt 规整
This commit is contained in:
yml2213
2026-10-13 14:49:36 +08:00
parent 4a9e5f9d66
commit 0d6a7786a4
12 changed files with 1100 additions and 48 deletions
@@ -10,6 +10,7 @@ import {
Wallet,
} from '@element-plus/icons-vue'
import { computed, onMounted, reactive, ref } from 'vue'
import { useRoute } from 'vue-router'
import { fetchAdminPayments, type AdminPayment } from '@/features/admin/api/adminPayments'
import { adminPath } from '@/shared/utils/adminPath'
@@ -45,7 +46,14 @@ const refundAmount = computed(() =>
.reduce((sum, item) => sum + Number(item.amount_cent || 0), 0)
)
onMounted(loadPayments)
onMounted(() => {
// 支持从用户管理「明细」跳转预填用户,直接查看该用户的支付记录。
const routeUserID = useRoute().query.user_id
if (typeof routeUserID === 'string' && routeUserID.trim()) {
filters.user_id = routeUserID.trim()
}
void loadPayments()
})
async function loadPayments() {
loading.value = true
@@ -22,13 +22,21 @@ import { realnameStatusLabel, userStatusLabel } from '@/shared/utils/statusLabel
import { formatDateTime } from '@/shared/utils/time'
import { useAdminSessionStore } from '@/stores/adminSession'
import AdminTablePagination from '../components/AdminTablePagination.vue'
import AdminUserDetailDrawer from '../components/AdminUserDetailDrawer.vue'
const adminSession = useAdminSessionStore()
const canAdjustWallet = computed(() => adminSession.hasPermission('user:wallet_adjust'))
const canAdjustGrowthPoints = computed(() => adminSession.hasPermission('user:growth_points'))
const canViewUserDetail = computed(
() =>
adminSession.hasPermission('wallet:view') ||
adminSession.hasPermission('order:list') ||
adminSession.hasPermission('withdrawal:list')
)
const submitting = ref(false)
const activeUser = ref<AdminUserItem | null>(null)
const detailUser = ref<AdminUserItem | null>(null)
const quotaUser = ref<AdminUserItem | null>(null)
const realnameUser = ref<AdminUserItem | null>(null)
const manualRealnameUser = ref<AdminUserItem | null>(null)
@@ -82,6 +90,10 @@ function resetFilters() {
queryUsers()
}
function openUserDetail(row: AdminUserItem) {
detailUser.value = row
}
function openFreeze(row: AdminUserItem) {
activeUser.value = row
freezeReason.value = ''
@@ -412,9 +424,18 @@ function moneyCent(value: number | string | undefined) {
<el-table-column label="注册时间" min-width="160">
<template #default="{ row }">{{ formatDateTime(row.created_at) }}</template>
</el-table-column>
<el-table-column label="操作" width="360" fixed="right" align="right">
<el-table-column label="操作" width="400" fixed="right" align="right">
<template #default="{ row }">
<div class="table-actions">
<el-button
v-if="canViewUserDetail"
text
type="primary"
size="small"
@click="openUserDetail(row)"
>
明细
</el-button>
<el-button
v-if="canAdjustWallet"
text
@@ -752,6 +773,12 @@ function moneyCent(value: number | string | undefined) {
</el-button>
</template>
</el-dialog>
<AdminUserDetailDrawer
:model-value="!!detailUser"
:user="detailUser"
@update:model-value="(val: boolean) => !val && (detailUser = null)"
/>
</section>
</template>
@@ -9,6 +9,7 @@ import {
Wallet,
} from '@element-plus/icons-vue'
import { computed, onMounted, reactive, ref } from 'vue'
import { useRoute } from 'vue-router'
import { fetchAdminWalletLedger, type AdminWalletLedger } from '@/features/admin/api/adminWallet'
import { adminPath } from '@/shared/utils/adminPath'
@@ -32,6 +33,7 @@ const filters = reactive({
order_id: '',
biz_type: '',
})
const route = useRoute()
const inAmount = computed(() =>
ledger.value
@@ -44,7 +46,14 @@ const outAmount = computed(() =>
.reduce((sum, item) => sum + Number(item.amount_cent || 0), 0)
)
onMounted(loadLedger)
onMounted(() => {
// 支持从用户管理「明细」跳转预填用户,直接查看该用户的资金流水。
const routeUserID = route.query.user_id
if (typeof routeUserID === 'string' && routeUserID.trim()) {
filters.user_id = routeUserID.trim()
}
void loadLedger()
})
async function loadLedger() {
loading.value = true