Commit b378995c authored by XieZhiXiong's avatar XieZhiXiong

feat: 对接适用用户接口

parent d52e5b78
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:03:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-08 16:35:58
* @LastEditTime: 2021-07-28 14:58:01
* @Description:
*/
import { FormPath, FormEffectHooks } from '@formily/antd';
......@@ -25,7 +25,10 @@ const fetchCouponTypes = async () => {
type: data.map(item => ({ label: item.name, value: item.value })),
};
}
return {};
return {
data: [],
totalCount: 0,
};
};
// 初始化 领券方式
......@@ -38,7 +41,10 @@ const fetchCouponGetWay = async () => {
getWay: data.map(item => ({ label: item.name, value: item.value })),
};
}
return {};
return {
data: [],
totalCount: 0,
};
};
// 初始化 适用用户角色
......@@ -60,7 +66,26 @@ const fetchApplicationUserRole = async () => {
applicationUserRole: options,
};
}
return {};
return {
data: [],
totalCount: 0,
};
};
// 初始化 适用用户
const fetchSuitableUser = async () => {
const res = await PublicApi.getMarketingCouponSuitableMemberTypeList();
if (res.code === 1000) {
const { data = [] } = res;
return {
suitableMemberTypes: data.map(item => ({ label: item.name, value: item.value })),
};
}
return {
data: [],
totalCount: 0,
};
};
// 获取 实用会员选项
......@@ -80,6 +105,10 @@ const fetchMemberOtions: (params: { current: string, pageSize: string, levelConf
totalCount: res.data.totalCount,
};
}
return {
data: [],
totalCount: 0,
};
};
export const createEffects = (context, actions) => {
......@@ -93,6 +122,8 @@ export const createEffects = (context, actions) => {
useAsyncInitSelect(['applicationUserRole'], fetchApplicationUserRole);
useAsyncInitSelect(['suitableMemberTypes'], fetchSuitableUser);
// 初始化 品牌数据
onFieldMount$('applicableBrands').subscribe(() => {
PublicApi.getProductSelectGetSelectBrand().then((res) => {
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:04:16
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-23 17:36:48
* @LastEditTime: 2021-07-28 14:33:19
* @Description:
*/
import { FormEffectHooks, FormPath, IFormActions } from '@formily/antd';
......@@ -16,6 +16,10 @@ import {
MERCHANT_COUPON_RECEIVE_DESIGNATED,
MERCHANT_COUPON_RECEIVE_ACTIVITY,
MERCHANT_COUPON_RECEIVE_OPERATE,
SUITABLE_TYPE_NEW_USER,
SUITABLE_TYPE_OLD_USER,
SUITABLE_TYPE_NEW_MEMBER,
SUITABLE_TYPE_OLD_MEMBER,
} from '@/constants/marketing';
const {
......@@ -31,8 +35,6 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
// 优惠券类型
onFieldInputChange$('type').subscribe(state => {
const { value } = state;
const denominationValue = getFieldValue('denomination'); // 券面额
const useConditionMoneyValue = getFieldValue('useConditionMoney'); // 使用条件
// 0元抵扣券
if (value === MERCHANT_COUPON_TYPE_VOUCHER) {
......@@ -192,8 +194,8 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
value === MERCHANT_COUPON_RECEIVE_DESIGNATED
|| value === MERCHANT_COUPON_RECEIVE_OPERATE
) && (
newItem.value === 1
|| newItem.value === 2
newItem.value === SUITABLE_TYPE_NEW_USER
|| newItem.value === SUITABLE_TYPE_OLD_USER
)
) {
newItem.disabled = true;
......@@ -233,7 +235,7 @@ export const useBusinessEffects = (context, actions: IFormActions) => {
const { value } = state;
// 包含新会员(仅会员用户) 或者 老会员(仅会员用户),展示 适用用户角色 与 会员等级列表
if (value && (value.includes(3) || value.includes(4))) {
if (value && (value.includes(SUITABLE_TYPE_NEW_MEMBER) || value.includes(SUITABLE_TYPE_OLD_MEMBER))) {
linkage.show('*(applicationUserRole,applicationMemberLevel)');
} else {
linkage.hide('*(applicationUserRole,applicationMemberLevel)');
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:05:57
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-19 17:20:56
* @LastEditTime: 2021-07-28 14:38:37
* @Description:
*/
import { ISchema } from '@formily/antd';
......@@ -441,28 +441,7 @@ const schema: ISchema = {
suitableMemberTypes: {
title: '适用用户',
type: 'string',
enum: [
{
label: '新用户(不包含会员)',
value: 1,
disabled: false,
},
{
label: '老用户(不包含会员)',
value: 2,
disabled: false,
},
{
label: '新会员(仅会员用户)',
value: 3,
disabled: false,
},
{
label: '老会员(仅会员用户)',
value: 4,
disabled: false,
},
],
enum: [],
default: [],
required: true,
'x-component': 'TofuCheckGroup',
......
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