feat: 更新提现功能,新增提现方式和状态枚举,优化提现审批流程

This commit is contained in:
2025-12-22 02:44:47 +07:00
parent 8192a6fc33
commit a810c21c1f
9 changed files with 298 additions and 118 deletions

22
.vscode/launch.json vendored
View File

@@ -1,22 +0,0 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Vue Debugger",
"url": "http://localhost:9527",
"webRoot": "${workspaceFolder}"
},
{
"type": "node",
"request": "launch",
"name": "TS Debugger",
"runtimeExecutable": "tsx",
"skipFiles": ["<node_internals>/**", "${workspaceFolder}/node_modules/**"],
"program": "${file}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]
}

56
.vscode/settings.json vendored
View File

@@ -1,21 +1,5 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
"editor.formatOnSave": false,
"eslint.validate": [
"html",
"css",
"scss",
"json",
"jsonc",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue"
],
"i18n-ally.displayLanguage": "zh-cn",
"i18n-ally.enabledParsers": ["ts"],
"i18n-ally.enabledFrameworks": ["vue"],
@@ -26,6 +10,44 @@
"moduleResolution": "node"
},
"prettier.enable": false,
"typescript.tsdk": "node_modules/typescript/lib",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
"eslint.rules.customizations": [
{ "rule": "style/*", "severity": "off", "fixable": true },
{ "rule": "format/*", "severity": "off", "fixable": true },
{ "rule": "*-indent", "severity": "off", "fixable": true },
{ "rule": "*-spacing", "severity": "off", "fixable": true },
{ "rule": "*-spaces", "severity": "off", "fixable": true },
{ "rule": "*-order", "severity": "off", "fixable": true },
{ "rule": "*-dangle", "severity": "off", "fixable": true },
{ "rule": "*-newline", "severity": "off", "fixable": true },
{ "rule": "*quotes", "severity": "off", "fixable": true },
{ "rule": "*semi", "severity": "off", "fixable": true }
],
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue",
"html",
"markdown",
"json",
"jsonc",
"yaml",
"toml",
"xml",
"gql",
"graphql",
"astro",
"svelte",
"css",
"less",
"scss",
"pcss",
"postcss"
],
"unocss.root": ["./"]
}

View File

@@ -50,7 +50,7 @@
"@better-scroll/core": "2.5.1",
"@elysiajs/eden": "^1.4.5",
"@iconify/vue": "5.0.0",
"@riwa/api-types": "http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz",
"@riwa/api-types": "http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz",
"@sa/axios": "workspace:*",
"@sa/color": "workspace:*",
"@sa/hooks": "workspace:*",

12
pnpm-lock.yaml generated
View File

@@ -18,8 +18,8 @@ importers:
specifier: 5.0.0
version: 5.0.0(vue@3.5.25(typescript@5.9.3))
'@riwa/api-types':
specifier: http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz
version: http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz
version: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))
'@sa/axios':
specifier: workspace:*
version: link:packages/axios
@@ -1068,9 +1068,9 @@ packages:
'@quansync/fs@0.1.6':
resolution: {integrity: sha512-zoA8SqQO11qH9H8FCBR7NIbowYARIPmBz3nKjgAaOUDi/xPAAu1uAgebtV7KXHTc6CDZJVRZ1u4wIGvY5CWYaw==}
'@riwa/api-types@http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz':
resolution: {tarball: http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz}
version: 0.0.30
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz':
resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz}
version: 0.0.44
peerDependencies:
'@elysiajs/eden': ^1.4.5
@@ -5057,7 +5057,7 @@ snapshots:
dependencies:
quansync: 0.3.0
'@riwa/api-types@http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
'@riwa/api-types@http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz(@elysiajs/eden@1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3)))':
dependencies:
'@elysiajs/eden': 1.4.5(elysia@1.4.19(@sinclair/typebox@0.34.41)(exact-mirror@0.2.5(@sinclair/typebox@0.34.41))(file-type@21.1.1)(openapi-types@12.1.3)(typescript@5.9.3))

