feat(admin): 提现审核一键查看号主相关订单,订单页支持URL预填搜索

This commit is contained in:
yml2213
2026-08-15 13:37:27 +08:00
parent 51c3f2767f
commit 134d6fa05e
3 changed files with 53 additions and 3 deletions
@@ -1,12 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { ref } from 'vue' import { ref } from 'vue'
import { useRouter } from 'vue-router'
import type { WithdrawalDetail } from '@/features/admin/api/adminWithdrawal' import type { WithdrawalDetail } from '@/features/admin/api/adminWithdrawal'
import { reviewWithdrawal, confirmPayment } from '@/features/admin/api/adminWithdrawal' import { reviewWithdrawal, confirmPayment } from '@/features/admin/api/adminWithdrawal'
import { formatCent } from '@/shared/utils/money' import { formatCent } from '@/shared/utils/money'
import { adminPath } from '@/shared/utils/adminPath'
import AuthImage from '@/shared/components/business/AuthImage.vue' import AuthImage from '@/shared/components/business/AuthImage.vue'
const router = useRouter()
const props = defineProps<{ const props = defineProps<{
modelValue: boolean modelValue: boolean
withdrawal: WithdrawalDetail | null withdrawal: WithdrawalDetail | null
@@ -19,6 +23,16 @@ const emit = defineEmits<{
const submitting = ref(false) const submitting = ref(false)
/** 跳转订单管理页并预填号主搜索,快速查看该号主相关订单 */
function goToOwnerOrders() {
if (!props.withdrawal) return
const keyword = props.withdrawal.user_phone?.trim() || String(props.withdrawal.user_id || '')
void router.push({
path: adminPath('orders'),
query: keyword ? { keyword } : {},
})
}
async function handleReview(approved: boolean) { async function handleReview(approved: boolean) {
if (!props.withdrawal) return if (!props.withdrawal) return
@@ -144,7 +158,18 @@ function accountTypeLabel(type: string) {
</el-descriptions> </el-descriptions>
<!-- 用户信息 --> <!-- 用户信息 -->
<h3 style="margin-top: 20px">用户信息</h3> <h3 style="margin-top: 20px">
用户信息
<el-button
size="small"
type="primary"
plain
style="margin-left: 12px"
@click="goToOwnerOrders"
>
查看该号主订单
</el-button>
</h3>
<el-descriptions :column="2" border> <el-descriptions :column="2" border>
<el-descriptions-item label="用户ID"> <el-descriptions-item label="用户ID">
{{ withdrawal.user_id }} {{ withdrawal.user_id }}
@@ -1,6 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { Refresh, Search } from '@element-plus/icons-vue' import { Refresh, Search } from '@element-plus/icons-vue'
import { onMounted, reactive, ref } from 'vue' import { onMounted, reactive, ref } from 'vue'
import { useRoute } from 'vue-router'
import { fetchAdminOrders, type AdminOrderQuery, type Order } from '@/features/orders' import { fetchAdminOrders, type AdminOrderQuery, type Order } from '@/features/orders'
import { import {
@@ -26,6 +27,7 @@ const orders = ref<Order[]>([])
const total = ref(0) const total = ref(0)
const currentPage = ref(1) const currentPage = ref(1)
const currentPageSize = ref(20) const currentPageSize = ref(20)
const route = useRoute()
const orderStatusOptions = [ const orderStatusOptions = [
{ label: '待支付', value: 'pending_payment' }, { label: '待支付', value: 'pending_payment' },
@@ -72,7 +74,14 @@ const settlementStatusOptions = [
{ label: '已仲裁', value: 'arbitrated' }, { label: '已仲裁', value: 'arbitrated' },
] as const ] as const
onMounted(loadOrders) onMounted(() => {
// 支持从提现审核等页面跳转预填号主/租客搜索
const keyword = route.query.keyword
if (typeof keyword === 'string' && keyword.trim()) {
filters.keyword = keyword.trim()
}
void loadOrders()
})
async function loadOrders() { async function loadOrders() {
loading.value = true loading.value = true
@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { import {
@@ -9,9 +10,12 @@ import {
type WithdrawalDetail, type WithdrawalDetail,
} from '@/features/admin/api/adminWithdrawal' } from '@/features/admin/api/adminWithdrawal'
import { formatCent } from '@/shared/utils/money' import { formatCent } from '@/shared/utils/money'
import { adminPath } from '@/shared/utils/adminPath'
import WithdrawalDetailDialog from '../components/WithdrawalDetailDialog.vue' import WithdrawalDetailDialog from '../components/WithdrawalDetailDialog.vue'
const router = useRouter()
const loading = ref(false) const loading = ref(false)
const withdrawals = ref<WithdrawalDetail[]>([]) const withdrawals = ref<WithdrawalDetail[]>([])
const total = ref(0) const total = ref(0)
@@ -67,6 +71,15 @@ function openDetail(withdrawal: WithdrawalDetail) {
showDetailDialog.value = true showDetailDialog.value = true
} }
/** 跳转订单管理页并预填号主搜索,快速查看该号主相关订单 */
function goToOwnerOrders(withdrawal: WithdrawalDetail) {
const keyword = withdrawal.user_phone?.trim() || String(withdrawal.user_id || '')
void router.push({
path: adminPath('orders'),
query: keyword ? { keyword } : {},
})
}
async function handleReview(withdrawal: WithdrawalDetail, approved: boolean) { async function handleReview(withdrawal: WithdrawalDetail, approved: boolean) {
const action = approved ? '通过' : '拒绝' const action = approved ? '通过' : '拒绝'
try { try {
@@ -248,9 +261,12 @@ function onDetailDialogSaved() {
{{ new Date(row.created_at).toLocaleString('zh-CN') }} {{ new Date(row.created_at).toLocaleString('zh-CN') }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="240" fixed="right"> <el-table-column label="操作" width="300" fixed="right">
<template #default="{ row }"> <template #default="{ row }">
<el-button size="small" @click="openDetail(row)"> 详情 </el-button> <el-button size="small" @click="openDetail(row)"> 详情 </el-button>
<el-button size="small" type="primary" plain @click="goToOwnerOrders(row)">
号主订单
</el-button>
<el-button <el-button
v-if="row.status === 'pending'" v-if="row.status === 'pending'"
size="small" size="small"