feat:【antd】【member 会员】完成 point-form 的迁移与 bugfix
This commit is contained in:
@@ -466,14 +466,16 @@ export function usePointFormSchema(): VbenFormSchema[] {
|
||||
precision: 0,
|
||||
placeholder: '请输入变动积分',
|
||||
},
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
fieldName: 'pointResult',
|
||||
label: '变动后积分',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '',
|
||||
},
|
||||
dependencies: {
|
||||
triggerFields: ['changePoint', 'changeType'],
|
||||
triggerFields: ['point', 'changePoint', 'changeType'],
|
||||
disabled: true,
|
||||
trigger(values, form) {
|
||||
form.setFieldValue(
|
||||
|
||||
@@ -40,10 +40,14 @@ const [Modal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data =
|
||||
(await formApi.getValues()) as MemberUserApi.UserLevelUpdateReqVO;
|
||||
const data = (await formApi.getValues()) as any;
|
||||
try {
|
||||
await updateUserLevel(data);
|
||||
// 按照Vue3版本的API调用方式
|
||||
await updateUserLevel({
|
||||
id: data.id,
|
||||
levelId: data.levelId,
|
||||
reason: data.reason,
|
||||
});
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
<script lang="ts" setup>
|
||||
import type { MemberUserApi } from '#/api/member/user';
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { getUser, updateUser } from '#/api/member/user';
|
||||
import { getUser, updateUserPoint } from '#/api/member/user';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { usePointFormSchema } from '../data';
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const formData = ref<MemberUserApi.User>();
|
||||
const getTitle = computed(() => {
|
||||
return $t('ui.actionTitle.edit', ['用户积分']);
|
||||
});
|
||||
|
||||
const [Form, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
@@ -37,9 +40,12 @@ const [Modal, modalApi] = useVbenModal({
|
||||
}
|
||||
modalApi.lock();
|
||||
// 提交表单
|
||||
const data = (await formApi.getValues()) as MemberUserApi.User;
|
||||
const data = await formApi.getValues();
|
||||
try {
|
||||
await updateUser(data);
|
||||
await updateUserPoint({
|
||||
id: data.id,
|
||||
point: data.changePoint * data.changeType,
|
||||
});
|
||||
// 关闭并提示
|
||||
await modalApi.close();
|
||||
emit('success');
|
||||
@@ -71,7 +77,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Modal class="w-1/3" :title="$t('ui.actionTitle.edit', ['用户积分'])">
|
||||
<Modal :title="getTitle" class="w-1/2">
|
||||
<Form class="mx-4" />
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user