Commit 00d1515c by 姜雷

修改获取接口

parent cf9efeed
...@@ -18,6 +18,7 @@ Page({ ...@@ -18,6 +18,7 @@ Page({
areaName: '', areaName: '',
areaList: [], areaList: [],
growthList: [], growthList: [],
activateList: [],
registerCount: 0, registerCount: 0,
customerCount: 0, customerCount: 0,
activeCount: 0, activeCount: 0,
...@@ -86,12 +87,12 @@ Page({ ...@@ -86,12 +87,12 @@ Page({
...entity, ...entity,
}; };
statisticsFetch({ statisticsFetch({
url: '/dcxy/reportInfo/queryReportList', url: '/dcxy/reportInfo/boss/queryReportList',
data: reqBody, data: reqBody,
}) })
.then(res => { .then(res => {
console.log(res); console.log(res);
const { customerCount, dayVos, activeCount } = res.data; const { customerCount, dayVos, activeCount, dayAcs } = res.data;
let dayList = new Array(31) let dayList = new Array(31)
.fill({ .fill({
count: 0, count: 0,
...@@ -103,12 +104,43 @@ Page({ ...@@ -103,12 +104,43 @@ Page({
for (let index = 0; index < oList.length; index++) { for (let index = 0; index < oList.length; index++) {
const element = oList[index]; const element = oList[index];
let daysIndex = Number(element.days.slice(-2)); let daysIndex = Number(element.days.slice(-2));
if (dayList[daysIndex - 1].count) {
dayList[daysIndex - 1] = { dayList[daysIndex - 1] = {
...dayList[daysIndex - 1], ...dayList[daysIndex - 1],
count: dayList[daysIndex - 1].count + element.count,
};
} else {
dayList[daysIndex - 1] = {
...dayList[daysIndex - 1],
count: element.count,
};
}
}
}
let activateList = new Array(31)
.fill({
count: 0,
})
.map((v, idx) => ({ ...v, days: idx + 1 }));
if (dayAcs && dayAcs.length) {
let oList = dayAcs;
for (let index = 0; index < oList.length; index++) {
const element = oList[index];
let daysIndex = Number(element.days.slice(-2));
if (activateList[daysIndex - 1].count) {
activateList[daysIndex - 1] = {
...activateList[daysIndex - 1],
count: activateList[daysIndex - 1].count + element.count,
};
} else {
activateList[daysIndex - 1] = {
...activateList[daysIndex - 1],
count: element.count, count: element.count,
}; };
} }
} }
}
let registerCount = dayVos.reduce( let registerCount = dayVos.reduce(
(total, current) => (total += current.count), (total, current) => (total += current.count),
0, 0,
...@@ -116,6 +148,7 @@ Page({ ...@@ -116,6 +148,7 @@ Page({
console.log('dayList:', dayList); console.log('dayList:', dayList);
this.setData!({ this.setData!({
growthList: dayList, growthList: dayList,
activateList: activateList,
registerCount: registerCount, registerCount: registerCount,
customerCount: customerCount ? customerCount : 0, customerCount: customerCount ? customerCount : 0,
activeCount: activeCount ? activeCount : 0, activeCount: activeCount ? activeCount : 0,
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<view class="userGrowth-title-text">用户活跃</view> <view class="userGrowth-title-text">用户活跃</view>
</view> </view>
<view class="userGrowth-canvas"> <view class="userGrowth-canvas">
<user-activity-chart dataList="{{growthList}}" month="{{month}}" /> <user-activity-chart dataList="{{activateList}}" month="{{month}}" />
</view> </view>
</view> </view>
</view> </view>
\ No newline at end of file
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