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, "editor.formatOnSave": false,
"eslint.validate": [
"html",
"css",
"scss",
"json",
"jsonc",
"javascript",
"javascriptreact",
"typescript",
"typescriptreact",
"vue"
],
"i18n-ally.displayLanguage": "zh-cn", "i18n-ally.displayLanguage": "zh-cn",
"i18n-ally.enabledParsers": ["ts"], "i18n-ally.enabledParsers": ["ts"],
"i18n-ally.enabledFrameworks": ["vue"], "i18n-ally.enabledFrameworks": ["vue"],
@@ -26,6 +10,44 @@
"moduleResolution": "node" "moduleResolution": "node"
}, },
"prettier.enable": false, "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": ["./"] "unocss.root": ["./"]
} }

View File

@@ -50,7 +50,7 @@
"@better-scroll/core": "2.5.1", "@better-scroll/core": "2.5.1",
"@elysiajs/eden": "^1.4.5", "@elysiajs/eden": "^1.4.5",
"@iconify/vue": "5.0.0", "@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/axios": "workspace:*",
"@sa/color": "workspace:*", "@sa/color": "workspace:*",
"@sa/hooks": "workspace:*", "@sa/hooks": "workspace:*",

12
pnpm-lock.yaml generated
View File

@@ -18,8 +18,8 @@ importers:
specifier: 5.0.0 specifier: 5.0.0
version: 5.0.0(vue@3.5.25(typescript@5.9.3)) version: 5.0.0(vue@3.5.25(typescript@5.9.3))
'@riwa/api-types': '@riwa/api-types':
specifier: http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz specifier: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.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))) 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': '@sa/axios':
specifier: workspace:* specifier: workspace:*
version: link:packages/axios version: link:packages/axios
@@ -1068,9 +1068,9 @@ packages:
'@quansync/fs@0.1.6': '@quansync/fs@0.1.6':
resolution: {integrity: sha512-zoA8SqQO11qH9H8FCBR7NIbowYARIPmBz3nKjgAaOUDi/xPAAu1uAgebtV7KXHTc6CDZJVRZ1u4wIGvY5CWYaw==} resolution: {integrity: sha512-zoA8SqQO11qH9H8FCBR7NIbowYARIPmBz3nKjgAaOUDi/xPAAu1uAgebtV7KXHTc6CDZJVRZ1u4wIGvY5CWYaw==}
'@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':
resolution: {tarball: http://192.168.1.33:9527/api/riwa-api-types-0.0.30.tgz} resolution: {tarball: http://192.168.1.27:9527/api/riwa-api-types-0.0.44.tgz}
version: 0.0.30 version: 0.0.44
peerDependencies: peerDependencies:
'@elysiajs/eden': ^1.4.5 '@elysiajs/eden': ^1.4.5
@@ -5057,7 +5057,7 @@ snapshots:
dependencies: dependencies:
quansync: 0.3.0 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: 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)) '@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> </TableHeaderOperation>
<NDataTable <NDataTable
:row-key="row => row.id" :row-key="row => (row as any).id"
:scroll-x="2000" :scroll-x="2000"
:columns="dataTableColumns" :columns="dataTableColumns"
:data="tableData" :data="tableData"

View File

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

View File

@@ -1,15 +1,15 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useTemplateRef } from 'vue'; import { h, ref, useTemplateRef } from 'vue';
import { NDatePicker, useDialog, useMessage } from 'naive-ui'; import { useDateFormat } from '@vueuse/core';
import { NDatePicker, NInput, useDialog } from 'naive-ui';
import { client, safeClient } from '@/service/api'; 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 TableBase from '@/components/table/table-base.vue';
import { WithdrawMethodEnum, WithdrawStatusEnum } from '@/enum';
const dialog = useDialog();
const message = useMessage();
const tableInst = useTemplateRef<TableInst>('tableInst'); const tableInst = useTemplateRef<TableInst>('tableInst');
const dialog = useDialog();
// 获取待审核的提现订单​
const fetchData: TableFetchData = ({ pagination, filter }) => { const fetchData: TableFetchData = ({ pagination, filter }) => {
return safeClient(() => return safeClient(() =>
client.api.admin.withdraw.pending.get({ client.api.admin.withdraw.pending.get({
@@ -27,51 +27,132 @@ const columns: TableBaseColumns = [
key: 'id' key: 'id'
}, },
{ {
title: '提现金额', title: '资产账户',
key: 'amount'
},
{
title: '资产代码',
key: 'assetCode' key: 'assetCode'
}, },
{
title: '提现金额',
key: 'amount',
render: row => {
return Number(row.amount).toFixed(2);
}
},
{ {
title: '实际到账金额', 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', title: '银行卡ID',
key: 'bankAccountId' key: 'bankAccountId'
}, },
{ {
title: '银行卡转账凭证', title: '手续费',
key: 'bankTransferProof' key: 'fee',
render: row => {
return Number(row.fee).toFixed(2);
}
}, },
{ {
title: '现金代理ID', title: '状态',
key: 'cashAgentId' key: 'status',
render: row => {
return WithdrawStatusEnum[row.status as keyof typeof WithdrawStatusEnum];
}
}, },
{ {
title: '现金提取时间', title: '创建时间',
key: 'cashPickedUpAt' key: 'createdAt',
render: (row: any) => {
return useDateFormat(row.createdAt, 'YYYY-MM-DD HH:mm').value;
}
}, },
{ title: '现金提取码', key: 'cashPickupCode' },
{ {
title: '操作', title: '操作',
fixed: 'right', fixed: 'right',
width: 180,
key: 'operation', key: 'operation',
operations: (row: any) => [ operations: (row: any) => [
{ {
contentText: '处理', contentText: '通过',
type: 'primary', type: 'primary',
ghost: true,
visible: row.status === 'pending',
onClick: () => { 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: '处理', contentText: '拒绝',
type: 'primary', type: 'error',
onClick: () => { ghost: true,
tableInst.value?.reload(); 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();
});
}
});
}
});
} }
} }
] ]