Commit bd382f69 by 胡悦

Merge branch 'gh_v1.2.0' into ty_v1.2.0

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