Commit bd382f69 by 胡悦

Merge branch 'gh_v1.2.0' into ty_v1.2.0

2 parents d01599f2 cdd190e5
// window.$HTTP // window.$HTTP
export default { export default {
/**获取品牌---总体模块信息(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus 的基础数据 和 前五排行/后五排行 ) */ /** 获取品牌---总体模块信息(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus 的基础数据 和 前五排行/后五排行 ) */
getBrandOverallbase (req) { getBrandOverallbase(req) {
return window.$HTTP.get('brand/overallbase', { req }) return window.$HTTP.get('brand/overallbase', { req })
}, },
/*获取品牌---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */ /* 获取品牌---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getBrandOveralltrend (req) { getBrandOveralltrend(req) {
return window.$HTTP.get('brand/overalltrend', { req }) return window.$HTTP.get('brand/overalltrend', { req })
}, },
/* 获取门店总体相关信息 */ /* 获取门店总体相关信息 */
getMerchantOverallbase (req) { getMerchantOverallbase(req) {
return window.$HTTP.get('merchant/overallbase', { req }) return window.$HTTP.get('merchant/overallbase', { req })
}, },
/*获取门店---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */ /* 获取门店---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getMerchantOveralltrend (req) { getMerchantOveralltrend(req) {
return window.$HTTP.get('merchant/overalltrend', { req }) return window.$HTTP.get('merchant/overalltrend', { req })
}, },
/**
* 获取接入门店数
*/
getMerchantNum(req) {
return window.$HTTP.get('brand/getMerchantNum', { req })
}
} }
...@@ -11,9 +11,13 @@ ...@@ -11,9 +11,13 @@
<div class="line-item"> <div class="line-item">
<marquee :direction="directionTimer" :delay="delayTimer" :text="item.label"></marquee> <marquee :direction="directionTimer" :delay="delayTimer" :text="item.label"></marquee>
</div> </div>
<div class="line-item"> <div class="line-item">
<marquee class="txt-orange" :direction="directionTimer" :delay="delayTimer" :text="item.value"></marquee> <span class="txt-orange" :direction="directionTimer" :delay="delayTimer">{{ item.value }}</span>
</div> </div>
<!-- <div class="line-item">
<marquee class="txt-orange" :direction="directionTimer" :delay="delayTimer" :text="item.value"></marquee>
</div> -->
</div> </div>
</div> </div>
</div> </div>
...@@ -137,17 +141,17 @@ export default { ...@@ -137,17 +141,17 @@ export default {
// 移除图表 // 移除图表
this[this.domId].on('globalout', () => { this[this.domId].on('globalout', () => {
// this.chartAction() this.chartAction()
this.getRankList(this.dataList.length - 1, this.rankFlag + 'List') this.getRankList(this.dataList.length - 1, this.rankFlag + 'List')
}) })
}, },
// chartAction(type) { chartAction(type) {
// this[this.domId].dispatchAction({ this[this.domId].dispatchAction({
// type: type || 'showTip', type: type || 'showTip',
// seriesIndex: +this.moveAttr.seriesIndex, seriesIndex: 0,
// dataIndex: +this.moveAttr.dataIndex dataIndex: this.dataList.length - 1
// }) })
// }, },
getRankList(idx, attrName = 'topList') { getRankList(idx, attrName = 'topList') {
this.dataList[idx][attrName].length ? this.$set(this, 'rankList', this.dataList[idx][attrName]) : this.resetRankList() this.dataList[idx][attrName].length ? this.$set(this, 'rankList', this.dataList[idx][attrName]) : this.resetRankList()
}, },
...@@ -157,10 +161,14 @@ export default { ...@@ -157,10 +161,14 @@ export default {
let month = new Date(e.statDate).getMonth() let month = new Date(e.statDate).getMonth()
this.lineOptions.xAxis.data.push(this.queryType == 0 ? `${month == 0 ? '1月' : `${Number(month) + 1}月`}` : e.statDate.split('-').slice(1).join('-')) this.lineOptions.xAxis.data.push(this.queryType == 0 ? `${month == 0 ? '1月' : `${Number(month) + 1}月`}` : e.statDate.split('-').slice(1).join('-'))
}) })
this.lineOptions.series[0].data = this.dataList.map(item => item.num) var seriesDate = this.dataList.map(item => +item.num)
this.lineOptions.series[0].data = seriesDate
this.lineOptions.yAxis.scale = true
// this.lineOptions.yAxis.min = Math.min(...seriesDate)
// this.lineOptions.yAxis.max = Math.max(...seriesDate)
this[this.domId].setOption(this.lineOptions) this[this.domId].setOption(this.lineOptions)
// 默认展示tooltip // 默认展示tooltip
// this.chartAction() this.chartAction()
this.getRankList(this.dataList.length - 1) this.getRankList(this.dataList.length - 1)
}, },
handleRankChange(value) { handleRankChange(value) {
......
<template> <template>
<div <div class="marquee-box" ref="marqueeBox">
class="marquee-box" <span class="marquee" ref="marqueeText" :style="[{ transition: `all ${move ? speed : 0}s linear` }, { left: target }]">{{ text }}</span>
ref="marqueeBox"
>
<span
class="marquee"
ref="marqueeText"
:style="[{'transition': `all ${move ? speed : 0}s linear`},{'left':target}]"
>{{text}}</span>
</div> </div>
</template> </template>
<script type='text/ecmascript-6'> <script type="text/ecmascript-6">
export default { export default {
name: 'Marquee', name: 'Marquee',
props: { props: {
...@@ -34,16 +27,21 @@ export default { ...@@ -34,16 +27,21 @@ export default {
speed: 0 speed: 0
} }
}, },
mounted () { watch:{
setTimeout(() => { 'text'(n){
if(n)setTimeout(() => {
let { marqueeBox, marqueeText } = this.$refs let { marqueeBox, marqueeText } = this.$refs
if (!marqueeBox) return if (!marqueeBox) return
let boxWidth = marqueeBox.offsetWidth, let boxWidth = marqueeBox.offsetWidth,
valueWidth = marqueeText.offsetWidth valueWidth = marqueeText.offsetWidth
this.valueWidth = valueWidth this.valueWidth = valueWidth
this.boxWidth = boxWidth this.boxWidth = boxWidth
if (boxWidth - 20 <= valueWidth) this.run(valueWidth) if (boxWidth - 10 <= valueWidth) this.run(valueWidth)
}, this.delay) }, this.delay)
}
},
mounted () {
}, },
methods: { methods: {
run () { run () {
...@@ -76,7 +74,7 @@ export default { ...@@ -76,7 +74,7 @@ export default {
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang="scss">
.marquee-box { .marquee-box {
width: 100%; width: 100%;
height: 100%; height: 100%;
......
...@@ -3,7 +3,10 @@ ...@@ -3,7 +3,10 @@
<div :id="id" :style="{ height: height }" class="pie-chart"></div> <div :id="id" :style="{ height: height }" class="pie-chart"></div>
<div class="center-content" :style="{ fontSize: size }"> <div class="center-content" :style="{ fontSize: size }">
<div :class="[id, 'center-content-num']"></div> <div :class="[id, 'center-content-num']"></div>
<div class="center-content-desc">{{ numDesc }}</div> </div>
<div class="content-desc">
<div class="content-desc-icon" :style="{ background: descColor }"></div>
{{ numDesc }}
</div> </div>
</div> </div>
</template> </template>
...@@ -32,7 +35,7 @@ export default { ...@@ -32,7 +35,7 @@ export default {
}, },
radius: { radius: {
type: Array, type: Array,
default: () => ['55%', '75%'] default: () => ['50%', '70%']
}, },
colors: { colors: {
type: Array, type: Array,
...@@ -54,7 +57,8 @@ export default { ...@@ -54,7 +57,8 @@ export default {
subtext: '', subtext: '',
currentIndex: -1, currentIndex: -1,
mainValue: 0, mainValue: 0,
numDesc: '' numDesc: '',
descColor: ''
} }
}, },
watch: { watch: {
...@@ -147,6 +151,7 @@ export default { ...@@ -147,6 +151,7 @@ export default {
this.echartsPie.on('mouseover', data => { this.echartsPie.on('mouseover', data => {
this.mainValue = data.data.value this.mainValue = data.data.value
this.numDesc = data.data.name this.numDesc = data.data.name
this.descColor = data.color
this.setAnamiteText() this.setAnamiteText()
// 停止定时器,清除之前的高亮 // 停止定时器,清除之前的高亮
clearInterval(this.mTime) clearInterval(this.mTime)
...@@ -178,16 +183,18 @@ export default { ...@@ -178,16 +183,18 @@ export default {
dataIndex: this.currentIndex dataIndex: this.currentIndex
}) })
//高亮项this.currentIndex //高亮项this.currentIndex
this.mainValue = this.option.series[0].data[this.currentIndex].value this.mainValue = this.option.series[0].data[this.currentIndex].value
this.numDesc = this.option.series[0].data[this.currentIndex].name this.numDesc = this.option.series[0].data[this.currentIndex].name
this.descColor = this.option.color[this.currentIndex]
this.setAnamiteText() this.setAnamiteText()
}, },
setAnamiteText() { setAnamiteText() {
document.querySelector(`.${this.id}`).nextElementSibling.style = 'animation-iteration-count:infinite;' // document.querySelector(`.${this.id}`).nextElementSibling.style = 'animation-iteration-count:infinite;'
if (document.querySelector(`.${this.id}`)) document.querySelector(`.${this.id}`).style = `--step:${this.mainValue}` if (document.querySelector(`.${this.id}`)) document.querySelector(`.${this.id}`).style = `--step:${this.mainValue}`
setTimeout(() => { // setTimeout(() => {
document.querySelector(`.${this.id}`).nextElementSibling.style = 'animation-iteration-count:0' // document.querySelector(`.${this.id}`).nextElementSibling.style = 'animation-iteration-count:0'
}, 3000) // }, 3000)
}, },
//高亮 //高亮
pieActive() { pieActive() {
...@@ -213,15 +220,15 @@ export default { ...@@ -213,15 +220,15 @@ export default {
text-align: center; text-align: center;
max-width: 40%; max-width: 40%;
&-num { &-num {
overflow: hidden; // overflow: hidden;
text-overflow: ellipsis; // text-overflow: ellipsis;
white-space: nowrap; // white-space: nowrap;
// font-size: 0.6vw; // font-size: 0.6vw;
color: #fff; color: #fff;
--step: 0; --step: 0;
counter-reset: count var(--step); counter-reset: count var(--step);
z-index: var(--step); z-index: var(--step);
transition: --step 1s; transition: --step 0.5s;
&::before { &::before {
content: counter(count); content: counter(count);
} }
...@@ -235,7 +242,26 @@ export default { ...@@ -235,7 +242,26 @@ export default {
animation: rotateIn 3s infinite; animation: rotateIn 3s infinite;
} }
} }
.pie-chart { .content-desc {
display:flex;
align-items: center;
font-size: 8px;
color: #c8c8c8;
text-align: center;
font-weight: 400;
position: absolute;
top: 91%;
left: 50%;
transform: translateX(-50%);
text-align: center;
height: 14px !important;
white-space: nowrap;
&-icon {
width: 8px;
height: 4px;
border-radius: 2px;
margin-right:4px;
}
} }
} }
@property --step { @property --step {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="tabs"> <div class="tabs">
<div class="tab pointer"> <div class="tab pointer">
<div class="tab-left box" @click="changeType('total')"> <div class="tab-left box" @click="changeType('total')">
<div class="tab-total-box"> <div :class="{ 'tab-total-box': true, active: tabType == 'total' }">
<div class="total-title-box flex"> <div class="total-title-box flex">
<div class="title inline total">客户总数</div> <div class="title inline total">客户总数</div>
<div class="title inline">{{ req.queryType == 0 ? '上月' : '昨日' }}新增</div> <div class="title inline">{{ req.queryType == 0 ? '上月' : '昨日' }}新增</div>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</div> </div>
<div class="tab-right box"> <div class="tab-right box">
<template v-for="(i, index) in tabs"> <template v-for="(i, index) in tabs">
<div :key="index" class="item flex" @click="changeType(i.key)"> <div :key="index" :class="['item', 'flex', tabType == i.key ? 'active' : '']" @click="changeType(i.key)">
<div class="item-title">{{ i.title }}</div> <div class="item-title">{{ i.title }}</div>
<transition-number :num="pageData[i.key].totalNum" :idKey="`number-${i.key}`" class="item-total" /> <transition-number :num="pageData[i.key].totalNum" :idKey="`number-${i.key}`" class="item-total" />
<div :class="['item-incr flex', { up: pageData[i.key].up }, { down: pageData[i.key].down }]"> <div :class="['item-incr flex', { up: pageData[i.key].up }, { down: pageData[i.key].down }]">
...@@ -34,7 +34,10 @@ ...@@ -34,7 +34,10 @@
<div class="tabs-content box"> <div class="tabs-content box">
<div class="tabs-title title-icon"> <div class="tabs-title title-icon">
<span class="icon"></span> <span class="icon"></span>
<span>客户增长趋势</span> <span>
客户增长趋势
<label class="tabs-title-info">-{{ tabTitle }}</label>
</span>
</div> </div>
<div class="tabs-content-chart flex"> <div class="tabs-content-chart flex">
<div class="line flex"> <div class="line flex">
...@@ -50,6 +53,7 @@ ...@@ -50,6 +53,7 @@
</template> </template>
</div> </div>
<div class="table user-select pointer"> <div class="table user-select pointer">
<div class="tabs-title-info table-position">{{ tabTitle }}</div>
<div class="table-head"> <div class="table-head">
<template v-for="(i, index) in tabHead"> <template v-for="(i, index) in tabHead">
<div :class="['table-head-item flex', { active: index == tabIndex }]" :key="index" @click="tabIndex = index"> <div :class="['table-head-item flex', { active: index == tabIndex }]" :key="index" @click="tabIndex = index">
...@@ -57,7 +61,7 @@ ...@@ -57,7 +61,7 @@
</div> </div>
</template> </template>
</div> </div>
<div class="table-body flex"> <div class="table-body">
<template v-for="(i, index) in tabIndex == 0 ? pageData[tabType].top : pageData[tabType].last"> <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-body-item flex" :key="index">
<div class="table-num flex">{{ index + 1 }}</div> <div class="table-num flex">{{ index + 1 }}</div>
...@@ -98,10 +102,11 @@ import * as echarts from 'echarts' ...@@ -98,10 +102,11 @@ import * as echarts from 'echarts'
export default { export default {
name: 'ViewTabs', name: 'ViewTabs',
mixins: [changeMixin], mixins: [changeMixin],
data () { data() {
return { return {
tabs, tabs,
tabHead: [], tabHead: [],
tabTitle: '客户总数',
tabType: 'total', tabType: 'total',
tabIndex: 0, tabIndex: 0,
delayTimer: 3000, delayTimer: 3000,
...@@ -121,10 +126,9 @@ export default { ...@@ -121,10 +126,9 @@ export default {
updata: Date.now() updata: Date.now()
} }
}, },
mounted () { mounted() {},
},
methods: { methods: {
init (params) { init(params) {
this.isGroup = true this.isGroup = true
let req = { let req = {
queryType: params.reportType || 0 queryType: params.reportType || 0
...@@ -137,14 +141,24 @@ export default { ...@@ -137,14 +141,24 @@ export default {
this.getOverallbase('wechatGroup') this.getOverallbase('wechatGroup')
this.getOverallbase('applet') this.getOverallbase('applet')
this.getOverallbase('publiccus') this.getOverallbase('publiccus')
this.getOveralltrend('total') this.getOveralltrend(this.tabType)
}, },
changeType (type) { changeType(type) {
let title = {
total: '客户总数',
wechat: '企微客户数',
wechatGroup: '企微群数',
applet: '小程序客户数',
publiccus: '公众号客户数'
}
this.tabTitle = title[type]
this.tabType = type this.tabType = type
this.getOveralltrend(type) this.getOveralltrend(type)
}, },
getOverallbase (queryItem) { getOverallbase(queryItem) {
let { req: { queryType } } = this let {
req: { queryType }
} = this
const params = { const params = {
queryItem, queryItem,
queryType, queryType,
...@@ -179,32 +193,34 @@ export default { ...@@ -179,32 +193,34 @@ export default {
} }
} }
this.pageData[queryItem] = dataList this.pageData[queryItem] = dataList
} }
}) })
}, },
ObjectToArray (obj) { ObjectToArray(obj) {
let arr = [] let arr = []
if (obj && obj !== 'null') { if (obj && obj !== 'null') {
obj = obj.replace('null', '"未知"') obj = obj.replace('null', '"未知"')
let item = JSON.parse(obj) let item = JSON.parse(obj)
if (Array.isArray(item)) item.map(e => { if (Array.isArray(item))
item.map(e => {
Object.keys(e).map(name => arr.push({ name, num: e[name] })) Object.keys(e).map(name => arr.push({ name, num: e[name] }))
}) })
else Object.keys(item).map(name => arr.push({ name, num: item[name] })) else Object.keys(item).map(name => arr.push({ name, num: item[name] }))
} }
return arr return arr
}, },
getOveralltrend (queryItem) { getOveralltrend(queryItem) {
let { req: { queryType } } = this let {
req: { queryType }
} = this
const params = { const params = {
queryItem, queryItem,
queryType, queryType,
querystartTime: queryType == 1 ? this.getNDate(-30) : this.getNMonth(-12), querystartTime: queryType == 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: queryType == 1 ? this.getNDate(-1) : this.getNMonth(-1), queryendTime: queryType == 1 ? this.getNDate(-1) : this.getNMonth(-1)
} }
this.api.overview[this.isGroup ? 'getBrandOveralltrend' : 'getMerchantOveralltrend'](params).then(({ data, code }) => { this.api.overview[this.isGroup ? 'getBrandOveralltrend' : 'getMerchantOveralltrend'](params)
.then(({ data, code }) => {
this.flag = true this.flag = true
if (code == 0) { if (code == 0) {
if (!data.dataList.map(item => item.totalNum).every(item => item === 0)) { if (!data.dataList.map(item => item.totalNum).every(item => item === 0)) {
...@@ -214,21 +230,29 @@ export default { ...@@ -214,21 +230,29 @@ export default {
this.draw(data.dataList, queryType) this.draw(data.dataList, queryType)
}) })
} }
} }
}).catch(() => { })
.catch(() => {
this.flag = true this.flag = true
}) })
}, },
draw (lineData, queryType) { chartAction() {
this.canvas.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: this.lineData.length - 1
})
},
draw(lineData, queryType) {
let data = [], let data = [],
Min = 0,
xData = [], xData = [],
title = { title = {
'total': '客户总数', total: '客户总数',
'wechat': '企微客户数', wechat: '企微客户数',
'wechatGroup': '企微群数', wechatGroup: '企微群数',
'applet': '小程序客户数', applet: '小程序客户数',
'publiccus': '公众号客户数' publiccus: '公众号客户数'
}, },
{ tabType } = this { tabType } = this
lineData.map(e => { lineData.map(e => {
...@@ -236,6 +260,7 @@ export default { ...@@ -236,6 +260,7 @@ export default {
xData.push(queryType == 0 ? `${month == 0 ? '1月' : `${Number(month) + 1}月`}` : new Date(e.statDate).format('MM-dd')) xData.push(queryType == 0 ? `${month == 0 ? '1月' : `${Number(month) + 1}月`}` : new Date(e.statDate).format('MM-dd'))
data.push(e.totalNum) data.push(e.totalNum)
}) })
Min = Math.min(...data)
let options = { let options = {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
...@@ -274,6 +299,8 @@ export default { ...@@ -274,6 +299,8 @@ export default {
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
// min: Min,
scale: true,
splitLine: { splitLine: {
lineStyle: { lineStyle: {
color: 'rgba(96,98,102,0.2)' color: 'rgba(96,98,102,0.2)'
...@@ -320,9 +347,17 @@ export default { ...@@ -320,9 +347,17 @@ export default {
] ]
} }
this.canvas.setOption(options) this.canvas.setOption(options)
this.chartAction(lineData)
this.canvas.on('globalout', () => {
this.chartAction(lineData)
})
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.canvas.resize() this.canvas.resize()
}) })
// 移除图表
this.canvas.on('globalout', () => {
this.chartAction()
})
} }
} }
} }
...@@ -336,8 +371,8 @@ export default { ...@@ -336,8 +371,8 @@ export default {
display: grid; display: grid;
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: 1vh;
overflow: hidden; // overflow: hidden;
.tab-total-box { .tab-total-box {
height: 100%; height: 100%;
padding-left: 8px; padding-left: 8px;
...@@ -426,6 +461,11 @@ export default { ...@@ -426,6 +461,11 @@ export default {
} }
} }
} }
.active {
background: rgba(235, 96, 1, 0.1);
box-sizing: border-box;
border: 1px solid rgba(235, 96, 1, 0.8);
}
} }
&-content { &-content {
height: 24.4vh; height: 24.4vh;
...@@ -436,6 +476,11 @@ export default { ...@@ -436,6 +476,11 @@ export default {
.tabs-title { .tabs-title {
font-size: 12px; font-size: 12px;
color: #e8e8e8; color: #e8e8e8;
&-info {
font-size: 10px;
color: #eb6001;
line-height: 17px;
}
} }
&-chart { &-chart {
height: 20.2vh; height: 20.2vh;
...@@ -457,6 +502,14 @@ export default { ...@@ -457,6 +502,14 @@ export default {
.table { .table {
flex: 3; flex: 3;
background: #262525; background: #262525;
position: relative;
.table-position {
position: absolute;
top: -20px;
left: 50%;
transform: translateX(-50%);
color: #606266 !important;
}
&-head { &-head {
display: grid; display: grid;
grid-template-columns: repeat(2, 50%); grid-template-columns: repeat(2, 50%);
...@@ -478,8 +531,6 @@ export default { ...@@ -478,8 +531,6 @@ export default {
} }
&-body { &-body {
height: calc(100% - 2.4vh); height: calc(100% - 2.4vh);
flex-direction: column;
justify-content: space-between;
&-item { &-item {
line-height: 3.4vh; line-height: 3.4vh;
width: 100%; width: 100%;
...@@ -492,6 +543,7 @@ export default { ...@@ -492,6 +543,7 @@ export default {
} }
.table-key { .table-key {
width: calc(100% - 96px); width: calc(100% - 96px);
height: 3.6vh;
} }
.tab-value { .tab-value {
width: 52px; width: 52px;
......
...@@ -8,10 +8,12 @@ ...@@ -8,10 +8,12 @@
<div class="top flex"> <div class="top flex">
<img src="@/assets/images/time.svg" class="icon" /> <img src="@/assets/images/time.svg" class="icon" />
<div class="now">{{ now }}</div> <div class="now">{{ now }}</div>
<div class="yesterday">数据截止至 {{ yesterday }}</div>
</div> </div>
<div class="bottom flex"> <div class="bottom flex">
<div class="merchant">已同步门店数:160</div> <div class="merchant">已同步门店数:{{ merchantNum.totalNum }}</div>
数据截止至 {{ yesterday }} <div class="merchant">上月新接入店数:{{merchantNum.increLastMonthNum}}</div>
<div class="merchant">本月新接入店数:{{merchantNum.increThisMonthNum}}</div>
</div> </div>
</div> </div>
<div class="center-control"> <div class="center-control">
...@@ -23,21 +25,35 @@ ...@@ -23,21 +25,35 @@
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
export default { export default {
name: 'ViewTitle', name: 'ViewTitle',
data () { data() {
return { return {
yesterday: '', yesterday: '',
now: new Date().format('yyyy-MM-dd hh:mm:ss') now: new Date().format('yyyy-MM-dd hh:mm:ss'),
merchantNum: {
totalNum: '--',
increLastMonthNum: '--',
increThisMonthNum: '--'
}
} }
}, },
mounted () { mounted() {
this.yesterday = new Date(new Date().setDate(new Date().getDate() - 1)).format('yyyy-MM-dd') this.yesterday = new Date(new Date().setDate(new Date().getDate() - 1)).format('yyyy-MM-dd')
this.timer() this.timer()
this.getMerchantNum()
}, },
methods: { methods: {
timer () { timer() {
setInterval(() => { setInterval(() => {
this.now = new Date().format('yyyy-MM-dd hh:mm:ss') this.now = new Date().format('yyyy-MM-dd hh:mm:ss')
}, 1e3) }, 1e3)
},
getMerchantNum() {
this.api.overview.getMerchantNum({}).then(res => {
console.log(res)
if (res.code === '0') {
this.merchantNum = res.data.dataList[0]
}
})
} }
} }
} }
...@@ -56,7 +72,7 @@ export default { ...@@ -56,7 +72,7 @@ export default {
color: transparent; color: transparent;
background: linear-gradient(left, #e60115 10%, #eb6001 25%, #f5aa01 50%, #fdf006 100%); background: linear-gradient(left, #e60115 10%, #eb6001 25%, #f5aa01 50%, #fdf006 100%);
-webkit-background-clip: text; -webkit-background-clip: text;
font-size: 22px; font-size: 18px;
font-weight: 600; font-weight: 600;
&::before { &::before {
content: ''; content: '';
...@@ -74,6 +90,11 @@ export default { ...@@ -74,6 +90,11 @@ export default {
color: #ffffff; color: #ffffff;
.top { .top {
justify-content: flex-end; justify-content: flex-end;
.yesterday {
font-size: 10px;
color: #606266;
margin-left: 5px;
}
} }
.icon { .icon {
width: 16px; width: 16px;
...@@ -88,6 +109,7 @@ export default { ...@@ -88,6 +109,7 @@ export default {
color: #eb6001; color: #eb6001;
margin-right: 10px; margin-right: 10px;
padding-right: 10px; padding-right: 10px;
line-height: 2vh;
position: relative; position: relative;
&::after { &::after {
position: absolute; position: absolute;
...@@ -97,7 +119,13 @@ export default { ...@@ -97,7 +119,13 @@ export default {
width: 1px; width: 1px;
height: 1.5vh; height: 1.5vh;
content: ''; content: '';
background-color: #606266; background-color: #EB6001;
}
&:last-child{
margin-right: 0;
&::after {
width: 0;
}
} }
} }
} }
......
...@@ -7,7 +7,7 @@ function getLineOptions(obj) { ...@@ -7,7 +7,7 @@ function getLineOptions(obj) {
backgroundColor: 'rgba(68,68,68,0.80)', backgroundColor: 'rgba(68,68,68,0.80)',
textStyle: { textStyle: {
color: '#FFFFFF', color: '#FFFFFF',
fontSize: '8px' fontSize: '1.5px'
}, },
formatter: tooltipFormatter || '', formatter: tooltipFormatter || '',
confine: true confine: true
......
...@@ -12,8 +12,9 @@ module.exports = { ...@@ -12,8 +12,9 @@ module.exports = {
title: 'XXX汽车服务', title: 'XXX汽车服务',
request: { request: {
// baseURL: 'http://192.168.3.126:8081', // 本地测试项目地址, // baseURL: 'http://192.168.3.126:8081', // 本地测试项目地址,
// baseURL: 'http://192.168.1.152:8081', // 本地开发项目地址, // baseURL: 'http://192.168.1.160:8081', // 本地开发项目地址,
baseURL: 'http://192.168.1.160:8081', // 本地开发项目地址, // baseURL: 'http://192.168.1.158:9996',
baseURL: 'http://192.168.1.152:9996',
// 设置超时时间 // 设置超时时间
timeout: 180000, timeout: 180000,
// 携带凭证 // 携带凭证
......
...@@ -48,7 +48,8 @@ export default { ...@@ -48,7 +48,8 @@ export default {
barData: [], barData: [],
key: '重要价值', key: '重要价值',
isBrand: false, isBrand: false,
brandName: '' brandName: '',
currentData: {}
} }
}, },
mounted() {}, mounted() {},
...@@ -60,6 +61,23 @@ export default { ...@@ -60,6 +61,23 @@ export default {
this.barChart.resize() this.barChart.resize()
}) })
this.option = { this.option = {
tooltip: {
trigger: 'axis',
showContent: false,
axisPointer: {
type: 'shadow',
shadowStyle: {
color: 'rgba(235,96,1,0.30'
}
},
borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)',
confine: true,
textStyle: {
color: '#FFFFFF',
fontSize: 8
}
},
grid: { grid: {
left: '3%', left: '3%',
right: '4%', right: '4%',
...@@ -94,7 +112,7 @@ export default { ...@@ -94,7 +112,7 @@ export default {
// data: [120, 200, 150, 80, 70, 110, 130, 300], // data: [120, 200, 150, 80, 70, 110, 130, 300],
data: this.barData.reverse(), data: this.barData.reverse(),
type: 'bar', type: 'bar',
barWidth: 12, barWidth: 18,
itemStyle: { itemStyle: {
normal: { normal: {
label: { label: {
...@@ -103,7 +121,7 @@ export default { ...@@ -103,7 +121,7 @@ export default {
textStyle: { textStyle: {
fontSize: '12', fontSize: '12',
color: '#fff', color: '#fff',
height: '12', height: '18',
padding: [1, 0, 0, 0] padding: [1, 0, 0, 0]
} }
}, },
...@@ -124,9 +142,26 @@ export default { ...@@ -124,9 +142,26 @@ export default {
} }
this.barChart.clear() this.barChart.clear()
this.barChart.setOption(this.option) this.barChart.setOption(this.option)
this.chartAction()
this.barChart.getZr().on('mousemove', params => {
const pointInPixel = [params.offsetX, params.offsetY]
const pointInGrid = this.barChart.convertFromPixel({ seriesIndex: 0 }, pointInPixel)
const yIndex = pointInGrid[1]
const op = this.barChart.getOption()
const name = op.yAxis[0].data[yIndex]
this.initPieData(name)
this.currentData = {
name,
dataIndex: yIndex
}
})
// 鼠标划入 // 鼠标划入
this.barChart.on('mouseover', data => { // this.barChart.on('mouseup', data => {
this.initPieData(data.name) // this.initPieData(data.name)
// })
this.barChart.on('globalout', () => {
this.chartAction(this.currentData.dataIndex)
this.initPieData(this.currentData.name)
}) })
}, },
getValueType() { getValueType() {
...@@ -178,6 +213,13 @@ export default { ...@@ -178,6 +213,13 @@ export default {
this.brandName = newVal.brand.name this.brandName = newVal.brand.name
} }
this.getValueType() this.getValueType()
},
chartAction(index = 7) {
this.barChart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: index
})
} }
} }
} }
......
...@@ -98,8 +98,8 @@ export default { ...@@ -98,8 +98,8 @@ export default {
}) })
this.dataList.push({ this.dataList.push({
num: item.num || 0, num: item.num || 0,
hrate: item.hrate.toFixed(2) || 0, hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(2) || 0, trate: item.trate.toFixed(4) || 0,
statDate: item.statDate, statDate: item.statDate,
topList: topList, topList: topList,
lastList: lastList lastList: lastList
......
...@@ -100,8 +100,8 @@ export default { ...@@ -100,8 +100,8 @@ export default {
}) })
this.dataList.push({ this.dataList.push({
num: item.num || 0, num: item.num || 0,
hrate: item.hrate.toFixed(2) || 0, hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(2) || 0, trate: item.trate.toFixed(4) || 0,
statDate: item.statDate, statDate: item.statDate,
topList: topList, topList: topList,
lastList: lastList lastList: lastList
......
...@@ -116,20 +116,20 @@ export default { ...@@ -116,20 +116,20 @@ export default {
Object.keys(topTempList).forEach(item => { Object.keys(topTempList).forEach(item => {
topList.push({ topList.push({
label: item, label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(2) + '%' : '- -' value: topTempList[item].rate ? topTempList[item].rate.toFixed(4) + '%' : '- -'
}) })
}) })
Object.keys(lastTempList).forEach(item => { Object.keys(lastTempList).forEach(item => {
lastList.push({ lastList.push({
label: item, label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(2) + '%' : '- -' value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(4) + '%' : '- -'
}) })
}) })
this.dataList.push({ this.dataList.push({
num: item.num || 0, num: item.num || 0,
rate: item.rate.toFixed(2) || 0, rate: item.rate.toFixed(4) || 0,
hrate: item.hrate.toFixed(2) || 0, hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(2) || 0, trate: item.trate.toFixed(4) || 0,
statDate: item.statDate, statDate: item.statDate,
topList: topList, topList: topList,
lastList: lastList lastList: lastList
......
...@@ -108,20 +108,20 @@ export default { ...@@ -108,20 +108,20 @@ export default {
Object.keys(topTempList).forEach(item => { Object.keys(topTempList).forEach(item => {
topList.push({ topList.push({
label: item, label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(2) + '%' : '- -' value: topTempList[item].rate ? topTempList[item].rate.toFixed(4) + '%' : '- -'
}) })
}) })
Object.keys(lastTempList).forEach(item => { Object.keys(lastTempList).forEach(item => {
lastList.push({ lastList.push({
label: item, label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(2) + '%' : '- -' value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(4) + '%' : '- -'
}) })
}) })
this.dataList.push({ this.dataList.push({
num: item.num || 0, num: item.num || 0,
rate: item.rate.toFixed(2) || 0, rate: item.rate.toFixed(4) || 0,
hrate: item.hrate.toFixed(2) || 0, hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(2) || 0, trate: item.trate.toFixed(4) || 0,
statDate: item.statDate, statDate: item.statDate,
topList: topList, topList: topList,
lastList: lastList lastList: lastList
......
...@@ -108,20 +108,20 @@ export default { ...@@ -108,20 +108,20 @@ export default {
Object.keys(topTempList).forEach(item => { Object.keys(topTempList).forEach(item => {
topList.push({ topList.push({
label: item, label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(2) + '%' : '- -' value: topTempList[item].rate ? topTempList[item].rate.toFixed(4) + '%' : '- -'
}) })
}) })
Object.keys(lastTempList).forEach(item => { Object.keys(lastTempList).forEach(item => {
lastList.push({ lastList.push({
label: item, label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(2) + '%' : '- -' value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(4) + '%' : '- -'
}) })
}) })
this.dataList.push({ this.dataList.push({
num: item.num || 0, num: item.num || 0,
rate: item.rate.toFixed(2) || 0, rate: item.rate.toFixed(4) || 0,
hrate: item.hrate.toFixed(2) || 0, hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(2) || 0, trate: item.trate.toFixed(4) || 0,
statDate: item.statDate, statDate: item.statDate,
topList: topList, topList: topList,
lastList: lastList lastList: lastList
......
...@@ -116,20 +116,20 @@ export default { ...@@ -116,20 +116,20 @@ export default {
Object.keys(topTempList).forEach(item => { Object.keys(topTempList).forEach(item => {
topList.push({ topList.push({
label: item, label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(2) + '%' : '- -' value: topTempList[item].rate ? topTempList[item].rate.toFixed(4) + '%' : '- -'
}) })
}) })
Object.keys(lastTempList).forEach(item => { Object.keys(lastTempList).forEach(item => {
lastList.push({ lastList.push({
label: item, label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(2) + '%' : '- -' value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(4) + '%' : '- -'
}) })
}) })
this.dataList.push({ this.dataList.push({
num: item.num || 0, num: item.num || 0,
rate: item.rate.toFixed(2) || 0, rate: item.rate.toFixed(4) || 0,
hrate: item.hrate.toFixed(2) || 0, hrate: item.hrate.toFixed(4) || 0,
trate: item.trate.toFixed(2) || 0, trate: item.trate.toFixed(4) || 0,
statDate: item.statDate, statDate: item.statDate,
topList: topList, topList: topList,
lastList: lastList lastList: lastList
......
...@@ -18,9 +18,10 @@ ...@@ -18,9 +18,10 @@
</div> </div>
</div> </div>
<div class="flow-right"> <div class="flow-right">
<!-- <div class="ranking-value">{{currentName}}{{ isBrand ? '门店' : '品牌' }}排名</div> -->
<div class="ranking-title"> <div class="ranking-title">
<div @click="changeRank(1)" :class="isActive == 1 ? 'active' : ''">前5{{ isBrand ? '门店' : '品牌' }}</div> <div @click="changeRank(1)" :style="{'background-color': isActive == 1 ? bgColor : ''}" :class="isActive == 1 ? 'active' : ''">{{currentName}}前5{{ isBrand ? '门店' : '品牌' }}</div>
<div @click="changeRank(2)" :class="isActive == 2 ? 'active' : ''">后5{{ isBrand ? '门店' : '品牌' }}</div> <div @click="changeRank(2)" :style="{'background-color': isActive == 2 ? bgColor : ''}" :class="isActive == 2 ? 'active' : ''">{{currentName}}后5{{ isBrand ? '门店' : '品牌' }}</div>
</div> </div>
<div class="ranking-content"> <div class="ranking-content">
<div class="ranking-item" v-for="(item, index) in flowData" :key="index"> <div class="ranking-item" v-for="(item, index) in flowData" :key="index">
...@@ -93,7 +94,10 @@ export default { ...@@ -93,7 +94,10 @@ export default {
paramsData: {}, paramsData: {},
topList: [], topList: [],
lastList: [], lastList: [],
isBrand: false isBrand: false,
currentName: '',
bgColor: '#BF98FF',
colorList: ['#BF98FF', '#E60115', '#4FA0FF', '#EB6001', '#F5AA01']
} }
}, },
mounted() { mounted() {
...@@ -150,7 +154,7 @@ export default { ...@@ -150,7 +154,7 @@ export default {
}, },
borderWidth: 0 borderWidth: 0
}, },
color: ['rgba(235, 96, 2, 1)', 'rgba(235, 96, 2, .8)', 'rgba(235, 96, 2, .6)', 'rgba(235, 96, 2, .4)', 'rgba(245, 170, 2, .8)'], color: this.colorList,
series: [ series: [
{ {
name: '漏斗图', name: '漏斗图',
...@@ -162,7 +166,7 @@ export default { ...@@ -162,7 +166,7 @@ export default {
minSize: '30%', minSize: '30%',
maxSize: '100%', maxSize: '100%',
sort: 'descending', sort: 'descending',
gap: 2, gap: 1,
label: { label: {
show: true, show: true,
position: 'inside', position: 'inside',
...@@ -190,15 +194,21 @@ export default { ...@@ -190,15 +194,21 @@ export default {
] ]
} }
this.echartsFunnel.setOption(this.option) this.echartsFunnel.setOption(this.option)
// this.echartsFunnel.getZr.on('mouseover', params => {
// })
this.echartsFunnel.on( this.echartsFunnel.on(
'mouseover', 'mouseover',
utils.debounce(data => { utils.debounce(data => {
this.getSaleTrans(this.paramsData, data.data.type) console.log(data)
this.getSaleTrans(this.paramsData, data.data.type, data.data.name, data.dataIndex)
}), }),
1000 / 60 500
) )
// this.echartsFunnel.on('globalout', () => {
// })
}, },
getSaleTrans(val, queryItem = 'enter') { getSaleTrans(val, queryItem = 'enter', name = '客流', index = 0) {
const params = { const params = {
req: { req: {
queryItem: queryItem, queryItem: queryItem,
...@@ -232,6 +242,8 @@ export default { ...@@ -232,6 +242,8 @@ export default {
} }
} }
this.flowData = this.isActive == 1 ? this.topList : this.lastList this.flowData = this.isActive == 1 ? this.topList : this.lastList
this.currentName = name
this.bgColor = this.colorList[index]
}) })
}, },
// 切换品牌排序 // 切换品牌排序
...@@ -279,12 +291,12 @@ export default { ...@@ -279,12 +291,12 @@ export default {
.ranking-content { .ranking-content {
background-color: #262525; background-color: #262525;
padding: 0.4vh 0; padding: 0.4vh 0;
height: 11vh;
} }
.ranking-item { .ranking-item {
display: flex; display: flex;
width: 100%; width: 100%;
align-items: center; align-items: center;
line-height: 2.2vh; line-height: 2.2vh;
height: 2.2vh; height: 2.2vh;
.ranking-sort { .ranking-sort {
......
/*
* @Description:
* @Author: huyue
* @Date: 2022-06-30 10:57:14
* @LastEditors: huyue
* @LastEditTime: 2022-06-30 10:57:17
*/
function getLineOptions(obj) {
const { tooltipFormatter } = obj
var lineOptions = {
tooltip: {
trigger: 'axis',
borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)',
textStyle: {
color: '#FFFFFF',
fontSize: '8px'
},
extraCssText: 'width: 60px;',
formatter: tooltipFormatter || ''
},
grid: {
left: '3%',
right: '4%',
top: '10%',
bottom: '10%',
containLabel: true
},
xAxis: {
type: 'category',
axisLabel: {
color: '#606266',
fontSize: '0.8em'
},
data: []
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: '#606266'
}
}
},
series: [
{
type: 'line',
itemStyle: {
color: '#F5AA01'
},
// 节点,平滑曲线
symbol: 'none',
smooth: true,
// 折线背景色
areaStyle: {
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 0,
color: 'rgba(254, 84, 0, 0.6)'
},
{
offset: 1,
color: 'rgba(254, 84, 0, 0.05)'
}
]
}
},
data: []
}
]
}
return lineOptions
}
export default getLineOptions
\ No newline at end of file \ No newline at end of file
...@@ -34,7 +34,8 @@ export default { ...@@ -34,7 +34,8 @@ export default {
dataList: [], dataList: [],
paramsData: [], paramsData: [],
list: ['enter', 'stayfile', 'test', 'placeorder', 'success'], list: ['enter', 'stayfile', 'test', 'placeorder', 'success'],
hasData: true hasData: true,
colorList: ['#BF98FF', '#E60115', '#4FA0FF', '#EB6001', '#F5AA01']
} }
}, },
mounted() { mounted() {
...@@ -107,12 +108,13 @@ export default { ...@@ -107,12 +108,13 @@ export default {
const date = this.dataList[0][index].statDate const date = this.dataList[0][index].statDate
var txt = date + '<br />' var txt = date + '<br />'
e.forEach(item => { e.forEach(item => {
txt = txt + item.seriesName + ':' + item.value + '<br />' item.marker = '<span style=\"display:inline-block;margin-right:4px;border-radius:5px;width:5px;height:5px;background-color:' + this.colorList[item.componentIndex] + ';\"></span>'
txt = txt + item.marker + item.seriesName + ':' + item.value + '<br />'
}) })
return txt return txt
} }
}, },
color: ['#4FA0FF', '#FF6E76', '#7CFFB2', '#FDF006', '#EB6001'], color: ['#BF98FF', '#E60115', '#4FA0FF', '#EB6001', '#F5AA01'],
grid: { grid: {
left: '3%', left: '3%',
right: '4%', right: '4%',
...@@ -190,6 +192,17 @@ export default { ...@@ -190,6 +192,17 @@ export default {
this.option.series[index].data = this.dataList[index].map(item => item.num) this.option.series[index].data = this.dataList[index].map(item => item.num)
}) })
this.echartsTrend.setOption(this.option) this.echartsTrend.setOption(this.option)
this.chartAction()
this.echartsTrend.on('globalout', () => {
this.chartAction()
})
},
chartAction(type) {
this.echartsTrend.dispatchAction({
type: type || 'showTip',
seriesIndex: 0,
dataIndex: this.dataList[0].length - 1
})
} }
} }
} }
...@@ -199,4 +212,11 @@ export default { ...@@ -199,4 +212,11 @@ export default {
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
} }
.trend-dot {
display: inline-block;
width: 2px;
height: 2px;
border-radius: 50%;
background-color: #BF98FF;
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!