feat:【ele】【pay 支付】pay/app 代码优化 4/4(对齐 ele 和 antd)
This commit is contained in:
@@ -254,29 +254,61 @@ export function useAppFormSchema(): VbenFormSchema[] {
|
||||
];
|
||||
}
|
||||
|
||||
/** 渠道新增/修改的表单 */
|
||||
export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
const schema: VbenFormSchema[] = [];
|
||||
// 添加通用字段
|
||||
schema.push(
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'id',
|
||||
dependencies: {
|
||||
triggerFields: [''],
|
||||
show: () => false,
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '应用编号',
|
||||
fieldName: 'appId',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '渠道编码',
|
||||
fieldName: 'code',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '渠道费率',
|
||||
fieldName: 'feeRate',
|
||||
component: 'InputNumber',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
placeholder: '请输入渠道费率',
|
||||
addonAfter: '%',
|
||||
},
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
label: '渠道状态',
|
||||
fieldName: 'status',
|
||||
component: 'RadioGroup',
|
||||
rules: z.number().default(CommonStatusEnum.ENABLE),
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
},
|
||||
},
|
||||
);
|
||||
// 根据类型添加特定字段
|
||||
if (formType.includes('alipay_')) {
|
||||
return [
|
||||
{
|
||||
label: '应用编号',
|
||||
fieldName: 'appId',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '渠道费率',
|
||||
fieldName: 'feeRate',
|
||||
component: 'InputNumber',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
placeholder: '请输入渠道费率',
|
||||
addonAfter: '%',
|
||||
},
|
||||
defaultValue: 0,
|
||||
},
|
||||
schema.push(
|
||||
{
|
||||
label: '开放平台 APPID',
|
||||
fieldName: 'config.appId',
|
||||
@@ -286,16 +318,6 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
placeholder: '请输入开放平台 APPID',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '渠道状态',
|
||||
fieldName: 'status',
|
||||
component: 'RadioGroup',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
},
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
label: '网关地址',
|
||||
fieldName: 'config.serverUrl',
|
||||
@@ -367,7 +389,7 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
rows: 3,
|
||||
},
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.mode === 1;
|
||||
},
|
||||
triggerFields: ['config.mode', 'mode', 'config'],
|
||||
@@ -385,7 +407,7 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
}),
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.mode === 2;
|
||||
},
|
||||
triggerFields: ['config.mode', 'mode', 'config'],
|
||||
@@ -403,7 +425,7 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
}),
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.mode === 2;
|
||||
},
|
||||
triggerFields: ['config.mode', 'mode', 'config'],
|
||||
@@ -421,7 +443,7 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
}),
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.mode === 2;
|
||||
},
|
||||
triggerFields: ['config.mode', 'mode', 'config'],
|
||||
@@ -452,106 +474,15 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.encryptType === 'AES';
|
||||
},
|
||||
triggerFields: ['config.encryptType', 'encryptType', 'config'],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
fieldName: 'remark',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
},
|
||||
},
|
||||
];
|
||||
} else if (formType.includes('mock') || formType.includes('wallet')) {
|
||||
return [
|
||||
{
|
||||
label: '应用编号',
|
||||
fieldName: 'appId',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '渠道状态',
|
||||
fieldName: 'status',
|
||||
component: 'RadioGroup',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
},
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
label: '渠道编码',
|
||||
fieldName: 'code',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '渠道费率',
|
||||
fieldName: 'feeRate',
|
||||
component: 'InputNumber',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
placeholder: '请输入渠道费率',
|
||||
addonAfter: '%',
|
||||
},
|
||||
defaultValue: 0,
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
fieldName: 'remark',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
},
|
||||
},
|
||||
];
|
||||
} else if (formType.includes('wx')) {
|
||||
return [
|
||||
{
|
||||
label: '应用编号',
|
||||
fieldName: 'appId',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '渠道编码',
|
||||
fieldName: 'code',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '渠道费率',
|
||||
fieldName: 'feeRate',
|
||||
component: 'InputNumber',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
placeholder: '请输入渠道费率',
|
||||
addonAfter: '%',
|
||||
},
|
||||
defaultValue: 0,
|
||||
},
|
||||
);
|
||||
} else if (formType.includes('wx_')) {
|
||||
schema.push(
|
||||
{
|
||||
label: '微信 APPID',
|
||||
fieldName: 'config.appId',
|
||||
@@ -572,16 +503,6 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
placeholder: '请输入商户号',
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '渠道状态',
|
||||
fieldName: 'status',
|
||||
component: 'RadioGroup',
|
||||
rules: 'required',
|
||||
componentProps: {
|
||||
options: getDictOptions(DICT_TYPE.COMMON_STATUS, 'number'),
|
||||
},
|
||||
defaultValue: 0,
|
||||
},
|
||||
{
|
||||
label: 'API 版本',
|
||||
fieldName: 'config.apiVersion',
|
||||
@@ -609,7 +530,7 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
placeholder: '请输入商户密钥',
|
||||
},
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.apiVersion === 'v2';
|
||||
},
|
||||
triggerFields: ['config.mode', 'mode', 'config'],
|
||||
@@ -630,7 +551,7 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
}),
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.apiVersion === 'v2';
|
||||
},
|
||||
triggerFields: ['config.mode', 'mode', 'config'],
|
||||
@@ -645,7 +566,7 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
placeholder: '请输入 API V3 密钥',
|
||||
},
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.apiVersion === 'v3';
|
||||
},
|
||||
triggerFields: ['config.mode', 'mode', 'config'],
|
||||
@@ -666,7 +587,7 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
}),
|
||||
rules: 'required',
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.apiVersion === 'v3';
|
||||
},
|
||||
triggerFields: ['config.mode', 'mode', 'config'],
|
||||
@@ -682,7 +603,7 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
placeholder: '请输入证书序列号',
|
||||
},
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.apiVersion === 'v3';
|
||||
},
|
||||
triggerFields: ['config.mode', 'mode', 'config'],
|
||||
@@ -702,7 +623,7 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
},
|
||||
}),
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.apiVersion === 'v3';
|
||||
},
|
||||
triggerFields: ['config.mode', 'mode', 'config'],
|
||||
@@ -718,22 +639,22 @@ export function useChannelFormSchema(formType: string = ''): VbenFormSchema[] {
|
||||
placeholder: '请输入公钥 ID',
|
||||
},
|
||||
dependencies: {
|
||||
show(values) {
|
||||
show(values: any) {
|
||||
return values?.config?.apiVersion === 'v3';
|
||||
},
|
||||
triggerFields: ['config.mode', 'mode', 'config'],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
fieldName: 'remark',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
},
|
||||
},
|
||||
];
|
||||
} else {
|
||||
return [];
|
||||
);
|
||||
}
|
||||
// 添加备注字段(所有类型都有)
|
||||
schema.push({
|
||||
label: '备注',
|
||||
fieldName: 'remark',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入备注',
|
||||
},
|
||||
});
|
||||
return schema;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user