Commit 8e259259 by 王志慧

commit-wzh

1 parent 0ac75913
...@@ -18,4 +18,9 @@ const aftersaleother = params => { ...@@ -18,4 +18,9 @@ const aftersaleother = params => {
return request.get('brand/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 { ...@@ -178,7 +178,7 @@ export default {
this.setAnamiteText() this.setAnamiteText()
}, },
setAnamiteText() { setAnamiteText() {
document.querySelector(`.${this.id}`).style = `--step:${this.mainValue}` if( document.querySelector(`.${this.id}`)) document.querySelector(`.${this.id}`).style = `--step:${this.mainValue}`
}, },
//高亮 //高亮
pieActive() { pieActive() {
......
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
}, },
methods: { methods: {
getClientData() { getClientData() {
let clientApi = this.isBrand ? 'overalldistribution' : 'merchantOveralldistribution' let clientApi = !this.isBrand ? 'overalldistribution' : 'merchantOveralldistribution'
const params = { const params = {
req: { req: {
corporateGroupName: '集团1', corporateGroupName: '集团1',
...@@ -27,6 +27,9 @@ export default { ...@@ -27,6 +27,9 @@ export default {
} }
if (this.isBrand) params.req.brandName = this.brandName if (this.isBrand) params.req.brandName = this.brandName
this.api.customer[clientApi](params).then(res => { this.api.customer[clientApi](params).then(res => {
this.clientData = []
this.brandList = []
this.distributionRank = ''
if (res.data.dataList.length > 0) { if (res.data.dataList.length > 0) {
let distribution = JSON.parse(res.data.dataList[0].distribution) let distribution = JSON.parse(res.data.dataList[0].distribution)
const keys = Object.keys(distribution) const keys = Object.keys(distribution)
...@@ -37,13 +40,10 @@ export default { ...@@ -37,13 +40,10 @@ export default {
}) })
}) })
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, 99999999999999999)
this.isBrand = false this.isBrand = false
if (newVal.brand) { if (newVal.brand) {
this.isBrand = true this.isBrand = true
......
...@@ -15,7 +15,7 @@ export default { ...@@ -15,7 +15,7 @@ export default {
}, },
methods: { methods: {
getSalesData() { getSalesData() {
let salesApi = this.isBrand ? 'getSales' : 'getMerchantSales' let salesApi = !this.isBrand ? 'getSales' : 'getMerchantSales'
const params = { const params = {
req: { req: {
corporateGroupName: '集团1', corporateGroupName: '集团1',
...@@ -27,6 +27,9 @@ export default { ...@@ -27,6 +27,9 @@ export default {
} }
if (this.isBrand) params.req.brandName = this.brandName if (this.isBrand) params.req.brandName = this.brandName
this.api.sales[salesApi](params).then(res => { this.api.sales[salesApi](params).then(res => {
this.salesData = []
this.typeRanking = ''
this.brandList = []
if (res.data.dataList.length > 0) { if (res.data.dataList.length > 0) {
let typeNum = JSON.parse(res.data.dataList[0].typeNum) let typeNum = JSON.parse(res.data.dataList[0].typeNum)
Object.keys(typeNum).forEach((item, index) => { Object.keys(typeNum).forEach((item, index) => {
...@@ -37,8 +40,6 @@ export default { ...@@ -37,8 +40,6 @@ export default {
}) })
this.typeRanking = JSON.parse(res.data.dataList[0].typeRanking) this.typeRanking = JSON.parse(res.data.dataList[0].typeRanking)
}else{
this.salesData = []
} }
}) })
}, },
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<template> <template>
<div> <div>
<div class="title">售后客户价值分析</div> <div class="title">售后客户价值分析</div>
<template v-if="barData.length > 0">
<div class="analyze-content" :style="{ height: height - 4.9 + 'vh' }"> <div class="analyze-content" :style="{ height: height - 4.9 + 'vh' }">
<div class="content-left bg"> <div class="content-left bg">
<div id="analyzeBar" style="height: 100%"></div> <div id="analyzeBar" style="height: 100%"></div>
...@@ -16,15 +17,21 @@ ...@@ -16,15 +17,21 @@
<pie-chart :id="chart.id" :list="analyzeData" :height="height - 4.9 + 'vh'" :radius="chart.radius"></pie-chart> <pie-chart :id="chart.id" :list="analyzeData" :height="height - 4.9 + 'vh'" :radius="chart.radius"></pie-chart>
</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> </div>
</template> </template>
<script> <script>
import * as echarts from 'echarts' import * as echarts from 'echarts'
import datas from '../../utils/data' import datas from '../../utils/data'
import { changeMixin } from '../../mixins/index'
export default { export default {
name: 'Analyze', name: 'Analyze',
props: ['height'], props: ['height'],
mixins: [changeMixin],
data() { data() {
return { return {
analyzeData: [], analyzeData: [],
...@@ -35,15 +42,12 @@ export default { ...@@ -35,15 +42,12 @@ export default {
barChart: '', barChart: '',
option: {}, option: {},
barData: [], barData: [],
key: 1 key: 1,
isBrand: false,
brandName: ''
} }
}, },
mounted() { mounted() {
this.barChart = echarts.init(document.getElementById('analyzeBar'))
// resize
window.addEventListener('resize', () => {
this.barChart.resize()
})
this.init() this.init()
}, },
methods: { methods: {
...@@ -51,6 +55,11 @@ export default { ...@@ -51,6 +55,11 @@ export default {
this.getValueType() this.getValueType()
}, },
getChart() { getChart() {
this.barChart = echarts.init(document.getElementById('analyzeBar'))
// resize
window.addEventListener('resize', () => {
this.barChart.resize()
})
this.option = { this.option = {
grid: { grid: {
left: '3%', left: '3%',
...@@ -114,6 +123,7 @@ export default { ...@@ -114,6 +123,7 @@ export default {
} }
] ]
} }
this.barChart.clear()
this.barChart.setOption(this.option) this.barChart.setOption(this.option)
// 鼠标划入 // 鼠标划入
this.barChart.on('mouseover', data => { this.barChart.on('mouseover', data => {
...@@ -121,25 +131,33 @@ export default { ...@@ -121,25 +131,33 @@ export default {
}) })
}, },
getValueType() { getValueType() {
let analyzeApi = !this.isBrand ? 'aftersaleother' : 'afterMerchantSaleother'
const params = { const params = {
req: { req: {
corporateGroupName: '集团1', corporateGroupName: '集团1',
queryItem: 'valueanalyse', queryItem: 'valueanalyse',
// queryTime: this.getCurrentDate,
queryTime: '2022-06-23', queryTime: '2022-06-23',
queryType: 0 queryType: this.watchReportParams.reportType
} }
} }
this.api.afterSales.aftersaleother(params).then(res => { 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) const reqData = JSON.parse(res.data.dataList[0].distribution)
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank) this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
this.barData = [] this.barData = []
for (let i in reqData) { for (let i in reqData) {
this.barData.push(reqData[i]) this.barData.push(reqData[i])
} }
this.$nextTick(() => {
this.getChart() this.getChart()
this.initPieData() this.initPieData()
}) })
}
})
}, },
initPieData(name) { initPieData(name) {
const distributionRank = this.distributionRank[this.key] const distributionRank = this.distributionRank[this.key]
...@@ -149,6 +167,14 @@ export default { ...@@ -149,6 +167,14 @@ export default {
value: distributionRank[item] value: distributionRank[item]
}) })
}) })
},
init(newVal) {
this.isBrand = false
if (newVal && newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getValueType()
} }
} }
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<template> <template>
<div> <div>
<div class="title">售后车辆里程</div> <div class="title">售后车辆里程</div>
<template v-if="mileageData.length > 0">
<div class="flex"> <div class="flex">
<pie-chart :id="chart.id" :list="mileageData" :height="height - 4.9 + 'vh'" :radius="chart.radius" @pieAction="pieAction"></pie-chart> <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-container">
...@@ -24,13 +25,19 @@ ...@@ -24,13 +25,19 @@
</div> </div>
</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> </div>
</template> </template>
<script> <script>
import { changeMixin } from '../../mixins/index'
export default { export default {
name: 'Mileage', name: 'Mileage',
props: ['height'], props: ['height'],
mixins: [changeMixin],
data() { data() {
return { return {
mileageData: [], mileageData: [],
...@@ -42,7 +49,9 @@ export default { ...@@ -42,7 +49,9 @@ export default {
}, },
delayTimer: 3000, delayTimer: 3000,
directionTimer: 3000, directionTimer: 3000,
brandList: this.list brandList: this.list,
isBrand: false,
brandName: ''
} }
}, },
mounted() { mounted() {
...@@ -50,15 +59,21 @@ export default { ...@@ -50,15 +59,21 @@ export default {
}, },
methods: { methods: {
getValueType() { getValueType() {
let mileageApi = !this.isBrand ? 'aftersaleother' : 'afterMerchantSaleother'
const params = { const params = {
req: { req: {
corporateGroupName: '集团1', corporateGroupName: '集团1',
queryItem: 'mileage', queryItem: 'mileage',
// queryTime: this.getCurrentDate,
queryTime: '2022-06-23', queryTime: '2022-06-23',
queryType: 0 queryType: this.watchReportParams.reportType
} }
} }
this.api.afterSales.aftersaleother(params).then(res => { 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) let distribution = JSON.parse(res.data.dataList[0].distribution)
// console.log() // console.log()
const keys = Object.keys(distribution) const keys = Object.keys(distribution)
...@@ -69,10 +84,10 @@ export default { ...@@ -69,10 +84,10 @@ export default {
}) })
}) })
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank) this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
}
}) })
}, },
pieAction(data) { pieAction(data) {
this.rankingData = []
let distributionRank = this.distributionRank[data.name] let distributionRank = this.distributionRank[data.name]
for (const key in distributionRank) { for (const key in distributionRank) {
this.rankingData.push({ this.rankingData.push({
...@@ -80,6 +95,14 @@ export default { ...@@ -80,6 +95,14 @@ export default {
value: distributionRank[key] 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 { ...@@ -38,7 +38,7 @@ export default {
}, },
methods: { methods: {
pieAction(data) { 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 { ...@@ -38,7 +38,7 @@ export default {
}, },
methods: { methods: {
pieAction(data) { 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 @@ ...@@ -13,7 +13,7 @@
</div> </div>
<div class="container flex"> <div class="container flex">
<template v-if="clientData.length > 0"> <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> <ran-king :list="brandList"></ran-king>
</template> </template>
<div class="empty" style="height:12.7vh" v-else> <div class="empty" style="height:12.7vh" v-else>
...@@ -31,13 +31,15 @@ export default { ...@@ -31,13 +31,15 @@ export default {
return { return {
type: 'gender', type: 'gender',
chart: { chart: {
id: 'sex-pie' id: 'sex-pie',
colors:["#EB6001","#BF98FF","#FF6E76"]
} }
} }
}, },
methods:{ methods:{
pieAction(data){ 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 { ...@@ -38,7 +38,7 @@ export default {
}, },
methods: { methods: {
pieAction(data) { pieAction(data) {
this.brandList = Object.keys(this.typeRanking[data.name]) this.brandList = this.typeRanking&&this.typeRanking[data.name]&&Object.keys(this.typeRanking[data.name])
} }
} }
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<pie-chart :id="chart.id" :list="salesData" @pieAction="pieAction"></pie-chart> <pie-chart :id="chart.id" :list="salesData" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king> <ran-king :list="brandList"></ran-king>
</template> </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="" /> <img src="../../assets/images/empty.png" alt="" />
</div> </div>
</div> </div>
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
}, },
methods: { methods: {
pieAction(data) { 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 { ...@@ -38,7 +38,7 @@ export default {
}, },
methods: { methods: {
pieAction(data) { 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!