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