Commit 7fe7abf4 authored by XieZhiXiong's avatar XieZhiXiong

chore: 添加 catch

parent dda7b95b
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-10 14:27:37
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-10 16:00:07
* @LastEditTime: 2021-07-30 10:24:06
* @Description: 区域选择
*/
import React, { useState, useEffect } from 'react';
......@@ -53,7 +53,7 @@ const AreaSelect = (props) => {
setProvinceLoading(true);
const res = await PublicApi.getMemberAreaProvince();
if (res.code === 1000) {
setProvinceList(res.data.map((item) => ({ label: item.name, value: item.code })));
setProvinceList(res.data?.map((item) => ({ label: item.name, value: item.code })));
}
setProvinceLoading(false);
};
......@@ -65,7 +65,7 @@ const AreaSelect = (props) => {
setCityLoading(true);
const res = await PublicApi.getMemberAreaCity({ code });
if (res.code === 1000) {
setCityList(res.data.map((item) => ({ label: item.name, value: item.code })));
setCityList(res.data?.map((item) => ({ label: item.name, value: item.code })));
}
setCityLoading(false);
};
......@@ -77,7 +77,7 @@ const AreaSelect = (props) => {
setDistrictLoading(true);
const res = await PublicApi.getMemberAreaDistrict({ code });
if (res.code === 1000) {
setDistrictList(res.data.map((item) => ({ label: item.name, value: item.code })));
setDistrictList(res.data?.map((item) => ({ label: item.name, value: item.code })));
}
setDistrictLoading(false);
};
......
......@@ -49,7 +49,7 @@ export type ChannelInfoProps = MellowCardProps & {
const MemberChannelInfo: React.FC<ChannelInfoProps> = (props: ChannelInfoProps) => {
const { dataSource, validateId, onModifyAfter, ...rest } = props;
const [visibleDrawer, setVisibleDrawer] = useState(false);
const [channelInfo, setChannerlInfo] = useState<GetMemberAbilityMaintenanceDetailBasicChannelResponse>();
const [channelInfo, setChannelInfo] = useState<GetMemberAbilityMaintenanceDetailBasicChannelResponse>();
const [infoLoading, setInfoLoading] = useState(false);
const [submitLoading, setSubmitLoading] = useState(false);
......@@ -66,9 +66,11 @@ const MemberChannelInfo: React.FC<ChannelInfoProps> = (props: ChannelInfoProps)
validateId,
}).then(res => {
if (res.code === 1000) {
setChannerlInfo(res.data);
setChannelInfo(res.data);
handleVisibleDrawer(true);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -199,6 +199,8 @@ const MemberChannelInfoForm: React.ForwardRefRenderFunction<ChannelRefHandle, IP
FormPath.setIn(state, 'props.enum', options);
});
}
}).catch((err) => {
console.warn(err);
});
});
......@@ -241,6 +243,8 @@ const MemberChannelInfoForm: React.ForwardRefRenderFunction<ChannelRefHandle, IP
}
);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
formActions.setFieldState(
FormPath.transform(fieldState.name, /\d/, $1 => `areaCodes.${$1}.cityCode`),
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-05-21 16:10:47
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-07-09 15:50:58
* @LastEditTime: 2021-07-30 10:28:19
* @Description: 会员分类信息
*/
import React, { useState } from 'react';
......@@ -101,23 +101,25 @@ const MemberDocCategory: React.FC<DocCategoryProps> = (props: DocCategoryProps)
}).then(res => {
if (res.code === 1000) {
setClassifyInfo({
code: res.data.code,
partnerType: res.data.partnerType,
maxAmount: res.data.maxAmount,
areaCodes: res.data.areaCodes,
categories: res.data.categories.map(({ names, paymentDay, taxPoint, ...rest }) => ({
code: res.data?.code,
partnerType: res.data?.partnerType,
maxAmount: res.data?.maxAmount,
areaCodes: res.data?.areaCodes,
categories: res.data?.categories.map(({ names, paymentDay, taxPoint, ...rest }) => ({
category: names,
paymentDay: `${paymentDay}`,
taxPoint: +taxPoint,
...rest
})),
});
setPartnerTypes(res.data.partnerTypes.map((item) => ({
setPartnerTypes(res.data?.partnerTypes.map((item) => ({
value: item.id,
label: item.text,
})));
handleVisibleDrawer(true);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......@@ -141,6 +143,8 @@ const MemberDocCategory: React.FC<DocCategoryProps> = (props: DocCategoryProps)
}
handleVisibleDrawer(false);
onModifyAfter?.();
}).catch((err) => {
console.warn(err);
}).finally(() => {
msg();
setSubmitLoading(false);
......
......@@ -22,8 +22,8 @@ import styles from './index.less';
const PAGE_SIZE = 5;
export interface EstimateSumItems {
id: number,
title: JSX.Element,
id?: number,
title?: JSX.Element,
star?: number,
last7days?: number,
last30days?: number,
......@@ -38,13 +38,13 @@ export interface FetchParams {
};
export interface ListItem {
id: number;
id?: number;
createTime: string;
star: number;
comment: string;
product: string;
byMemberName: string;
remark: string;
remark?: string;
};
interface IProps extends MellowCardProps {
......
......@@ -29,7 +29,7 @@ export interface ReceivedData {
/**
* 获取的数量(返现金额、积分)
*/
point: number
point: string
/**
* 备注
*/
......
......@@ -211,6 +211,8 @@ const VerifyComingDataDrawer: React.FC<IProps> = (props: IProps) => {
FormPath.setIn(state, 'props.enum', options);
});
}
}).catch((err) => {
console.warn(err);
});
});
......@@ -253,6 +255,8 @@ const VerifyComingDataDrawer: React.FC<IProps> = (props: IProps) => {
}
);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
formActions.setFieldState(
FormPath.transform(fieldState.name, /\d/, $1 => `areaCodes.${$1}.cityCode`),
......
......@@ -282,6 +282,8 @@ const ComingClassifyDrawer: React.FC<IProps> = (props: IProps) => {
}
);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
formActions.setFieldState(
FormPath.transform(fieldState.name, /\d/, $1 => `areaCodes.${$1}.cityCode`),
......@@ -342,6 +344,8 @@ const ComingClassifyDrawer: React.FC<IProps> = (props: IProps) => {
FormPath.setIn(state, 'props.enum', options);
});
}
}).catch((err) => {
console.warn(err);
});
// 请求会员品类数据
......@@ -352,6 +356,8 @@ const ComingClassifyDrawer: React.FC<IProps> = (props: IProps) => {
FormPath.setIn(state, 'props.x-component-props.options', data);
});
}
}).catch((err) => {
console.warn(err);
});
});
}}
......
......@@ -89,7 +89,7 @@ const ComingCtl = (props: IProps) => {
if (res.code === 1000) {
return res.data;
}
return {};
return { data: [], totalCount: 0 };
};
useEffect(() => {
......
......@@ -46,6 +46,7 @@ const fetchListData = async (params: any) => {
if (res.code === 1000) {
return res.data;
}
return { data: [], totalCount: 0 };
};
const MemberRoleFormItem = (props) => {
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-05-31 16:24:44
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-31 16:24:45
* @LastEditTime: 2021-07-30 10:51:43
* @Description:
*/
import { useBusinessEffects } from './useBusinessEffects';
......@@ -23,5 +23,7 @@ export const createEffects = (context, actions) => {
state.props['x-component-props'].dataSource = res.data.filter((item) => item.processType === 2);
});
}
}).catch((err) => {
console.warn(err);
});
};
\ No newline at end of file
......@@ -40,11 +40,22 @@ interface MemberFormProps {
isEdit?: boolean,
};
type RuleInfoType = Omit<GetMemberProcessRuleGetResponse, 'roleName' | 'businessTypeName' | 'memberTypeName' | 'roleId' | 'roleTypeName'> & {
memberRole: {
roleName: string,
businessTypeName: string,
memberTypeName: string,
roleId: number,
roleTypeName: string,
},
configIds: any[],
}
const FlowRuleForm: React.FC<MemberFormProps> = ({
id,
isEdit = false,
}) => {
const [ruleInfo, setRuleInfo] = useState<GetMemberProcessRuleGetResponse>();
const [ruleInfo, setRuleInfo] = useState<RuleInfoType>();
const [submitLoading, setSubmitLoading] = useState(false);
const [infoLoading, setInfoLoading] = useState(false);
const [unsaved, setUnsaved] = useState(false);
......@@ -69,7 +80,7 @@ const FlowRuleForm: React.FC<MemberFormProps> = ({
businessTypeName,
details,
...rest
} = res.data;
} = res.data as any;
setRuleInfo({
memberRole: {
roleName,
......@@ -97,8 +108,6 @@ const FlowRuleForm: React.FC<MemberFormProps> = ({
...rest
} = values;
console.log('values', values);
if (!id && isEdit) {
setSubmitLoading(true);
const msg = message.loading({
......
......@@ -44,7 +44,7 @@ const fetchListData = async (params: any) => {
if (res.code === 1000) {
return res.data;
}
return [];
return { data: [], totalCount: 0 };
};
const MemberFlowRule: React.FC<[]> = () => {
......
......@@ -26,11 +26,11 @@ type MemberInfoType = {
roleId: number,
level: number,
countryCodeId: number,
phone: number,
email: number,
upperRelationId: number,
channelLevel: string,
areas: {
phone: string | number,
email: string,
upperRelationId?: number,
channelLevel?: string,
areas?: {
/**
* 省编码
*/
......@@ -40,7 +40,7 @@ type MemberInfoType = {
*/
cityCode: string
}[],
remark: string,
remark?: string,
} & { [key: string]: any }
interface MemberFormProps {
......@@ -244,7 +244,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
validateMsg: null,
validateStatus: 1,
validateStatusDesc: '待审核',
});
} as any);
setUnsaved(false);
setTimeout(() => {
history.push('/memberCenter/home');
......@@ -343,6 +343,8 @@ const MemberForm: React.FC<MemberFormProps> = ({
const options = data.map(item => ({ label: item.roleName, value: item.roleId }));
linkage.enum('roleId', options);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
linkage.loaded('roleId');
});
......@@ -406,6 +408,8 @@ const MemberForm: React.FC<MemberFormProps> = ({
formActions.setFieldState('channelTypeId', state => {
FormPath.setIn(state, 'props.enum', channelType);
});
}).catch((err) => {
console.warn(err);
});
});
......@@ -422,6 +426,8 @@ const MemberForm: React.FC<MemberFormProps> = ({
const { data = [] } = res;
setMemberItems(data);
}
}).catch((err) => {
console.warn(err);
});
});
......@@ -454,6 +460,8 @@ const MemberForm: React.FC<MemberFormProps> = ({
const options = data.map(item => ({ label: item.levelTag, value: item.level }));
linkage.enum('level', options);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
linkage.loaded('level');
});
......@@ -483,6 +491,8 @@ const MemberForm: React.FC<MemberFormProps> = ({
FormPath.setIn(state, 'props.enum', options);
});
}
}).catch((err) => {
console.warn(err);
});
});
......@@ -525,6 +535,8 @@ const MemberForm: React.FC<MemberFormProps> = ({
}
);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
formActions.setFieldState(
FormPath.transform(fieldState.name, /\d/, $1 => `areas.${$1}.cityCode`),
......
......@@ -46,7 +46,7 @@ const fetchListData = async (params: any) => {
if (res.code === 1000) {
return res.data;
}
return [];
return { data: {}, totalCount: 0 };
};
const MemberMaintain: React.FC<[]> = () => {
......
......@@ -49,6 +49,8 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
setLevelInfo(res.data);
setThresholdValue(point);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -22,7 +22,7 @@ const fetchData = async (params: any) => {
if (res.code === 1000) {
return res.data;
}
return {};
return { data: [], totalCount: 0 };
};
const MemberLevel: React.FC<[]> = () => {
......
......@@ -74,6 +74,8 @@ const MemberMaintainBlack: React.FC<{}> = () => {
if (res.code === 1000) {
setMemberInfo(res.data);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoaading(false);
});
......
......@@ -74,6 +74,8 @@ const MemberMaintainCorrect: React.FC<{}> = () => {
if (res.code === 1000) {
setMemberInfo(res.data);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoaading(false);
});
......
......@@ -110,6 +110,8 @@ const MemberArchiveInfo = () => {
if (res.code === 1000) {
setArchiveInfo(res.data);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setLoading(false);
});
......
......@@ -54,6 +54,8 @@ const MemberBasicInfo: React.FC<MemberBasicInfoProps> = ({
return;
}
MemberStore.setMemberInfo(res.data);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -29,6 +29,8 @@ const MemberRightsInfo: React.FC<{}> = () => {
return;
}
setEquityInfo(res.data);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -60,6 +60,8 @@ const MemberMaintainDetailed: React.FC<QueryProps> = props => {
}
setMemberInfo(res.data);
MemberStore.setMemberInfo(res.data);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -32,6 +32,8 @@ const MemberLevelInfo: React.FC<{}> = () => {
}
setLevelInfo(res.data);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:35
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-26 16:08:41
* @LastEditTime: 2021-07-30 11:08:08
* @Description: 会员信用信息详情
*/
import React, { useEffect, useState } from 'react';
......@@ -82,6 +82,8 @@ const MemberSincerityInfo: React.FC<{}> = () => {
pieData,
items: configs,
});
}).catch((err) => {
console.warn(err);
}).finally(() => {
setBasicInfoLoading(false);
});
......@@ -99,6 +101,8 @@ const MemberSincerityInfo: React.FC<{}> = () => {
}
const { rows = [] } = (res.data || {});
setOrderEstimateSum(rows);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setOrderEstimateSumLoading(false);
});
......@@ -116,6 +120,8 @@ const MemberSincerityInfo: React.FC<{}> = () => {
}
const { rows = [] } = (res.data || {});
setAfterServiceEstimateSum(rows);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setAfterServiceEstimateSumLoading(false);
});
......@@ -131,6 +137,8 @@ const MemberSincerityInfo: React.FC<{}> = () => {
return;
}
setFeedbackSum(res.data);
}).catch((err) => {
console.warn(err);
});
};
......
......@@ -74,6 +74,8 @@ const MemberMaintainEliminate: React.FC<{}> = () => {
if (res.code === 1000) {
setMemberInfo(res.data);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoaading(false);
});
......
......@@ -68,6 +68,8 @@ const MemberFrozen: React.FC<{}> = () => {
if (res.code === 1000) {
setMemberInfo(res.data);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoaading(false);
});
......
......@@ -43,7 +43,7 @@ const fetchData = async (params: any) => {
if (res.code === 1000) {
return res.data;
}
return [];
return { data: [], totalCount: 0 };
};
const MemberMaintain: React.FC<[]> = () => {
......
......@@ -68,6 +68,8 @@ const MemberMaintainUnfreeze: React.FC<{}> = () => {
if (res.code === 1000) {
setMemberInfo(res.data);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoaading(false);
});
......
......@@ -288,6 +288,8 @@ const ComingClassifyDrawer: React.FC<IProps> = (props: IProps) => {
}
);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
formActions.setFieldState(
FormPath.transform(fieldState.name, /\d/, $1 => `areaCodes.${$1}.cityCode`),
......@@ -347,6 +349,8 @@ const ComingClassifyDrawer: React.FC<IProps> = (props: IProps) => {
FormPath.setIn(state, 'props.enum', options);
});
}
}).catch((err) => {
console.warn(err);
});
// 请求会员品类数据
......@@ -357,6 +361,8 @@ const ComingClassifyDrawer: React.FC<IProps> = (props: IProps) => {
FormPath.setIn(state, 'props.x-component-props.options', data);
});
}
}).catch((err) => {
console.warn(err);
});
});
......
......@@ -74,7 +74,7 @@ const MemberPrVerifyChangeConfrim: React.FC<{}> = props => {
if (res.code === 1000) {
return res.data;
}
return [];
return { data: [], totalCount: 0 };
};
const handleBatch = () => {
......
......@@ -74,7 +74,7 @@ const MemberPrVerifyComing1: React.FC<{}> = props => {
if (res.code === 1000) {
return res.data;
}
return [];
return { data: [], totalCount: 0 };
};
const handleBatch = () => {
......
......@@ -74,7 +74,7 @@ const MemberPrVerifyComing2: React.FC<{}> = props => {
if (res.code === 1000) {
return res.data;
}
return [];
return { data: [], totalCount: 0 };
};
const handleBatch = () => {
......
......@@ -74,7 +74,7 @@ const MemberPrVerifyComingConfirm: React.FC<{}> = props => {
if (res.code === 1000) {
return res.data;
}
return [];
return { data: [], totalCount: 0 };
};
const handleBatch = () => {
......
......@@ -74,7 +74,7 @@ const MemberPrVerifyComingData: React.FC<{}> = props => {
if (res.code === 1000) {
return res.data;
}
return [];
return { data: [], totalCount: 0 };
};
const handleBatch = () => {
......
......@@ -74,7 +74,7 @@ const memberPrVerifyComingQualifications: React.FC<{}> = props => {
if (res.code === 1000) {
return res.data;
}
return [];
return { data: [], totalCount: 0 };
};
const handleBatch = () => {
......
......@@ -109,6 +109,8 @@ const MemberArchiveInfo = () => {
if (res.code === 1000) {
setArchiveInfo(res.data);
}
}).catch((err) => {
console.warn(err);
}).finally(() => {
setLoading(false);
});
......
......@@ -28,6 +28,8 @@ const MemberRightsInfo: React.FC<{}> = () => {
return;
}
setEquityInfo(res.data);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -53,6 +53,8 @@ const MemberQueryDetailed: React.FC<QueryProps> = props => {
}
setMemberInfo(res.data);
MemberStore.setMemberInfo(res.data);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -31,6 +31,8 @@ const MemberLevelInfo: React.FC<{}> = () => {
}
setLevelInfo(res.data);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setInfoLoading(false);
});
......
......@@ -81,6 +81,8 @@ const MemberSincerityInfo: React.FC<{}> = () => {
pieData,
items: configs,
});
}).catch((err) => {
console.warn(err);
}).finally(() => {
setBasicInfoLoading(false);
});
......@@ -97,6 +99,8 @@ const MemberSincerityInfo: React.FC<{}> = () => {
}
const { rows = [] } = (res.data || {});
setOrderEstimateSum(rows);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setOrderEstimateSumLoading(false);
});
......@@ -113,6 +117,8 @@ const MemberSincerityInfo: React.FC<{}> = () => {
}
const { rows = [] } = (res.data || {});
setAfterServiceEstimateSum(rows);
}).catch((err) => {
console.warn(err);
}).finally(() => {
setAfterServiceEstimateSumLoading(false);
});
......@@ -127,6 +133,8 @@ const MemberSincerityInfo: React.FC<{}> = () => {
return;
}
setFeedbackSum(res.data);
}).catch((err) => {
console.warn(err);
});
};
......
......@@ -43,7 +43,10 @@ const fetchData = async (params: any) => {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
let res = await PublicApi.getMemberAbilityInfoPage(payload);
if (res.code === 1000) {
return res.data;
}
return { data: [], totalCount: 0 };
};
const MemberQuery: React.FC<{}> = () => {
......
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