Commit 3c378b32 by 李伟康

Merge branch 'dev_v1.0.0' of http://192.168.3.233:8090/gh/data-view into dev_v1.0.0

2 parents f30c05cc 8539ac6e
...@@ -8,14 +8,19 @@ ...@@ -8,14 +8,19 @@
import Request from '../request' import Request from '../request'
var request = new Request() var request = new Request()
// 售后档案客户 // 品牌-售后档案客户
const getAfterSale = params => { const getAfterSale = params => {
return request.get('brand/aftersale', params) return request.get('brand/aftersale', params)
} }
// 门店-售后档案客户
const getMerchantAfterSale = params => {
return request.get('merchant/aftersale', params)
}
// 获取品牌售后其他信息 // 获取品牌售后其他信息
const aftersaleother = params => { const aftersaleother = params => {
return request.get('brand/aftersaleother', params) return request.get('brand/aftersaleother', params)
} }
export default { getAfterSale, aftersaleother } export default { getAfterSale, getMerchantAfterSale, aftersaleother }
...@@ -33,11 +33,15 @@ const storeTotal = params => { ...@@ -33,11 +33,15 @@ const storeTotal = params => {
const storeSaleTrans = params => { const storeSaleTrans = params => {
return request.get('merchant/saleTrans', params) return request.get('merchant/saleTrans', params)
} }
// 获取门店销售相关信息
const getMerchantSales = params => {
return request.get('merchant/sale', params)
}
export default { export default {
getSales, getSales,
saleTotal, saleTotal,
saleTrans, saleTrans,
storeTotal, storeTotal,
storeSaleTrans storeSaleTrans,
getMerchantSales
} }
<template> <template>
<div class="line-box"> <div class="line-box">
<div id="line-chart" class="line-chart"></div> <div :id="domId" class="line-chart"></div>
<div class="rank-box"> <div class="rank-box">
<div class="rank-title-block"> <div class="rank-title-block">
<p :class="[ 'rank-title', rankFlag == 'top' ? 'rank-title-active' : '' ]" @click="handleRankChange('top')">前5{{ storeOrBrandTxt }}</p> <p :class="[ 'rank-title', rankFlag == 'top' ? 'rank-title-active' : '' ]" @click="handleRankChange('top')">前5{{ storeOrBrandTxt }}</p>
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
</div> </div>
<div class="rank-block"> <div class="rank-block">
<div class="rank-line" v-for="(item, index) in rankList" :key="index"> <div class="rank-line" v-for="(item, index) in rankList" :key="index">
<marquee class="line-item" :direction="directionTimer" :delay="delayTimer" :text="item.name"></marquee> <marquee class="line-item" :direction="directionTimer" :delay="delayTimer" :text="item.label"></marquee>
<p class="line-item txt-orange">{{ item.num }}</p> <p class="line-item txt-orange">{{ item.value }}</p>
</div> </div>
</div> </div>
</div> </div>
...@@ -23,9 +23,13 @@ import getLineOptions from './lineOptions' ...@@ -23,9 +23,13 @@ import getLineOptions from './lineOptions'
export default { export default {
name: 'LineChart', name: 'LineChart',
props: { props: {
domId: {
type: String,
default: 'line-chart'
},
storeOrBrandTxt: { storeOrBrandTxt: {
type: String, type: String,
default: '门店' default: '品牌'
}, },
dataList: { dataList: {
type: Array, type: Array,
...@@ -55,15 +59,8 @@ export default { ...@@ -55,15 +59,8 @@ export default {
}, },
mounted() { mounted() {
this.lineDom = document.getElementById('line-chart') this.lineDom = document.getElementById(this.domId)
this.echartsLine = echarts.init(this.lineDom) this.echartsLine = echarts.init(this.lineDom)
this.chartBindEvent()
},
watch: {
dataList() {
this.drawLine()
}
}, },
methods: { methods: {
...@@ -114,7 +111,7 @@ export default { ...@@ -114,7 +111,7 @@ export default {
}, },
getRankList(idx, attrName = 'topList') { getRankList(idx, attrName = 'topList') {
this.rankList = this.dataList[idx][attrName] this.$set(this, 'rankList', this.dataList[idx][attrName])
}, },
drawLine() { drawLine() {
...@@ -124,6 +121,21 @@ export default { ...@@ -124,6 +121,21 @@ export default {
this.echartsLine.setOption(this.lineOptions) this.echartsLine.setOption(this.lineOptions)
// // 鼠标划入
// this.echartsLine.on('click', data => {
// clearInterval(this.timer)
// this.chartAction('downplay')
// })
// // 鼠标划出
// this.echartsLine.on('mouseout', () => {
// this.moveAttr.dataIndex = -1
// this.autoMove()
// })
// console.log(this.echartsLine)
this.chartBindEvent()
this.getRankList(0) this.getRankList(0)
this.autoMove() this.autoMove()
......
...@@ -56,10 +56,14 @@ export default { ...@@ -56,10 +56,14 @@ export default {
watch: { watch: {
list: { list: {
handler(newVal) { handler(newVal) {
this.initData() if (newVal.length > 0) {
this.draw() this.initData()
this.$nextTick(() => {
this.draw()
})
}
}, },
immediate:false immediate: true
} }
}, },
...@@ -71,19 +75,22 @@ export default { ...@@ -71,19 +75,22 @@ export default {
methods: { methods: {
//初始化数据 //初始化数据
initData() { initData() {
let { list, viewData, keys } = this let { list, keys } = this
this.viewData = []
list.forEach(item => { list.forEach(item => {
viewData.push({ this.viewData.push({
name: item[keys[0]], name: item[keys[0]],
value: item[keys[1]] value: item[keys[1]]
}) })
}) })
}, },
draw() { draw() {
if (this.mTime) clearInterval(this.mTime)
this.echartsPie = echarts.init(document.getElementById(this.id)) this.echartsPie = echarts.init(document.getElementById(this.id))
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.echartsPie.resize() this.echartsPie.resize()
}) })
// 指定图表的配置项和数据 // 指定图表的配置项和数据
this.option = { this.option = {
// tooltip: { // tooltip: {
...@@ -91,29 +98,6 @@ export default { ...@@ -91,29 +98,6 @@ export default {
// }, // },
color: this.colors, color: this.colors,
title: {
text: this.text,
// 副标题
subtext: this.subtext,
// 主副标题间距
itemGap: 5,
x: 'center',
y: 'center',
top: '50',
// 主标题样式
textStyle: {
fontSize: '12',
color: '#ffffff',
textAlign: 'center',
fontWeight: 500
},
// 副标题样式
subtextStyle: {
fontSize: '10',
fontWeight: '400',
color: '#606266'
}
},
series: [ series: [
{ {
name: '客户年龄分布', name: '客户年龄分布',
...@@ -139,16 +123,16 @@ export default { ...@@ -139,16 +123,16 @@ export default {
labelLine: { labelLine: {
show: false show: false
}, },
animationType: 'scale',
animationEasing: 'elasticOut',
animationDurationUpdate: 3000,
animationTypeUpdate: 'transition',
animation: true,
data: this.viewData data: this.viewData
} }
] ]
} }
this.echartsPie.clear()
this.mainValue = 0
this.numDesc = ''
this.setAnamiteText()
this.echartsPie.setOption(this.option) this.echartsPie.setOption(this.option)
this.mTime = setInterval(this.pieActive, 3000) this.mTime = setInterval(this.pieActive, 3000)
// 鼠标划出 // 鼠标划出
this.echartsPie.on('mouseout', () => { this.echartsPie.on('mouseout', () => {
...@@ -161,7 +145,6 @@ export default { ...@@ -161,7 +145,6 @@ export default {
this.setAnamiteText() this.setAnamiteText()
// 停止定时器,清除之前的高亮 // 停止定时器,清除之前的高亮
clearInterval(this.mTime) clearInterval(this.mTime)
console.log('mouseover')
this.currentIndex = data.dataIndex this.currentIndex = data.dataIndex
this.highlightPie() this.highlightPie()
this.emitEvent(data.data) this.emitEvent(data.data)
...@@ -212,7 +195,7 @@ export default { ...@@ -212,7 +195,7 @@ export default {
.pie-box { .pie-box {
background: #262525; background: #262525;
position: relative; position: relative;
flex:1; flex: 1;
.center-content { .center-content {
position: absolute; position: absolute;
top: 50%; top: 50%;
......
...@@ -46,8 +46,7 @@ export default { ...@@ -46,8 +46,7 @@ export default {
font-size: 10px; font-size: 10px;
color: #eb6001; color: #eb6001;
font-weight: 400; font-weight: 400;
text-align: center; padding: 0.4vh 0 0.4vh 20%;
padding: 0.4vh 0;
box-sizing: border-box; box-sizing: border-box;
} }
.ranking { .ranking {
...@@ -61,10 +60,9 @@ export default { ...@@ -61,10 +60,9 @@ export default {
.brand-num { .brand-num {
color: #606266; color: #606266;
margin-right: 0.6vw; margin-right: 0.6vw;
max-width:20px;
} }
.marquee { .marquee {
width: calc(100% - 1.5vw); width: 80%;
height: 1.9vh; height: 1.9vh;
} }
} }
......
// import{changeMixin} from "./changeMixin" import { changeMixin } from './index'
export default { export default {
data() { data() {
return { return {
now: new Date().format('yyyy-MM-dd'),
clientData: [], clientData: [],
brandList: [], brandList: [],
distributionRank: '' distributionRank: '',
isBrand: false,
brandName: ''
} }
}, },
// mixins: [changeMixin], mixins: [changeMixin],
created() { created() {
this.getClientData() this.getClientData()
}, },
methods: { methods: {
getClientData() { getClientData() {
let clientApi = this.isBrand ? 'overalldistribution' : 'merchantOveralldistribution'
const params = { const params = {
req: { req: {
corporateGroupName: '集团1', corporateGroupName: '集团1',
queryItem: this.type, queryItem: this.type,
// queryTime: this.now, // queryTime: this.getCurrentDate,
queryTime: '2022-06-23', queryTime: '2022-06-23',
queryType: 0 queryType: this.watchReportParams.reportType
} }
} }
this.api.customer.overalldistribution(params).then(res => { if (this.isBrand) params.req.brandName = this.brandName
let distribution = JSON.parse(res.data.dataList[0].distribution) this.api.customer[clientApi](params).then(res => {
const keys = Object.keys(distribution) if (res.data.dataList.length > 0) {
keys.forEach((item, index) => { let distribution = JSON.parse(res.data.dataList[0].distribution)
this.clientData.push({ const keys = Object.keys(distribution)
name: item, keys.forEach((item, index) => {
value: distribution[item] this.clientData.push({
name: item,
value: distribution[item]
})
}) })
}) this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank) } else {
this.clientData = []
}
}) })
}, },
init(newVal){ init(newVal) {
// console.log(newVal,1111111111111111111111111) console.log(newVal, 99999999999999999)
this.isBrand = false
if (newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getClientData()
} }
} }
} }
import { changeMixin } from './index'
export default { export default {
data() { data() {
return { return {
now: new Date().format('yyyy-MM-dd'),
salesData: [], salesData: [],
brandList: [], brandList: [],
typeRanking: '' typeRanking: '',
isBrand: false,
brandName: ''
} }
}, },
mixins: [changeMixin],
created() { created() {
this.getSalesData() this.getSalesData()
}, },
methods: { methods: {
getSalesData() { getSalesData() {
let salesApi = this.isBrand ? 'getSales' : 'getMerchantSales'
const params = { const params = {
req: { req: {
corporateGroupName: '集团1', corporateGroupName: '集团1',
queryItem: this.type, queryItem: this.type,
// queryTime: this.now, // queryTime: this.getCurrentDate,
queryTime: '2022-06-23', queryTime: '2022-06-23',
queryType: 0 queryType: this.watchReportParams.reportType
} }
} }
this.api.sales.getSales(params).then(res => { if (this.isBrand) params.req.brandName = this.brandName
let typeNum = JSON.parse(res.data.dataList[0].typeNum) this.api.sales[salesApi](params).then(res => {
Object.keys(typeNum).forEach((item, index) => { if (res.data.dataList.length > 0) {
this.salesData.push({ let typeNum = JSON.parse(res.data.dataList[0].typeNum)
name: item, Object.keys(typeNum).forEach((item, index) => {
value: typeNum[item] this.salesData.push({
name: item,
value: typeNum[item]
})
}) })
})
this.typeRanking = JSON.parse(res.data.dataList[0].typeRanking) this.typeRanking = JSON.parse(res.data.dataList[0].typeRanking)
}else{
this.salesData = []
}
}) })
},
init(newVal) {
this.isBrand = false
if (newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getSalesData()
} }
} }
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-06-23 17:38:33 * @Date: 2022-06-23 17:38:33
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-06-27 14:42:09 * @LastEditTime: 2022-06-29 19:47:34
*/ */
const DefaultData = { const DefaultData = {
defaultLineHeight: '19.8', defaultLineHeight: '19.8',
...@@ -83,14 +83,14 @@ const Customer = { ...@@ -83,14 +83,14 @@ const Customer = {
valueType: { valueType: {
name: '价值类型', name: '价值类型',
value: [ value: [
{ name: '一般发展', value: 37 }, { name: '重要价值', value: 1 },
{ name: '一般价值', value: 37 }, { name: '重要发展', value: 2 },
{ name: '一般挽留', value: 37 }, { name: '重要召回', value: 3 },
{ name: '重要挽留', value: 37 }, { name: '重要挽留', value: 4 },
{ name: '重要价值', value: 37 }, { name: '一般价值', value: 5 },
{ name: '重要发展', value: 37 }, { name: '一般发展', value: 6 },
{ name: '一般保持', value: 37 }, { name: '一般召回', value: 7 },
{ name: '重要保持', value: 37 } { name: '一般挽留', value: 8 }
] ]
} }
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-06-23 15:05:21 * @Date: 2022-06-23 15:05:21
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-06-29 11:30:36 * @LastEditTime: 2022-06-29 19:47:17
--> -->
<template> <template>
<div> <div>
...@@ -61,7 +61,7 @@ export default { ...@@ -61,7 +61,7 @@ export default {
}, },
yAxis: { yAxis: {
type: 'category', type: 'category',
data: datas.Customer.valueType.value.map(item => item.name), data: datas.Customer.valueType.value.map(item => item.name).reverse(),
splitLine: { splitLine: {
show: false show: false
}, },
...@@ -84,7 +84,7 @@ export default { ...@@ -84,7 +84,7 @@ export default {
series: [ series: [
{ {
// data: [120, 200, 150, 80, 70, 110, 130, 300], // data: [120, 200, 150, 80, 70, 110, 130, 300],
data: this.barData, data: this.barData.reverse(),
type: 'bar', type: 'bar',
barWidth: 12, barWidth: 12,
itemStyle: { itemStyle: {
...@@ -115,6 +115,10 @@ export default { ...@@ -115,6 +115,10 @@ export default {
] ]
} }
this.barChart.setOption(this.option) this.barChart.setOption(this.option)
// 鼠标划入
this.barChart.on('mouseover', data => {
this.initPieData(data.name)
})
}, },
getValueType() { getValueType() {
const params = { const params = {
...@@ -137,7 +141,7 @@ export default { ...@@ -137,7 +141,7 @@ export default {
this.initPieData() this.initPieData()
}) })
}, },
initPieData() { initPieData(name) {
const distributionRank = this.distributionRank[this.key] const distributionRank = this.distributionRank[this.key]
Object.keys(distributionRank).forEach(item => { Object.keys(distributionRank).forEach(item => {
this.analyzeData.push({ this.analyzeData.push({
...@@ -161,7 +165,7 @@ export default { ...@@ -161,7 +165,7 @@ export default {
flex: 1; flex: 1;
} }
.contetn-right { .contetn-right {
width: 43%; width: 50%;
margin-left: 8px; margin-left: 8px;
} }
} }
......
...@@ -8,7 +8,15 @@ ...@@ -8,7 +8,15 @@
<template> <template>
<div> <div>
<div class="title">有效客户</div> <div class="title">有效客户</div>
<LineChart @handleRankChange="handleRankChange" :rankList="rankList"></LineChart> <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"></LineChart>
</div>
</div> </div>
</template> </template>
...@@ -25,48 +33,77 @@ export default { ...@@ -25,48 +33,77 @@ export default {
}, },
data() { data() {
return { return {
rankList: [ isEmpty: true,
{ storeOrBrandTxt: '品牌',
name: '奥迪', dataList: []
num: 599604
},
{
name: '宝马',
num: 599604
},
{
name: '现代起亚',
num: 599604
},
{
name: '奔驰',
num: 599604
},
{
name: '沃尔沃',
num: 599604
}
]
} }
}, },
mounted() { mounted() { },
// this.dealList()
},
methods: { methods: {
init(val) { init(val) {
}, this.isEmpty = true
// 折线图数据 var params = {
getList() { }, req: {
// 排名数据 // corporateGroupName: '广汇',
getRankList() { }, corporateGroupName: '集团1',
dealList() { queryItem: 'valid',
this.rankList.forEach(item => { querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
item.num = this.numAddSymbol(item.num) queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: val.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
}
}) })
}, },
handleRankChange(value) { dealList(list) {
console.log(value) 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: this.numAddSymbol(topTempList[item])
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item])
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate || 0,
trate: item.trate || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
} }
} }
} }
</script> </script>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<div v-if="isEmpty" class="empty"> <div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" /> <img src="../../assets/images/empty.png" alt="" />
</div> </div>
<LineChart v-else :dataList="dataList"></LineChart> <LineChart v-else ref="lineChartRef" domId="fileChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt"></LineChart>
</div> </div>
</div> </div>
</template> </template>
...@@ -34,6 +34,7 @@ export default { ...@@ -34,6 +34,7 @@ export default {
data() { data() {
return { return {
isEmpty: true, isEmpty: true,
storeOrBrandTxt: '品牌',
dataList: [] dataList: []
} }
}, },
...@@ -42,29 +43,36 @@ export default { ...@@ -42,29 +43,36 @@ export default {
}, },
methods: { methods: {
init(val) { init(val) {
console.log(val) // console.log(val)
this.isEmpty = true
var params = { var params = {
req: { req: {
corporateGroupName: '广汇', // corporateGroupName: '广汇',
corporateGroupName: '集团1',
queryItem: 'file', queryItem: 'file',
querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12), querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1), queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: val.reportType || 0 queryType: val.reportType || 0
} }
} }
this.api.afterSales.getAfterSale(params).then(res => { 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 var { code, data } = res
switch (+code) { switch (+code) {
case 0: case 0:
this.dataList = [] this.dataList = []
console.log(data.dataList.map(item => item.num).every(item => item !== 0)) if (!data.dataList.map(item => item.num).every(item => item === 0)) {
if (data.dataList.map(item => item.num).every(item => item !== 0)) {
this.isEmpty = false this.isEmpty = false
this.dealList(data.dataList) this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
} }
break break
// default:
// alert(message)
} }
}) })
}, },
...@@ -72,8 +80,8 @@ export default { ...@@ -72,8 +80,8 @@ export default {
var topList = [] var topList = []
var lastList = [] var lastList = []
list.forEach(item => { list.forEach(item => {
const topTempList = JSON.parse(item.topList) const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = JSON.parse(item.lastList) const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = [] topList = []
lastList = [] lastList = []
Object.keys(topTempList).forEach(item => { Object.keys(topTempList).forEach(item => {
......
...@@ -8,11 +8,101 @@ ...@@ -8,11 +8,101 @@
<template> <template>
<div> <div>
<div class="title">首保回店</div> <div class="title">首保回店</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"></LineChart>
</div>
</div> </div>
</template> </template>
<script> <script>
import { changeMixin } from '@/mixins'
export default { export default {
name: 'First' name: 'First',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
dataList: []
}
},
mounted() { },
methods: {
init(val) {
this.isEmpty = true
var params = {
req: {
// corporateGroupName: '广汇',
corporateGroupName: '集团1',
queryItem: 'first',
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 ? '门店' : '品牌'
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: this.numAddSymbol(topTempList[item].num)
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item].num)
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate || 0,
trate: item.trate || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
} }
</script> </script>
...@@ -8,11 +8,101 @@ ...@@ -8,11 +8,101 @@
<template> <template>
<div> <div>
<div class="title">客户保持</div> <div class="title">客户保持</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"></LineChart>
</div>
</div> </div>
</template> </template>
<script> <script>
import { changeMixin } from '@/mixins'
export default { export default {
name: 'Keep' name: 'Keep',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
dataList: []
}
},
mounted() { },
methods: {
init(val) {
this.isEmpty = true
var params = {
req: {
// corporateGroupName: '广汇',
corporateGroupName: '集团1',
queryItem: 'retain',
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 ? '门店' : '品牌'
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: this.numAddSymbol(topTempList[item])
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item])
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate || 0,
trate: item.trate || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
} }
</script> </script>
...@@ -8,11 +8,101 @@ ...@@ -8,11 +8,101 @@
<template> <template>
<div> <div>
<div class="title">客户流失</div> <div class="title">客户流失</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"></LineChart>
</div>
</div> </div>
</template> </template>
<script> <script>
import { changeMixin } from '@/mixins'
export default { export default {
name: 'Lost' name: 'Lost',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
dataList: []
}
},
mounted() { },
methods: {
init(val) {
this.isEmpty = true
var params = {
req: {
// corporateGroupName: '广汇',
corporateGroupName: '集团1',
queryItem: 'loss',
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 ? '门店' : '品牌'
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: this.numAddSymbol(topTempList[item])
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item])
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate || 0,
trate: item.trate || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
} }
</script> </script>
...@@ -8,11 +8,101 @@ ...@@ -8,11 +8,101 @@
<template> <template>
<div> <div>
<div class="title">定保回店</div> <div class="title">定保回店</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"></LineChart>
</div>
</div> </div>
</template> </template>
<script> <script>
import { changeMixin } from '@/mixins'
export default { export default {
name: 'Sadayasu' name: 'Sadayasu',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
dataList: []
}
},
mounted() { },
methods: {
init(val) {
this.isEmpty = true
var params = {
req: {
// corporateGroupName: '广汇',
corporateGroupName: '集团1',
queryItem: 'regular',
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 ? '门店' : '品牌'
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: this.numAddSymbol(topTempList[item].num)
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: this.numAddSymbol(lastTempList[item].num)
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate || 0,
trate: item.trate || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
} }
</script> </script>
...@@ -12,8 +12,13 @@ ...@@ -12,8 +12,13 @@
<span>客户年龄分布</span> <span>客户年龄分布</span>
</div> </div>
<div class="container flex"> <div class="container flex">
<pie-chart :id="chart.id" :list="clientData" @pieAction="pieAction"></pie-chart> <template v-if="clientData.length > 0">
<ran-king :list="brandList"></ran-king> <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>
</div> </div>
</template> </template>
...@@ -25,16 +30,16 @@ export default { ...@@ -25,16 +30,16 @@ export default {
mixins: [clientMixin], mixins: [clientMixin],
data() { data() {
return { return {
type:'age', type: 'age',
chart: { chart: {
id: 'age-pie' id: 'age-pie'
} }
} }
}, },
methods:{ methods: {
pieAction(data){ pieAction(data) {
this.brandList=Object.keys(this.distributionRank[data.name]) this.brandList = Object.keys(this.distributionRank[data.name])
}, }
} }
} }
</script> </script>
...@@ -11,9 +11,14 @@ ...@@ -11,9 +11,14 @@
<span class="icon"></span> <span class="icon"></span>
<span>客户购车年限</span> <span>客户购车年限</span>
</div> </div>
<div class="container flex"> <div class="container flex">
<pie-chart :id="chart.id" :list="clientData" @pieAction="pieAction"></pie-chart> <template v-if="clientData.length > 0">
<ran-king :list="brandList"></ran-king> <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>
</div> </div>
</template> </template>
......
...@@ -11,9 +11,14 @@ ...@@ -11,9 +11,14 @@
<span class="icon"></span> <span class="icon"></span>
<span>客户性别</span> <span>客户性别</span>
</div> </div>
<div class="container flex"> <div class="container flex">
<pie-chart :id="chart.id" :list="clientData" @pieAction="pieAction"></pie-chart> <template v-if="clientData.length > 0">
<ran-king :list="brandList"></ran-king> <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>
</div> </div>
</template> </template>
......
...@@ -12,8 +12,13 @@ ...@@ -12,8 +12,13 @@
<span>客户级别</span> <span>客户级别</span>
</div> </div>
<div class="flex container"> <div class="flex container">
<pie-chart :id="chart.id" :list="salesData" @pieAction="pieAction"></pie-chart> <template v-if="salesData.length > 0">
<ran-king :list="brandList"></ran-king> <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>
</div> </div>
</template> </template>
......
...@@ -11,9 +11,14 @@ ...@@ -11,9 +11,14 @@
<span class="icon"></span> <span class="icon"></span>
<span>进店类型</span> <span>进店类型</span>
</div> </div>
<div class="container flex"> <div class="flex container">
<pie-chart :id="chart.id" :list="salesData" @pieAction="pieAction"></pie-chart> <template v-if="salesData.length > 0">
<ran-king :list="brandList"></ran-king> <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>
</div> </div>
</template> </template>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-06-23 15:05:21 * @Date: 2022-06-23 15:05:21
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-06-29 18:45:58 * @LastEditTime: 2022-06-29 19:45:27
--> -->
<template> <template>
<div> <div>
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
</div> </div>
<div class="flow-right"> <div class="flow-right">
<div class="ranking-title"> <div class="ranking-title">
<div @click="changeRank(1)" :class="isActive == 1 ? 'active' : ''">前5品牌</div> <div @click="changeRank(1)" :class="isActive == 1 ? 'active' : ''">前5{{ isBrand ? '门店' : '品牌' }}</div>
<div @click="changeRank(2)" :class="isActive == 2 ? 'active' : ''">后5品牌</div> <div @click="changeRank(2)" :class="isActive == 2 ? 'active' : ''">后5{{ isBrand ? '门店' : '品牌' }}</div>
</div> </div>
<div class="ranking-content"> <div class="ranking-content">
<div class="ranking-item" v-for="(item, index) in flowData" :key="index"> <div class="ranking-item" v-for="(item, index) in flowData" :key="index">
...@@ -82,16 +82,15 @@ export default { ...@@ -82,16 +82,15 @@ export default {
], ],
option: {}, option: {},
echartsFunnel: '', echartsFunnel: '',
funnelDom: '',
hasData: true, hasData: true,
paramsData: {}, paramsData: {},
topList: [], topList: [],
lastList: [] lastList: [],
isBrand: false
} }
}, },
mounted() { mounted() {
this.funnelDom = document.getElementById('flow') this.echartsFunnel = echarts.init(document.getElementById('flow'))
this.echartsFunnel = echarts.init(this.funnelDom)
// resize // resize
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.echartsFunnel.resize() this.echartsFunnel.resize()
...@@ -101,6 +100,7 @@ export default { ...@@ -101,6 +100,7 @@ export default {
methods: { methods: {
init(val) { init(val) {
this.paramsData = this.$store.state.app.reportParams this.paramsData = this.$store.state.app.reportParams
this.isBrand = this.paramsData.brand && this.paramsData.brand.name
this.getSaletTotal(this.paramsData) this.getSaletTotal(this.paramsData)
this.getSaleTrans(this.paramsData) this.getSaleTrans(this.paramsData)
}, },
...@@ -205,60 +205,63 @@ export default { ...@@ -205,60 +205,63 @@ export default {
api = 'storeSaleTrans' api = 'storeSaleTrans'
} }
this.api.sales[api](params).then(res => { this.api.sales[api](params).then(res => {
this.topList = [ const { topList, lastList } = res.data.dataList[0]
{ this.topList = topList ? JSON.parse(topList) : []
id: 1, this.lastList = lastList ? JSON.parse(lastList) : []
name: '林则徐:苟利国家生死以岂因祸福避趋之', // this.topList = [
num: 3323425 // {
}, // id: 1,
{ // name: '林则徐:苟利国家生死以岂因祸福避趋之',
id: 2, // num: 3323425
name: '林则徐', // },
num: 9999999 // {
}, // id: 2,
{ // name: '林则徐',
id: 3, // num: 9999999
name: 'fg', // },
num: 33234 // {
}, // id: 3,
{ // name: 'fg',
id: 4, // num: 33234
name: '售后客户价值分析', // },
num: 33234 // {
}, // id: 4,
{ // name: '售后客户价值分析',
id: 5, // num: 33234
name: '林则徐:苟利国家生死以岂因祸福避趋之', // },
num: 33234 // {
} // id: 5,
] // name: '林则徐:苟利国家生死以岂因祸福避趋之',
this.lastList = [ // num: 33234
{ // }
id: 1, // ]
name: '广汇集团BI数据看板-前端-交互', // this.lastList = [
num: 3323425 // {
}, // id: 1,
{ // name: '广汇集团BI数据看板-前端-交互',
id: 2, // num: 3323425
name: '广汇集团BI数据看板-前端-交互广汇集团BI数据看板-前端-交互', // },
num: 9999999 // {
}, // id: 2,
{ // name: '广汇集团BI数据看板-前端-交互广汇集团BI数据看板-前端-交互',
id: 3, // num: 9999999
name: 'fsdfasdg', // },
num: 33234 // {
}, // id: 3,
{ // name: 'fsdfasdg',
id: 4, // num: 33234
name: '广汇集团BI数据看板-前端-交互', // },
num: 33234 // {
}, // id: 4,
{ // name: '广汇集团BI数据看板-前端-交互',
id: 5, // num: 33234
name: '广汇集团BI数据看板-前端-交互', // },
num: 33234 // {
} // id: 5,
] // name: '广汇集团BI数据看板-前端-交互',
// num: 33234
// }
// ]
this.flowData = this.topList this.flowData = this.topList
}) })
}, },
......
...@@ -11,9 +11,14 @@ ...@@ -11,9 +11,14 @@
<span class="icon"></span> <span class="icon"></span>
<span>信息来源</span> <span>信息来源</span>
</div> </div>
<div class="container flex"> <div class="flex container">
<pie-chart :id="chart.id" :list="salesData" @pieAction="pieAction"></pie-chart> <template v-if="salesData.length > 0">
<ran-king :list="brandList"></ran-king> <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>
</div> </div>
</template> </template>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!