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