feat: 优化充值操作逻辑,简化金额输入,增加确认提示
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { h, ref, useTemplateRef } from 'vue';
|
import { useTemplateRef } from 'vue';
|
||||||
import { NInputNumber, NSelect, useDialog, useMessage } from 'naive-ui';
|
import { NSelect, useDialog, useMessage } from 'naive-ui';
|
||||||
import { client, safeClient } from '@/service/api';
|
import { client, safeClient } from '@/service/api';
|
||||||
import { DepositTypeEnum } from '@/enum';
|
import { DepositTypeEnum } from '@/enum';
|
||||||
import type { TableBaseColumns, TableFetchData, TableFilterColumns, TableInst } from '@/components/table';
|
import type { TableBaseColumns, TableFetchData, TableFilterColumns, TableInst } from '@/components/table';
|
||||||
@@ -43,38 +43,33 @@ const columns: TableBaseColumns = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '金额',
|
title: '金额',
|
||||||
key: 'amount'
|
key: 'amount',
|
||||||
|
render: row => {
|
||||||
|
return Number(row.amount).toFixed(2);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '操作',
|
title: '操作',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
key: 'operation',
|
key: 'operation',
|
||||||
|
width: 160,
|
||||||
operations: (row: any) => [
|
operations: (row: any) => [
|
||||||
{
|
{
|
||||||
contentText: '通过',
|
contentText: '通过',
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
strong: true,
|
strong: true,
|
||||||
secondary: true,
|
secondary: true,
|
||||||
size: 'small',
|
|
||||||
visible: row.status !== 'approved',
|
visible: row.status !== 'approved',
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
const amount = ref<string>(row.amount);
|
|
||||||
dialog.create({
|
dialog.create({
|
||||||
title: '通过充值',
|
title: '提示',
|
||||||
positiveText: '是',
|
positiveText: '是',
|
||||||
negativeText: '否',
|
negativeText: '否',
|
||||||
content: () =>
|
content: '确认通过该充值请求吗?',
|
||||||
h(NInputNumber, {
|
|
||||||
value: Number(amount.value),
|
|
||||||
'onUpdate:value': value => {
|
|
||||||
amount.value = String(value);
|
|
||||||
},
|
|
||||||
placeholder: '请输入实际充值金额'
|
|
||||||
}),
|
|
||||||
onPositiveClick: async () => {
|
onPositiveClick: async () => {
|
||||||
await safeClient(() =>
|
await safeClient(() =>
|
||||||
client.api.admin.deposit.approve({ orderId: row.id as string }).post({
|
client.api.admin.deposit.approve({ orderId: row.id as string }).post({
|
||||||
actualAmount: amount.value
|
actualAmount: row.amount
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
tableInst.value?.reload();
|
tableInst.value?.reload();
|
||||||
@@ -87,7 +82,6 @@ const columns: TableBaseColumns = [
|
|||||||
contentText: '拒绝',
|
contentText: '拒绝',
|
||||||
type: 'error',
|
type: 'error',
|
||||||
ghost: true,
|
ghost: true,
|
||||||
size: 'small',
|
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
dialog.create({
|
dialog.create({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
|
|||||||
Reference in New Issue
Block a user