zqwang 1 년 전
부모
커밋
40dada3f1e

+ 12 - 5
src/api/dataStatistics/userStatistics.ts

@@ -21,13 +21,20 @@ export function statisticUserList(params?: object) {
 /**
  * 用户统计-今日数据
  */
-export function statisticUserTodayData() {
-  return http.get('/statistic/users/today');
+export function statisticUserTodayData(params?: object) {
+  return http.get('/statistic/users/today',params);
 }
 
 /**
  * 用户统计-今日数据
  */
-export function statisticUserHistoryData() {
-  return http.get('/statistic/users/stats');
-}
+export function statisticUserHistoryData(params?: object) {
+  return http.get('/statistic/users/stats',params);
+}
+
+/**
+ * 首页--今日数据统计
+ */
+export function statisticHomeTodayData(params?: object) {
+  return http.get('/statistic/home',params);
+}

+ 162 - 0
src/views/dashboard/dataStatistics/todayData.vue

@@ -0,0 +1,162 @@
+<template>
+	<p class="title">今日数据 <label style="color: #909399; margin-left: 50px;">注: 以下数据为当日所有小程序的累计数据,如需查看各个小程序数据,可前往<span @click="go2tj" style="color: #29d;">数据统计</span>进行查看</label></p>
+	<div class="data-line">
+		<div class="box-card">
+			<el-tooltip placement="top">
+				<template #content> 新增用户的定义:不在其他推广链接染色时间范围内且被成功绑定到当前链接的用户,即为当前链接对应优化师的新增用户<br /> </template>
+				<el-icon>
+					<InfoFilled />
+				</el-icon>
+			</el-tooltip>
+			<label class="text-sm">新增用户:</label>
+			<p class="text-base">{{ todayChargeData.new_user_num || '0' }}</p>
+		</div>
+		<div class="box-card">
+			<el-tooltip placement="top">
+				<template #content> 新增用户中今日充值的人数<br /> </template>
+				<el-icon>
+					<InfoFilled />
+				</el-icon>
+			</el-tooltip>
+			<label class="text-sm">新增用户充值人数:</label>
+			<p class="text-base">{{ todayChargeData.new_user_recharge_num || '0' }}</p>
+			<p class="text-pt">普通:{{ todayChargeData.new_user_recharge_coin_num || '0' }}</p>
+			<p class="text-pt">会员:{{ todayChargeData.new_user_recharge_vip_num || '0' }}</p>
+		</div>
+		<div class="box-card">
+			<el-tooltip placement="top">
+				<template #content> 新用户充值人数/新增用户<br /> </template>
+				<el-icon>
+					<InfoFilled />
+				</el-icon>
+			</el-tooltip>
+			<label class="text-sm">新增用户付费率:</label>
+			<p class="text-base">{{ todayChargeData.new_user_recharge_rate || '0' }}</p>
+			
+		</div>
+		<div class="box-card">
+			<el-tooltip placement="top">
+				<template #content> 当日新增用户的充值总额<br /> </template>
+				<el-icon>
+					<InfoFilled />
+				</el-icon>
+			</el-tooltip>
+			<label class="text-sm">新增用户充值金额:</label>
+			<p class="text-base">{{ todayChargeData.new_user_recharge_total || '0' }}</p>
+			<p class="text-pt">普通:{{ todayChargeData.new_user_recharge_coin_total || '0' }}</p>
+			<p class="text-pt">会员:{{ todayChargeData.new_user_recharge_coin_total || '0' }}</p>
+		</div>
+		<div class="box-card">
+			<el-tooltip placement="top">
+				<template #content> 新用户充值总额/新用户充值人数<br /> </template>
+				<el-icon>
+					<InfoFilled />
+				</el-icon>
+			</el-tooltip>
+			<label class="text-sm">新增用户人均充值:</label>
+			<p class="text-base">{{ todayChargeData.new_user_mean || '0' }}</p>
+			
+		</div>
+		<div class="box-card">
+			<el-tooltip placement="top">
+				<template #content> 当日累计充值总金额<br /> </template>
+				<el-icon>
+					<InfoFilled />
+				</el-icon>
+			</el-tooltip>
+			<label class="text-sm">充值金额:</label>
+			<p class="text-base">{{ todayChargeData.recharge_total || '0' }}</p>
+			<p class="text-pt">普通:{{ todayChargeData.recharge_coin_total || '0' }}</p>
+			<p class="text-pt">会员:{{ todayChargeData.recharge_coin_total || '0' }}</p>
+		</div>
+		<div class="box-card">
+			<el-tooltip placement="top">
+				<template #content> 当日累计充值笔数<br /> </template>
+				<el-icon>
+					<InfoFilled />
+				</el-icon>
+			</el-tooltip>
+			<label class="text-sm">充值笔数:</label>
+			<p class="text-base">{{ todayChargeData.recharge_num || '0' }}</p>
+			
+		</div>
+		<div class="box-card">
+			<el-tooltip placement="top">
+				<template #content> 充值金额/充值笔数<br /> </template>
+				<el-icon>
+					<InfoFilled />
+				</el-icon>
+			</el-tooltip>
+			<label class="text-sm">充值单价:</label>
+			<p class="text-base">{{ todayChargeData.recharge_mean || '0' }}</p>
+			
+		</div>
+		
+	</div>
+</template>
+
+<script lang="ts" setup>
+import { checkPermission } from '@/directives/permission';
+import { InfoFilled } from '@element-plus/icons-vue';
+import Cache from '@/support/cache';
+import { statisticHomeTodayData } from '@/api/dataStatistics/userStatistics';
+import router from '@/router';
+const todayChargeData = ref({});
+const miniprogram_idJ = ref(0);
+
+const init = () => {
+	statisticHomeTodayData({ miniprogram_id: miniprogram_idJ.value }).then(
+		res => {
+			todayChargeData.value = res.data;
+		}
+	);
+};
+
+onMounted(() => {
+	if (JSON.parse(Cache.get('nav_data'))?.app.id) {
+		miniprogram_idJ.value = JSON.parse(Cache.get('nav_data'))?.app.id;
+	}
+	init();
+});
+
+const go2tj=()=>{
+	router.push({ path: "/statistic/userStatistical" });
+}
+</script>
+
+<style>
+.data-line{
+  display: flex;   /* flex布局 */
+  justify-content: space-between;   /* 左对齐 */
+  flex-wrap: wrap;   /* 换行 */
+}
+.title{
+	margin-left: 15px;
+}
+.box-card{
+	margin-top: 20px;
+	border-radius: 10px;
+	margin-right: 10px;
+	background-color: cornsilk;
+	padding:15px 20px;
+	height: 200px;
+	width: calc((100% - 60px) / 4);
+	justify-content: flex-start;
+
+
+}
+.box-card:nth-of-type(4n+0) {
+	 margin-right: 0;
+}
+.text-sm{
+
+}
+.text-base{
+	font-size:40px;
+	margin: 20px 0px;
+}
+.text-pt{
+	font-size:10px;
+	margin-top: 15px;
+}
+</style>

+ 13 - 15
src/views/dashboard/index.vue

@@ -1,24 +1,22 @@
 <template>
-  <el-card v-if="!path" shadow="always" class="flex justify-center h-full" :body-style="{ padding: '20px' }">
-    <div class="welcome">
-      <div class="header">
-        <!-- <img src="@/assets/logo.png" alt="logo" class="logo"> -->
-        <h1>追剧云平台</h1>
-      </div>
-      <div class="content">
-        <h2>欢迎使用</h2>
-        <p>点击左侧菜单进行操作</p>
-      </div>
-    </div>
-  </el-card>
+	<el-card>
+		111111
+	</el-card>
+	
+	<el-card shadow="always">
+		<todayData></todayData>
+	</el-card>
+
+  
 </template>
 
 <script lang="ts" setup>
 import { checkPermission, getFirstPath } from '@/directives/permission';
 import router from '@/router';
+import todayData from "./dataStatistics/todayData.vue";
 let path = getFirstPath(0);
 if (path) {
-  router.push({ path: path });
+  // router.push({ path: path });
 }
 console.log('path', path)
 </script>
@@ -27,8 +25,8 @@ console.log('path', path)
 .welcome {
   display: flex;
   flex-direction: column;
-  align-items: center;
-  justify-content: center;
+  align-items: flex-start;
+  justify-content: flex-start;
   height: 100%;
 }
 

+ 7 - 13
src/views/dataStatistics/userStatistics/summaryStatistics.vue

@@ -192,6 +192,7 @@
 import { checkPermission } from '@/directives/permission';
 import { InfoFilled } from '@element-plus/icons-vue';
 import { useCountdownTimer } from '@/utils/timerUtils';
+import Cache from '@/support/cache'
 import {
   statisticUserTodayData,
   statisticUserHistoryData,
@@ -201,6 +202,7 @@ const todayChargeData = ref({})
 const currentMonth = ref({})
 const lastMonth = ref({})
 const totalData = ref({})
+const miniprogram_idJ = ref(0)
 const rolesIdentify = inject('rolesIdentify')
 const refreshInterface = (): void => {
   initTodayCharge()
@@ -209,31 +211,23 @@ const timer = useCountdownTimer(60, refreshInterface);
 
 const initTodayCharge = () => {
  
-  statisticUserTodayData().then(res => {
+  statisticUserTodayData({miniprogram_id:miniprogram_idJ.value}).then(res => {
     todayChargeData.value = res.data
   })
 }
 const init = () => {
   
-    statisticUserHistoryData().then(res => {
+    statisticUserHistoryData({miniprogram_id:miniprogram_idJ.value}).then(res => {
 		currentMonth.value = res.data.month;
 		lastMonth.value = res.data.lastMonth;
 		totalData.value = res.data.history;
     })
-  // }
-  // if (checkPermission('statistic.chargeTJ.lastMonthCharge')) {
-  //   statisticChargeLastMonthCharge().then(res => {
-  //     lastMonthChargeData.value = res.data;
-  //   })
-  // }
-  // if (checkPermission('statistic.chargeTJ.totalCharge')) {
-  //   statisticChargeTotalCharge().then(res => {
-  //     totalChargeData.value = res.data;
-  //   })
-  // }
 }
 
 onMounted(() => {
+ if (JSON.parse(Cache.get('nav_data'))?.app.id) {
+	miniprogram_idJ.value = JSON.parse(Cache.get('nav_data'))?.app.id
+  }
   init()
   initTodayCharge()
 });