feat:【antd】【ele】【pay 支付】pay/wallet/package 迁移 antd、ele 版本

This commit is contained in:
YunaiV
2025-10-06 17:41:59 +08:00
parent b2de0e2a29
commit 4f2ffc58f7
9 changed files with 150 additions and 94 deletions

View File

@@ -1,50 +1,66 @@
import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import { DICT_TYPE } from '@vben/constants';
import { CommonStatusEnum, DICT_TYPE } from '@vben/constants';
import { getDictOptions } from '@vben/hooks';
import { z } from '#/adapter/form';
import { getRangePickerDefaultProps } from '#/utils';
/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
return [
{
fieldName: 'id',
component: 'Input',
dependencies: {
triggerFields: [''],
show: () => false,
},
},
{
fieldName: 'name',
label: '套餐名',
label: '套餐名',
component: 'Input',
rules: 'required',
componentProps: {
placeholder: '请输入套餐名称',
},
},
{
fieldName: 'payPrice',
label: '支付金额(元)',
component: 'InputNumber',
rules: 'required',
rules: z.number().min(0, '支付金额不能小于0'),
componentProps: {
min: 0,
precision: 2,
step: 0.01,
placeholder: '请输入支付金额',
},
},
{
fieldName: 'bonusPrice',
label: '赠送金额(元)',
component: 'InputNumber',
rules: 'required',
rules: z.number().min(0, '赠送金额不能小于0'),
componentProps: {
min: 0,
precision: 2,
step: 0.01,
placeholder: '请输入赠送金额',
},
},
{
fieldName: 'status',
label: '开启状态',
component: 'RadioGroup',
rules: 'required',
componentProps: {
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
buttonStyle: 'solid',
optionType: 'button',
},
rules: z.number().default(CommonStatusEnum.ENABLE),
},
];
}
@@ -56,14 +72,19 @@ export function useGridFormSchema(): VbenFormSchema[] {
fieldName: 'name',
label: '套餐名称',
component: 'Input',
componentProps: {
placeholder: '请输入套餐名称',
clearable: true,
},
},
{
fieldName: 'status',
label: '状态',
component: 'Select',
componentProps: {
clearable: true,
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
placeholder: '请选择状态',
clearable: true,
},
},
{
@@ -71,8 +92,8 @@ export function useGridFormSchema(): VbenFormSchema[] {
label: '创建时间',
component: 'RangePicker',
componentProps: {
clearable: true,
...getRangePickerDefaultProps(),
clearable: true,
},
},
];
@@ -83,25 +104,30 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
return [
{
field: 'id',
title: '编号',
title: '套餐编号',
minWidth: 100,
},
{
field: 'name',
title: '套餐名称',
minWidth: 150,
},
{
field: 'payPrice',
title: '支付金额',
minWidth: 120,
formatter: 'formatFenToYuanAmount',
},
{
field: 'bonusPrice',
title: '赠送金额',
minWidth: 120,
formatter: 'formatFenToYuanAmount',
},
{
field: 'status',
title: '状态',
minWidth: 100,
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS },
@@ -110,11 +136,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] {
{
field: 'createTime',
title: '创建时间',
minWidth: 180,
formatter: 'formatDateTime',
},
{
title: '操作',
width: 130,
width: 160,
fixed: 'right',
slots: { default: 'actions' },
},