Commit c2532d2a by 王志慧

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

2 parents 8e259259 58016170
...@@ -8,11 +8,16 @@ ...@@ -8,11 +8,16 @@
import Request from '../request' import Request from '../request'
var request = new Request() var request = new Request()
// 售后档案客户 // 品牌-售后档案客户
const getAfterSale = params => { const getAfterSale = params => {
return request.get('brand/aftersale', params) return request.get('brand/aftersale', params)
} }
// 门店-售后档案客户
const getMerchantAfterSale = params => {
return request.get('merchant/aftersale', params)
}
// 获取品牌售后其他信息 // 获取品牌售后其他信息
const aftersaleother = params => { const aftersaleother = params => {
return request.get('brand/aftersaleother', params) return request.get('brand/aftersaleother', params)
...@@ -23,4 +28,4 @@ const afterMerchantSaleother = params => { ...@@ -23,4 +28,4 @@ const afterMerchantSaleother = params => {
return request.get('merchant/aftersaleother', params) return request.get('merchant/aftersaleother', params)
} }
export default { getAfterSale, aftersaleother,afterMerchantSaleother } export default { getAfterSale, aftersaleother,afterMerchantSaleother,getMerchantAfterSale }
import Request from '../request'
var request = new Request()
// window.$HTTP
export default {
/**获取品牌名称*/
getBrandList () {
return request.get('brand/getBrandName', {
req: {
corporateGroupName: '集团1',
queryTime: '2022-06-23'
}
})
}
}
import Request from '../request'
var request = new Request()
// window.$HTTP
export default {
/**获取品牌---总体模块信息(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus 的基础数据 和 前五排行/后五排行 ) */
getBrandOverallbase(params){
return request.get('brand/overallbase', params)
}
}
<template> <template>
<div class="line-box"> <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-box">
<div class="rank-title-block"> <div class="rank-title-block">
<p :class="[ 'rank-title', rankFlag == 'top' ? 'rank-title-active' : '' ]" @click="handleRankChange('top')">前5{{ storeOrBrandTxt }}</p> <p :class="[ 'rank-title', rankFlag == 'top' ? 'rank-title-active' : '' ]" @click="handleRankChange('top')">前5{{ storeOrBrandTxt }}</p>
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
</div> </div>
<div class="rank-block"> <div class="rank-block">
<div class="rank-line" v-for="(item, index) in rankList" :key="index"> <div class="rank-line" v-for="(item, index) in rankList" :key="index">
<marquee class="line-item" :direction="directionTimer" :delay="delayTimer" :text="item.name"></marquee> <marquee class="line-item" :direction="directionTimer" :delay="delayTimer" :text="item.label"></marquee>
<p class="line-item txt-orange">{{ item.num }}</p> <p class="line-item txt-orange">{{ item.value }}</p>
</div> </div>
</div> </div>
</div> </div>
...@@ -23,13 +23,38 @@ import getLineOptions from './lineOptions' ...@@ -23,13 +23,38 @@ import getLineOptions from './lineOptions'
export default { export default {
name: 'LineChart', name: 'LineChart',
props: { props: {
domId: {
type: String,
default: 'line-chart'
},
storeOrBrandTxt: { storeOrBrandTxt: {
type: String, type: String,
default: '门店' default: '品牌'
}, },
dataList: { dataList: {
type: Array, type: Array,
default: () => [] default: () => []
},
tooltipFormatterObj: {
type: Array,
default: () => {
return [
{
label: '数量',
attrName: 'num'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
} }
}, },
...@@ -55,21 +80,21 @@ export default { ...@@ -55,21 +80,21 @@ export default {
}, },
mounted() { mounted() {
this.lineDom = document.getElementById('line-chart') this.lineDom = document.getElementById(this.domId)
this.echartsLine = echarts.init(this.lineDom) this.echartsLine = echarts.init(this.lineDom)
this.chartBindEvent()
},
watch: {
dataList() {
this.drawLine()
}
}, },
methods: { methods: {
tooltipFormatter(obj) { tooltipFormatter(obj) {
var currentItem = this.dataList[obj[0].dataIndex] var currentItem = this.dataList[obj[0].dataIndex]
return `数量:${currentItem.num}<br>环比:${currentItem.hrate}%<br>同比:${currentItem.trate}%` var txt = ''
this.tooltipFormatterObj.forEach(item => {
if (txt) {
txt = txt + '<br>'
}
txt = txt + item.label + ':' + currentItem[item.attrName] + (item.addSymbol || '')
})
return txt
}, },
autoMove() { autoMove() {
...@@ -114,7 +139,7 @@ export default { ...@@ -114,7 +139,7 @@ export default {
}, },
getRankList(idx, attrName = 'topList') { getRankList(idx, attrName = 'topList') {
this.rankList = this.dataList[idx][attrName] this.$set(this, 'rankList', this.dataList[idx][attrName])
}, },
drawLine() { drawLine() {
...@@ -124,6 +149,21 @@ export default { ...@@ -124,6 +149,21 @@ export default {
this.echartsLine.setOption(this.lineOptions) 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.getRankList(0)
this.autoMove() this.autoMove()
......
<template>
<div
class="transition-number"
:id="idKey"
>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'TransitionNumber',
props: {
num: [String, Number],
idKey: String
},
data () {
return {
}
},
watch: {
num (n) {
if (n) document.querySelector(`#${this.idKey}`).style = `--step:${n}`
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
.transition-number {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: #fff;
--step: 0;
counter-reset: count var(--step);
z-index: var(--step);
transition: --step 1s;
&::before {
content: counter(count);
}
}
@property --step {
syntax: '<integer>';
inherits: false;
initial-value: 15;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
:class="['options-item flex',{'active':i.active}]" :class="['options-item flex',{'active':i.active}]"
:key="index" :key="index"
@click="chooseBrand({i,index})" @click="chooseBrand({i,index})"
>{{i.name}}</div> >{{i.brandName}}</div>
</template> </template>
</div> </div>
</div> </div>
...@@ -43,19 +43,6 @@ ...@@ -43,19 +43,6 @@
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
let test = [{ name: '东风本田' },
{ name: '别克' },
{ name: '凯迪拉克' },
{ name: 'MINI' },
{ name: '荣威' },
{ name: '上海大众' },
{ name: '沃尔沃' },
{ name: '一汽丰田' },
{ name: '平行进口' },
{ name: '奥迪' },
{ name: '广汽本田' },
{ name: '比亚迪' },
{ name: '奔驰' },]
export default { export default {
name: 'ViewControl', name: 'ViewControl',
data () { data () {
...@@ -69,8 +56,18 @@ export default { ...@@ -69,8 +56,18 @@ export default {
} }
}, },
mounted () { mounted () {
test.map(e => e.active = false) this.api.common.getBrandList().then(({ code, data }) => {
this.brands = test let brands = []
if (code == 0) {
data.dataList.map(e => {
brands.push({
brandName: e,
active: false
})
})
}
this.brands = brands
})
}, },
methods: { methods: {
change (index, item) { change (index, item) {
...@@ -80,7 +77,7 @@ export default { ...@@ -80,7 +77,7 @@ export default {
this.tab = ['广汇集团', '品牌概览'] this.tab = ['广汇集团', '品牌概览']
} else { } else {
if (!item) return if (!item) return
this.tab[1] = item.name this.tab[1] = item.brandName
} }
this.tabIndex = index this.tabIndex = index
this.emit() this.emit()
...@@ -97,7 +94,7 @@ export default { ...@@ -97,7 +94,7 @@ export default {
reportType: reportIndex == 0 ? 1 : 0 //月表0,日表1 reportType: reportIndex == 0 ? 1 : 0 //月表0,日表1
} }
if (tabIndex == 1) brands.map(e => { if (tabIndex == 1) brands.map(e => {
if (e.active) params.brand = e if (e.active) params.brandName = e.brandName
}) })
this.$store.state.app.reportParams = params this.$store.state.app.reportParams = params
}, },
...@@ -166,7 +163,7 @@ export default { ...@@ -166,7 +163,7 @@ export default {
top: 4.1vh; top: 4.1vh;
right: 0; right: 0;
width: 50%; width: 50%;
height: 30vh; max-height: 30vh;
background: #383737; background: #383737;
border: 1px solid rgba(96, 98, 102, 1); border: 1px solid rgba(96, 98, 102, 1);
box-shadow: 0px 3px 2px 1px rgba(0, 0, 0, 0.5); box-shadow: 0px 3px 2px 1px rgba(0, 0, 0, 0.5);
...@@ -177,7 +174,7 @@ export default { ...@@ -177,7 +174,7 @@ export default {
&:hover { &:hover {
display: block; display: block;
} }
&:hover .brand{ &:hover .brand {
background-color: #096; background-color: #096;
} }
.options-item { .options-item {
......
...@@ -2,11 +2,55 @@ ...@@ -2,11 +2,55 @@
<div class="tabs"> <div class="tabs">
<div class="tab pointer"> <div class="tab pointer">
<div class="tab-left box"> <div class="tab-left box">
<div class="title inline">客户总数</div> <div class="tab-total-box">
<div class="total-title-box flex">
<div class="title inline total">客户总数</div>
<div class="title inline">昨日新增</div>
<div class="title inline">上月到店</div>
</div> </div>
<div class="tab-right box"></div> <div class="total-number-box flex">
<transition-number
:num="pageData.total.totalNum"
idKey="number-total"
/>
<transition-number
:num="pageData.total.incrNum"
idKey="number-incr"
/>
<transition-number
:num="pageData.total.returnNum"
idKey="number-return"
/>
</div> </div>
<div class="tabs-content box"> </div>
</div>
<div class="tab-right box">
<template v-for="(i,index) in tabs">
<div
:key="index"
class="item flex"
>
<div class="item-title">{{i.title}}</div>
<transition-number
:num="pageData[i.key].totalNum"
:idKey="`number-${i.key}`"
class="item-total"
/>
<div class="item-incr flex">
上月
<transition-number
:num="pageData[i.key].incrNum"
:idKey="`number-incr-${i.key}`"
class="item-incr-numer"
/>
</div>
</div>
</template>
</div>
</div>
<div class="
tabs-content
box">
<div class="title inline">客户增长趋势</div> <div class="title inline">客户增长趋势</div>
</div> </div>
</div> </div>
...@@ -19,11 +63,66 @@ export default { ...@@ -19,11 +63,66 @@ export default {
mixins: [changeMixin], mixins: [changeMixin],
data () { data () {
return { return {
tabs: [
{
title: '企微客户',
key: 'wechat'
},
{
title: '企微群数',
key: 'wechatGroup'
},
{
title: '小程序客户数',
key: 'applet'
},
{
title: '公众号客户数',
key: 'publiccus'
}
],
queryItem: 'total',
id: '10086',
pageData: {
total: {},
wechat: {},
wechatGroup: {},
applet: {},
publiccus: {}
}
} }
}, },
mounted () { mounted () {
}, },
methods: { methods: {
init (params) {
console.log(params)
this.getBrandOverallbase('total')
this.getBrandOverallbase('wechat')
this.getBrandOverallbase('wechatGroup')
this.getBrandOverallbase('applet')
this.getBrandOverallbase('publiccus')
},
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
if (code == 0) {
let [dataList] = data.dataList
console.log(`________________${queryItem}_______________________`, data)
this.pageData[queryItem] = dataList
}
})
}
} }
} }
</script> </script>
...@@ -37,6 +136,67 @@ export default { ...@@ -37,6 +136,67 @@ export default {
grid-template-columns: 41.5% 57.5%; grid-template-columns: 41.5% 57.5%;
justify-content: space-between; justify-content: space-between;
margin-bottom: 0.5vh; margin-bottom: 0.5vh;
.tab-total-box {
height: 100%;
padding-left: 8px;
box-sizing: border-box;
.total-title-box {
.total {
width: 40%;
}
> div {
box-sizing: border-box;
width: 30%;
padding-left: 0;
}
}
.total-number-box {
#number-total {
font-size: 24px;
color: #eb6001;
font-weight: 700;
line-height: 3.7vh;
width: 40%;
}
> div {
width: 30%;
font-size: 14px;
color: #f5aa01;
}
}
}
&-right {
display: grid;
grid-template-columns: repeat(4, 25%);
height: 100%;
.item {
padding: 0 8px;
box-sizing: border-box;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
&-title {
font-size: 12px;
color: #e8e8e8;
padding-top: 0.5vh;
}
&-total {
font-size: 16px;
color: #eb6001;
font-weight: 700;
}
&-incr {
font-size: 12px;
color: #606266;
padding-bottom: 0.5vh;
&-numer {
font-size: 10.5px;
color: #e60115;
}
}
}
}
} }
&-content { &-content {
height: 24.4vh; height: 24.4vh;
......
...@@ -20,7 +20,6 @@ import { fetchConfig, cfg } from '@/config' ...@@ -20,7 +20,6 @@ import { fetchConfig, cfg } from '@/config'
import '@/assets/css/index.scss' import '@/assets/css/index.scss'
import './utils/util' import './utils/util'
import 'components' import 'components'
Vue.prototype.api = api
Vue.prototype.to = function (name, params) { Vue.prototype.to = function (name, params) {
if (name === -1) { if (name === -1) {
router.go(-1) router.go(-1)
...@@ -39,7 +38,9 @@ fetchConfig(!isMock).then(res => { ...@@ -39,7 +38,9 @@ fetchConfig(!isMock).then(res => {
// 设置 js中可以访问 $cdn // 设置 js中可以访问 $cdn
Vue.use(cfg) Vue.use(cfg)
// if (res.vconsole) new VConsole() // if (res.vconsole) new VConsole()
window.$HTTP = new Request(res.request) window.$HTTP = new Request()
// window.$HTTP = new Request(res.request)
Vue.prototype.api = api
window.vm = new Vue({ window.vm = new Vue({
el: '#app', el: '#app',
router, router,
......
...@@ -8,7 +8,15 @@ ...@@ -8,7 +8,15 @@
<template> <template>
<div> <div>
<div class="title">有效客户</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> </div>
</template> </template>
...@@ -25,48 +33,77 @@ export default { ...@@ -25,48 +33,77 @@ export default {
}, },
data() { data() {
return { return {
rankList: [ isEmpty: true,
{ storeOrBrandTxt: '品牌',
name: '奥迪', dataList: []
num: 599604
},
{
name: '宝马',
num: 599604
},
{
name: '现代起亚',
num: 599604
},
{
name: '奔驰',
num: 599604
},
{
name: '沃尔沃',
num: 599604
}
]
} }
}, },
mounted() { mounted() { },
// this.dealList()
},
methods: { methods: {
init(val) { init(val) {
}, this.isEmpty = true
// 折线图数据 var params = {
getList() { }, req: {
// 排名数据 // corporateGroupName: '广汇',
getRankList() { }, corporateGroupName: '集团1',
dealList() { queryItem: 'valid',
this.rankList.forEach(item => { querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
item.num = this.numAddSymbol(item.num) 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) { dealList(list) {
console.log(value) 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> </script>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<div v-if="isEmpty" class="empty"> <div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" /> <img src="../../assets/images/empty.png" alt="" />
</div> </div>
<LineChart v-else :dataList="dataList"></LineChart> <LineChart v-else ref="lineChartRef" domId="fileChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt"></LineChart>
</div> </div>
</div> </div>
</template> </template>
...@@ -34,6 +34,7 @@ export default { ...@@ -34,6 +34,7 @@ export default {
data() { data() {
return { return {
isEmpty: true, isEmpty: true,
storeOrBrandTxt: '品牌',
dataList: [] dataList: []
} }
}, },
...@@ -42,7 +43,8 @@ export default { ...@@ -42,7 +43,8 @@ export default {
}, },
methods: { methods: {
init(val) { init(val) {
console.log(val) // console.log(val)
this.isEmpty = true
var params = { var params = {
req: { req: {
// corporateGroupName: '广汇', // corporateGroupName: '广汇',
...@@ -53,19 +55,24 @@ export default { ...@@ -53,19 +55,24 @@ export default {
queryType: val.reportType || 0 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 var { code, data } = res
switch (+code) { switch (+code) {
case 0: case 0:
this.dataList = [] 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.isEmpty = false
this.dealList(data.dataList) this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
} }
break break
// default:
// alert(message)
} }
}) })
}, },
...@@ -73,8 +80,8 @@ export default { ...@@ -73,8 +80,8 @@ export default {
var topList = [] var topList = []
var lastList = [] var lastList = []
list.forEach(item => { list.forEach(item => {
const topTempList = JSON.parse(item.topList) const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = JSON.parse(item.lastList) const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = [] topList = []
lastList = [] lastList = []
Object.keys(topTempList).forEach(item => { Object.keys(topTempList).forEach(item => {
......
...@@ -8,11 +8,118 @@ ...@@ -8,11 +8,118 @@
<template> <template>
<div> <div>
<div class="title">首保回店</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" :tooltipFormatterObj="tooltipFormatterObj"></LineChart>
</div>
</div> </div>
</template> </template>
<script> <script>
import { changeMixin } from '@/mixins'
export default { export default {
name: 'First' name: 'First',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
tooltipFormatterObj: [
{
label: '回店率',
attrName: 'num',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
],
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> </script>
...@@ -8,11 +8,101 @@ ...@@ -8,11 +8,101 @@
<template> <template>
<div> <div>
<div class="title">客户保持</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> </div>
</template> </template>
<script> <script>
import { changeMixin } from '@/mixins'
export default { 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> </script>
...@@ -8,11 +8,101 @@ ...@@ -8,11 +8,101 @@
<template> <template>
<div> <div>
<div class="title">客户流失</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> </div>
</template> </template>
<script> <script>
import { changeMixin } from '@/mixins'
export default { 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> </script>
...@@ -8,11 +8,118 @@ ...@@ -8,11 +8,118 @@
<template> <template>
<div> <div>
<div class="title">定保回店</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" :tooltipFormatterObj="tooltipFormatterObj"></LineChart>
</div>
</div> </div>
</template> </template>
<script> <script>
import { changeMixin } from '@/mixins'
export default { export default {
name: 'Sadayasu' name: 'Sadayasu',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
tooltipFormatterObj: [
{
label: '回店率',
attrName: 'num',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
],
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> </script>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!