Commit e441c520 by 王志慧

commit-wzh

1 parent 72476d0b
......@@ -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
}
......@@ -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()
}
}
}
......@@ -51,7 +51,7 @@ export default {
this.dealList(data.dataList)
break
default:
alert(message)
// alert(message)
}
})
},
......
......@@ -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>
......
......@@ -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!