统计加筛选

This commit is contained in:
dengbw
2022-11-07 17:47:48 +08:00
parent db358d2dd7
commit c2d5dde5fb
7 changed files with 543 additions and 82 deletions
+14
View File
@@ -182,6 +182,20 @@ export async function getActivityStatisticsTeam(id) {
return Promise.reject(new Error(res.data.message));
}
/**
* 分页查询门店统计
* @param params 查询条件
*/
export async function pageStatisticsArea(params) {
const res = await request.get('/sylive/statistics/page_area', {
params
});
if (res.data.code === 0) {
return res.data.data;
}
return Promise.reject(new Error(res.data.message));
}
/**
* 分页查询门店统计
* @param params 查询条件
@@ -0,0 +1,272 @@
<!-- 用户编辑弹窗 -->
<template>
<ele-modal
width="750px"
:visible="visible"
:append-to-body="true"
:close-on-click-modal="true"
custom-class="ele-dialog-form"
:title="isUpdate ? '修改商品' : '添加商品'"
@update:visible="updateVisible"
>
<el-form ref="form" :model="form" :rules="rules" label-width="82px">
<el-form-item label="商品标题:" prop="title">
<el-input
clearable
:maxlength="60"
v-model="form.title"
placeholder="请输入商品标题"
/>
</el-form-item>
<el-form-item label="商品价格:" prop="price">
<el-input
clearable
:maxlength="60"
v-model="form.price"
placeholder="请输入商品价格"
/>
</el-form-item>
<el-form-item label="库存数:" prop="stock">
<el-input
clearable
:maxlength="60"
v-model="form.stock"
placeholder="请输入库存数"
/>
</el-form-item>
<el-form-item label="商品图片:" prop="banner">
<ele-image-upload
v-model="form.banner"
:limit="10"
:drag="true"
:multiple="true"
:upload-handler="bannerHandler"
@upload="onUpload"
/>
<div class="ele-text-secondary">建议尺寸750X680</div>
</el-form-item>
<el-form-item label="抢购时间:" prop="dateRange">
<el-date-picker
v-model="form.dateRange"
type="datetimerange"
unlink-panels
range-separator=""
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
class="ele-fluid"
/>
</el-form-item>
<el-form-item label="排序:">
<el-input
clearable
:maxlength="60"
v-model="form.sort"
placeholder="请输入排序"
/>
</el-form-item>
<el-form-item label="商品详情:" prop="descrip">
<!-- 编辑器 -->
<div v-if="editversion">
<tinymce-editor
:init="editoption"
v-model="form.descrip"
placeholder="请输入商品详情"
/>
</div>
</el-form-item>
</el-form>
<template v-slot:footer>
<el-button @click="updateVisible(false)">取消</el-button>
<el-button type="primary" :loading="loading" @click="save">
保存
</el-button>
</template>
</ele-modal>
</template>
<script>
import TinymceEditor from '@/components/TinymceEditor/index.vue';
import EleImageUpload from 'ele-admin/es/ele-image-upload';
import request from '@/utils/request';
import { addGoods, updateGoods } from '@/api/sylive/goods';
export default {
components: { EleImageUpload, TinymceEditor },
props: {
// 弹窗是否打开
visible: Boolean,
// 修改回显的数据
data: Object
},
data() {
const defaultForm = {
id: null,
activityId: null,
title: '',
price: '',
stock: '',
banner: [],
dateRange: '',
sort: '',
descrip: ''
};
return {
editversion: false,
editoption: {
height: 300,
toolbar: [
'code | forecolor backcolor bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify outdent indent | fontsizeselect | bullist numlist | \
table emoticons hr preview | fullscreen | bdmap indent2em lineheight formatpainter axupimgs| image emoticons hr '
]
},
defaultForm,
// 表单数据
form: { ...defaultForm },
// 表单验证规则
rules: {
title: [
{
required: true,
message: '请输入商品标题',
trigger: 'blur'
}
],
price: [
{
required: true,
message: '请输入商品价格',
trigger: 'blur'
}
],
stock: [
{
required: true,
message: '请输入库存数',
trigger: 'blur'
}
]
},
// 提交状态
loading: false,
// 是否是修改
isUpdate: false
};
},
computed: {
// 是否开启响应式布局
styleResponsive() {
return this.$store.state.theme.styleResponsive;
}
},
methods: {
/* 保存编辑 */
save() {
this.$refs.form.validate((valid) => {
if (!valid) {
return false;
}
this.loading = true;
const data = {
...this.form
};
const saveOrUpdate = this.isUpdate ? updateGoods : addGoods;
saveOrUpdate(data)
.then((msg) => {
this.loading = false;
this.$message.success(msg);
this.updateVisible(false);
this.$emit('done');
})
.catch((e) => {
this.loading = false;
this.$message.error(e.message);
});
});
},
/* 更新visible */
updateVisible(value) {
this.$emit('update:visible', value);
},
/* 上传事件 */
bannerHandler(file) {
const item = {
file,
uid: file.uid,
name: file.name,
progress: 0,
status: null
};
if (!file.type.startsWith('image')) {
this.$message.error('只能选择图片');
return;
}
if (file.size / 1024 / 1024 > 2) {
this.$message.error('大小不能超过 2MB');
return;
}
item.url = window.URL.createObjectURL(file);
// 关键就是这里要自己 push 添加数据而不是靠 v-modal 自动更新
this.form.banner.push(item);
this.onUpload(item);
},
/* 上传 item */
onUpload(item) {
item.status = 'uploading';
const formData = new FormData();
formData.append('file', item.file);
request({
url: '/upload',
method: 'post',
data: formData,
onUploadProgress: (e) => {
if (e.lengthComputable) {
item.progress = (e.loaded / e.total) * 100;
}
}
})
.then((res) => {
if (res.data.code === 0) {
item.status = 'done';
item.url = res.data.data.full_url;
item.fileUrl = res.data.data.url;
}
})
.catch(() => {
item.status = 'exception';
});
}
},
watch: {
visible(visible) {
this.editversion = false;
if (visible) {
this.editversion = true;
if (this.data.id) {
this.$util.assignObject(this.form, {
...this.data
});
this.isUpdate = true;
} else {
this.form.activityId = this.data.activityId;
this.isUpdate = false;
}
} else {
this.$refs.form.clearValidate();
this.form = { ...this.defaultForm };
}
}
}
};
</script>
<style>
.ele-image-upload-list .ele-image-upload-item {
margin-top: 5px;
margin-bottom: 5px;
}
.tox-menubar {
display: none !important;
}
/* .tox-toolbar__group:last-child {
display: none !important;
} */
</style>
+20 -9
View File
@@ -8,7 +8,7 @@
ref="table"
:columns="columns"
:datasource="datasource"
cache-key="syliveOrderTable"
cache-key="syliveActivityGoodsTable"
>
<!-- 表头工具栏 -->
<template v-slot:toolbar>
@@ -33,12 +33,15 @@
</template>
</ele-pro-table>
</el-card>
<!-- 编辑弹窗 -->
<goods-edit :data="current" :visible.sync="showEdit" @done="reload" />
</div>
</template>
<script>
import { setPageTabTitle } from '@/utils/page-tab-util';
import GoodsSearch from './components/goods-search.vue';
import GoodsEdit from './components/goods-edit.vue';
import { getActivity } from '@/api/sylive/activity';
import {
pageGoods,
@@ -49,13 +52,18 @@
const ROUTE_PATH = '/sylive/activity/goods';
export default {
name: 'syliveActivityOrder',
components: { GoodsSearch },
name: 'syliveActivityGoods',
components: { GoodsSearch, GoodsEdit },
data() {
return {
// 加载状态
title: '权益订单',
title: '周边好物',
loading: true,
// 当前编辑数据
current: null,
// 是否显示编辑弹窗
showEdit: false,
activityId: null,
// 表格列配置
columns: [
{
@@ -143,16 +151,16 @@
methods: {
/* 表格数据源 */
datasource({ page, limit, where, order }) {
const activityId = this.$route.query.id;
const activityId = this.activityId;
return pageGoods({ ...where, ...order, page, limit, activityId });
},
query() {
const activityId = this.$route.query.id;
if (!activityId) {
this.activityId = Number(this.$route.query.id);
if (!this.activityId) {
return;
}
this.loading = true;
getActivity(Number(activityId))
getActivity(this.activityId)
.then((data) => {
this.loading = false;
// 修改页签标题
@@ -172,7 +180,10 @@
},
/* 显示编辑 */
openEdit(item) {
this.editData = item;
if (!item) {
item.activityId = this.activityId;
}
this.current = item;
this.showEdit = true;
},
/* 删除 */
@@ -0,0 +1,145 @@
<template>
<el-card shadow="never">
<!-- 数据表格 -->
<ele-pro-table
ref="table"
title="区域统计"
:columns="columns"
:datasource="datasource"
size="mini"
>
<template v-slot:toolkit>
<div class="list-tool-item">
<el-select
v-model="day"
placeholder="全部日期"
clearable
class="ele-fluid"
@input="updateValue"
>
<el-option
v-for="item in data"
:key="item.value"
:value="item.value"
:label="item.name"
/>
</el-select>
</div>
<div class="list-tool-divider">
<el-divider direction="vertical" />
</div>
</template>
</ele-pro-table>
</el-card>
</template>
<script>
import { pageStatisticsArea } from '@/api/sylive/activity';
export default {
props: { data: [] },
data() {
return {
// 表格选中数据
day: '',
selection: [],
// 表格列配置
columns: [
{
prop: 'areaName',
label: '区域名称',
align: 'center',
showOverflowTooltip: true,
minWidth: 110
},
{
prop: 'biz',
label: '参与门店数',
align: 'center',
showOverflowTooltip: true,
minWidth: 110
},
{
prop: 'consultant',
label: '参与/全部顾问数',
align: 'center',
showOverflowTooltip: true,
minWidth: 110
},
{
prop: 'browse',
label: '浏览数(人)',
align: 'center',
sortable: 'custom',
showOverflowTooltip: true,
minWidth: 110
},
{
prop: 'subscribe',
label: '预约数(人)',
align: 'center',
sortable: 'custom',
showOverflowTooltip: true,
minWidth: 110
},
{
prop: 'watch',
label: '观看数(人)',
align: 'center',
sortable: 'custom',
showOverflowTooltip: true,
minWidth: 110
},
{
prop: 'order',
label: '订单数(单)',
align: 'center',
sortable: 'custom',
showOverflowTooltip: true,
minWidth: 110
},
{
prop: 'livePV',
label: '观看数(人次)',
align: 'center',
showOverflowTooltip: true,
minWidth: 110
},
{
prop: 'watchDuration',
label: '人均观看(分)',
align: 'center',
showOverflowTooltip: true,
minWidth: 110
}
]
};
},
methods: {
/* 表格数据源 */
datasource({ page, limit, order }) {
const activityId = this.$route.query.id;
if (!activityId) {
return;
}
const day = this.day;
return pageStatisticsArea({
...order,
page,
limit,
activityId,
day
});
},
/* 更新选中数据 */
updateValue() {
this.$refs.table.reload({ page: 1 });
}
}
};
</script>
<style lang="scss" scoped>
.list-tool-divider {
padding: 0 12px;
}
</style>
@@ -8,6 +8,27 @@
:datasource="datasource"
size="mini"
>
<template v-slot:toolkit>
<div class="list-tool-item">
<el-select
v-model="day"
placeholder="全部日期"
clearable
class="ele-fluid"
@input="updateValue"
>
<el-option
v-for="item in data"
:key="item.value"
:value="item.value"
:label="item.name"
/>
</el-select>
</div>
<div class="list-tool-divider">
<el-divider direction="vertical" />
</div>
</template>
</ele-pro-table>
</el-card>
</template>
@@ -16,8 +37,12 @@
import { pageStatisticsBiz } from '@/api/sylive/activity';
export default {
props: { data: [] },
data() {
return {
// 表格选中数据
day: '',
selection: [],
// 表格列配置
columns: [
{
@@ -90,8 +115,24 @@
if (!activityId) {
return;
}
return pageStatisticsBiz({ ...order, page, limit, activityId });
const day = this.day;
return pageStatisticsBiz({
...order,
page,
limit,
activityId,
day
});
},
/* 更新选中数据 */
updateValue() {
this.$refs.table.reload({ page: 1 });
}
}
};
</script>
<style lang="scss" scoped>
.list-tool-divider {
padding: 0 12px;
}
</style>
@@ -8,6 +8,27 @@
:datasource="datasource"
size="mini"
>
<template v-slot:toolkit>
<div class="list-tool-item">
<el-select
v-model="day"
placeholder="全部日期"
clearable
class="ele-fluid"
@input="updateValue"
>
<el-option
v-for="item in data"
:key="item.value"
:value="item.value"
:label="item.name"
/>
</el-select>
</div>
<div class="list-tool-divider">
<el-divider direction="vertical" />
</div>
</template>
</ele-pro-table>
</el-card>
</template>
@@ -16,8 +37,10 @@
import { pageStatisticsConsultant } from '@/api/sylive/activity';
export default {
props: { data: [] },
data() {
return {
day: '',
// 表格列配置
columns: [
{
@@ -25,7 +48,7 @@
label: '顾问名称',
align: 'center',
showOverflowTooltip: true,
minWidth: 110
minWidth: 150
},
{
prop: 'browse',
@@ -49,7 +72,7 @@
align: 'center',
sortable: 'custom',
showOverflowTooltip: true,
minWidth: 110
minWidth: 100
},
{
prop: 'order',
@@ -57,7 +80,7 @@
align: 'center',
sortable: 'custom',
showOverflowTooltip: true,
minWidth: 110
minWidth: 100
},
{
prop: 'livePV',
@@ -71,7 +94,7 @@
label: '人均观看(分)',
align: 'center',
showOverflowTooltip: true,
minWidth: 110
minWidth: 100
}
]
};
@@ -83,8 +106,24 @@
if (!activityId) {
return;
}
return pageStatisticsConsultant({ ...order, page, limit, activityId });
const day = this.day;
return pageStatisticsConsultant({
...order,
page,
limit,
activityId,
day
});
},
/* 更新选中数据 */
updateValue() {
this.$refs.table.reload({ page: 1 });
}
}
};
</script>
<style lang="scss" scoped>
.list-tool-divider {
padding: 0 12px;
}
</style>
+6 -67
View File
@@ -346,71 +346,9 @@
</div>
</el-col>
</el-card>
<el-card
shadow="never"
header="区域统计"
body-style="padding: 11px;"
class="workplace-table-card"
>
<el-table :data="statistics.areaData">
<el-table-column
label="区域名称"
prop="areaName"
align="center"
show-overflow-tooltip
/>
<el-table-column
label="参与门店数"
prop="biz"
align="center"
show-overflow-tooltip
/>
<el-table-column
prop="consultant"
label="参与/全部顾问数"
align="center"
show-overflow-tooltip
/>
<el-table-column
prop="browse"
label="浏览数(人)"
align="center"
show-overflow-tooltip
/>
<el-table-column
prop="subscribe"
label="预约数(人)"
align="center"
show-overflow-tooltip
/>
<el-table-column
prop="watch"
label="观看数(人)"
align="center"
show-overflow-tooltip
/>
<el-table-column
prop="order"
label="订单数(单)"
align="center"
show-overflow-tooltip
/>
<el-table-column
prop="livePV"
label="观看数(人次)"
align="center"
show-overflow-tooltip
/>
<el-table-column
prop="watchDuration"
label="人均观看(分)"
align="center"
show-overflow-tooltip
/>
</el-table>
</el-card>
<biz-table />
<consultant-table />
<area-table :data="statistics.days" />
<biz-table :data="statistics.days" />
<consultant-table :data="statistics.days" />
</div>
</template>
@@ -428,6 +366,7 @@
import VChart from 'vue-echarts';
import 'echarts-wordcloud';
import { echartsMixin } from '@/utils/echarts-mixin';
import AreaTable from './components/area-table.vue';
import BizTable from './components/biz-table.vue';
import ConsultantTable from './components/consultant-table.vue';
@@ -435,7 +374,7 @@
export default {
name: 'SyliveActivityStatistics',
components: { VChart, BizTable, ConsultantTable },
components: { VChart, AreaTable, BizTable, ConsultantTable },
mixins: [echartsMixin(['funnelChart'])],
data() {
return {
@@ -444,7 +383,7 @@
activityId: null,
activityData1: { list: [], style: '' },
activityData2: { list: [], style: '' },
areaData: []
days: []
},
loading: true,
browseRank: { area: [], biz: [], consultant: [] },