Commit d04db7a0 authored by XieZhiXiong's avatar XieZhiXiong

对接完毕现有会员维护-》会员详情接口相关

parent eae42aa1
......@@ -245,7 +245,7 @@ class Pie extends Component<PieProps, PieState> {
'x*y*percent',
(x: string, y: number, p: number) => ({
name: x,
value: `${y} | ${(p * 100).toFixed(2)}%`,
value: `${y}`,
}),
];
......
......@@ -25,6 +25,7 @@
z-index: 0;
&-name {
min-height: 33px;
margin-bottom: 48px;
line-height: 33px;
font-size: 24px;
......
......@@ -156,7 +156,7 @@ const LevelInfo: React.FC<LevelInfoProps> = ({
padding={[10, 20, 50, 60]}
scale={{
x: {
alias: '2021年', // 别名
alias: `${new Date().getFullYear()}年`, // 别名
},
y: {
tickCount: 5,
......
import React, { useEffect, useState } from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import Info, { BasicInfo, EstimateSum } from '../../components/SincerityInfo';
import Info, { BasicInfo, ComplaintSum, EstimateSum, SalesProps, ComplaintProps } from '../../components/SincerityInfo';
const SincerityInfo: React.FC<{}> = () => {
const { id, validateId } = usePageStatus();
const [basicInfo, setBasicInfo] = useState<BasicInfo>(null);
const [infoLoading, setInfoLoading] = useState(false);
const [estimateSum, setEstimateSum] = useState<EstimateSum>(null);
const [estimateSumLoading, setEstimateSumLoading] = useState(false);
const [salesEstimateSum, setSalesEstimateSum] = useState<EstimateSum>(null);
const [salesEstimateSumLoading, setSalesEstimateSumLoading] = useState(false);
const [afterEstimateSum, setAfterEstimateSum] = useState<EstimateSum>(null);
const [afterEstimateSumLoading, setAfterEstimateSumLoading] = useState(false);
const [complainSum, setComplainSum] = useState<ComplaintSum>(null);
const [complainSumLoading, setComplainSumLoading] = useState(false);
const getBasicInfo = () => {
setInfoLoading(true);
......@@ -53,8 +57,8 @@ const SincerityInfo: React.FC<{}> = () => {
});
};
const getEstimateSum = () => {
setEstimateSumLoading(true);
const getSalesEstimateSum = () => {
setSalesEstimateSumLoading(true);
PublicApi.getMemberAbilityMaintenanceDetailCreditTradeSummary({
memberId: id,
validateId,
......@@ -64,62 +68,102 @@ const SincerityInfo: React.FC<{}> = () => {
}
const { rows = [] } = (res.data || {});
const mock = [
{
before180days: 1,
last7days: 1,
last30days: 1,
last180days: 1,
star: 1,
sum: 1,
},
{
before180days: 2,
last7days: 2,
last30days: 2,
last180days: 2,
star: 2,
sum: 2,
},
{
before180days: 3,
last7days: 3,
last30days: 3,
last180days: 3,
star: 3,
sum: 3,
},
{
before180days: 4,
last7days: 4,
last30days: 4,
last180days: 4,
star: 4,
sum: 4,
},
{
before180days: 5,
last7days: 5,
last30days: 5,
last180days: 5,
star: 5,
sum: 5,
},
];
setSalesEstimateSum({
dataSource: rows,
});
}).finally(() => {
setSalesEstimateSumLoading(false);
});
};
const getAfterEstimateSum = () => {
setAfterEstimateSumLoading(true);
PublicApi.getMemberAbilityMaintenanceDetailCreditAftersaleSummary({
memberId: id,
validateId,
}).then(res => {
if (res.code !== 1000) {
return;
}
const { rows = [] } = (res.data || {});
setEstimateSum({
dataSource: mock,
setAfterEstimateSum({
dataSource: rows,
});
}).finally(() => {
setEstimateSumLoading(false);
setAfterEstimateSumLoading(false);
});
};
const getComplaintSum = () => {
setSalesEstimateSumLoading(true);
PublicApi.getMemberAbilityMaintenanceDetailCreditComplainSummary({
memberId: id,
validateId,
}).then(res => {
if (res.code !== 1000) {
return;
}
setComplainSum({
dataSource: res.data,
});
}).finally(() => {
setSalesEstimateSumLoading(false);
});
};
useEffect(() => {
getBasicInfo();
getEstimateSum();
getSalesEstimateSum();
getAfterEstimateSum();
getComplaintSum();
}, []);
const getSalesList = (params) => {
return new Promise<{ data: SalesProps[] , totalCount: number }>((resolve, reject) => {
PublicApi.getMemberAbilityMaintenanceDetailCreditTradeHistoryPage({
memberId: id,
validateId,
...params,
}).then(res => {
const { data = [], totalCount = 0 } = res.data;
resolve({ data, totalCount });
}).catch(err => {
reject(err);
});
});
};
const getAfterList = (params) => {
return new Promise<{ data: SalesProps[] , totalCount: number }>((resolve, reject) => {
PublicApi.getMemberAbilityMaintenanceDetailCreditAftersaleHistoryPage({
memberId: id,
validateId,
...params,
}).then(res => {
const { data = [], totalCount = 0 } = res.data;
resolve({ data, totalCount });
}).catch(err => {
reject(err);
});
});
};
const getComplaintList = (params) => {
return new Promise<{ data: ComplaintProps[] , totalCount: number }>((resolve, reject) => {
PublicApi.getMemberAbilityMaintenanceDetailCreditComplainHistoryPage({
memberId: id,
validateId,
...params,
}).then(res => {
const { data = [], totalCount = 0 } = res.data;
resolve({ data, totalCount });
}).catch(err => {
reject(err);
});
});
};
return (
<div>
<Info
......@@ -127,10 +171,21 @@ const SincerityInfo: React.FC<{}> = () => {
...basicInfo,
loading: infoLoading,
}}
estimateSum={{
...estimateSum,
loading: estimateSumLoading,
salesEstimateSum={{
...salesEstimateSum,
loading: salesEstimateSumLoading,
}}
fetchSalesList={getSalesList}
afterEstimateSum={{
...afterEstimateSum,
loading: afterEstimateSumLoading,
}}
fetchAfterList={getAfterList}
complaintSum={{
...complainSum,
loading: complainSumLoading,
}}
fetchComplaintList={getComplaintList}
/>
</div>
);
......
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