Commit 8e259259 by 王志慧

commit-wzh

1 parent 0ac75913
......@@ -18,4 +18,9 @@ const aftersaleother = params => {
return request.get('brand/aftersaleother', params)
}
export default { getAfterSale, aftersaleother }
// 获取门店品牌售后其他信息
const afterMerchantSaleother = params => {
return request.get('merchant/aftersaleother', params)
}
export default { getAfterSale, aftersaleother,afterMerchantSaleother }
......@@ -178,7 +178,7 @@ export default {
this.setAnamiteText()
},
setAnamiteText() {
document.querySelector(`.${this.id}`).style = `--step:${this.mainValue}`
if( document.querySelector(`.${this.id}`)) document.querySelector(`.${this.id}`).style = `--step:${this.mainValue}`
},
//高亮
pieActive() {
......
......@@ -15,7 +15,7 @@ export default {
},
methods: {
getClientData() {
let clientApi = this.isBrand ? 'overalldistribution' : 'merchantOveralldistribution'
let clientApi = !this.isBrand ? 'overalldistribution' : 'merchantOveralldistribution'
const params = {
req: {
corporateGroupName: '集团1',
......@@ -27,6 +27,9 @@ export default {
}
if (this.isBrand) params.req.brandName = this.brandName
this.api.customer[clientApi](params).then(res => {
this.clientData = []
this.brandList = []
this.distributionRank = ''
if (res.data.dataList.length > 0) {
let distribution = JSON.parse(res.data.dataList[0].distribution)
const keys = Object.keys(distribution)
......@@ -37,13 +40,10 @@ export default {
})
})
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
} else {
this.clientData = []
}
})
},
init(newVal) {
console.log(newVal, 99999999999999999)
this.isBrand = false
if (newVal.brand) {
this.isBrand = true
......
......@@ -15,7 +15,7 @@ export default {
},
methods: {
getSalesData() {
let salesApi = this.isBrand ? 'getSales' : 'getMerchantSales'
let salesApi = !this.isBrand ? 'getSales' : 'getMerchantSales'
const params = {
req: {
corporateGroupName: '集团1',
......@@ -27,6 +27,9 @@ export default {
}
if (this.isBrand) params.req.brandName = this.brandName
this.api.sales[salesApi](params).then(res => {
this.salesData = []
this.typeRanking = ''
this.brandList = []
if (res.data.dataList.length > 0) {
let typeNum = JSON.parse(res.data.dataList[0].typeNum)
Object.keys(typeNum).forEach((item, index) => {
......@@ -37,8 +40,6 @@ export default {
})
this.typeRanking = JSON.parse(res.data.dataList[0].typeRanking)
}else{
this.salesData = []
}
})
},
......
......@@ -8,13 +8,18 @@
<template>
<div>
<div class="title">售后客户价值分析</div>
<div class="analyze-content" :style="{ height: height - 4.9 + 'vh' }">
<div class="content-left bg">
<div id="analyzeBar" style="height: 100%"></div>
</div>
<div class="contetn-right bg">
<pie-chart :id="chart.id" :list="analyzeData" :height="height - 4.9 + 'vh'" :radius="chart.radius"></pie-chart>
<template v-if="barData.length > 0">
<div class="analyze-content" :style="{ height: height - 4.9 + 'vh' }">
<div class="content-left bg">
<div id="analyzeBar" style="height: 100%"></div>
</div>
<div class="contetn-right bg">
<pie-chart :id="chart.id" :list="analyzeData" :height="height - 4.9 + 'vh'" :radius="chart.radius"></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>
......@@ -22,9 +27,11 @@
<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: [],
......@@ -35,15 +42,12 @@ export default {
barChart: '',
option: {},
barData: [],
key: 1
key: 1,
isBrand: false,
brandName: ''
}
},
mounted() {
this.barChart = echarts.init(document.getElementById('analyzeBar'))
// resize
window.addEventListener('resize', () => {
this.barChart.resize()
})
this.init()
},
methods: {
......@@ -51,6 +55,11 @@ export default {
this.getValueType()
},
getChart() {
this.barChart = echarts.init(document.getElementById('analyzeBar'))
// resize
window.addEventListener('resize', () => {
this.barChart.resize()
})
this.option = {
grid: {
left: '3%',
......@@ -114,6 +123,7 @@ export default {
}
]
}
this.barChart.clear()
this.barChart.setOption(this.option)
// 鼠标划入
this.barChart.on('mouseover', data => {
......@@ -121,24 +131,32 @@ export default {
})
},
getValueType() {
let analyzeApi = !this.isBrand ? 'aftersaleother' : 'afterMerchantSaleother'
const params = {
req: {
corporateGroupName: '集团1',
queryItem: 'valueanalyse',
// queryTime: this.getCurrentDate,
queryTime: '2022-06-23',
queryType: 0
queryType: this.watchReportParams.reportType
}
}
this.api.afterSales.aftersaleother(params).then(res => {
const reqData = JSON.parse(res.data.dataList[0].distribution)
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
if (this.isBrand) params.req.brandName = this.brandName
this.api.afterSales[analyzeApi](params).then(res => {
this.analyzeData = []
this.barData = []
for (let i in reqData) {
this.barData.push(reqData[i])
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.getChart()
this.initPieData()
})
},
initPieData(name) {
......@@ -149,6 +167,14 @@ export default {
value: distributionRank[item]
})
})
},
init(newVal) {
this.isBrand = false
if (newVal && newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getValueType()
}
}
}
......
......@@ -8,29 +8,36 @@
<template>
<div>
<div class="title">售后车辆里程</div>
<div class="flex">
<pie-chart :id="chart.id" :list="mileageData" :height="height - 4.9 + 'vh'" :radius="chart.radius" @pieAction="pieAction"></pie-chart>
<div class="ranking-container">
<div class="ranking-title">
<div class="ranking-title-brand">品牌</div>
<div>客户数</div>
</div>
<div class="ranking">
<div class="brand flex" v-for="(item, index) in rankingData" :key="index">
<span class="brand-num">{{ index + 1 }}</span>
<marquee class="marquee" :direction="directionTimer" :delay="delayTimer" :text="item.brand" />
<span>{{ item.value }}</span>
<template v-if="mileageData.length > 0">
<div class="flex">
<pie-chart :id="chart.id" :list="mileageData" :height="height - 4.9 + 'vh'" :radius="chart.radius" @pieAction="pieAction"></pie-chart>
<div class="ranking-container">
<div class="ranking-title">
<div class="ranking-title-brand">品牌</div>
<div>客户数</div>
</div>
<div class="ranking">
<div class="brand flex" v-for="(item, index) in rankingData" :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: [],
......@@ -42,7 +49,9 @@ export default {
},
delayTimer: 3000,
directionTimer: 3000,
brandList: this.list
brandList: this.list,
isBrand: false,
brandName: ''
}
},
mounted() {
......@@ -50,29 +59,35 @@ export default {
},
methods: {
getValueType() {
let mileageApi = !this.isBrand ? 'aftersaleother' : 'afterMerchantSaleother'
const params = {
req: {
corporateGroupName: '集团1',
queryItem: 'mileage',
// queryTime: this.getCurrentDate,
queryTime: '2022-06-23',
queryType: 0
queryType: this.watchReportParams.reportType
}
}
this.api.afterSales.aftersaleother(params).then(res => {
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]
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)
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
}
})
},
pieAction(data) {
this.rankingData = []
let distributionRank = this.distributionRank[data.name]
for (const key in distributionRank) {
this.rankingData.push({
......@@ -80,6 +95,14 @@ export default {
value: distributionRank[key]
})
}
},
init(newVal) {
this.isBrand = false
if (newVal && newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getValueType()
}
}
}
......
......@@ -38,7 +38,7 @@ export default {
},
methods: {
pieAction(data) {
this.brandList = Object.keys(this.distributionRank[data.name])
this.brandList = this.distributionRank&&this.distributionRank[data.name]&&Object.keys(this.distributionRank[data.name])
}
}
}
......
......@@ -38,7 +38,7 @@ export default {
},
methods: {
pieAction(data) {
this.brandList = Object.keys(this.distributionRank[data.name])
this.brandList = this.distributionRank&&this.distributionRank[data.name]&&Object.keys(this.distributionRank[data.name])
}
}
}
......
......@@ -13,7 +13,7 @@
</div>
<div class="container flex">
<template v-if="clientData.length > 0">
<pie-chart :id="chart.id" :list="clientData" @pieAction="pieAction"></pie-chart>
<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>
......@@ -31,13 +31,15 @@ export default {
return {
type: 'gender',
chart: {
id: 'sex-pie'
id: 'sex-pie',
colors:["#EB6001","#BF98FF","#FF6E76"]
}
}
},
methods:{
pieAction(data){
this.brandList=Object.keys(this.distributionRank[data.name])
console.log(this.distributionRank,'客户性别')
this.brandList = this.distributionRank&&this.distributionRank[data.name]&&Object.keys(this.distributionRank[data.name])
}
}
}
......
......@@ -38,7 +38,7 @@ export default {
},
methods: {
pieAction(data) {
this.brandList = Object.keys(this.typeRanking[data.name])
this.brandList = this.typeRanking&&this.typeRanking[data.name]&&Object.keys(this.typeRanking[data.name])
}
}
}
......
......@@ -11,12 +11,12 @@
<span class="icon"></span>
<span>进店类型</span>
</div>
<div class="flex container">
<template v-if="salesData.length > 0">
<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>
<div class="empty" style="height: 12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
......@@ -38,7 +38,7 @@ export default {
},
methods: {
pieAction(data) {
this.brandList=Object.keys(this.typeRanking[data.name])
this.brandList = this.typeRanking && this.typeRanking[data.name] && Object.keys(this.typeRanking[data.name])
}
}
}
......
......@@ -38,7 +38,7 @@ export default {
},
methods: {
pieAction(data) {
this.brandList = Object.keys(this.typeRanking[data.name])
this.brandList = this.typeRanking&&this.typeRanking[data.name]&&Object.keys(this.typeRanking[data.name])
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!