Commit 3a525ab7 authored by XieZhiXiong's avatar XieZhiXiong

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

parent 91674da4
......@@ -57,10 +57,6 @@ const ApplicableMember: React.FC<IProps> = (props) => {
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 (
<MellowCard
title="适用用户"
......@@ -91,16 +87,6 @@ const ApplicableMember: React.FC<IProps> = (props) => {
<>
<Field
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 }))}
name="applicationMemberLevel"
x-component="MemberCheckboxGroup"
......
......@@ -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 res = await PublicApi.getMarketingCouponSuitableMemberTypeList();
......@@ -121,8 +96,6 @@ export const createEffects = (context, actions) => {
useAsyncInitSelect(['getWay'], fetchCouponGetWay);
useAsyncInitSelect(['applicationUserRole'], fetchApplicationUserRole);
useAsyncInitSelect(['suitableMemberTypes'], fetchSuitableUser);
// 初始化 品牌数据
......
......@@ -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 => {
const { value } = state;
// 包含新会员(仅会员用户) 或者 老会员(仅会员用户),展示 适用用户角色 与 会员等级列表
// 包含新会员(仅会员用户) 或者 老会员(仅会员用户),展示 会员等级列表
if (value && (value.includes(SUITABLE_TYPE_NEW_MEMBER) || value.includes(SUITABLE_TYPE_OLD_MEMBER))) {
linkage.show('*(applicationUserRole,applicationMemberLevel)');
linkage.show('*(applicationMemberLevel)');
} else {
linkage.hide('*(applicationUserRole,applicationMemberLevel)');
linkage.hide('*(applicationMemberLevel)');
}
});
......
......@@ -127,10 +127,6 @@ export type SubmitValueType = {
*/
suitableMemberTypes: number[],
/**
* 适用用户角色
*/
applicationUserRole: any[],
/**
* 适用会员等级
*/
applicationMemberLevel: number[],
......@@ -200,15 +196,11 @@ const CouponForm: React.FC<IProps> = (props) => {
history,
...rest
} = res.data;
let applicationUserRole = suitableMemberLevelTypes?.map((item) => item.roleId) || [];
// 去重
applicationUserRole = applicationUserRole?.filter((item, index) => applicationUserRole.findIndex(item2 => item2 === item) === index);
setCouponInfo({
goodsList: suitableCommoditySkuList as any,
applicableCategories: (suitableCategoryList as any)?.map((item) => ({ category: item.map((category) => `${category.id}`)})),
applicableBrands: suitableBrandList?.map((item) => ({ brand: item.id })),
applicationUserRole,
applicationMemberLevel: suitableMemberLevelTypes?.map((item) => item.id),
suitableMemberTypes: suitableMemberTypes?.map((item) => item.value),
suitableMallTypes: suitableMallTypes?.map((item) => item.id),
......@@ -303,7 +295,6 @@ const CouponForm: React.FC<IProps> = (props) => {
applicableBrands,
applicableCategories,
applicationMemberLevel,
applicationUserRole,
releaseTimeStart,
releaseTimeEnd,
effectiveTimeStart,
......
......@@ -512,15 +512,6 @@ const schema: ISchema = {
'x-component-props': {
},
},
applicationUserRole: {
title: '适用用户角色',
type: 'string',
enum: [],
default: [0],
'x-component': 'TofuCheckGroup',
'x-component-props': {
},
},
applicationMemberLevel: {
type: 'string',
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