Commit 3ad1e9fc authored by XieZhiXiong's avatar XieZhiXiong

chore: 修改接口

parent 3c4579a3
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 14:03:34
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-28 14:58:01
* @LastEditTime: 2021-08-03 11:26:22
* @Description:
*/
import { FormPath, FormEffectHooks } from '@formily/antd';
......@@ -49,7 +49,7 @@ const fetchCouponGetWay = async () => {
// 初始化 适用用户角色
const fetchApplicationUserRole = async () => {
const res = await PublicApi.getMemberAbilityLevelRoleList();
const res = await PublicApi.getMemberManageMarketingSuitableLevelConfigPageItems();
const allItem = {
label: '全部',
......@@ -89,8 +89,8 @@ const fetchSuitableUser = async () => {
};
// 获取 实用会员选项
const fetchMemberOtions: (params: { current: string, pageSize: string, levelConfigIds: string, roleIds: string }) => Promise<ResponseType> = async (params) => {
const res = await PublicApi.getMemberAbilityLevelTagPage(params);
const fetchMemberOptions: (params: { current: string, pageSize: string, levelConfigIds: string, roleIds: string }) => Promise<ResponseType> = async (params) => {
const res = await PublicApi.getMemberManageMarketingSuitableLevelConfigPage(params);
if (res.code === 1000) {
const options = res.data.data.map(item => ({
label: item.roleName,
......@@ -165,7 +165,7 @@ export const createEffects = (context, actions) => {
setFieldState('applicationMemberLevel', state => {
FormPath.setIn(state, 'props.x-component-props', {
showMoreAction: true,
fetchOptions: fetchMemberOtions,
fetchOptions: fetchMemberOptions,
});
});
});
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-24 13:47:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-08-02 17:58:54
* @LastEditTime: 2021-08-03 11:42:36
* @Description: 新增/修改 优惠券表单
*/
import React, { useState, useMemo, useEffect } from 'react';
......@@ -182,6 +182,7 @@ const CouponForm: React.FC<IProps> = (props) => {
suitableBrandList,
suitableMallTypes,
suitableMemberLevelTypes,
suitableMemberTypes,
denomination,
quantity,
releaseTimeStart,
......@@ -197,12 +198,17 @@ 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: [],
applicationUserRole,
applicationMemberLevel: suitableMemberLevelTypes?.map((item) => item.id),
suitableMemberTypes: suitableMemberTypes?.map((item) => item.value),
suitableMallTypes: suitableMallTypes?.map((item) => item.id),
denomination: `${denomination}`,
quantity: `${quantity}`,
......@@ -213,8 +219,8 @@ const CouponForm: React.FC<IProps> = (props) => {
invalidDay: invalidDay !== null ? `${invalidDay}` : undefined,
useConditionMoney: `${useConditionMoney}`,
receiveCondition: {
conditionGetTotal: `${conditionGetTotal}`,
conditionGetDay: `${conditionGetDay}`,
conditionGetTotal: conditionGetTotal ? `${conditionGetTotal}` : undefined,
conditionGetDay: conditionGetDay ? `${conditionGetDay}` : undefined,
},
...rest,
});
......
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