管理端 商户数据统计

pull/17/head
Jruome 2023-06-14 17:28:10 +08:00
parent 1389bb9b91
commit d415963aa3
6 changed files with 457 additions and 27 deletions

View File

@ -0,0 +1,12 @@
import request from '@/utils/request'
// 数据统计(全部)
export function statisticsAll(query) {
return request({
url: '/system/statement/statisticsAll',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,20 @@
import request from '@/utils/request'
// 数据统计(根据租户统计)
export function statisticsData(query) {
return request({
url: '/system/statement/statistics',
method: 'get',
params: query
})
}
// 导出数据统计(根据租户统计) Excel
export function statement(query) {
return request({
url: '/system/statement/statement-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}

View File

@ -1,5 +1,30 @@
<template>
<div class="dashboard-editor-container">
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="100px">
<el-form-item label="快速查看" class="width100" prop="type">
<el-radio-group v-model="queryParams.type" type="button" class="mr20" size="small" >
<el-radio-button v-for="(item,i) in lookList" :label=i+1 :key="i">{{item.name}}</el-radio-button>
</el-radio-group>
</el-form-item>
<el-form-item label="选择日期" class="width100" prop="dateLimit">
<el-date-picker @change="onchangeTime" v-model="queryParams.dateLimit" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" size="small" type="datetimerange" start-placeholder=""
end-placeholder="结束时间" placement="bottom-end" placeholder="自定义时间" style="width: 220px;" ></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<div class="statistics">
<div v-for="(item,index) in list" :key="index" :class="[item.class,'statistics_item']">
<span>{{item.name}}</span>
<span v-if="index<3">{{item.value}}</span>
<span v-else>{{item.value}} </span>
</div>
</div>
</div>
<!-- <div class="dashboard-editor-container">-->
<!-- <panel-group @handleSetLineChartData="handleSetLineChartData" />-->
@ -26,7 +51,7 @@
<!-- </el-row>-->
</div>
<!-- </div>-->
</template>
<script>
@ -35,7 +60,10 @@ import LineChart from './dashboard/LineChart'
import RaddarChart from './dashboard/RaddarChart'
import PieChart from './dashboard/PieChart'
import BarChart from './dashboard/BarChart'
import creatComment from "@/views/mall/product/comment/creatComment.vue";
import {
statisticsAll
} from '@/api/index';
const lineChartData = {
newVisitis: {
expectedData: [100, 120, 161, 134, 105, 160, 165],
@ -58,6 +86,7 @@ const lineChartData = {
export default {
name: 'Index',
components: {
creatComment,
PanelGroup,
LineChart,
RaddarChart,
@ -66,10 +95,47 @@ export default {
},
data() {
return {
lineChartData: lineChartData.newVisitis
lineChartData: lineChartData.newVisitis,
queryParams: {
},
list:[],
lookList:[{name:'今日'},{name:'上周'},{name:'上月'},{name:'全部'}],
statisticsList:[{name:'总销售金额',class:'totalMoney'},{name:'总订单数量(单)',class:'totalNum'},{name:'总退款金额',class:'totalWithdrawMoney'},{name:'240档订单数量',class:'threeTotalNum'},{name:'400档订单数量',class:'twoTotalNum'},{name:'640档订单数量',class:'oneTotalNum'}],
}
},
created() {
this.getList();
},
methods: {
onchangeTime(value){
this.queryParams.startTime = value[0]
this.queryParams.endTime = value[1]
},
/** 查询列表 */
getList() {
this.loading = true;
//
statisticsAll(this.queryParams).then(response => {
this.statisticsList.forEach((item,index) =>{
for (let key in response.data){
if(item.class === key){
item.value = response.data[key]
}
}
})
this.list = this.statisticsList
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams ={};
this.handleQuery();
},
handleSetLineChartData(type) {
this.lineChartData = lineChartData[type]
}
@ -78,6 +144,49 @@ export default {
</script>
<style lang="scss" scoped>
.statistics{
width: 100%;
height: 30%;
display: flex;
justify-content: space-around;
flex-wrap: wrap;
.statistics_item{
border-radius: 10px;
width: 14%;
min-height: 90px;
margin: 10px 8%;
font-size: 20px;
color: #fff;
display: flex;
flex-direction: column;
justify-content: center;
word-wrap: break-word;
span:nth-of-type(1){
margin-left: 20px;
}
span:nth-of-type(2){
margin-left: 40px;
}
}
.totalMoney{
background: rgb(77,157,255);
}
.totalNum{
background: rgb(95,212,89);
}
.totalWithdrawMoney{
background: rgb(171,109,234);
}
.threeTotalNum{
background: rgb(255,154,1);
}
.twoTotalNum{
background: rgb(10,193,224);
}
.oneTotalNum{
background: rgb(10,196,160);
}
}
.dashboard-editor-container {
padding: 32px;
background-color: rgb(240, 242, 245);

View File

@ -0,0 +1,271 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="110px">
<el-form-item label="商铺名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="选择日期" class="width100" prop="dateLimit">
<el-date-picker @change="onchangeTime" v-model="queryParams.dateLimit" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss" size="small" type="datetimerange" start-placeholder=""
end-placeholder="结束时间" placement="bottom-end" placeholder="自定义时间" style="width: 220px;" @keyup.enter.native="handleQuery"></el-date-picker>
</el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery" >搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"-->
<!-- v-hasPermi="['member:promoter:create']">新增-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button type="info" icon="el-icon-upload2" size="mini" @click="handleImport"-->
<!-- v-hasPermi="['member:promoter:export']">导入-->
<!-- </el-button>-->
<!-- </el-col>-->
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="编号" align="center" type="index"/>
<el-table-column label="商铺名称" align="center" prop="tenantName"/>
<el-table-column label="销售金额" align="center" prop="totalMoney"/>
<el-table-column label="订单数量" align="center" prop="totalNum"/>
<el-table-column label="退款金额" align="center" prop="totalWithdrawMoney"/>
<el-table-column label="240档订单数量" align="center" prop="threeTotalNum"/>
<el-table-column label="400档订单数量" align="center" prop="twoTotalNum"/>
<el-table-column label="640档订单数量" align="center" prop="oneTotalNum"/>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
<!-- 用户导入对话框 -->
<el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
<el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<!-- <div class="el-upload__tip" slot="tip">-->
<!-- <el-checkbox v-model="upload.updateSupport" /> 是否更新已经存在的用户数据-->
<!-- </div>-->
<span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;"
@click="importTemplate">下载模板
</el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm" :loading="submitLoading" :disabled="submitLoading"> </el-button>
<el-button @click="upload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
statement,
statisticsData
} from '@/api/statistics/merchantData';
import {getBaseHeader} from '@/utils/request';
import {DICT_TYPE} from '@/utils/dict';
import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
import ImageUpload from '@/components/ImageUpload/index.vue';
export default {
name: 'Promoter',
computed: {
DICT_TYPE() {
return DICT_TYPE
}
},
components: {
ImageUpload,
Treeselect
},
data() {
const validatePass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请输入密码'));
} else {
if (this.updatePasswordForm.checkPass !== '') {
this.$refs.updatePasswordForm.validateField('checkPass');
}
callback();
}
};
const validateCheckPass = (rule, value, callback) => {
if (value === '') {
callback(new Error('请再次输入密码'));
} else if (value !== this.updatePasswordForm.password) {
callback(new Error('两次输入密码不一致!'));
} else {
callback();
}
};
return {
//
loading: true,
submitLoading: false,
deptOptions: undefined,
//
exportLoading: false,
//
showSearch: true,
//
total: 0,
// 广
list: [],
//
title: '',
//
open: false,
//
upload: {
//
open: false,
//
title: '推广员导入',
//
isUploading: false,
//
updateSupport: 0,
//
headers: getBaseHeader(),
//
url: process.env.VUE_APP_BASE_API + '/admin-api/member/promoter/import'
},
updatePasswordForm: {},
//
queryParams: {
pageNo: 1,
pageSize: 8,
},
//
form: {
},
};
},
created() {
this.getList();
},
methods: {
onchangeTime(value){
this.queryParams.startTime = value[0]
this.queryParams.endTime = value[1]
},
handleChange(value){
this.form.tenantId = value.tenantId
},
/** 查询列表 */
getList() {
this.loading = true;
//
statisticsData(this.queryParams).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
handleUpdatePassword(row) {
this.updatePasswordForm = {}
this.updatePassword.show = true
this.updatePassword.userId = row.userId
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
deptId: undefined,
userId: undefined,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.queryParams.startTime = undefined;
this.queryParams.endTime = undefined;
this.handleQuery();
},
/** 导出按钮操作 */
handleExport() {
//
let params = {...this.queryParams};
params.pageSize = 999;
this.$modal.confirm('是否确认导出商户分销数据项?').then(() => {
this.exportLoading = true;
return statement(params);
}).then(response => {
this.$download.excel(response, '分销数据.xls');
this.exportLoading = false;
}).catch(() => {
});
},
/** 导入按钮操作 */
handleImport() {
this.upload.title = '推广员导入';
this.upload.open = true;
},
// /** */
// importTemplate() {
// importTemplate().then(response => {
// this.$download.excel(response, '广.xls');
// });
// },
//
handleFileUploadProgress(event, file, fileList) {
this.upload.isUploading = true;
},
//
handleFileSuccess(response, file, fileList) {
if (response.code !== 0) {
this.$modal.msgError(response.msg)
return;
}
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
//
let data = response.data;
let text = '创建成功数量:' + data.createUsernames.length;
for (const username of data.createUsernames) {
text += '<br />&nbsp;&nbsp;&nbsp;&nbsp;' + username;
}
text += '<br />创建失败数量:' + Object.keys(data.failureUsernames).length;
for (const username in data.failureUsernames) {
text += '<br />&nbsp;&nbsp;&nbsp;&nbsp;' + username + '' + data.failureUsernames[username];
}
this.$alert(text, '导入结果', {dangerouslyUseHTMLString: true});
this.getList();
},
//
submitFileForm() {
this.$refs.upload.submit();
}
}
};
</script>

View File

@ -56,16 +56,16 @@
<image src="@/static/images/wecheat.png" ></image>
</view>
</view>
<view class="protocol-text">
<text>
<image src="/static/images/trade.jpg" mode=""></image>
电子证照中心
</text>
<text @click="handleTrade">
ICP备案号渝ICP备2022012409号-1
</text>
<text class="text">Copyright@2022-2023创盈云网络cyywl.top版权所有</text>
</view>
<view class="protocol-text">
<text @click="handleTrade('证照')">
<image src="/static/images/trade.jpg" mode=""></image>
电子证照中心
</text>
<text @click="handleTrade('备案')">
ICP备案号渝ICP备2022012409号-1
</text>
<text class="text">Copyright@2022-2023创盈云网络cyywl.top版权所有</text>
</view>
<!-- <view class="hot">
<view class="contain"></view>
<view class="top">
@ -371,11 +371,19 @@
})
},
methods: {
handleTrade() {
uni.navigateTo({
url: '/pages/business_license/index'
})
},
handleTrade(value) {
switch (value) {
case '证照':
uni.navigateTo({
url: '/pages/business_license/index'
})
break;
case '备案':
window.location.href = 'https://beian.miit.gov.cn/'
break;
}
},
handleCustomer(value){
switch (value) {
case '电话客服':
@ -755,6 +763,8 @@
</style>
<style lang="scss">
.box {
overflow: auto;
padding-bottom: 6%;
.header {
position: relative;
width: 100%;
@ -886,7 +896,7 @@
// border-radius: 20rpx;
.customer{
margin: 3% 44rpx;
height: 240rpx;
height: 310rpx;
image{
width: 100%;
height: 100%;

View File

@ -51,11 +51,11 @@
<view class="text">我已阅读并同意 <span class="link" @click="onLinkUserPrivacy"></span></view>
</div>
<view class="protocol-text">
<text>
<text @click="handleTrade('证照')">
<image src="/static/images/trade.jpg" mode=""></image>
电子证照中心
</text>
<text @click="handleTrade">
<text @click="handleTrade('备案')">
ICP备案号渝ICP备2022012409号-1
</text>
<text class="text">Copyright@2022-2023创盈云网络cyywl.top版权所有</text>
@ -121,10 +121,18 @@
},
methods: {
handleTrade() {
uni.navigateTo({
url: '/pages/business_license/index'
})
handleTrade(value) {
switch (value) {
case '证照':
uni.navigateTo({
url: '/pages/business_license/index'
})
break;
case '备案':
window.location.href = 'https://beian.miit.gov.cn/'
break;
}
},
onLinkUserPrivacy() {
uni.navigateTo({