feat: 新增银行管理功能,包括创建和编辑银行的组件及相关逻辑
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
<script lang="ts" setup>
|
||||
import { useTemplateRef } from 'vue';
|
||||
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, TableFilterColumns, TableInst } from '@/components/table';
|
||||
import Add from './components/add.vue';
|
||||
import Edit from './components/edit.vue';
|
||||
|
||||
const dialog = useDialog();
|
||||
const message = useMessage();
|
||||
@@ -32,10 +34,16 @@ const columns: TableBaseColumns = [
|
||||
{
|
||||
title: '是否启用',
|
||||
key: 'isActive',
|
||||
width: 100,
|
||||
render(row: any) {
|
||||
return row.isActive ? '是' : '否';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
key: 'sortOrder',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
key: 'createdAt',
|
||||
@@ -52,9 +60,10 @@ const columns: TableBaseColumns = [
|
||||
{
|
||||
contentText: '编辑',
|
||||
type: 'primary',
|
||||
ghost: true,
|
||||
size: 'small',
|
||||
onClick: () => {
|
||||
tableInst.value?.reload();
|
||||
handleEdit(row);
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -69,13 +78,9 @@ const columns: TableBaseColumns = [
|
||||
negativeText: '否',
|
||||
content: '确认删除该银行信息?',
|
||||
onPositiveClick: async () => {
|
||||
safeClient(() =>
|
||||
client.api.admin.deposit.reject({ orderId: row.id as string }).post({
|
||||
reviewNote: '管理员拒绝充值'
|
||||
})
|
||||
);
|
||||
// tableInst.value?.reload();
|
||||
safeClient(() => client.api.admin.bank_account.banks({ id: row.id }).delete());
|
||||
message.success('删除成功');
|
||||
tableInst.value?.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -95,7 +100,35 @@ const filterColumns: TableFilterColumns = [
|
||||
}
|
||||
];
|
||||
|
||||
function handleAdd() {}
|
||||
function handleAdd() {
|
||||
const dialogInstance = dialog.create({
|
||||
title: '创建银行',
|
||||
content: () =>
|
||||
h(Add, {
|
||||
onClose: () => {
|
||||
dialogInstance.destroy();
|
||||
tableInst.value?.reload();
|
||||
}
|
||||
}),
|
||||
style: { width: '600px' },
|
||||
showIcon: false
|
||||
});
|
||||
}
|
||||
function handleEdit(row) {
|
||||
const dialogInstance = dialog.create({
|
||||
title: '编辑银行',
|
||||
content: () =>
|
||||
h(Edit, {
|
||||
data: row,
|
||||
onClose: () => {
|
||||
dialogInstance.destroy();
|
||||
tableInst.value?.reload();
|
||||
}
|
||||
}),
|
||||
style: { width: '600px' },
|
||||
showIcon: false
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user