View File

@@ -108,7 +108,7 @@ defineExpose({
</TableHeaderOperation>
<NDataTable
:row-key="row => row.id"
:row-key="row => (row as any).id"
:scroll-x="2000"
:columns="dataTableColumns"
:data="tableData"

View File

@@ -16,3 +16,16 @@ export enum RwaStatusEnum {
approved = '已通过',
rejected = '已拒绝'
}
export enum WithdrawMethodEnum {
bank = '银行转账',
crypto = '加密货币转账',
cash = '现金提现'
}
export enum WithdrawStatusEnum {
pending = '待处理',
approved = '已通过',
rejected = '已拒绝',
completed = '已完成'
}

View File

@@ -0,0 +1,70 @@
<script lang="ts" setup>
import { computed, ref } from 'vue';
import type { Treaty } from '@elysiajs/eden';
import { client, safeClient } from '@/service/api';
defineOptions({ name: 'WithdrawApprovedComplete' });
const emit = defineEmits<{
(e: 'close'): void;
}>();
const props = defineProps<{
data: Treaty.Data<typeof client.api.admin.withdraw.approved.get>['data'][number];
}>();
const withdrawType = computed(() => props.data.withdrawMethod);
const input = ref('');
const loading = ref(false);
async function handleSubmit() {
loading.value = true;
await safeClient(
client.api.admin.withdraw({ orderId: props.data.id }).complete.post({
bankTransferProof: withdrawType.value === 'bank' ? input.value : undefined,
txHash: withdrawType.value === 'crypto' ? input.value : undefined,
cashPickupCode: withdrawType.value === 'cash' ? input.value : undefined
})
).finally(() => {
loading.value = false;
});
window.$message?.success('操作成功');
setTimeout(() => {
emit('close');
}, 300);
}
</script>
<template>
<NSpace vertical size="large" class="my-5">
<div>
<div v-if="withdrawType === 'bank'">
<div class="text-md">转账人卡号</div>
<div class="text-2xl">{{ data.bankAccountId }}</div>
</div>
<div v-else-if="withdrawType === 'crypto'">
<div class="text-md">转账人链上地址</div>
<div class="text-2xl">{{ data.toAddress }}</div>
</div>
<div v-else>
<div class="text-md">现金提取码</div>
<div class="text-2xl">{{ data.cashPickupCode }}</div>
</div>
</div>
<NForm>
<NFormItem v-if="withdrawType === 'bank'" label="银行转账凭证">
<NInput v-model:value="input" placeholder="银行转账凭证(可选)" />
</NFormItem>
<NFormItem v-else-if="withdrawType === 'crypto'" label="链上交易哈希">
<NInput v-model:value="input" placeholder="链上交易哈希(可选)" />
</NFormItem>
<NSpace justify="end">
<NButton @click="emit('close')"> </NButton>
<NButton type="primary" :loading="loading" @click="handleSubmit"> </NButton>
</NSpace>
</NForm>
</NSpace>
</template>
<style lang="css" scoped></style>

View File

@@ -1,9 +1,11 @@
<script lang="ts" setup>
import { h, ref, useTemplateRef } from 'vue';
import { NDatePicker, NInputNumber, useDialog, useMessage } from 'naive-ui';
import dayjs from 'dayjs';
import { h, useTemplateRef } from 'vue';
import { useDateFormat } from '@vueuse/core';
import { useDialog, useMessage } from 'naive-ui';
import { client, safeClient } from '@/service/api';
import type { TableBaseColumns, TableFetchData, TableInst } from '@/components/table';
import type { TableBaseColumns, TableFetchData, TableFilterColumns, TableInst } from '@/components/table';
import { WithdrawMethodEnum, WithdrawStatusEnum } from '@/enum';
import Complete from './components/complete.vue';
const dialog = useDialog();
const message = useMessage();
@@ -25,57 +27,54 @@ const columns: TableBaseColumns = [
title: 'ID',
key: 'id'
},
{
title: '资产账户',
key: 'assetCode'
},
{
title: '提现金额',
key: 'amount'
key: 'amount',
render: row => {
return Number(row.amount).toFixed(2);
}
},
{
title: '实际到账金额',
key: 'actualAmount'
key: 'actualAmount',
render: row => {
return Number(row.actualAmount).toFixed(2);
}
},
{
title: '资产代码',
key: 'assetCode'
title: '提现方式',
key: 'withdrawMethod',
render: row => {
return WithdrawMethodEnum[row.withdrawMethod as keyof typeof WithdrawMethodEnum];
}
},
{
title: '银行卡ID',
key: 'bankAccountId'
},
{
title: '银行转账凭证',
key: 'bankTransferProof'
},
{
title: '现金代理ID',
key: 'cashAgentId'
},
{
title: '现金提取时间',
key: 'cashPickedUpAt',
render(row: any) {
return h('span', {}, row.cashPickedUpAt ? dayjs(row.cashPickedUpAt).format('YYYY-MM-DD HH:mm:ss') : '-');
title: '手续费',
key: 'fee',
render: row => {
return Number(row.fee).toFixed(2);
}
},
{ title: '现金提取码', key: 'cashPickupCode' },
{
title: 'createdAt',
title: '状态',
key: 'status',
render: row => {
return WithdrawStatusEnum[row.status as keyof typeof WithdrawStatusEnum];
}
},
{
title: '创建时间',
key: 'createdAt',
render(row: any) {
return h('span', {}, row.createdAt ? dayjs(row.createdAt).format('YYYY-MM-DD HH:mm:ss') : '-');
}
},
{
title: 'updatedAt',
key: 'updatedAt',
render(row: any) {
return h('span', {}, row.updatedAt ? dayjs(row.updatedAt).format('YYYY-MM-DD HH:mm:ss') : '-');
}
},
{
title: 'deletedAt',
key: 'deletedAt',
render(row: any) {
return h('span', {}, row.deletedAt ? dayjs(row.deletedAt).format('YYYY-MM-DD HH:mm:ss') : '-');
render: (row: any) => {
return useDateFormat(row.createdAt, 'YYYY-MM-DD HH:mm').value;
}
},
{
@@ -85,30 +84,41 @@ const columns: TableBaseColumns = [
width: 160,
operations: (row: any) => [
{
contentText: '编辑',
contentText: '完成',
type: 'primary',
ghost: true,
onClick: () => {
tableInst.value?.reload();
const dialogInstance = dialog.create({
title: '提示',
style: { width: '600px' },
content: () =>
h(Complete, {
data: row,
onClose: () => {
dialogInstance.destroy();
tableInst.value?.reload();
}
})
});
}
},
{
contentText: '删除',
contentText: '拒绝',
type: 'error',
ghost: true,
size: 'small',
onClick: async () => {
dialog.create({
title: '提示',
positiveText: '是',
negativeText: '否',
content: '确认删除该银行信息',
content: '确定拒绝该提现申请吗',
onPositiveClick: async () => {
safeClient(() =>
await safeClient(() =>
client.api.admin.deposit.reject({ orderId: row.id as string }).post({
reviewNote: '管理员拒绝充值'
})
);
// tableInst.value?.reload();
tableInst.value?.reload();
message.success('删除成功');
}
});
@@ -127,7 +137,13 @@ const filterColumns: TableFilterColumns = [
</script>
<template>
<TableBase ref="tableInst" :columns="columns" :filter-columns="filterColumns" :fetch-data="fetchData" />
<TableBase
ref="tableInst"
show-header-operation
:columns="columns"
:filter-columns="filterColumns"
:fetch-data="fetchData"
/>
</template>
<style lang="css" scoped></style>

View File

@@ -1,15 +1,15 @@
<script lang="ts" setup>
import { useTemplateRef } from 'vue';
import { NDatePicker, useDialog, useMessage } from 'naive-ui';
import { h, ref, useTemplateRef } from 'vue';
import { useDateFormat } from '@vueuse/core';
import { NDatePicker, NInput, useDialog } from 'naive-ui';
import { client, safeClient } from '@/service/api';
import type { TableBaseColumns, TableFetchData, TableInst } from '@/components/table';
import type { TableBaseColumns, TableFetchData, TableFilterColumns, TableInst } from '@/components/table';
import TableBase from '@/components/table/table-base.vue';
import { WithdrawMethodEnum, WithdrawStatusEnum } from '@/enum';
const dialog = useDialog();
const message = useMessage();
const tableInst = useTemplateRef<TableInst>('tableInst');
const dialog = useDialog();
// 获取待审核的提现订单​
const fetchData: TableFetchData = ({ pagination, filter }) => {
return safeClient(() =>
client.api.admin.withdraw.pending.get({
@@ -27,51 +27,132 @@ const columns: TableBaseColumns = [
key: 'id'
},
{
title: '提现金额',
key: 'amount'
},
{
title: '资产代码',
title: '资产账户',
key: 'assetCode'
},
{
title: '提现金额',
key: 'amount',
render: row => {
return Number(row.amount).toFixed(2);
}
},
{
title: '实际到账金额',
key: 'actualAmount'
key: 'actualAmount',
render: row => {
return Number(row.actualAmount).toFixed(2);
}
},
{
title: '提现方式',
key: 'withdrawMethod',
render: row => {
return WithdrawMethodEnum[row.withdrawMethod as keyof typeof WithdrawMethodEnum];
}
},
{
title: '银行卡ID',
key: 'bankAccountId'
},
{
title: '银行卡转账凭证',
key: 'bankTransferProof'
title: '手续费',
key: 'fee',
render: row => {
return Number(row.fee).toFixed(2);
}
},
{
title: '现金代理ID',
key: 'cashAgentId'
title: '状态',
key: 'status',
render: row => {
return WithdrawStatusEnum[row.status as keyof typeof WithdrawStatusEnum];
}
},
{
title: '现金提取时间',
key: 'cashPickedUpAt'
title: '创建时间',
key: 'createdAt',
render: (row: any) => {
return useDateFormat(row.createdAt, 'YYYY-MM-DD HH:mm').value;
}
},
{ title: '现金提取码', key: 'cashPickupCode' },
{
title: '操作',
fixed: 'right',
width: 180,
key: 'operation',
operations: (row: any) => [
{
contentText: '处理',
contentText: '通过',
type: 'primary',
ghost: true,
visible: row.status === 'pending',
onClick: () => {
tableInst.value?.reload();
const reason = ref<string>('');
dialog.create({
title: '通过提现',
positiveText: '是',
negativeText: '否',
showIcon: false,
content: () =>
h(NInput, {
type: 'textarea',
rows: 4,
placeholder: '请输入通过理由(可选)',
'onUpdate:value': value => {
reason.value = value;
}
}),
onPositiveClick: async () => {
await safeClient(() =>
client.api.admin.withdraw({ orderId: row.id }).approve.post({
reviewNote: reason.value
})
);
tableInst.value?.reload();
}
});
}
},
{
contentText: '处理',
type: 'primary',
onClick: () => {
tableInst.value?.reload();
contentText: '拒绝',
type: 'error',
ghost: true,
visible: row.status === 'pending',
onClick: async () => {
const reason = ref<string>('');
dialog.create({
title: '拒绝提现',
positiveText: '是',
negativeText: '否',
showIcon: false,
content: () =>
h(NInput, {
type: 'textarea',
rows: 4,
placeholder: '请输入拒绝理由',
'onUpdate:value': value => {
reason.value = value;
}
}),
onPositiveClick: () => {
return new Promise<void>((resolve, reject) => {
if (!reason.value) {
window.$message?.error('请输入拒绝理由');
reject(new Error('请输入拒绝理由'));
} else {
safeClient(() =>
client.api.admin.withdraw({ orderId: row.id }).reject.post({
rejectReason: reason.value
})
).then(() => {
tableInst.value?.reload();
resolve();
});
}
});
}
});
}
}
]