Commit 3a525ab7 authored by XieZhiXiong's avatar XieZhiXiong

chore: 删除适用会员用户字段(UI需求)

parent 91674da4
...@@ -57,10 +57,6 @@ const ApplicableMember: React.FC<IProps> = (props) => { ...@@ -57,10 +57,6 @@ const ApplicableMember: React.FC<IProps> = (props) => {
const showApplicationMemberLevel = true; const showApplicationMemberLevel = true;
let applicationUserRoleOptions = applicableMember?.applicationMemberLevel?.map((item) => ({ label: item.roleName, value: item.id }));
// 去重
applicationUserRoleOptions = applicationUserRoleOptions?.filter((item, index) => applicationUserRoleOptions.findIndex(item2 => item2.label === item.label) === index);
return ( return (
<MellowCard <MellowCard
title="适用用户" title="适用用户"
...@@ -91,16 +87,6 @@ const ApplicableMember: React.FC<IProps> = (props) => { ...@@ -91,16 +87,6 @@ const ApplicableMember: React.FC<IProps> = (props) => {
<> <>
<Field <Field
type="string" type="string"
enum={applicationUserRoleOptions}
title="适用用户角色"
name="applicationUserRole"
x-component="TofuCheckGroup"
x-component-props={{
ediabled: false,
}}
/>
<Field
type="string"
enum={applicableMember?.applicationMemberLevel?.map((item) => ({ ...item, value: item.id }))} enum={applicableMember?.applicationMemberLevel?.map((item) => ({ ...item, value: item.id }))}
name="applicationMemberLevel" name="applicationMemberLevel"
x-component="MemberCheckboxGroup" x-component="MemberCheckboxGroup"
......
...@@ -48,31 +48,6 @@ const fetchCouponGetWay = async () => { ...@@ -48,31 +48,6 @@ const fetchCouponGetWay = async () => {
}; };
}; };
// 初始化 适用用户角色
const fetchApplicationUserRole = async () => {
const res = await PublicApi.getMemberManageMarketingSuitableLevelConfigPageItems();
const allItem = {
label: '全部',
value: 0,
};
if (res.code === 1000) {
const { data = [] } = res;
const options = [
allItem,
...(data.map(item => ({ label: item.roleName, value: item.roleId })))
];
return {
applicationUserRole: options,
};
}
return {
data: [],
totalCount: 0,
};
};
// 初始化 适用用户 // 初始化 适用用户
const fetchSuitableUser = async () => { const fetchSuitableUser = async () => {
const res = await PublicApi.getMarketingCouponSuitableMemberTypeList(); const res = await PublicApi.getMarketingCouponSuitableMemberTypeList();
...@@ -121,8 +96,6 @@ export const createEffects = (context, actions) => { ...@@ -121,8 +96,6 @@ export const createEffects = (context, actions) => {
useAsyncInitSelect(['getWay'], fetchCouponGetWay); useAsyncInitSelect(['getWay'], fetchCouponGetWay);
useAsyncInitSelect(['applicationUserRole'], fetchApplicationUserRole);
useAsyncInitSelect(['suitableMemberTypes'], fetchSuitableUser); useAsyncInitSelect(['suitableMemberTypes'], fetchSuitableUser);
// 初始化 品牌数据 // 初始化 品牌数据
......
...@@ -221,37 +221,15 @@ export const useBusinessEffects = (context, actions: IFormActions) => { ...@@ -221,37 +221,15 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
}); });
}); });
// 适用用户角色
onFieldInputChange$('applicationUserRole').subscribe(state => {
const { value } = state;
let filtered = [...value];
// 这里处理一下全部,当点击了 全部 把 0 去掉,否则插入一个 0
if (value.includes(0)) {
filtered = (value || []).filter((item) => item !== 0); // 过滤掉 0全选元素
} else {
filtered.unshift(0);
}
setFieldState('applicationMemberLevel', fieldState => {
FormPath.setIn(fieldState, 'props.x-component-props', Object.assign({}, fieldState.props['x-component-props'], {
extraParams: {
roleIds: filtered.join(','),
levelConfigIds: '',
},
}));
});
});
// 适用用户 // 适用用户
onFieldValueChange$('suitableMemberTypes').subscribe(state => { onFieldValueChange$('suitableMemberTypes').subscribe(state => {
const { value } = state; const { value } = state;
// 包含新会员(仅会员用户) 或者 老会员(仅会员用户),展示 适用用户角色 与 会员等级列表 // 包含新会员(仅会员用户) 或者 老会员(仅会员用户),展示 会员等级列表
if (value && (value.includes(SUITABLE_TYPE_NEW_MEMBER) || value.includes(SUITABLE_TYPE_OLD_MEMBER))) { if (value && (value.includes(SUITABLE_TYPE_NEW_MEMBER) || value.includes(SUITABLE_TYPE_OLD_MEMBER))) {
linkage.show('*(applicationUserRole,applicationMemberLevel)'); linkage.show('*(applicationMemberLevel)');
} else { } else {
linkage.hide('*(applicationUserRole,applicationMemberLevel)'); linkage.hide('*(applicationMemberLevel)');
} }
}); });
......
...@@ -127,10 +127,6 @@ export type SubmitValueType = { ...@@ -127,10 +127,6 @@ export type SubmitValueType = {
*/ */
suitableMemberTypes: number[], suitableMemberTypes: number[],
/** /**
* 适用用户角色
*/
applicationUserRole: any[],
/**
* 适用会员等级 * 适用会员等级
*/ */
applicationMemberLevel: number[], applicationMemberLevel: number[],
...@@ -200,15 +196,11 @@ const CouponForm: React.FC<IProps> = (props) => { ...@@ -200,15 +196,11 @@ const CouponForm: React.FC<IProps> = (props) => {
history, history,
...rest ...rest
} = res.data; } = res.data;
let applicationUserRole = suitableMemberLevelTypes?.map((item) => item.roleId) || [];
// 去重
applicationUserRole = applicationUserRole?.filter((item, index) => applicationUserRole.findIndex(item2 => item2 === item) === index);
setCouponInfo({ setCouponInfo({
goodsList: suitableCommoditySkuList as any, goodsList: suitableCommoditySkuList as any,
applicableCategories: (suitableCategoryList as any)?.map((item) => ({ category: item.map((category) => `${category.id}`)})), applicableCategories: (suitableCategoryList as any)?.map((item) => ({ category: item.map((category) => `${category.id}`)})),
applicableBrands: suitableBrandList?.map((item) => ({ brand: item.id })), applicableBrands: suitableBrandList?.map((item) => ({ brand: item.id })),
applicationUserRole,
applicationMemberLevel: suitableMemberLevelTypes?.map((item) => item.id), applicationMemberLevel: suitableMemberLevelTypes?.map((item) => item.id),
suitableMemberTypes: suitableMemberTypes?.map((item) => item.value), suitableMemberTypes: suitableMemberTypes?.map((item) => item.value),
suitableMallTypes: suitableMallTypes?.map((item) => item.id), suitableMallTypes: suitableMallTypes?.map((item) => item.id),
...@@ -303,7 +295,6 @@ const CouponForm: React.FC<IProps> = (props) => { ...@@ -303,7 +295,6 @@ const CouponForm: React.FC<IProps> = (props) => {
applicableBrands, applicableBrands,
applicableCategories, applicableCategories,
applicationMemberLevel, applicationMemberLevel,
applicationUserRole,
releaseTimeStart, releaseTimeStart,
releaseTimeEnd, releaseTimeEnd,
effectiveTimeStart, effectiveTimeStart,
......
...@@ -512,15 +512,6 @@ const schema: ISchema = { ...@@ -512,15 +512,6 @@ const schema: ISchema = {
'x-component-props': { 'x-component-props': {
}, },
}, },
applicationUserRole: {
title: '适用用户角色',
type: 'string',
enum: [],
default: [0],
'x-component': 'TofuCheckGroup',
'x-component-props': {
},
},
applicationMemberLevel: { applicationMemberLevel: {
type: 'string', type: 'string',
required: true, required: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment