Commit a2a83b08 by 前端

一轮测试代码优化

1 parent 22457473
# gh-hall # gh
基于 vue-cli4.0 + webpack 4 + vant ui + sass+ rem 适配方案+axios 封装,构建手机端模板脚手架 基于 vue-cli4.0 + webpack 4 + vant ui + sass+ rem 适配方案+axios 封装,构建手机端模板脚手架
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
"postcss-loader": "^6.2.0", "postcss-loader": "^6.2.0",
"sha1": "^1.1.1", "sha1": "^1.1.1",
"storejs": "^1.1.0", "storejs": "^1.1.0",
"v-fit-columns": "^0.2.0",
"vconsole": "^3.7.0", "vconsole": "^3.7.0",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-router": "^3.2.0", "vue-router": "^3.2.0",
......
/*
* @Description: 售后数据
* @Author: huyue
* @Date: 2022-06-28 16:55:48
* @LastEditors: huyue
* @LastEditTime: 2022-06-28 19:13:34
*/
// 品牌-售后档案客户
const getAfterSale = params => {
return window.$HTTP.get('brand/aftersale', params)
}
// 门店-售后档案客户
const getMerchantAfterSale = params => {
return window.$HTTP.get('merchant/aftersale', params)
}
// 获取品牌售后其他信息
const aftersaleother = params => {
return window.$HTTP.get('brand/aftersaleother', params)
}
// 获取门店品牌售后其他信息
const afterMerchantSaleother = params => {
return window.$HTTP.get('merchant/aftersaleother', params)
}
export default { getAfterSale, aftersaleother, afterMerchantSaleother, getMerchantAfterSale }
// window.$HTTP
export default {
/**获取品牌名称*/
getBrandList () {
return window.$HTTP.get('brand/getBrandName', {
req: {
queryTime: window.vm.getCurrentDate()
}
})
}
}
// 获取品牌年龄/性别/购车年限
const overalldistribution = params => {
return window.$HTTP.get('brand/overalldistribution', params)
}
// 获取门店年龄/性别/购车年限
const merchantOveralldistribution = params => {
return window.$HTTP.get('merchant/overalldistribution', params)
}
export default {
overalldistribution,
merchantOveralldistribution
}
// window.$HTTP
export default {
/** 获取品牌---总体模块信息(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus 的基础数据 和 前五排行/后五排行 ) */
getBrandOverallbase(req) {
return window.$HTTP.get('brand/overallbase', { req })
},
/* 获取品牌---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getBrandOveralltrend(req) {
return window.$HTTP.get('brand/overalltrend', { req })
},
/* 获取门店总体相关信息 */
getMerchantOverallbase(req) {
return window.$HTTP.get('merchant/overallbase', { req })
},
/* 获取门店---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getMerchantOveralltrend(req) {
return window.$HTTP.get('merchant/overalltrend', { req })
},
/**
* 获取接入门店数
*/
getMerchantNum(req) {
return window.$HTTP.get('brand/getMerchantNum', { req })
}
}
/*
* @Description: 获取品牌销售相关信息
* @Author: huyue
* @Date: 2022-06-28 14:58:30
* @LastEditors: huyue
* @LastEditTime: 2022-06-30 14:27:04
*/
// 集团相关
// 获取品牌销售模块其他相关信息
const getSales = params => {
return window.$HTTP.get('brand/saleothers', params)
}
// 获取品牌销售转化总数居
const saleTotal = params => {
return window.$HTTP.get('brand/saletotal', params)
}
// 获取品牌销售转化信息
const saleTrans = params => {
return window.$HTTP.get('brand/saleTrans', params)
}
// 获取品牌客流转化趋势
const saleTransTrend = params => {
return window.$HTTP.get('brand/saleTransTrend', params)
}
// 门店相关
// 获取门店销售转化总数据
const storeTotal = params => {
return window.$HTTP.get('merchant/saletotal', params)
}
// 获取门店销售转化相关信息
const storeSaleTrans = params => {
return window.$HTTP.get('merchant/saleTrans', params)
}
// 获取门店销售相关信息
const getMerchantSales = params => {
return window.$HTTP.get('merchant/sale', params)
}
// 获取门店客流转化趋势
const storeTransTrend = params => {
return window.$HTTP.get('merchant/saleTransTrend', params)
}
export default {
getSales,
saleTotal,
saleTrans,
storeTotal,
storeSaleTrans,
getMerchantSales,
saleTransTrend,
storeTransTrend
}
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
</div> </div>
</template> </template>
</el-table> </el-table>
<!-- hasPageComputed -->} <!-- hasPageComputed -->
<el-pagination <el-pagination
v-if='hasPageComputed' v-if='hasPageComputed'
@size-change='handleSizeChange' @size-change='handleSizeChange'
...@@ -827,14 +827,9 @@ export default { ...@@ -827,14 +827,9 @@ export default {
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
} }
/deep/ .el-table td.el-table__cell, .el-table th.el-table__cell.is-leaf{
</style> border-bottom: none;
<style lang='scss'>
.hightline {
/deep/ .el-table--enable-row-hover .el-table__body tr:hover > td {
background: red !important;
cursor: pointer;
}
} }
</style> </style>
...@@ -40,8 +40,9 @@ export default { ...@@ -40,8 +40,9 @@ export default {
<style lang='scss' scoped> <style lang='scss' scoped>
.static-rank { .static-rank {
margin: 0 3px; margin: 0 3px;
height: 200px;
.rank-wrap { .rank-wrap {
height: 9%;
display: grid; display: grid;
grid-template-columns: 8% 77% 15%; grid-template-columns: 8% 77% 15%;
color: #FFFFFF; color: #FFFFFF;
......
...@@ -26,6 +26,7 @@ export default { ...@@ -26,6 +26,7 @@ export default {
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;
padding: 1vh 24px 1.1vh; padding: 1vh 24px 1.1vh;
min-height: 94.15vh;
.top{ .top{
display: grid; display: grid;
grid-template-columns: 30% 70%; grid-template-columns: 30% 70%;
......
...@@ -25,8 +25,12 @@ ...@@ -25,8 +25,12 @@
placeholder='请选择品牌' placeholder='请选择品牌'
> >
<el-option v-for='(item,index) in brandOptionList' <el-option label='全部' value=''></el-option>
:key='index' :label='item.brandName' :value='item.brandName'></el-option> <el-option
v-for='(item,index) in brandOptionList'
:key='index'
:label='item.brandName'
:value='item.brandName'></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label='查询时间' size='mini'> <el-form-item label='查询时间' size='mini'>
...@@ -44,9 +48,12 @@ ...@@ -44,9 +48,12 @@
<el-form-item class='btn-wrap'> <el-form-item class='btn-wrap'>
<el-button @click='handleSearch' class='search-btn btn' size='mini'>查询</el-button> <el-button @click='handleSearch' class='search-btn btn' size='mini'>查询</el-button>
<el-button @click='reset' class='reset-btn btn' size='mini'>重置</el-button> <el-button @click='reset' class='reset-btn btn' size='mini'>重置</el-button>
</el-form-item>
<el-form-item class='btn-wrap btn-out-warp'>
<el-button @click='handleOutput' class='output-btn btn' size='mini'>导出</el-button> <el-button @click='handleOutput' class='output-btn btn' size='mini'>导出</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div class='view-content-table'> <div class='view-content-table'>
...@@ -92,8 +99,10 @@ ...@@ -92,8 +99,10 @@
width='170'> width='170'>
<template slot-scope='scope'> <template slot-scope='scope'>
<template v-if='scope.row.viewActivityNum'> <template v-if='scope.row.viewActivityNum'>
<div class='activity-Name' <div
v-for='(item,index) in scope.row.viewActivityNum.map(item => item.activityName)' :key='index'> class='activity-Name'
v-for='(item,index) in scope.row.viewActivityNum.map(item => item.activityName)'
:key='index'>
<span :title='item'>{{ item }}</span> <span :title='item'>{{ item }}</span>
</div> </div>
</template> </template>
...@@ -106,7 +115,8 @@ ...@@ -106,7 +115,8 @@
<div <div
@click="clickDialogTable(scope.row,'viewActivity',index)" @click="clickDialogTable(scope.row,'viewActivity',index)"
class='activity-Name' class='activity-Name'
v-for='(item,index) in scope.row.viewActivityNum.map(item => item.activityNum)' :key='index'> v-for='(item,index) in scope.row.viewActivityNum.map(item => item.activityNum)'
:key='index'>
{{ item }} {{ item }}
</div> </div>
</template> </template>
...@@ -127,8 +137,10 @@ ...@@ -127,8 +137,10 @@
width='170'> width='170'>
<template slot-scope='scope'> <template slot-scope='scope'>
<template v-if='scope.row.forwardActivityNum?.length > 0'> <template v-if='scope.row.forwardActivityNum?.length > 0'>
<div class='activity-Name' <div
v-for='(item,index) in scope.row.forwardActivityNum.map(item => item.activityName)' :key='index'> class='activity-Name'
v-for='(item,index) in scope.row.forwardActivityNum.map(item => item.activityName)'
:key='index'>
<span :title='item'>{{ item }}</span> <span :title='item'>{{ item }}</span>
</div> </div>
</template> </template>
...@@ -139,9 +151,11 @@ ...@@ -139,9 +151,11 @@
label='数量'> label='数量'>
<template slot-scope='scope'> <template slot-scope='scope'>
<template v-if='scope.row.forwardActivityNum?.length > 0'> <template v-if='scope.row.forwardActivityNum?.length > 0'>
<div class='activity-Name' <div
class='activity-Name'
@click="clickDialogTable(scope.row,'forwardActivity',index)" @click="clickDialogTable(scope.row,'forwardActivity',index)"
v-for='(item,index) in scope.row.forwardActivityNum.map(item => item.activityNum)' :key='index'> v-for='(item,index) in scope.row.forwardActivityNum.map(item => item.activityNum)'
:key='index'>
{{ item }} {{ item }}
</div> </div>
</template> </template>
...@@ -164,8 +178,10 @@ ...@@ -164,8 +178,10 @@
label='活动名称'> label='活动名称'>
<template slot-scope='scope'> <template slot-scope='scope'>
<template v-if='scope.row.clueActivityNum?.length > 0'> <template v-if='scope.row.clueActivityNum?.length > 0'>
<div class='activity-Name' <div
v-for='(item,index) in scope.row.clueActivityNum.map(item => item.activityName)' :key='index'> class='activity-Name'
v-for='(item,index) in scope.row.clueActivityNum.map(item => item.activityName)'
:key='index'>
<span :title='item'>{{ item }}</span> <span :title='item'>{{ item }}</span>
</div> </div>
</template> </template>
...@@ -177,7 +193,8 @@ ...@@ -177,7 +193,8 @@
<template slot-scope='scope'> <template slot-scope='scope'>
<template v-if='scope.row.clueActivityNum?.length > 0'> <template v-if='scope.row.clueActivityNum?.length > 0'>
<div class='activity-Name' <div
class='activity-Name'
@click="clickDialogTable(scope.row,'clueActivity',index)" @click="clickDialogTable(scope.row,'clueActivity',index)"
v-for='(item,index) in scope.row.clueActivityNum.map(item => item.activityNum)' v-for='(item,index) in scope.row.clueActivityNum.map(item => item.activityNum)'
:key='index'> :key='index'>
...@@ -204,8 +221,10 @@ ...@@ -204,8 +221,10 @@
label='活动名称'> label='活动名称'>
<template slot-scope='scope'> <template slot-scope='scope'>
<template v-if=' scope.row.activationActivityNum?.length > 0'> <template v-if=' scope.row.activationActivityNum?.length > 0'>
<div class='activity-Name' <div
v-for='(item,index) in scope.row.activationActivityNum.map(item => item.activityName)' :key='index'> class='activity-Name'
v-for='(item,index) in scope.row.activationActivityNum.map(item => item.activityName)'
:key='index'>
<span :title='item'>{{ item }}</span> <span :title='item'>{{ item }}</span>
</div> </div>
</template> </template>
...@@ -216,9 +235,11 @@ ...@@ -216,9 +235,11 @@
label='数量'> label='数量'>
<template slot-scope='scope'> <template slot-scope='scope'>
<template v-if='scope.row.activationActivityNum?.length > 0'> <template v-if='scope.row.activationActivityNum?.length > 0'>
<div class='activity-Name' <div
class='activity-Name'
@click="clickDialogTable(scope.row,'activationActivity',index)" @click="clickDialogTable(scope.row,'activationActivity',index)"
v-for='(item,index) in scope.row.activationActivityNum.map(item => item.activityNum)' :key='index'> v-for='(item,index) in scope.row.activationActivityNum.map(item => item.activityNum)'
:key='index'>
{{ item }} {{ item }}
</div> </div>
</template> </template>
...@@ -233,7 +254,6 @@ ...@@ -233,7 +254,6 @@
</el-table> </el-table>
</div> </div>
</div> </div>
</template> </template>
...@@ -309,7 +329,7 @@ export default { ...@@ -309,7 +329,7 @@ export default {
return params return params
}, },
handleOutput() { handleOutput() {
let params = this.getSearchForm() const params = this.getSearchForm()
this.api.renewal.exportApi(params).then(res => { this.api.renewal.exportApi(params).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.$Utils.exportFn(res.data.dataList[0].url) this.$Utils.exportFn(res.data.dataList[0].url)
...@@ -369,7 +389,8 @@ export default { ...@@ -369,7 +389,8 @@ export default {
background: #1D1C1C; background: #1D1C1C;
margin: 8px 0; margin: 8px 0;
height: 56px; height: 56px;
width: 100%;
position: relative;
.demo-form-inline { .demo-form-inline {
height: 76px; height: 76px;
display: flex; display: flex;
...@@ -384,7 +405,10 @@ export default { ...@@ -384,7 +405,10 @@ export default {
background: #353535; background: #353535;
border: none; border: none;
} }
.btn-out-warp{
right: 0;
position: absolute;
}
.btn-wrap { .btn-wrap {
.btn { .btn {
border: none; border: none;
...@@ -400,6 +424,7 @@ export default { ...@@ -400,6 +424,7 @@ export default {
} }
.output-btn { .output-btn {
//margin-left:1%;
background: #353535; background: #353535;
} }
} }
...@@ -450,7 +475,6 @@ export default { ...@@ -450,7 +475,6 @@ export default {
cursor: pointer; cursor: pointer;
} }
//去掉外边框线 //去掉外边框线
/deep/ .el-table--border { /deep/ .el-table--border {
border: 1px solid #606266; border: 1px solid #606266;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// 本地环境配置 // 本地环境配置
module.exports = { module.exports = {
envVersion: 'trial', envVersion: 'trial',
title: '广汇汽车服务', title: '广汇续保权益数据看板',
request: { request: {
// baseURL: 'http://192.168.3.126:8081', // 本地测试项目地址, // baseURL: 'http://192.168.3.126:8081', // 本地测试项目地址,
// baseURL: 'http://192.168.1.160:8081', // 本地开发项目地址, // baseURL: 'http://192.168.1.160:8081', // 本地开发项目地址,
......
module.exports = { module.exports = {
title: '广汇汽车服务', title: '广汇续保权益数据看板',
request: { request: {
// baseURL: 'http://ghwx.cgacar.com/scrm-wechat' // 生产 // baseURL: 'http://ghwx.cgacar.com/scrm-wechat' // 生产
baseURL: 'http://cim.chinagrandauto.com/scrm-wechat' // 生产 baseURL: 'http://cim.chinagrandauto.com/scrm-wechat' // 生产
......
...@@ -18,6 +18,7 @@ import api from './api' ...@@ -18,6 +18,7 @@ import api from './api'
import { Util } from './common/util' import { Util } from './common/util'
import Request from './api/request' import Request from './api/request'
import { fetchConfig, cfg } from '@/config' import { fetchConfig, cfg } from '@/config'
import Plugin from 'v-fit-columns';
import '@/assets/css/index.scss' import '@/assets/css/index.scss'
import './utils/util' import './utils/util'
import 'components' import 'components'
...@@ -41,6 +42,7 @@ fetchConfig(!isMock).then(res => { ...@@ -41,6 +42,7 @@ fetchConfig(!isMock).then(res => {
// 设置 js中可以访问 $cdn // 设置 js中可以访问 $cdn
Vue.use(cfg) Vue.use(cfg)
Vue.use(ElementUI); Vue.use(ElementUI);
Vue.use(Plugin);
// if (res.vconsole) new VConsole() // if (res.vconsole) new VConsole()
window.$HTTP = new Request(res.request) window.$HTTP = new Request(res.request)
Vue.prototype.api = api Vue.prototype.api = api
......
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,7 @@ export default {
{ {
label: '员工', label: '员工',
prop: 'staff', prop: 'staff',
width: 120, width: 220,
line: 1, line: 1,
addHtml: 'staff' addHtml: 'staff'
}, },
......
<!--
* @Description: 售后客户价值分析
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-29 19:47:17
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>售后客户价值分析</span>
</div>
<template v-if="barData.length > 0">
<div class="analyze-content" :style="{ height: height - 5 + 'vh' }">
<div class="content-left">
<div id="analyzeBar" style="height: 100%"></div>
</div>
<div class="contetn-right">
<pie-chart :id="chart.id" :list="analyzeData" :height="height - 5 + 'vh'" :radius="chart.radius" :size="chart.size"></pie-chart>
</div>
</div>
</template>
<div class="empty" :style="{ height: height - 4.9 + 'vh' }" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</template>
<script>
import * as echarts from 'echarts'
import datas from '../../utils/data'
import { changeMixin } from '../../mixins/index'
export default {
name: 'Analyze',
props: ['height'],
mixins: [changeMixin],
data() {
return {
analyzeData: [],
chart: {
id: 'analyzePie',
radius: ['60%', '78%'],
size: '0.8vw'
},
barChart: '',
option: {},
barData: [],
key: '重要价值',
isBrand: false,
brandName: '',
currentData: {}
}
},
mounted() {},
methods: {
getChart() {
this.barChart = echarts.init(document.getElementById('analyzeBar'))
// resize
window.addEventListener('resize', () => {
this.barChart.resize()
})
this.option = {
tooltip: {
trigger: 'axis',
showContent: false,
axisPointer: {
type: 'shadow',
shadowStyle: {
color: 'rgba(235,96,1,0.30'
}
},
borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)',
confine: true,
textStyle: {
color: '#FFFFFF',
fontSize: 8
}
},
grid: {
left: '3%',
right: '4%',
top: '2%',
bottom: '2%',
containLabel: true
},
yAxis: {
type: 'category',
data: datas.Customer.valueType.value.map(item => item.name).reverse(),
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
}
},
xAxis: {
type: 'value',
splitLine: {
show: false
},
axisLabel: {
show: false
}
},
series: [
{
// data: [120, 200, 150, 80, 70, 110, 130, 300],
data: this.barData.reverse(),
type: 'bar',
barWidth: 18,
itemStyle: {
normal: {
label: {
show: true,
position: 'center',
textStyle: {
fontSize: '12',
color: '#fff',
height: '18',
padding: [1, 0, 0, 0]
}
},
color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
{
offset: 0,
color: '#F79902'
},
{
offset: 1,
color: '#EB6001'
}
])
}
}
}
]
}
this.barChart.clear()
this.barChart.setOption(this.option)
this.chartAction()
this.barChart.getZr().on('mousemove', params => {
const pointInPixel = [params.offsetX, params.offsetY]
const pointInGrid = this.barChart.convertFromPixel({ seriesIndex: 0 }, pointInPixel)
const yIndex = pointInGrid[1]
const op = this.barChart.getOption()
const name = op.yAxis[0].data[yIndex]
this.initPieData(name)
this.currentData = {
name,
dataIndex: yIndex
}
})
// 鼠标划入
// this.barChart.on('mouseup', data => {
// this.initPieData(data.name)
// })
this.barChart.on('globalout', () => {
this.chartAction(this.currentData.dataIndex)
this.initPieData(this.currentData.name)
})
},
getValueType() {
let analyzeApi = !this.isBrand ? 'aftersaleother' : 'afterMerchantSaleother'
const params = {
req: {
queryItem: 'valueanalyse',
// queryTime: "2022-06-23",
queryTime: this.getCurrentDate(),
queryType: this.watchReportParams.reportType
}
}
if (this.isBrand) params.req.brandName = this.brandName
this.api.afterSales[analyzeApi](params).then(res => {
this.analyzeData = []
this.barData = []
if (res.data.dataList.length > 0) {
const reqData = JSON.parse(res.data.dataList[0].distribution)
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
this.barData = []
for (let i in reqData) {
this.barData.push(reqData[i])
}
this.$nextTick(() => {
this.getChart()
this.initPieData(this.key)
})
}
})
},
initPieData(name) {
this.analyzeData = []
datas.Customer.valueType.value.map(item => {
if (item.name == name) {
const distributionRank = this.distributionRank[item.value]
Object.keys(distributionRank).forEach(item => {
this.analyzeData.push({
name: item,
value: distributionRank[item]
})
})
}
})
},
init(newVal) {
this.isBrand = false
if (newVal && newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getValueType()
},
chartAction(index = 7) {
this.barChart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: index
})
}
}
}
</script>
<style lang="scss" scoped>
.title {
padding: 1vh 8px;
height: 4vh;
}
.analyze-content {
display: flex;
padding: 0 8px;
box-sizing: border-box;
.bg {
background-color: #262525;
}
.content-left {
flex: 1;
height: 100%;
}
.contetn-right {
width: 50%;
margin-left: 8px;
}
}
</style>
<!--
* @Description: 有效客户
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:21:17
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>有效客户</span>
</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="efficientChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt" :queryType="queryType"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'Efficient',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
dataList: []
}
},
mounted() { },
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'valid',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].num ? this.numAddSymbol(topTempList[item].num) : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].num ? this.numAddSymbol(lastTempList[item].num) : '- -'
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(4) || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 售后档案客户
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:21:39
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>售后档案客户</span>
</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="fileChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt" :queryType="queryType"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'File',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
dataList: []
}
},
mounted() {
// this.dealList()
},
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'file',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].num ? this.numAddSymbol(topTempList[item].num) : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].num ? this.numAddSymbol(lastTempList[item].num) : '- -'
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(4) || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 首保回店
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:21:59
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>首保回店</span>
</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart
v-else
ref="lineChartRef"
domId="firstChart"
:dataList.sync="dataList"
:storeOrBrandTxt="storeOrBrandTxt"
:tooltipFormatterObj="tooltipFormatterObj"
:queryType="queryType"
></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'First',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
tooltipFormatterObj: [
{
label: '回店数',
attrName: 'num'
},
{
label: '回店率',
attrName: 'rate',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
],
dataList: []
}
},
mounted() {},
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'first',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(4) + '%' : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(4) + '%' : '- -'
})
})
this.dataList.push({
num: item.num || 0,
rate: item.rate.toFixed(4) || 0,
hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(4) || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 客户保持
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:22:21
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>客户保持</span>
</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="keepChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt" :tooltipFormatterObj="tooltipFormatterObj" :queryType="queryType"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'Keep',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
dataList: [],
tooltipFormatterObj: [
{
label: '保持数',
attrName: 'num'
},
{
label: '保持率',
attrName: 'rate',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
},
mounted() {},
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'retain',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(4) + '%' : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(4) + '%' : '- -'
})
})
this.dataList.push({
num: item.num || 0,
rate: item.rate.toFixed(4) || 0,
hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(4) || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 客户流失
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:22:34
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>客户流失</span>
</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="lostChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt" :queryType="queryType" :tooltipFormatterObj="tooltipFormatterObj"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'Lost',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
dataList: [],
tooltipFormatterObj: [
{
label: '流失数',
attrName: 'num'
},
{
label: '流失率',
attrName: 'rate',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
},
mounted() {},
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'loss',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(4) + '%' : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(4) + '%' : '- -'
})
})
this.dataList.push({
num: item.num || 0,
rate: item.rate.toFixed(4) || 0,
hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(4) || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 售后车辆里程
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-07-11 11:00:49
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>售后车辆里程</span>
</div>
<template v-if="mileageData.length > 0">
<div class="flex container">
<pie-chart :id="chart.id" :list="mileageData" :height="height - 5 + 'vh'" :radius="chart.radius" @pieAction="pieAction" :size="chart.size"></pie-chart>
<div class="ranking-container">
<div class="ranking-title">
<div class="ranking-title-brand">{{ this.$store.state.app.reportParams.brand ? '门店' : '品牌' }}</div>
<div>客户数</div>
</div>
<div class="ranking">
<div class="brand flex" v-for="(item, index) in rankingData.slice(0, 5)" :key="index">
<span class="brand-num">{{ index + 1 }}</span>
<marquee class="marquee" :direction="directionTimer" :delay="delayTimer" :text="item.brand" />
<span>{{ item.value }}</span>
</div>
</div>
</div>
</div>
</template>
<div class="empty" :style="{ height: height - 4.9 + 'vh' }" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</template>
<script>
import { changeMixin } from '../../mixins/index'
export default {
name: 'Mileage',
props: ['height'],
mixins: [changeMixin],
data() {
return {
mileageData: [],
distributionRank: '',
rankingData: [],
chart: {
id: 'mileagePie',
radius: ['60%', '78%'],
size: '0.8vw'
},
delayTimer: 3000,
directionTimer: 3000,
brandList: this.list,
isBrand: false,
brandName: ''
}
},
mounted() {
this.getValueType()
},
methods: {
getValueType() {
let mileageApi = !this.isBrand ? 'aftersaleother' : 'afterMerchantSaleother'
const params = {
req: {
queryItem: 'mileage',
queryTime: this.getCurrentDate(),
queryType: this.watchReportParams.reportType
}
}
if (this.isBrand) params.req.brandName = this.brandName
this.api.afterSales[mileageApi](params).then(res => {
this.mileageData = []
this.rankingData = []
if (res.data.dataList.length > 0) {
let distribution = JSON.parse(res.data.dataList[0].distribution)
// console.log()
const keys = Object.keys(distribution)
keys.forEach((item, index) => {
this.mileageData.push({
name: item,
value: distribution[item]
})
})
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
}
})
},
pieAction(data) {
let distributionRank = this.distributionRank[data.name]
this.rankingData = []
for (const key in distributionRank) {
this.rankingData.push({
brand: key,
value: distributionRank[key]
})
}
this.rankingData.sort(function (a, b) {
return b.value - a.value //倒序
})
},
init(newVal) {
this.isBrand = false
if (newVal && newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getValueType()
}
}
}
</script>
<style lang="scss" scoped>
.title {
padding: 1vh 8px;
height: 4vh;
}
.ranking-container {
flex: 1;
margin-left: 0.6vw;
box-sizing: border-box;
height: 21.5vh;
width: 10.8vw;
background: #262525;
.ranking-title {
padding: 0.5vh 1.5vw 0.4vh 1.5vw;
font-size: 0.833vw;
color: #eb6001;
letter-spacing: 0;
font-weight: 400;
background: rgba(53, 53, 53, 0.6);
display: flex;
align-items: center;
div {
white-space: nowrap;
}
.ranking-title-brand {
width: 4.9vw;
margin-right: 0.6vw;
}
}
.ranking {
font-size: 0.694vw;
color: #ffffff;
letter-spacing: 0;
font-weight: 400;
padding: 0.1vh 0 0.4vh 8px;
height: 18.5vh;
box-sizing: border-box;
.brand {
line-height: 3.6vh;
.brand-num {
color: #606266;
margin-right: 8px;
display: inline-block;
width: 0.3vw;
text-align: center;
}
.marquee {
width: 4.9vw;
height: 3.6vh;
margin-right: 0.6vw;
}
}
}
}
</style>
<!--
* @Description: 定保回店
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:23:11
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>定保回店</span>
</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart
v-else
ref="lineChartRef"
domId="sadayasuChart"
:dataList.sync="dataList"
:storeOrBrandTxt="storeOrBrandTxt"
:tooltipFormatterObj="tooltipFormatterObj"
:queryType="queryType"
></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'Sadayasu',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
tooltipFormatterObj: [
{
label: '回店数',
attrName: 'num'
},
{
label: '回店率',
attrName: 'rate',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
],
dataList: []
}
},
mounted() {},
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'regular',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(4) + '%' : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(4) + '%' : '- -'
})
})
this.dataList.push({
num: item.num || 0,
rate: item.rate.toFixed(4) || 0,
hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(4) || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 客户年龄分布
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 16:45:11
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>客户年龄分布</span>
</div>
<div class="container flex">
<template v-if="clientData.length > 0">
<pie-chart :id="chart.id" :list="clientData" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height:12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { clientMixin } from '../../mixins/index'
export default {
name: 'Age',
mixins: [clientMixin],
data() {
return {
type: 'age',
chart: {
id: 'age-pie'
}
}
}
}
</script>
<!--
* @Description: 客户购车年限
* @Author: huyue
* @Date: 2022-06-23 15:06:32
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:03:19
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>客户购车年限</span>
</div>
<div class="container flex">
<template v-if="clientData.length > 0">
<pie-chart :id="chart.id" :list="clientData" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height:12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { clientMixin } from '../../mixins/index'
export default {
name: 'BuyCar',
mixins: [clientMixin],
data() {
return {
type: 'buycarRange',
chart: {
id: 'car-pie'
}
}
}
}
</script>
<!--
* @Description: 客户性别
* @Author: huyue
* @Date: 2022-06-23 15:05:57
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:02:58
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>客户性别</span>
</div>
<div class="container flex">
<template v-if="clientData.length > 0">
<pie-chart :id="chart.id" :list="clientData" :colors="chart.colors" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height: 12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { clientMixin } from '../../mixins/index'
export default {
name: 'Sex',
mixins: [clientMixin],
data() {
return {
type: 'gender',
chart: {
id: 'sex-pie',
colors: ['#EB6001', '#BF98FF', '#FF6E76']
}
}
}
}
</script>
<template> <template>
<div class='login-container'> <div class='login-container'>
<div class='login-top flex'> <div class='login-top flex'>
<div class='view-title user-select flex'>广汇集团客户池数据大屏</div> <div class='view-title user-select flex'>广汇续保数字化数据看板</div>
</div> </div>
<div class='login-center flex'> <div class='login-center flex'>
...@@ -65,21 +65,13 @@ export default { ...@@ -65,21 +65,13 @@ export default {
} }
</script> </script>
<style lang='scss'>
.authorization-wrap {
/deep/ .el-input_inner {
background: linear-gradient(269deg, #ff660000 0%, #fb6900c7 51%, #FA6A00 98%);
border: none;
opacity: 0.67;
color: #fff
}
}
</style>
<style lang='scss' scoped> <style lang='scss' scoped>
.user-icon { .user-icon {
width: 80px; width: 80px;
height: 80px; height: 80px;
margin-right: 8px;
} }
.login-container { .login-container {
...@@ -101,7 +93,7 @@ export default { ...@@ -101,7 +93,7 @@ export default {
color: transparent; color: transparent;
background: linear-gradient(left, #e60115 10%, #eb6001 25%, #f5aa01 50%, #fdf006 100%); background: linear-gradient(left, #e60115 10%, #eb6001 25%, #f5aa01 50%, #fdf006 100%);
-webkit-background-clip: text; -webkit-background-clip: text;
font-size: 18px; font-size: 30px;
font-weight: 600; font-weight: 600;
margin-top: -9vh; margin-top: -9vh;
...@@ -119,14 +111,18 @@ export default { ...@@ -119,14 +111,18 @@ export default {
.login-center { .login-center {
margin: 0 auto; margin: 0 auto;
width: 75%; width: 75%;
height: 68vh; height: 70%;
background-image: url('./../../assets/images/login/login-center.png'); background-image: url('./../../assets/images/login/login-center.png');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
justify-content: center; justify-content: center;
align-items: center; //align-items: center;
position: relative;
.authorization-wrap { .authorization-wrap {
margin-bottom: 10%;
.password-wrap{
margin-top: 20px;
}
.user-input{ .user-input{
/deep/ .el-input__inner { /deep/ .el-input__inner {
background: linear-gradient(269deg, #ff660000 0%, #fb6900c7 51%, #FA6A00 98%); background: linear-gradient(269deg, #ff660000 0%, #fb6900c7 51%, #FA6A00 98%);
...@@ -142,6 +138,10 @@ export default { ...@@ -142,6 +138,10 @@ export default {
} }
.login-btn { .login-btn {
position: absolute;
bottom: 10%;
width: 312.71px;
height: 89.52px;
background-image: url('./../../assets/images/login/login-bottom.png'); background-image: url('./../../assets/images/login/login-bottom.png');
background-repeat: no-repeat; background-repeat: no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
......
<!--
* @Description: 客户级别
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:13:49
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>客户级别</span>
</div>
<div class="flex container">
<template v-if="salesData.length > 0">
<pie-chart :id="chart.id" :list="salesData" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height:12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { salesMixin } from '../../mixins/index'
export default {
name: 'CustomerCategory',
mixins: [salesMixin],
data() {
return {
type: 'customerlevel',
chart: {
id: 'customerCategory-pie'
}
}
},
methods: {
// pieAction(data) {
// console.log(data,'客户级别')
// console.log(this.typeRanking)
// this.brandList = this.typeRanking&&this.typeRanking[data.name]&&Object.keys(this.typeRanking[data.name])
// }
}
}
</script>
<!--
* @Description: 进店类型
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:13:03
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>进店类型</span>
</div>
<div class="flex container">
<template v-if="salesData.length > 0">
<pie-chart :id="chart.id" :list="salesData" :colors="chart.colors" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height: 12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { salesMixin } from '../../mixins/index'
export default {
name: 'EnterCategory',
mixins: [salesMixin],
data() {
return {
type: 'entertype',
chart: {
id: 'enterCategory-pie',
colors: ['#F5AA01', '#FF6E76', '#4FA0FF']
}
}
},
}
</script>
<!--
* @Description: 客流转化
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-07-07 17:27:53
-->
<template>
<div>
<div v-show="hasData" class="flow-box">
<div class="flow-left">
<div class="title title-icon">
<span class="icon"></span>
<span>客流转化</span>
</div>
<div class="chart-box">
<div id="flow" :style="{ height: height - 4.1 + 'vh' }"></div>
</div>
</div>
<div class="flow-right">
<!-- <div class="ranking-value">{{currentName}}{{ isBrand ? '门店' : '品牌' }}排名</div> -->
<div class="ranking-title">
<div @click="changeRank(1)" :style="{'background-color': isActive == 1 ? bgColor : ''}" :class="isActive == 1 ? 'active' : ''">{{currentName}}前5{{ isBrand ? '门店' : '品牌' }}</div>
<div @click="changeRank(2)" :style="{'background-color': isActive == 2 ? bgColor : ''}" :class="isActive == 2 ? 'active' : ''">{{currentName}}后5{{ isBrand ? '门店' : '品牌' }}</div>
</div>
<div class="ranking-content">
<div class="ranking-item" v-for="(item, index) in flowData" :key="index">
<span class="ranking-sort">{{ index + 1 }}</span>
<span class="ranking-name">
<marquee :direction="directionTimer" :delay="delayTimer" :text="item.brand" />
</span>
<span class="ranking-text">{{ item.value }}</span>
</div>
</div>
</div>
</div>
<div v-show="!hasData">
<div class="title title-icon">
<span class="icon"></span>
<span>客流转化</span>
</div>
<div class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
import datas from '../../utils/data'
import utils from '../../utils/util'
import * as echarts from 'echarts'
export default {
name: 'Flow',
mixins: [changeMixin],
props: ['height'],
data() {
return {
directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer,
flowData: [],
isActive: 1,
funnelData: [
{
name: '客流',
type: 'enter',
value: 100
},
{
name: '留档',
type: 'stayfile',
value: 80
},
{
name: '试驾',
type: 'test',
value: 60
},
{
name: '订单',
type: 'placeorder',
value: 40
},
{
name: '成交',
type: 'success',
value: 20
}
],
option: {},
echartsFunnel: '',
hasData: true,
paramsData: {},
topList: [],
lastList: [],
isBrand: false,
currentName: '',
bgColor: '#BF98FF',
colorList: ['#BF98FF', '#E60115', '#4FA0FF', '#EB6001', '#F5AA01']
}
},
mounted() {
this.echartsFunnel = echarts.init(document.getElementById('flow'))
// resize
window.addEventListener('resize', () => {
this.echartsFunnel.resize()
})
},
methods: {
init(val) {
this.paramsData = this.$store.state.app.reportParams
this.isBrand = this.paramsData.brand && this.paramsData.brand.name
this.getSaletTotal(this.paramsData)
this.getSaleTrans(this.paramsData)
},
getSaletTotal(val) {
const params = {
req: {
queryTime: this.getCurrentDate(),
queryType: val.reportType
}
}
var brandName = val.brand ? val.brand.name : ''
this.api.sales[brandName ? 'storeTotal' : 'saleTotal'](params)
.then(res => {
if (res.code === '0') {
if (res.data.dataList.length) {
res.data.dataList[0].num.forEach((item, index) => {
this.funnelData[index].num = item
})
this.hasData = !res.data.dataList[0].num.every(i => i == 0)
if (this.hasData) this.draw()
} else {
this.hasData = false
}
}
})
.catch(() => {
this.hasData = false
})
},
draw() {
this.option = {
tooltip: {
trigger: 'item',
backgroundColor: 'rgba(68,68,68,0.8)',
formatter: e => {
return `${e.data.name}: ${e.data.num}`
},
textStyle: {
color: '#fff',
fontSize: 8
},
borderWidth: 0
},
color: this.colorList,
series: [
{
name: '漏斗图',
type: 'funnel',
left: 0,
top: 8,
bottom: 8,
width: '100%',
minSize: '30%',
maxSize: '100%',
sort: 'descending',
gap: 1,
label: {
show: true,
position: 'inside',
color: '#fff'
},
labelLine: {
length: 10,
lineStyle: {
width: 1,
type: 'solid'
}
},
itemStyle: {
borderColor: '#fff',
borderWidth: 0
},
emphasis: {
label: {
fontSize: 20
}
},
data: this.funnelData
// ]
}
]
}
this.echartsFunnel.setOption(this.option)
// this.echartsFunnel.getZr.on('mouseover', params => {
// })
this.echartsFunnel.on(
'mouseover',
utils.debounce(data => {
console.log(data)
this.getSaleTrans(this.paramsData, data.data.type, data.data.name, data.dataIndex)
}),
500
)
// this.echartsFunnel.on('globalout', () => {
// })
},
getSaleTrans(val, queryItem = 'enter', name = '客流', index = 0) {
const params = {
req: {
queryItem: queryItem,
queryTime: this.getCurrentDate(),
queryType: val.reportType
}
}
let api = 'saleTrans'
if (val.brand && val.brand.name) {
params.req.brandName = '品牌1'
api = 'storeSaleTrans'
}
this.api.sales[api](params).then(res => {
this.topList = []
this.lastList = []
if (res.data.dataList.length) {
let { topList, lastList } = res.data.dataList[0]
topList = topList ? JSON.parse(topList) : []
lastList = lastList ? JSON.parse(lastList) : []
for (const key in topList) {
this.topList.push({
brand: key,
value: topList[key]
})
}
for (const key in lastList) {
this.lastList.push({
brand: key,
value: lastList[key]
})
}
}
this.flowData = this.isActive == 1 ? this.topList : this.lastList
this.currentName = name
this.bgColor = this.colorList[index]
})
},
// 切换品牌排序
changeRank(val) {
this.isActive = val
this.flowData = val == 1 ? this.topList : this.lastList
}
}
}
</script>
<style lang="scss" scoped>
.flow-box {
display: flex;
padding: 0 8px 1vh 0;
box-sizing: border-box;
.flow-left {
padding-bottom: 0.9vh;
width: 50%;
.title {
text-align: left;
}
}
.flow-right {
flex: 1;
color: #fff;
font-size: 10px;
padding: 1vh 0 0.9vh 20px;
.ranking-title {
display: flex;
width: 100%;
margin-right: 20px;
cursor: default;
.active {
background-color: #eb6001;
color: #fff;
}
div {
width: 50%;
text-align: center;
background-color: #353535;
line-height: 2.4vh;
}
}
.ranking-content {
background-color: #262525;
padding: 0.4vh 0;
height: 11vh;
}
.ranking-item {
display: flex;
width: 100%;
align-items: center;
line-height: 2.2vh;
height: 2.2vh;
.ranking-sort {
display: inline-block;
width: 0.3vw;
text-align: center;
}
.ranking-name {
width: calc(100% - 33% - 28px);
}
.ranking-text {
width: 33%;
padding-left: 4px;
// width: calc(100% - 50px);
}
span {
display: inline-block;
&:first-child {
padding: 0 8px;
}
}
}
}
}
.chart-box {
width: 100%;
box-sizing: border-box;
// height: 11.7vh;
padding: 0 25px;
}
</style>
<!--
* @Description: 信息来源
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:13:23
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>信息来源</span>
</div>
<div class="flex container">
<template v-if="salesData.length > 0">
<pie-chart :id="chart.id" :list="salesData" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height: 12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { salesMixin } from '../../mixins/index'
export default {
name: 'InfoFrom',
mixins: [salesMixin],
data() {
return {
type: 'infosource',
chart: {
id: 'infoFrom-pie',
}
}
},
}
</script>
<!--
* @Description: 转化趋势
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-07-06 15:07:56
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>转化趋势</span>
</div>
<div v-show="hasData" class="linetrend-box">
<div id="lineTrend" :style="{ height: height - 4.1 + 'vh' }"></div>
</div>
<div v-show="!hasData" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</template>
<script>
import * as echarts from 'echarts'
import { changeMixin } from '@/mixins'
export default {
name: 'Trend',
props: ['height'],
mixins: [changeMixin],
data() {
return {
echartsTrend: {},
option: {},
dataList: [],
paramsData: [],
list: ['enter', 'stayfile', 'test', 'placeorder', 'success'],
hasData: true,
colorList: ['#BF98FF', '#E60115', '#4FA0FF', '#EB6001', '#F5AA01']
}
},
mounted() {
this.echartsTrend = echarts.init(document.getElementById('lineTrend'))
window.addEventListener('resize', () => {
this.echartsTrend.resize()
})
},
methods: {
init(val) {
this.getChartData(val)
},
getChartData(val) {
var params = {
req: {
// queryItem: 'enter',
querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: val.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
const api = brandName ? 'storeTransTrend' : 'saleTransTrend'
const p = []
this.list.forEach((i, idx) => {
p[idx] = new Promise((resolve, reject) => {
params.req.queryItem = i
this.api.sales[api](params)
.then(res => {
resolve(res.data.dataList)
})
.catch(err => {
reject(err)
})
})
})
Promise.all([p[0], p[1], p[2], p[3], p[4]])
.then(results => {
this.dataList = results
const flag = results.map(item => {
if (item.length) {
return item.map(i => i.num).some(j => j != 0)
} else {
return false
}
})
this.$set(this, 'hasData', !flag.every(i => !i))
this.draw(val.reportType)
})
.catch(() => {
this.hasData = false
})
},
draw(reportType) {
this.option = {
tooltip: {
trigger: 'axis',
show: true,
borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)',
confine: true,
textStyle: {
color: '#FFFFFF',
fontSize: 8
},
extraCssText: 'width: 80px;',
formatter: e => {
const index = e[0].dataIndex
const date = this.dataList[0][index].statDate
var txt = date + '<br />'
e.forEach(item => {
item.marker = '<span style=\"display:inline-block;margin-right:4px;border-radius:5px;width:5px;height:5px;background-color:' + this.colorList[item.componentIndex] + ';\"></span>'
txt = txt + item.marker + item.seriesName + ':' + item.value + '<br />'
})
return txt
}
},
color: ['#BF98FF', '#E60115', '#4FA0FF', '#EB6001', '#F5AA01'],
grid: {
left: '3%',
right: '4%',
top: '10%',
bottom: '10%',
containLabel: true
},
xAxis: {
type: 'category',
axisLabel: {
color: '#606266',
fontSize: 10
},
data: []
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: 'rgba(96,98,102,0.2)'
}
},
splitNumber: 4
},
series: [
{
name: '客流',
type: 'line',
symbol: 'circle',
smooth: true,
showSymbol: false,
data: []
},
{
name: '留档',
type: 'line',
symbol: 'circle',
smooth: true,
showSymbol: false,
data: []
},
{
name: '试驾',
type: 'line',
symbol: 'circle',
smooth: true,
showSymbol: false,
data: []
},
{
name: '订单',
type: 'line',
symbol: 'circle',
showSymbol: false,
smooth: true,
data: []
},
{
name: '成交',
type: 'line',
symbol: 'circle',
showSymbol: false,
smooth: true,
data: []
}
]
}
const xData = []
this.option.xAxis.data = xData
this.dataList[0].map(e => {
const month = new Date(e.statDate).getMonth()
xData.push(reportType == 0 ? `${month == 0 ? '1月' : `${Number(month) + 1}月`}` : e.statDate)
})
this.list.forEach((i, index) => {
this.option.series[index].data = this.dataList[index].map(item => item.num)
})
this.echartsTrend.setOption(this.option)
this.chartAction()
this.echartsTrend.on('globalout', () => {
this.chartAction()
})
},
chartAction(type) {
this.echartsTrend.dispatchAction({
type: type || 'showTip',
seriesIndex: 0,
dataIndex: this.dataList[0].length - 1
})
}
}
}
</script>
<style lang="scss" scoped>
.linetrend-box {
width: 100%;
overflow: hidden;
}
.trend-dot {
display: inline-block;
width: 2px;
height: 2px;
border-radius: 50%;
background-color: #BF98FF;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!