Commit 34eefc91 by 胡悦

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

2 parents 9abe597e e47ee55c
......@@ -23,4 +23,9 @@ const aftersaleother = params => {
return request.get('brand/aftersaleother', params)
}
export default { getAfterSale, getMerchantAfterSale, aftersaleother }
// 获取门店品牌售后其他信息
const afterMerchantSaleother = params => {
return request.get('merchant/aftersaleother', params)
}
export default { getAfterSale, aftersaleother,afterMerchantSaleother,getMerchantAfterSale }
......@@ -10,8 +10,7 @@ export default {
getBrandList () {
return request.get('brand/getBrandName', {
req: {
corporateGroupName: '集团1',
queryTime: '2022-06-23'
queryTime: window.vm.getCurrentDate()
}
})
}
......
......@@ -4,7 +4,11 @@ var request = new Request()
// window.$HTTP
export default {
/**获取品牌---总体模块信息(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus 的基础数据 和 前五排行/后五排行 ) */
getBrandOverallbase(params){
return request.get('brand/overallbase', params)
getBrandOverallbase (req) {
return request.get('brand/overallbase', { req })
},
/*获取品牌---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getBrandOveralltrend (req) {
return request.get('brand/overalltrend', { req })
}
}
......@@ -3,13 +3,13 @@ class Request {
constructor(_request_) {
this.DOMAIN = _request_ ? _request_.baseURL : this.DOMAIN
}
get(url, params, returnAll) {
get (url, params, returnAll) {
return this.request('GET', url, params, returnAll)
}
post(url, params, returnAll) {
post (url, params, returnAll) {
return this.request('POST', url, params, returnAll)
}
request(method, url, params, returnAll) {
request (method, url, params, returnAll) {
var requestConfig = {
headers: {
// 'Content-Type': method == 'GET' ? 'application/json' : 'application/x-www-form-urlencoded; charset=UTF-8'
......@@ -17,7 +17,7 @@ class Request {
},
method
}
params.req.corporateGroupName = '集团1'
if (method === 'GET') {
var paramsArray = []
Object.keys(params.req).forEach(key => paramsArray.push('req.' + key + '=' + params.req[key]))
......
......@@ -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() {
......
<template>
<div class="tabs">
<div class="tab pointer">
<div class="tab-left box">
<div
class="tab-left box"
@click="changeType('total')"
>
<div class="tab-total-box">
<div class="total-title-box flex">
<div class="title inline total">客户总数</div>
......@@ -29,6 +32,7 @@
<div
:key="index"
class="item flex"
@click="changeType(i.key)"
>
<div class="item-title">{{i.title}}</div>
<transition-number
......@@ -48,22 +52,51 @@
</template>
</div>
</div>
<div class="
tabs-content
box">
<div class="title inline">客户增长趋势</div>
<div class="tabs-content box">
<div class="tabs-title">客户增长趋势</div>
<div class="tabs-content-chart flex">
<div
class="line"
id="total-chart"
></div>
<div class="table user-select pointer">
<div class="table-head">
<template v-for="(i,index) in tabHead">
<div
:class="['table-head-item flex',{'active':index == tabIndex}]"
:key="index"
@click="changeTab(index)"
>
{{i}}
</div>
</template>
</div>
<div class="table-body flex">
<template v-for="(i,index) in tabIndex == 0 ? pageData[tabType].top : pageData[tabType].last">
<div
class="table-body-item flex"
:key="index"
>
<div class="table-num flex">{{index + 1}}</div>
<div class="table-key">
<marquee
:direction="directionTimer"
:delay="delayTimer"
:text="i.name"
/>
</div>
<div class="table-value">{{i.num}}</div>
</div>
</template>
</div>
</div>
</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
import { changeMixin } from '@/mixins'
export default {
name: 'ViewTabs',
mixins: [changeMixin],
data () {
return {
tabs: [
const tabs = [
{
title: '企微客户',
key: 'wechat'
......@@ -80,9 +113,21 @@ export default {
title: '公众号客户数',
key: 'publiccus'
}
],
queryItem: 'total',
id: '10086',
]
let tabHead = ['前5品牌', '后5品牌']
import { changeMixin } from '@/mixins'
import * as echarts from 'echarts'
export default {
name: 'ViewTabs',
mixins: [changeMixin],
data () {
return {
tabs,
tabHead,
tabType: 'total',
tabIndex: 0,
delayTimer: 3000,
directionTimer: 3000,
pageData: {
total: {},
wechat: {},
......@@ -104,24 +149,49 @@ export default {
this.getBrandOverallbase('wechatGroup')
this.getBrandOverallbase('applet')
this.getBrandOverallbase('publiccus')
this.getBrandOveralltrend('total')
},
changeType (type) {
console.log(type)
this.tabType = type
this.getBrandOveralltrend(type)
},
changeTab (index) {
this.tabIndex = index
},
getBrandOverallbase (queryItem) {
const params = {
req: {
queryItem,
queryTime: '2022-06-23',
corporateGroupName: '集团1',
queryType: 0
}
}
this.api.overview.getBrandOverallbase(params).then(res => {
const { code, data } = res
this.api.overview.getBrandOverallbase(params).then(({ code, data }) => {
if (code == 0) {
let [dataList] = data.dataList
console.log(`________________${queryItem}_______________________`, data)
dataList.top = this.ObjectToArray(dataList.topList)
dataList.last = this.ObjectToArray(dataList.lastList)
this.pageData[queryItem] = dataList
}
})
},
ObjectToArray (obj) {
let arr = []
obj = JSON.parse(obj)
Object.keys(obj).map(name => arr.push({ name, num: obj[name] }))
return arr
},
getBrandOveralltrend (queryItem) {
const params = {
queryItem,
querystartTime: '2022-05-23',
queryendTime: '2022-06-23',
corporateGroupName: '集团1',
queryType: 0
}
this.api.overview.getBrandOverallbase(params).then(res => {
console.log(`________________${queryItem}_______________________`, res)
})
}
}
}
......@@ -200,6 +270,74 @@ export default {
}
&-content {
height: 24.4vh;
box-sizing: border-box;
padding: 1vh 8px;
display: flex;
flex-direction: column;
.tabs-title {
font-size: 12px;
color: #e8e8e8;
}
&-chart {
height: 20.2vh;
margin-top: auto;
justify-content: space-between;
gap: 0 8px;
.line {
flex: 7;
background: #022;
}
.table {
flex: 3;
background: #262525;
&-head {
display: grid;
grid-template-columns: repeat(2, 50%);
height: 2.4vh;
&-item {
height: 100%;
font-size: 10px;
background: #353535;
color: rgba($color: #fff, $alpha: 0.7);
justify-content: center;
&:hover {
opacity: 0.9;
}
}
.active {
background: #eb6001;
color: #fff;
}
}
&-body {
height: calc(100% - 2.4vh);
flex-direction: column;
justify-content: space-between;
&-item {
line-height: 3.4vh;
width: 100%;
font-size: 10px;
color: #ffffff;
.table-num {
width: 22px;
justify-content: center;
color: #606266;
}
.table-key {
width: calc(100% - 96px);
}
.tab-value {
width: 52px;
margin-left: auto;
padding-right: 4px;
}
}
}
}
> div {
height: 100%;
}
}
}
}
</style>
......@@ -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,6 +8,7 @@
<template>
<div>
<div class="title">售后客户价值分析</div>
<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>
......@@ -16,15 +17,21 @@
<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>
<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,25 +131,33 @@ 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 => {
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)
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()
})
}
})
},
initPieData(name) {
const distributionRank = this.distributionRank[this.key]
......@@ -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,6 +8,7 @@
<template>
<div>
<div class="title">售后车辆里程</div>
<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">
......@@ -24,13 +25,19 @@
</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,15 +59,21 @@ 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 => {
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)
......@@ -69,10 +84,10 @@ export default {
})
})
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])
}
}
}
......
......@@ -16,7 +16,7 @@
<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!