|
|
@@ -0,0 +1,91 @@
|
|
|
+<template>
|
|
|
+ <div class="withdraw-review">
|
|
|
+ <el-card>
|
|
|
+ <template #header>
|
|
|
+ <div class="card-header">
|
|
|
+ <span>提现审核</span>
|
|
|
+ <el-button size="small" @click="fetchData">刷新</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <el-table :data="tableData" v-loading="loading" stripe style="width: 100%">
|
|
|
+ <el-table-column prop="id" label="ID" width="70" />
|
|
|
+ <el-table-column prop="userId" label="用户ID" width="80" />
|
|
|
+ <el-table-column label="金额" width="100">
|
|
|
+ <template #default="{ row }">¥{{ Math.abs(row.amount ?? 0).toFixed(2) }}</template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="remark" label="备注" min-width="150" />
|
|
|
+ <el-table-column prop="createdAt" label="申请时间" width="160" />
|
|
|
+ <el-table-column label="操作" width="200" fixed="right">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button size="small" type="success" @click="handleReview(row, true)">通过</el-button>
|
|
|
+ <el-button size="small" type="danger" @click="handleReview(row, false)">驳回</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <EmptyState v-if="!loading && tableData.length === 0" description="暂无待审核提现" />
|
|
|
+ </el-card>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+import { ref, onMounted } from 'vue'
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
+import { getWalletController } from '../api/wallet-controller'
|
|
|
+import EmptyState from '../components/EmptyState.vue'
|
|
|
+
|
|
|
+const api = getWalletController()
|
|
|
+const tableData = ref<Record<string, unknown>[]>([])
|
|
|
+const loading = ref(false)
|
|
|
+
|
|
|
+async function fetchData() {
|
|
|
+ loading.value = true
|
|
|
+ try {
|
|
|
+ const res = await api.listPendingWithdrawals({ pageNum: 1, pageSize: 50 })
|
|
|
+ if (res.code === 200 && res.data) {
|
|
|
+ tableData.value = res.data as Record<string, unknown>[]
|
|
|
+ }
|
|
|
+ } catch {
|
|
|
+ tableData.value = []
|
|
|
+ } finally {
|
|
|
+ loading.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function handleReview(row: Record<string, unknown>, approved: boolean) {
|
|
|
+ const action = approved ? '通过' : '驳回'
|
|
|
+ const promptTitle = action === '通过' ? '确认通过' : '驳回原因'
|
|
|
+ ElMessageBox.prompt(
|
|
|
+ `确定${action}该提现申请?${approved ? '' : '请输入驳回原因'}`,
|
|
|
+ promptTitle,
|
|
|
+ { inputType: 'textarea', inputPlaceholder: approved ? '' : '原因(可选)' },
|
|
|
+ ).then(async ({ value }) => {
|
|
|
+ try {
|
|
|
+ const res = await api.reviewWithdraw(Number(row.id), { approved, rejectReason: value || '' })
|
|
|
+ if (res.code === 200) {
|
|
|
+ ElMessage.success(`${action}成功`)
|
|
|
+ await fetchData()
|
|
|
+ } else {
|
|
|
+ ElMessage.error(`${action}失败`)
|
|
|
+ }
|
|
|
+ } catch {
|
|
|
+ ElMessage.error(`${action}失败`)
|
|
|
+ }
|
|
|
+ }).catch(() => {})
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => fetchData())
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.withdraw-review {
|
|
|
+ padding: 16px;
|
|
|
+}
|
|
|
+.card-header {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 600;
|
|
|
+}
|
|
|
+</style>
|