|
|
@@ -30,6 +30,10 @@ export default function Index() { |
|
|
|
newAddUser: [], |
|
|
|
repurChase: [] |
|
|
|
}); |
|
|
|
//新增会员数 |
|
|
|
const [newMemberNum, setNewMemberNum] = useState(0); |
|
|
|
//复购次数 |
|
|
|
const [repurChaseNum, setRepurChaseNum] = useState(0); |
|
|
|
|
|
|
|
//新增会员图表实例 |
|
|
|
let newMemberObj = null; |
|
|
@@ -116,6 +120,16 @@ export default function Index() { |
|
|
|
const response = await marketAPI.getMemberReport(jsonData); |
|
|
|
setShowLoading(false); |
|
|
|
if (response.statusCode === 200) { |
|
|
|
let sumNewMember = 0; |
|
|
|
let sumRepurChase = 0; |
|
|
|
response.data.newAddUser.forEach(item => { |
|
|
|
sumNewMember += item.userValue |
|
|
|
}); |
|
|
|
response.data.repurChase.forEach(item => { |
|
|
|
sumRepurChase += item.userValue |
|
|
|
}); |
|
|
|
setNewMemberNum(sumNewMember); |
|
|
|
setRepurChaseNum(sumRepurChase); |
|
|
|
setMemberReport(response.data); |
|
|
|
} else { |
|
|
|
message.error(response.errors || '获取会员报表失败'); |
|
|
@@ -133,7 +147,7 @@ export default function Index() { |
|
|
|
const seriesData = []; |
|
|
|
memberReport.newAddUser.forEach(item => { |
|
|
|
const date = new Date(item.userKey); |
|
|
|
xAxisData.push(date.toLocaleString()); |
|
|
|
xAxisData.push(date.toLocaleDateString()); |
|
|
|
seriesData.push(item.userValue); |
|
|
|
}); |
|
|
|
const option = { |
|
|
@@ -173,6 +187,15 @@ export default function Index() { |
|
|
|
title: { |
|
|
|
text: '复购次数' |
|
|
|
}, |
|
|
|
tooltip: { |
|
|
|
trigger: 'axis', |
|
|
|
axisPointer: { |
|
|
|
label: { |
|
|
|
show: true, |
|
|
|
formatter: '复购{value}次' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
xAxis: { |
|
|
|
type: 'category', |
|
|
|
data: xAxisData |
|
|
@@ -284,7 +307,7 @@ export default function Index() { |
|
|
|
新增会员 |
|
|
|
</div> |
|
|
|
<div className={styles['member-card-sufixx']}> |
|
|
|
{memberReport.newAddUser.length} |
|
|
|
{newMemberNum} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className={styles['member-card-box']}> |
|
|
@@ -292,7 +315,7 @@ export default function Index() { |
|
|
|
复购数量 |
|
|
|
</div> |
|
|
|
<div className={styles['member-card-sufixx']}> |
|
|
|
{memberReport.repurChase.length} |
|
|
|
{repurChaseNum} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</Card> |
|
|
|