feat: 添加钱包管理功能,整合钱包类型编辑页面及相关路由,支持钱包类型的增删改查
This commit is contained in:
@@ -232,7 +232,8 @@ const local: App.I18n.Schema = {
|
|||||||
product: 'Product',
|
product: 'Product',
|
||||||
user: ' User',
|
user: ' User',
|
||||||
news: 'News',
|
news: 'News',
|
||||||
withdraw: 'Withdraw'
|
withdraw: 'Withdraw',
|
||||||
|
wallet: 'Wallet'
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
login: {
|
login: {
|
||||||
|
|||||||
@@ -228,7 +228,8 @@ const local: App.I18n.Schema = {
|
|||||||
product: '产品管理',
|
product: '产品管理',
|
||||||
user: '用户管理',
|
user: '用户管理',
|
||||||
news: '新闻管理',
|
news: '新闻管理',
|
||||||
withdraw: '提现管理'
|
withdraw: '提现管理',
|
||||||
|
wallet: '钱包管理'
|
||||||
},
|
},
|
||||||
page: {
|
page: {
|
||||||
login: {
|
login: {
|
||||||
|
|||||||
@@ -24,5 +24,6 @@ export const views: Record<LastLevelRouteKey, RouteComponent | (() => Promise<Ro
|
|||||||
news: () => import("@/views/news/index.vue"),
|
news: () => import("@/views/news/index.vue"),
|
||||||
product: () => import("@/views/product/index.vue"),
|
product: () => import("@/views/product/index.vue"),
|
||||||
user: () => import("@/views/user/index.vue"),
|
user: () => import("@/views/user/index.vue"),
|
||||||
|
wallet: () => import("@/views/wallet/index.vue"),
|
||||||
withdraw: () => import("@/views/withdraw/index.vue"),
|
withdraw: () => import("@/views/withdraw/index.vue"),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -100,6 +100,15 @@ export const generatedRoutes: GeneratedRoute[] = [
|
|||||||
i18nKey: 'route.user'
|
i18nKey: 'route.user'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'wallet',
|
||||||
|
path: '/wallet',
|
||||||
|
component: 'layout.base$view.wallet',
|
||||||
|
meta: {
|
||||||
|
title: 'wallet',
|
||||||
|
i18nKey: 'route.wallet'
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'withdraw',
|
name: 'withdraw',
|
||||||
path: '/withdraw',
|
path: '/withdraw',
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ const routeMap: RouteMap = {
|
|||||||
"news": "/news",
|
"news": "/news",
|
||||||
"product": "/product",
|
"product": "/product",
|
||||||
"user": "/user",
|
"user": "/user",
|
||||||
|
"wallet": "/wallet",
|
||||||
"withdraw": "/withdraw"
|
"withdraw": "/withdraw"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
6
src/typings/components.d.ts
vendored
6
src/typings/components.d.ts
vendored
@@ -51,8 +51,6 @@ declare module 'vue' {
|
|||||||
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
NColorPicker: typeof import('naive-ui')['NColorPicker']
|
||||||
NDataTable: typeof import('naive-ui')['NDataTable']
|
NDataTable: typeof import('naive-ui')['NDataTable']
|
||||||
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||||
NDescriptions: typeof import('naive-ui')['NDescriptions']
|
|
||||||
NDescriptionsItem: typeof import('naive-ui')['NDescriptionsItem']
|
|
||||||
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
||||||
NDivider: typeof import('naive-ui')['NDivider']
|
NDivider: typeof import('naive-ui')['NDivider']
|
||||||
NDrawer: typeof import('naive-ui')['NDrawer']
|
NDrawer: typeof import('naive-ui')['NDrawer']
|
||||||
@@ -100,6 +98,7 @@ declare module 'vue' {
|
|||||||
TableHeaderOperation: typeof import('./../components/advanced/table-header-operation.vue')['default']
|
TableHeaderOperation: typeof import('./../components/advanced/table-header-operation.vue')['default']
|
||||||
ThemeSchemaSwitch: typeof import('./../components/common/theme-schema-switch.vue')['default']
|
ThemeSchemaSwitch: typeof import('./../components/common/theme-schema-switch.vue')['default']
|
||||||
Upload: typeof import('./../components/upload/index.vue')['default']
|
Upload: typeof import('./../components/upload/index.vue')['default']
|
||||||
|
UserSelect: typeof import('./../components/common/user-select.vue')['default']
|
||||||
WaveBg: typeof import('./../components/custom/wave-bg.vue')['default']
|
WaveBg: typeof import('./../components/custom/wave-bg.vue')['default']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -145,8 +144,6 @@ declare global {
|
|||||||
const NColorPicker: typeof import('naive-ui')['NColorPicker']
|
const NColorPicker: typeof import('naive-ui')['NColorPicker']
|
||||||
const NDataTable: typeof import('naive-ui')['NDataTable']
|
const NDataTable: typeof import('naive-ui')['NDataTable']
|
||||||
const NDatePicker: typeof import('naive-ui')['NDatePicker']
|
const NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||||
const NDescriptions: typeof import('naive-ui')['NDescriptions']
|
|
||||||
const NDescriptionsItem: typeof import('naive-ui')['NDescriptionsItem']
|
|
||||||
const NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
const NDialogProvider: typeof import('naive-ui')['NDialogProvider']
|
||||||
const NDivider: typeof import('naive-ui')['NDivider']
|
const NDivider: typeof import('naive-ui')['NDivider']
|
||||||
const NDrawer: typeof import('naive-ui')['NDrawer']
|
const NDrawer: typeof import('naive-ui')['NDrawer']
|
||||||
@@ -194,5 +191,6 @@ declare global {
|
|||||||
const TableHeaderOperation: typeof import('./../components/advanced/table-header-operation.vue')['default']
|
const TableHeaderOperation: typeof import('./../components/advanced/table-header-operation.vue')['default']
|
||||||
const ThemeSchemaSwitch: typeof import('./../components/common/theme-schema-switch.vue')['default']
|
const ThemeSchemaSwitch: typeof import('./../components/common/theme-schema-switch.vue')['default']
|
||||||
const Upload: typeof import('./../components/upload/index.vue')['default']
|
const Upload: typeof import('./../components/upload/index.vue')['default']
|
||||||
|
const UserSelect: typeof import('./../components/common/user-select.vue')['default']
|
||||||
const WaveBg: typeof import('./../components/custom/wave-bg.vue')['default']
|
const WaveBg: typeof import('./../components/custom/wave-bg.vue')['default']
|
||||||
}
|
}
|
||||||
3
src/typings/elegant-router.d.ts
vendored
3
src/typings/elegant-router.d.ts
vendored
@@ -26,6 +26,7 @@ declare module "@elegant-router/types" {
|
|||||||
"news": "/news";
|
"news": "/news";
|
||||||
"product": "/product";
|
"product": "/product";
|
||||||
"user": "/user";
|
"user": "/user";
|
||||||
|
"wallet": "/wallet";
|
||||||
"withdraw": "/withdraw";
|
"withdraw": "/withdraw";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -67,6 +68,7 @@ declare module "@elegant-router/types" {
|
|||||||
| "news"
|
| "news"
|
||||||
| "product"
|
| "product"
|
||||||
| "user"
|
| "user"
|
||||||
|
| "wallet"
|
||||||
| "withdraw"
|
| "withdraw"
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@@ -93,6 +95,7 @@ declare module "@elegant-router/types" {
|
|||||||
| "news"
|
| "news"
|
||||||
| "product"
|
| "product"
|
||||||
| "user"
|
| "user"
|
||||||
|
| "wallet"
|
||||||
| "withdraw"
|
| "withdraw"
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
|||||||
256
src/views/wallet/components/edit.vue
Normal file
256
src/views/wallet/components/edit.vue
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { onMounted, ref } from 'vue';
|
||||||
|
import type { FormInst, FormRules } from 'naive-ui';
|
||||||
|
import { client, safeClient } from '@/service/api';
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'WalletTypeEdit'
|
||||||
|
});
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
data: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Emits {
|
||||||
|
(e: 'close'): void;
|
||||||
|
}
|
||||||
|
|
||||||
|
const props = defineProps<Props>();
|
||||||
|
const emit = defineEmits<Emits>();
|
||||||
|
|
||||||
|
interface WalletTypeForm {
|
||||||
|
name: string;
|
||||||
|
code: string;
|
||||||
|
minWithdrawAmount: number;
|
||||||
|
maxWithdrawAmount: number;
|
||||||
|
minTransferAmount: number;
|
||||||
|
maxTransferAmount: number;
|
||||||
|
minExchangeAmount: number;
|
||||||
|
maxExchangeAmount: number;
|
||||||
|
isActive: boolean;
|
||||||
|
allowDeposit: boolean;
|
||||||
|
allowExchange: boolean;
|
||||||
|
allowReceiveExchange: boolean;
|
||||||
|
allowTransaction: boolean;
|
||||||
|
allowTransfer: boolean;
|
||||||
|
allowWithdraw: boolean;
|
||||||
|
description: string;
|
||||||
|
exchangeRate: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
const formRef = ref<FormInst | null>(null);
|
||||||
|
const loading = ref(false);
|
||||||
|
|
||||||
|
const formModel = ref<WalletTypeForm>({
|
||||||
|
name: '',
|
||||||
|
code: '',
|
||||||
|
minWithdrawAmount: 0,
|
||||||
|
maxWithdrawAmount: 0,
|
||||||
|
minTransferAmount: 0,
|
||||||
|
maxTransferAmount: 0,
|
||||||
|
minExchangeAmount: 0,
|
||||||
|
maxExchangeAmount: 0,
|
||||||
|
isActive: true,
|
||||||
|
allowDeposit: false,
|
||||||
|
allowExchange: false,
|
||||||
|
allowReceiveExchange: false,
|
||||||
|
allowTransaction: false,
|
||||||
|
allowTransfer: false,
|
||||||
|
allowWithdraw: false,
|
||||||
|
description: '',
|
||||||
|
exchangeRate: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules: FormRules = {
|
||||||
|
name: [{ required: true, message: '请输入钱包类型名称', trigger: 'blur' }],
|
||||||
|
code: [{ required: true, message: '请输入钱包代码', trigger: 'blur' }],
|
||||||
|
minWithdrawAmount: [{ required: true, type: 'number', message: '请输入最低提现金额', trigger: 'blur' }],
|
||||||
|
maxWithdrawAmount: [{ required: true, type: 'number', message: '请输入最高提现金额', trigger: 'blur' }],
|
||||||
|
minTransferAmount: [{ required: true, type: 'number', message: '请输入最低转账金额', trigger: 'blur' }],
|
||||||
|
maxTransferAmount: [{ required: true, type: 'number', message: '请输入最高转账金额', trigger: 'blur' }],
|
||||||
|
minExchangeAmount: [{ required: true, type: 'number', message: '请输入最低兑换金额', trigger: 'blur' }],
|
||||||
|
maxExchangeAmount: [{ required: true, type: 'number', message: '请输入最高兑换金额', trigger: 'blur' }],
|
||||||
|
exchangeRate: [{ required: true, type: 'number', message: '请输入兑换比例', trigger: 'blur' }]
|
||||||
|
};
|
||||||
|
|
||||||
|
async function handleSubmit() {
|
||||||
|
await formRef.value?.validate();
|
||||||
|
loading.value = true;
|
||||||
|
|
||||||
|
const transformedData = {
|
||||||
|
...formModel.value,
|
||||||
|
minWithdrawAmount: String(formModel.value.minWithdrawAmount),
|
||||||
|
maxWithdrawAmount: String(formModel.value.maxWithdrawAmount),
|
||||||
|
minTransferAmount: String(formModel.value.minTransferAmount),
|
||||||
|
maxTransferAmount: String(formModel.value.maxTransferAmount),
|
||||||
|
minExchangeAmount: String(formModel.value.minExchangeAmount),
|
||||||
|
maxExchangeAmount: String(formModel.value.maxExchangeAmount),
|
||||||
|
exchangeRate: String(formModel.value.exchangeRate)
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = await safeClient(() =>
|
||||||
|
client.api.admin.wallet_types({ id: props.data.id }).patch({
|
||||||
|
...transformedData
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.data) {
|
||||||
|
window.$message?.success('更新成功');
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
loading.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleCancel() {
|
||||||
|
emit('close');
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
formModel.value = {
|
||||||
|
name: props.data.name || '',
|
||||||
|
code: props.data.code || '',
|
||||||
|
minWithdrawAmount: Number(props.data.minWithdrawAmount) || 0,
|
||||||
|
maxWithdrawAmount: Number(props.data.maxWithdrawAmount) || 0,
|
||||||
|
minTransferAmount: Number(props.data.minTransferAmount) || 0,
|
||||||
|
maxTransferAmount: Number(props.data.maxTransferAmount) || 0,
|
||||||
|
minExchangeAmount: Number(props.data.minExchangeAmount) || 0,
|
||||||
|
maxExchangeAmount: Number(props.data.maxExchangeAmount) || 0,
|
||||||
|
isActive: props.data.isActive ?? true,
|
||||||
|
allowDeposit: props.data.allowDeposit ?? false,
|
||||||
|
allowExchange: props.data.allowExchange ?? false,
|
||||||
|
allowReceiveExchange: props.data.allowReceiveExchange ?? false,
|
||||||
|
allowTransaction: props.data.allowTransaction ?? false,
|
||||||
|
allowTransfer: props.data.allowTransfer ?? false,
|
||||||
|
allowWithdraw: props.data.allowWithdraw ?? false,
|
||||||
|
description: props.data.description || '',
|
||||||
|
exchangeRate: Number(props.data.exchangeRate) || 1
|
||||||
|
};
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<NForm ref="formRef" :model="formModel" :rules="rules" label-placement="left" :label-width="120">
|
||||||
|
<NGrid :cols="2" :x-gap="24">
|
||||||
|
<NFormItemGi label="钱包类型" path="name">
|
||||||
|
<NInput v-model:value="formModel.name" placeholder="请输入钱包类型名称" />
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="钱包代码" path="code">
|
||||||
|
<NInput v-model:value="formModel.code" placeholder="请输入钱包代码" disabled />
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="最低提现金额" path="minWithdrawAmount">
|
||||||
|
<NInputNumber
|
||||||
|
v-model:value="formModel.minWithdrawAmount"
|
||||||
|
placeholder="请输入最低提现金额"
|
||||||
|
class="w-full"
|
||||||
|
:min="0"
|
||||||
|
/>
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="最高提现金额" path="maxWithdrawAmount">
|
||||||
|
<NInputNumber
|
||||||
|
v-model:value="formModel.maxWithdrawAmount"
|
||||||
|
placeholder="请输入最高提现金额"
|
||||||
|
class="w-full"
|
||||||
|
:min="0"
|
||||||
|
/>
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="最低转账金额" path="minTransferAmount">
|
||||||
|
<NInputNumber
|
||||||
|
v-model:value="formModel.minTransferAmount"
|
||||||
|
placeholder="请输入最低转账金额"
|
||||||
|
class="w-full"
|
||||||
|
:min="0"
|
||||||
|
/>
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="最高转账金额" path="maxTransferAmount">
|
||||||
|
<NInputNumber
|
||||||
|
v-model:value="formModel.maxTransferAmount"
|
||||||
|
placeholder="请输入最高转账金额"
|
||||||
|
class="w-full"
|
||||||
|
:min="0"
|
||||||
|
/>
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="最低兑换金额" path="minExchangeAmount">
|
||||||
|
<NInputNumber
|
||||||
|
v-model:value="formModel.minExchangeAmount"
|
||||||
|
placeholder="请输入最低兑换金额"
|
||||||
|
class="w-full"
|
||||||
|
:min="0"
|
||||||
|
/>
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="最高兑换金额" path="maxExchangeAmount">
|
||||||
|
<NInputNumber
|
||||||
|
v-model:value="formModel.maxExchangeAmount"
|
||||||
|
placeholder="请输入最高兑换金额"
|
||||||
|
class="w-full"
|
||||||
|
:min="0"
|
||||||
|
/>
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="兑换比例" path="exchangeRate">
|
||||||
|
<NInputNumber
|
||||||
|
v-model:value="formModel.exchangeRate"
|
||||||
|
placeholder="请输入兑换比例"
|
||||||
|
class="w-full"
|
||||||
|
:min="0"
|
||||||
|
:step="0.01"
|
||||||
|
/>
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="是否启用" path="isActive">
|
||||||
|
<NSwitch v-model:value="formModel.isActive" />
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="允许充值" path="allowDeposit">
|
||||||
|
<NSwitch v-model:value="formModel.allowDeposit" />
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="允许兑换" path="allowExchange">
|
||||||
|
<NSwitch v-model:value="formModel.allowExchange" />
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="允许接收兑换" path="allowReceiveExchange">
|
||||||
|
<NSwitch v-model:value="formModel.allowReceiveExchange" />
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="允许交易" path="allowTransaction">
|
||||||
|
<NSwitch v-model:value="formModel.allowTransaction" />
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="允许转账" path="allowTransfer">
|
||||||
|
<NSwitch v-model:value="formModel.allowTransfer" />
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi label="允许提现" path="allowWithdraw">
|
||||||
|
<NSwitch v-model:value="formModel.allowWithdraw" />
|
||||||
|
</NFormItemGi>
|
||||||
|
|
||||||
|
<NFormItemGi :span="2" label="描述" path="description">
|
||||||
|
<NInput
|
||||||
|
v-model:value="formModel.description"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
:autosize="{ minRows: 3, maxRows: 5 }"
|
||||||
|
/>
|
||||||
|
</NFormItemGi>
|
||||||
|
</NGrid>
|
||||||
|
</NForm>
|
||||||
|
|
||||||
|
<div class="mt-16px flex justify-end gap-12px">
|
||||||
|
<NButton @click="handleCancel">取消</NButton>
|
||||||
|
<NButton type="primary" :loading="loading" @click="handleSubmit">确定</NButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
209
src/views/wallet/index.vue
Normal file
209
src/views/wallet/index.vue
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { h, useTemplateRef } from 'vue';
|
||||||
|
import { NSelect, NTag, useDialog } from 'naive-ui';
|
||||||
|
import { client, safeClient } from '@/service/api';
|
||||||
|
import type { TableBaseColumns, TableFetchData, TableFilterColumns, TableInst } from '@/components/table';
|
||||||
|
import Edit from './components/edit.vue';
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
name: 'TeamDialog'
|
||||||
|
});
|
||||||
|
|
||||||
|
const dialog = useDialog();
|
||||||
|
const tableInst = useTemplateRef<TableInst>('tableInst');
|
||||||
|
|
||||||
|
const fetchData: TableFetchData = ({ pagination, filter }) => {
|
||||||
|
return safeClient(() => client.api.admin.wallet_types.get({ query: { ...pagination, ...filter } }));
|
||||||
|
};
|
||||||
|
|
||||||
|
const columns: TableBaseColumns = [
|
||||||
|
{
|
||||||
|
key: 'name',
|
||||||
|
title: '钱包类型',
|
||||||
|
fixed: 'left'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'code',
|
||||||
|
title: '钱包代码'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'minWithdrawAmount',
|
||||||
|
title: '最低提现金额',
|
||||||
|
render: (row: any) => {
|
||||||
|
return Number(row.minWithdrawAmount);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'maxWithdrawAmount',
|
||||||
|
title: '最高提现金额',
|
||||||
|
render: (row: any) => {
|
||||||
|
return Number(row.minWithdrawAmount);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'minTransferAmount',
|
||||||
|
title: '最低转账金额',
|
||||||
|
render: (row: any) => {
|
||||||
|
return Number(row.minWithdrawAmount);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'maxTransferAmount',
|
||||||
|
title: '最高转账金额',
|
||||||
|
render: (row: any) => {
|
||||||
|
return Number(row.minWithdrawAmount);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'minExchangeAmount',
|
||||||
|
title: '最低兑换金额',
|
||||||
|
render: (row: any) => {
|
||||||
|
return Number(row.minWithdrawAmount);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'maxExchangeAmount',
|
||||||
|
title: '最高兑换金额',
|
||||||
|
render: (row: any) => {
|
||||||
|
return Number(row.minWithdrawAmount);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'isActive',
|
||||||
|
title: '是否启用',
|
||||||
|
render(row) {
|
||||||
|
return row.isActive ? h(NTag, { type: 'primary' }, '是') : h(NTag, { type: 'error' }, '否');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'allowDeposit',
|
||||||
|
title: '允许充值',
|
||||||
|
render(row) {
|
||||||
|
return row.allowDeposit ? h(NTag, { type: 'primary' }, '是') : h(NTag, { type: 'error' }, '否');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'allowExchange',
|
||||||
|
title: '允许兑换',
|
||||||
|
render(row) {
|
||||||
|
return row.allowExchange ? h(NTag, { type: 'primary' }, '是') : h(NTag, { type: 'error' }, '否');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'allowReceiveExchange',
|
||||||
|
title: '允许接收兑换',
|
||||||
|
render(row) {
|
||||||
|
return row.allowReceiveExchange ? h(NTag, { type: 'primary' }, '是') : h(NTag, { type: 'error' }, '否');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'allowTransaction',
|
||||||
|
title: '允许交易',
|
||||||
|
render(row) {
|
||||||
|
return row.allowTransaction ? h(NTag, { type: 'primary' }, '是') : h(NTag, { type: 'error' }, '否');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'allowTransfer',
|
||||||
|
title: '允许转账',
|
||||||
|
render(row) {
|
||||||
|
return row.allowTransfer ? h(NTag, { type: 'primary' }, '是') : h(NTag, { type: 'error' }, '否');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'allowWithdraw',
|
||||||
|
title: '允许提现',
|
||||||
|
render(row) {
|
||||||
|
return row.allowWithdraw ? h(NTag, { type: 'primary' }, '是') : h(NTag, { type: 'error' }, '否');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'description',
|
||||||
|
title: '描述'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'exchangeRate',
|
||||||
|
title: '兑换比例',
|
||||||
|
render: (row: any) => {
|
||||||
|
return `${Number(row.exchangeRate)} : 1`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'operations',
|
||||||
|
title: '操作',
|
||||||
|
width: 150,
|
||||||
|
fixed: 'right',
|
||||||
|
operations: (row: any) => [
|
||||||
|
{
|
||||||
|
contentText: '编辑',
|
||||||
|
size: 'small',
|
||||||
|
onClick: () => {
|
||||||
|
handleEdit(row);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
contentText: '停用',
|
||||||
|
size: 'small',
|
||||||
|
type: 'warning',
|
||||||
|
ghost: true,
|
||||||
|
onClick: () => {
|
||||||
|
dialog.warning({
|
||||||
|
title: '确认停用该钱包类型?',
|
||||||
|
content: '停用后,用户将无法使用该钱包类型进行相关操作。',
|
||||||
|
positiveText: '确认',
|
||||||
|
negativeText: '取消',
|
||||||
|
onPositiveClick: async () => {
|
||||||
|
await safeClient(() => client.api.admin.wallet_types({ id: row.id }).delete());
|
||||||
|
tableInst.value?.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const filterColumns: TableFilterColumns = [
|
||||||
|
{
|
||||||
|
key: 'depth',
|
||||||
|
title: '团队层级',
|
||||||
|
component: NSelect,
|
||||||
|
componentProps: {
|
||||||
|
options: [
|
||||||
|
{ label: '一级', value: '1' },
|
||||||
|
{ label: '二级', value: '2' },
|
||||||
|
{ label: '三级', value: '3' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
function handleEdit(row: any) {
|
||||||
|
const d = dialog.create({
|
||||||
|
title: '编辑钱包类型',
|
||||||
|
showIcon: false,
|
||||||
|
style: { width: '1000px' },
|
||||||
|
content: () =>
|
||||||
|
h(Edit, {
|
||||||
|
data: row,
|
||||||
|
onClose: () => {
|
||||||
|
d.destroy();
|
||||||
|
tableInst.value?.reload();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<TableBase
|
||||||
|
ref="tableInst"
|
||||||
|
:fetch-data="fetchData"
|
||||||
|
:columns="columns"
|
||||||
|
:filter-columns="filterColumns"
|
||||||
|
:scroll-x="2300"
|
||||||
|
:show-header-operation="false"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="css" scoped></style>
|
||||||
Reference in New Issue
Block a user