|
@@ -26,17 +26,17 @@
|
|
</svg>
|
|
</svg>
|
|
<el-form :inline="true" :model="form" label-width="0">
|
|
<el-form :inline="true" :model="form" label-width="0">
|
|
<el-form-item label="">
|
|
<el-form-item label="">
|
|
- <el-select v-model="form.time" placeholder="">
|
|
|
|
- <el-option label="按周查看" value="1" />
|
|
|
|
- <el-option label="按月查看" value="2" />
|
|
|
|
|
|
+ <el-select v-model="form.time" placeholder="" @change="selectTimeChange">
|
|
|
|
+ <el-option label="按周查看" value="week" />
|
|
|
|
+ <el-option label="按月查看" value="month" />
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="">
|
|
<el-form-item label="">
|
|
- <el-date-picker :type="'daterange'" style="width: 242px;" v-model="form.dateArray" range-separator="至"
|
|
|
|
|
|
+ <el-date-picker :type="'daterange'" style="width: 242px;" v-model="form.dateArray" range-separator="至" @change="selectDateChange"
|
|
start-placeholder="开始日期" end-placeholder="结束日期" />
|
|
start-placeholder="开始日期" end-placeholder="结束日期" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="">
|
|
<el-form-item label="">
|
|
- 一周内,卸载流失设备数<span>510</span>
|
|
|
|
|
|
+ 一周内,卸载流失设备数<span>{{ uninstallCount.count }}</span>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<div class="tips">您可以根据下方的卸载画像报表,查看易卸载用户和高粘性用户的特征,了解什么样的用户留不住。</div>
|
|
<div class="tips">您可以根据下方的卸载画像报表,查看易卸载用户和高粘性用户的特征,了解什么样的用户留不住。</div>
|
|
</el-form>
|
|
</el-form>
|
|
@@ -51,25 +51,14 @@
|
|
<el-row :gutter="12" style="padding: 0 12px 0; row-gap: 12px;">
|
|
<el-row :gutter="12" style="padding: 0 12px 0; row-gap: 12px;">
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
|
|
<el-card shadow="none">
|
|
<el-card shadow="none">
|
|
- <user-info title="不易卸载用户画像" :type="true" :tags="[
|
|
|
|
- '专科',
|
|
|
|
- '便携生活',
|
|
|
|
- '社交通讯',
|
|
|
|
- '同城本地社区'
|
|
|
|
- ]" tips="卸载用户 vs. 活跃用户具备的明显特征,有以下特征的用户易卸载" style="margin-bottom: 24px;">
|
|
|
|
-
|
|
|
|
- </user-info>
|
|
|
|
- <data-table :data="data" :columns="columns"></data-table>
|
|
|
|
|
|
+ <user-info title="不易卸载用户画像" :type="true" :tags="hardData.length > 0 ? hardData.map((item: any) => item.name) : []" tips="卸载用户 vs. 活跃用户具备的明显特征,有以下特征的用户易卸载" style="margin-bottom: 24px;"></user-info>
|
|
|
|
+ <data-table :data="hardData" :columns="columns"></data-table>
|
|
</el-card>
|
|
</el-card>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
|
|
<el-card shadow="none">
|
|
<el-card shadow="none">
|
|
- <user-info title="不易卸载用户特征" :type="false" :tags="[
|
|
|
|
- '25-29岁',
|
|
|
|
- '三线城市',
|
|
|
|
- '普通消费'
|
|
|
|
- ]" tips="活跃用户 vs. 卸载用户具备的明显差异点,有以下特征的人群卸载可能性低" style="margin-bottom: 24px;"></user-info>
|
|
|
|
- <data-table :data="data" :columns="columns"></data-table>
|
|
|
|
|
|
+ <user-info title="不易卸载用户特征" :type="false" :tags="easyData.length > 0 ? easyData.map((item: any) => item.name) : []" tips="活跃用户 vs. 卸载用户具备的明显差异点,有以下特征的人群卸载可能性低" style="margin-bottom: 24px;"></user-info>
|
|
|
|
+ <data-table :data="easyData" :columns="columns"></data-table>
|
|
</el-card>
|
|
</el-card>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -100,14 +89,14 @@
|
|
</div>
|
|
</div>
|
|
<el-row :gutter="12" style="padding: 12px 12px 12px; row-gap: 12px;">
|
|
<el-row :gutter="12" style="padding: 12px 12px 12px; row-gap: 12px;">
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
|
|
- <div style="padding-top: 8px;">
|
|
|
|
- <BarChart :data="usageTimeData" :is-multi-series="true" :series-names="seriesNames" title=""
|
|
|
|
|
|
+ <div style="padding-top: 8px;" v-if="echartsData.length > 0">
|
|
|
|
+ <BarChart :data="echartsData" :is-multi-series="true" :series-names="seriesNames" title=""
|
|
style="height: 320px;" :chartHeight="320" />
|
|
style="height: 320px;" :chartHeight="320" />
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
|
|
<el-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
|
|
<div class="">
|
|
<div class="">
|
|
- <data-table :data="data2" :columns="columns2"></data-table>
|
|
|
|
|
|
+ <data-table :data="usageTimeData" :columns="columns2"></data-table>
|
|
</div>
|
|
</div>
|
|
</el-col>
|
|
</el-col>
|
|
</el-row>
|
|
</el-row>
|
|
@@ -121,100 +110,100 @@ import { ref } from 'vue';
|
|
import UserInfo from './components/UserInfo.vue';
|
|
import UserInfo from './components/UserInfo.vue';
|
|
import DataTable from './components/DataTable.vue';
|
|
import DataTable from './components/DataTable.vue';
|
|
import BarChart from '/@/views/count/components/BarChart.vue';
|
|
import BarChart from '/@/views/count/components/BarChart.vue';
|
|
|
|
+import { formatDate } from '/@/utils/formatTime';
|
|
|
|
+import { uninstallPortrait } from '/@/api/count/churn';
|
|
|
|
|
|
const columns = ref([
|
|
const columns = ref([
|
|
- { label: '用户特征', prop: 'feature', width: '100px' },
|
|
|
|
|
|
+ { label: '用户特征', prop: 'name', width: '100px' },
|
|
{ prop: 'percent', type: 'percentDom' },
|
|
{ prop: 'percent', type: 'percentDom' },
|
|
{ label: 'TGI', prop: 'tgi', width: '100px' },
|
|
{ label: 'TGI', prop: 'tgi', width: '100px' },
|
|
{ label: '百分比', prop: 'percent', width: '100px' },
|
|
{ label: '百分比', prop: 'percent', width: '100px' },
|
|
])
|
|
])
|
|
|
|
|
|
const columns2 = ref([
|
|
const columns2 = ref([
|
|
- { label: '卸载前使用App次数', prop: 'usageTime', width: '150px' },
|
|
|
|
|
|
+ { label: '卸载前使用App次数', prop: 'phase', width: '150px' },
|
|
{ prop: 'percent', type: 'percentDom' },
|
|
{ prop: 'percent', type: 'percentDom' },
|
|
{ label: '百分比', prop: 'percent', width: '100px' },
|
|
{ label: '百分比', prop: 'percent', width: '100px' },
|
|
{ label: '卸载用户数', prop: 'count', width: '100px' },
|
|
{ label: '卸载用户数', prop: 'count', width: '100px' },
|
|
])
|
|
])
|
|
|
|
|
|
const form = ref({
|
|
const form = ref({
|
|
- time: '1',
|
|
|
|
- dateArray: []
|
|
|
|
|
|
+ time: 'week',
|
|
|
|
+ dateArray: [formatDate(new Date(new Date().setDate(new Date().getDate() - 7)), 'YYYY-mm-dd'), formatDate(new Date(), 'YYYY-mm-dd')]
|
|
})
|
|
})
|
|
|
|
|
|
-const data = ref([
|
|
|
|
- { feature: '专科', tgi: 3.74, percent: 3.22 },
|
|
|
|
- { feature: '便携生活智能生...', tgi: 3.74, percent: 3.22 },
|
|
|
|
- { feature: '社交通讯', tgi: 3.74, percent: 3.22 },
|
|
|
|
- { feature: '同城本地社区', tgi: 3.74, percent: 3.22 },
|
|
|
|
- { feature: '普通消费', tgi: 3.74, percent: 3.22 },
|
|
|
|
-])
|
|
|
|
-
|
|
|
|
-const data2 = ref([
|
|
|
|
- { usageTime: '1次', percent: 3.22, count: 3.22 },
|
|
|
|
- { usageTime: '2次', percent: 3.22, count: 3.22 },
|
|
|
|
- { usageTime: '3次', percent: 3.22, count: 3.22 },
|
|
|
|
- { usageTime: '4次', percent: 3.22, count: 3.22 },
|
|
|
|
- { usageTime: '5次', percent: 3.22, count: 3.22 },
|
|
|
|
- { usageTime: '6次以上', percent: 3.22, count: 3.22 },
|
|
|
|
-])
|
|
|
|
-
|
|
|
|
-// 多系列数据对比
|
|
|
|
-const usageTimeData = ref([
|
|
|
|
- {
|
|
|
|
- name: '未使用',
|
|
|
|
- values: []
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '使用1次',
|
|
|
|
- values: []
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '使用2次',
|
|
|
|
- values: []
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '使用3次',
|
|
|
|
- values: []
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '使用4次',
|
|
|
|
- values: []
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '使用5次',
|
|
|
|
- values: []
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- name: '6次以上',
|
|
|
|
- values: []
|
|
|
|
- }
|
|
|
|
-])
|
|
|
|
-
|
|
|
|
-const seriesNames = ref<string[]>([]);
|
|
|
|
-
|
|
|
|
-const handleDateChange = (val: string[]) => {
|
|
|
|
- // 强制触发响应式更新
|
|
|
|
- seriesNames.value = [...val];
|
|
|
|
|
|
+const echartsData = ref<any[]>([])
|
|
|
|
+const seriesNames = ref<string[]>(['卸载用户数']);
|
|
|
|
+const easyData = ref<any[]>([])
|
|
|
|
+const hardData = ref<any[]>([])
|
|
|
|
+const usageTimeData = ref<any[]>([])// 使用次数
|
|
|
|
+const uninstallCount = ref({
|
|
|
|
+ count: 0,
|
|
|
|
+})
|
|
|
|
|
|
- // 创建新的数据对象以确保响应式更新
|
|
|
|
- const newData = usageTimeData.value.map((item: any) => ({
|
|
|
|
- ...item,
|
|
|
|
- values: val.map((date: string) => {
|
|
|
|
- const value = Math.floor(Math.random() * 100);
|
|
|
|
- return {
|
|
|
|
- value: value,
|
|
|
|
- percentage: `${value}%`
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }));
|
|
|
|
|
|
+const init = () => {
|
|
|
|
+ uninstallPortrait({
|
|
|
|
+ startDate: formatDate(new Date(form.value.dateArray[0]), 'YYYY-mm-dd'),
|
|
|
|
+ endDate: formatDate(new Date(form.value.dateArray[1]), 'YYYY-mm-dd'),
|
|
|
|
+ timeUnit: form.value.time,
|
|
|
|
+ }).then(res => {
|
|
|
|
+ uninstallCount.value = {
|
|
|
|
+ count: res.data?.uninstallCount.count,
|
|
|
|
+ }
|
|
|
|
+ // if (res.data?.uninstallPortraitPhaseList) {
|
|
|
|
+ const newData: any[] = [];
|
|
|
|
+ easyData.value = [];
|
|
|
|
+ hardData.value = [];
|
|
|
|
+ usageTimeData.value = [];
|
|
|
|
+ res.data?.uninstallPortraitPhaseList.forEach((item: any) => {
|
|
|
|
+ newData.push({
|
|
|
|
+ name: item.phase,
|
|
|
|
+ values: [
|
|
|
|
+ {
|
|
|
|
+ value: item.count,
|
|
|
|
+ percentage: item.rate + "%",
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ echartsData.value = newData;
|
|
|
|
+ res.data?.uninstallPortraitPhaseList.forEach((item: any) => {
|
|
|
|
+ usageTimeData.value.push({
|
|
|
|
+ ...item,
|
|
|
|
+ percent: item.rate,
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ // }
|
|
|
|
+ // if (res.data?.uninstallPortraitCharactList) {
|
|
|
|
+ res.data?.uninstallPortraitCharactList.forEach((item: any) => {
|
|
|
|
+ if(item.status == 0){
|
|
|
|
+ easyData.value.push({
|
|
|
|
+ ...item,
|
|
|
|
+ percent: item.percent.substring(0, item.percent.length - 1),
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ hardData.value.push({
|
|
|
|
+ ...item,
|
|
|
|
+ percent: item.percent.substring(0, item.percent.length - 1),
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // }
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
|
|
- console.log(newData);
|
|
|
|
|
|
+const selectTimeChange = () => {
|
|
|
|
+ console.log(form.value.time);
|
|
|
|
+ init();
|
|
|
|
+}
|
|
|
|
|
|
- usageTimeData.value = newData;
|
|
|
|
|
|
+const selectDateChange = () => {
|
|
|
|
+ console.log(form.value.dateArray);
|
|
|
|
+ init();
|
|
}
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
- handleDateChange(['卸载用户数']);
|
|
|
|
|
|
+ init();
|
|
})
|
|
})
|
|
|
|
|
|
</script>
|
|
</script>
|