|
@@ -1,8 +1,9 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
- <lineChartModel :tableData="tableData" :lineListData="lineListData" title="收益" />
|
|
|
|
|
- <lineChartModel :tableData="tableData" :lineListData="lineListData" :type="'ecpm'" title="ECPM趋势" />
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <lineChartModel :tableData="tableData" :lineListData="lineListData" :totalProfit="totalProfit" title="收益" />
|
|
|
|
|
+ <lineChartModel :tableData="tableData" :lineListData="lineListData" :totalProfit="totalProfit" :type="'ecpm'"
|
|
|
|
|
+ title="ECPM趋势" />
|
|
|
|
|
+
|
|
|
<userDataChart />
|
|
<userDataChart />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -15,21 +16,42 @@ import userDataChart from './userDataChart.vue'
|
|
|
|
|
|
|
|
|
|
|
|
|
const tableData = ref([])
|
|
const tableData = ref([])
|
|
|
|
|
+const totalProfit = ref({})
|
|
|
const getIndexProfitData = async () => {
|
|
const getIndexProfitData = async () => {
|
|
|
const res = await getIndexProfit()
|
|
const res = await getIndexProfit()
|
|
|
tableData.value = res.data
|
|
tableData.value = res.data
|
|
|
|
|
+
|
|
|
|
|
+ const summary = res.data.reduce((acc, cur) => {
|
|
|
|
|
+ acc.today += parseFloat(cur.today)
|
|
|
|
|
+ acc.yesterday += parseFloat(cur.yesterday)
|
|
|
|
|
+ acc.month += parseFloat(cur.month)
|
|
|
|
|
+ acc.ecpmToday += parseFloat(cur.ecpmToday)
|
|
|
|
|
+ acc.ecpmYesterday += parseFloat(cur.ecpmYesterday)
|
|
|
|
|
+ acc.ecpmMonth += parseFloat(cur.ecpmMonth)
|
|
|
|
|
+ return acc
|
|
|
|
|
+ }, { today: 0, yesterday: 0, month: 0, ecpmToday: 0, ecpmYesterday: 0, ecpmMonth: 0 })
|
|
|
|
|
+
|
|
|
|
|
+ // 格式化为两位小数字符串
|
|
|
|
|
+ totalProfit.value = {
|
|
|
|
|
+ today: summary.today.toFixed(2),
|
|
|
|
|
+ yesterday: summary.yesterday.toFixed(2),
|
|
|
|
|
+ month: summary.month.toFixed(2),
|
|
|
|
|
+ ecpmToday: summary.ecpmToday.toFixed(2),
|
|
|
|
|
+ ecpmYesterday: summary.ecpmYesterday.toFixed(2),
|
|
|
|
|
+ ecpmMonth: summary.ecpmMonth.toFixed(2),
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const lineListData = ref({})
|
|
const lineListData = ref({})
|
|
|
const getIndexHourReportData = async () => {
|
|
const getIndexHourReportData = async () => {
|
|
|
- const res = await getIndexHourReport()
|
|
|
|
|
-
|
|
|
|
|
- // 整理 lineListData
|
|
|
|
|
- lineListData.value = res.data.reduce((acc, item) => {
|
|
|
|
|
- const { channelName, estimatedRevenueList, estimatedRevenueEcpmList } = item;
|
|
|
|
|
- acc[channelName] = { estimatedRevenueList, estimatedRevenueEcpmList };
|
|
|
|
|
- return acc;
|
|
|
|
|
- }, {});
|
|
|
|
|
|
|
+ const res = await getIndexHourReport()
|
|
|
|
|
+
|
|
|
|
|
+ // 整理 lineListData
|
|
|
|
|
+ lineListData.value = res.data.reduce((acc, item) => {
|
|
|
|
|
+ const { channelName, estimatedRevenueList, estimatedRevenueEcpmList } = item;
|
|
|
|
|
+ acc[channelName] = { estimatedRevenueList, estimatedRevenueEcpmList };
|
|
|
|
|
+ return acc;
|
|
|
|
|
+ }, {});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
onBeforeMount(async () => {
|
|
onBeforeMount(async () => {
|