Commit 647f59e8 by 王志慧

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

2 parents 1e0edae5 16a04866
...@@ -3,20 +3,41 @@ ...@@ -3,20 +3,41 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-06-28 14:58:30 * @Date: 2022-06-28 14:58:30
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-06-28 18:10:58 * @LastEditTime: 2022-06-29 15:56:22
*/ */
import Request from '../request' import Request from '../request'
const request = new Request() const request = new Request()
// 集团相关
// 获取品牌销售模块其他相关信息
const getSales = params => { const getSales = params => {
return request.get('brand/sale', params) return request.get('brand/saleothers', params)
} }
// 获取品牌销售转化总数居 // 获取品牌销售转化总数居
const saleTotal = params => { const saleTotal = params => {
return request.get('brand/saletotal', params) return request.get('brand/saletotal', params)
} }
// 获取品牌销售转化信息
const saleTrans = params => {
return request.get('brand/saleTrans', params)
}
// 门店相关
// 获取门店销售转化总数据
const storeTotal = params => {
return request.get('merchant/saletotal', params)
}
// 获取门店销售转化相关信息
const storeSaleTrans = params => {
return request.get('merchant/saleTrans', params)
}
export default { export default {
getSales, getSales,
saleTotal saleTotal,
saleTrans,
storeTotal,
storeSaleTrans
} }
...@@ -101,3 +101,15 @@ img { ...@@ -101,3 +101,15 @@ img {
.container{ .container{
margin:0 8px; margin:0 8px;
} }
.empty {
display: flex;
width: 100%;
height: calc(100% - 4.1vh);
align-items: center;
justify-content: center;
img {
width: 20vh;
height: 9.5vh;
}
}
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div id="line-chart" class="line-chart"></div> <div id="line-chart" 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 == 'first' ? 'rank-title-active' : '' ]" @click="handleRankChange('first')">前5{{ storeOrBrandTxt }}</p> <p :class="[ 'rank-title', rankFlag == 'top' ? 'rank-title-active' : '' ]" @click="handleRankChange('top')">前5{{ storeOrBrandTxt }}</p>
<p :class="[ 'rank-title', rankFlag == 'last' ? 'rank-title-active' : '' ]" @click="handleRankChange('last')">后5{{ storeOrBrandTxt }}</p> <p :class="[ 'rank-title', rankFlag == 'last' ? 'rank-title-active' : '' ]" @click="handleRankChange('last')">后5{{ storeOrBrandTxt }}</p>
</div> </div>
<div class="rank-block"> <div class="rank-block">
...@@ -23,15 +23,11 @@ import getLineOptions from './lineOptions' ...@@ -23,15 +23,11 @@ import getLineOptions from './lineOptions'
export default { export default {
name: 'LineChart', name: 'LineChart',
props: { props: {
apiName: {
type: String,
default: ''
},
storeOrBrandTxt: { storeOrBrandTxt: {
type: String, type: String,
default: '门店' default: '门店'
}, },
rankList: { dataList: {
type: Array, type: Array,
default: () => [] default: () => []
} }
...@@ -41,13 +37,10 @@ export default { ...@@ -41,13 +37,10 @@ export default {
return { return {
directionTimer: datas.DefaultData.directionTimer, directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer, delayTimer: datas.DefaultData.delayTimer,
rankFlag: 'first', rankFlag: 'top',
lineOptions: [], lineOptions: [],
xAxisLabel: { rankList: [],
monthList: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
},
echartsLine: '', echartsLine: '',
dataList: [1, 2, 3, 10, 5, 2, 7, 8, 9, 10, 11, 12],
moveAttr: { moveAttr: {
speed: 900, speed: 900,
seriesIndex: 0, seriesIndex: 0,
...@@ -65,18 +58,18 @@ export default { ...@@ -65,18 +58,18 @@ export default {
this.lineDom = document.getElementById('line-chart') this.lineDom = document.getElementById('line-chart')
this.echartsLine = echarts.init(this.lineDom) this.echartsLine = echarts.init(this.lineDom)
this.chartBindEvent() this.chartBindEvent()
},
watch: {
dataList() {
this.drawLine() this.drawLine()
}
}, },
methods: { methods: {
dealxAxisLabel() {
this.lineOptions.xAxis.data = this.xAxisLabel.monthList
},
tooltipFormatter(obj) { tooltipFormatter(obj) {
var currentItem = this.dataList[obj[0].dataIndex] var currentItem = this.dataList[obj[0].dataIndex]
return `数量:${currentItem}<br>环比:${currentItem}<br>同比:${currentItem}` return `数量:${currentItem.num}<br>环比:${currentItem.hrate}%<br>同比:${currentItem.trate}%`
}, },
autoMove() { autoMove() {
...@@ -86,8 +79,10 @@ export default { ...@@ -86,8 +79,10 @@ export default {
if (this.moveAttr.dataIndex === this.dataList.length) { if (this.moveAttr.dataIndex === this.dataList.length) {
this.moveAttr.dataIndex = 0 this.moveAttr.dataIndex = 0
} }
this.chartAction() this.chartAction()
this.autoMove() this.autoMove()
this.getRankList(this.moveAttr.dataIndex, this.rankFlag + 'List')
}, this.moveAttr.speed) }, this.moveAttr.speed)
}, },
...@@ -118,19 +113,25 @@ export default { ...@@ -118,19 +113,25 @@ export default {
}) })
}, },
getRankList(idx, attrName = 'topList') {
this.rankList = this.dataList[idx][attrName]
},
drawLine() { drawLine() {
this.dealxAxisLabel() this.lineOptions.xAxis.data = this.dataList.map(item => item.statDate)
this.lineOptions.series[0].data = this.dataList
this.lineOptions.series[0].data = this.dataList.map(item => item.num)
this.echartsLine.setOption(this.lineOptions) this.echartsLine.setOption(this.lineOptions)
console.log(this.echartsLine) this.getRankList(0)
this.autoMove() this.autoMove()
}, },
handleRankChange(value) { handleRankChange(value) {
this.rankFlag = value this.rankFlag = value
this.$emit('handleRankChange', value) this.getRankList(this.moveAttr.seriesIndex, this.rankFlag + 'List')
} }
} }
} }
...@@ -192,7 +193,7 @@ p { ...@@ -192,7 +193,7 @@ p {
padding-bottom: 0.6vh; padding-bottom: 0.6vh;
} }
} }
.rank-line:first-child { .rank-line:top-child {
border-width: 0; border-width: 0;
} }
} }
......
<template> <template>
<div class="content flex box"> <div class="content flex">
<div class="logo user-select"> <div class="logo user-select">
<img <img
src="@/assets/images/logo.svg" src="@/assets/images/logo.svg"
...@@ -47,6 +47,8 @@ export default { ...@@ -47,6 +47,8 @@ export default {
box-sizing: border-box; box-sizing: border-box;
padding: 0 24px; padding: 0 24px;
position: relative; position: relative;
background: #1d1c1c;
z-index: 9999999999;
.view-title { .view-title {
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%);
......
function getLineOptions(obj) { function getLineOptions(obj) {
const { tooltipFormatter } = obj const { tooltipFormatter } = obj
console.log(obj)
var lineOptions = { var lineOptions = {
tooltip: { tooltip: {
trigger: 'axis', trigger: 'axis',
......
import Vue from 'vue' import Vue from 'vue'
import { import { Toast, Dialog } from 'vant'
Toast,
Dialog
} from 'vant'
/** /**
* 日期格式化 * 日期格式化
...@@ -17,14 +14,14 @@ Date.prototype.format = function (fmt) { ...@@ -17,14 +14,14 @@ Date.prototype.format = function (fmt) {
's+': this.getSeconds(), //秒 's+': this.getSeconds(), //秒
//季度 //季度
'q+': Math.floor((this.getMonth() + 3) / 3), 'q+': Math.floor((this.getMonth() + 3) / 3),
'S': this.getMilliseconds() //毫秒 S: this.getMilliseconds() //毫秒
}; }
if (/(y+)/.test(fmt)) { if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
} }
for (let k in o) { for (let k in o) {
if (new RegExp(`(${k})`).test(fmt)) { if (new RegExp(`(${k})`).test(fmt)) {
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length))) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
} }
} }
return fmt return fmt
...@@ -99,7 +96,6 @@ const setLocalStorage = (key, item) => { ...@@ -99,7 +96,6 @@ const setLocalStorage = (key, item) => {
const getLocalStorage = key => { const getLocalStorage = key => {
return JSON.parse(window.localStorage.getItem(key)) return JSON.parse(window.localStorage.getItem(key))
// return JSON.parse(sessionStorage.getItem(key)) // return JSON.parse(sessionStorage.getItem(key))
} }
const removeLocalStorage = key => { const removeLocalStorage = key => {
window.localStorage.removeItem(key) window.localStorage.removeItem(key)
...@@ -116,7 +112,7 @@ const makePhoneCall = phoneNumber => { ...@@ -116,7 +112,7 @@ const makePhoneCall = phoneNumber => {
/**是否全面屏 */ /**是否全面屏 */
const isFullSucreen = () => { const isFullSucreen = () => {
let result = false; let result = false
const rate = window.screen.height / window.screen.width const rate = window.screen.height / window.screen.width
let limit = window.screen.height == window.screen.availHeight ? 1.8 : 1.65 // 临界判断值 let limit = window.screen.height == window.screen.availHeight ? 1.8 : 1.65 // 临界判断值
result = rate > limit result = rate > limit
...@@ -164,7 +160,7 @@ const toTop = () => { ...@@ -164,7 +160,7 @@ const toTop = () => {
const getParams = () => { const getParams = () => {
return window.vm.$route.params return window.vm.$route.params
} }
const getQuery = (name) => { const getQuery = name => {
let [url, paramsList] = window.location.href.split('?') let [url, paramsList] = window.location.href.split('?')
if (!paramsList) return name ? null : {} if (!paramsList) return name ? null : {}
let param = paramsList.split('&') let param = paramsList.split('&')
...@@ -189,6 +185,22 @@ const getCurrentDate = (fmt = 'yyyy-MM-dd') => { ...@@ -189,6 +185,22 @@ const getCurrentDate = (fmt = 'yyyy-MM-dd') => {
return new Date().format(fmt) return new Date().format(fmt)
} }
/** 获取前/后n天
* 负数:今天前n天
* 正数:今天后n天
*/
const getNDate = (n, fmt = 'yyyy-MM-dd') => {
return new Date(new Date().setDate(new Date().getDate() + n)).format(fmt)
}
/** 获取前/后n月
* 负数:今天前n月
* 正数:今天后n月
*/
const getNMonth = (n, fmt = 'yyyy-MM-dd') => {
return new Date(new Date().setMonth(new Date().getMonth() + n)).format(fmt)
}
const utils = { const utils = {
removeLocalStorage, removeLocalStorage,
setClipboardData, setClipboardData,
...@@ -214,7 +226,9 @@ const utils = { ...@@ -214,7 +226,9 @@ const utils = {
dialog, dialog,
toTop, toTop,
numAddSymbol, numAddSymbol,
getCurrentDate getCurrentDate,
getNDate,
getNMonth
} }
Object.keys(utils).map(key => { Object.keys(utils).map(key => {
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<template> <template>
<div> <div>
<div class="title">售后档案客户</div> <div class="title">售后档案客户</div>
<LineChart @handleRankChange="handleRankChange" :rankList="rankList"></LineChart> <LineChart :dataList="dataList"></LineChart>
</div> </div>
</template> </template>
...@@ -25,28 +25,7 @@ export default { ...@@ -25,28 +25,7 @@ export default {
}, },
data() { data() {
return { return {
rankList: [ dataList: []
{
name: '奥迪',
num: 599604
},
{
name: '宝马',
num: 599604
},
{
name: '现代起亚',
num: 599604
},
{
name: '奔驰',
num: 599604
},
{
name: '沃尔沃',
num: 599604
}
]
} }
}, },
mounted() { mounted() {
...@@ -54,30 +33,57 @@ export default { ...@@ -54,30 +33,57 @@ export default {
}, },
methods: { methods: {
init(val) { init(val) {
console.log(val) // console.log(val)
var params = { var params = {
req: { req: {
corporateGroupName: '广汇', corporateGroupName: '广汇',
queryItem: 'file', queryItem: 'file',
queryTime: '2022-06-25', querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryType: 0 queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: val.reportType || 0
} }
} }
this.api.afterSales.getAfterSale(params).then(res => { this.api.afterSales.getAfterSale(params).then(res => {
console.log(res) var { code, data, message } = res
switch (+code) {
case 0:
this.dataList = []
this.dealList(data.dataList)
break
default:
alert(message)
}
}) })
}, },
// 折线图数据 dealList(list) {
getList() { }, var topList = []
// 排名数据 var lastList = []
getRankList() { }, list.forEach(item => {
dealList() { const topTempList = JSON.parse(item.topList)
this.rankList.forEach(item => { const lastTempList = JSON.parse(item.lastList)
item.num = this.numAddSymbol(item.num) 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
})
}) })
},
handleRankChange(value) {
// console.log(value)
} }
} }
} }
......
...@@ -3,20 +3,21 @@ ...@@ -3,20 +3,21 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-06-23 15:05:21 * @Date: 2022-06-23 15:05:21
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-06-28 18:41:37 * @LastEditTime: 2022-06-29 15:47:23
--> -->
<template> <template>
<div class="flow-box"> <div>
<div v-if="hasData" class="flow-box">
<div class="flow-left"> <div class="flow-left">
<div class="title inline">客流转化</div> <div class="title inline" style="padding-left: 0">客流转化</div>
<div class="chart-box"> <div class="chart-box">
<div id="flow" :style="{ height: height - 4.1 + 'vh' }"></div> <div id="flow" :style="{ height: height - 4.1 + 'vh' }"></div>
</div> </div>
</div> </div>
<div class="flow-right"> <div class="flow-right">
<div class="ranking-title"> <div class="ranking-title">
<div @click="isActive = 1" :class="isActive == 1 ? 'active' : ''">前5品牌</div> <div @click="changeRank(1)" :class="isActive == 1 ? 'active' : ''">前5品牌</div>
<div @click="isActive = 2" :class="isActive == 2 ? 'active' : ''">后5品牌</div> <div @click="changeRank(2)" :class="isActive == 2 ? 'active' : ''">后5品牌</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">
...@@ -29,45 +30,28 @@ ...@@ -29,45 +30,28 @@
</div> </div>
</div> </div>
</div> </div>
<div v-else>
<div class="title">客流转化</div>
<div class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template> </template>
<script> <script>
import { changeMixin } from '@/mixins'
import datas from '../../utils/data' import datas from '../../utils/data'
import * as echarts from 'echarts' import * as echarts from 'echarts'
export default { export default {
name: 'Flow', name: 'Flow',
mixins: [changeMixin],
props: ['height'], props: ['height'],
data() { data() {
return { return {
directionTimer: datas.DefaultData.directionTimer, directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer, delayTimer: datas.DefaultData.delayTimer,
flowData: [ flowData: [],
{
id: 1,
name: '林则徐:苟利国家生死以岂因祸福避趋之',
num: 3323425
},
{
id: 2,
name: '林则徐',
num: 9999999
},
{
id: 3,
name: 'fg',
num: 33234
},
{
id: 4,
name: '售后客户价值分析',
num: 33234
},
{
id: 5,
name: '林则徐:苟利国家生死以岂因祸福避趋之',
num: 33234
}
],
isActive: 1, isActive: 1,
funnelData: [ funnelData: [
{ {
...@@ -98,7 +82,11 @@ export default { ...@@ -98,7 +82,11 @@ export default {
], ],
option: {}, option: {},
echartsFunnel: '', echartsFunnel: '',
funnelDom: '' funnelDom: '',
hasData: true,
paramsData: {},
topList: [],
lastList: []
} }
}, },
mounted() { mounted() {
...@@ -111,24 +99,28 @@ export default { ...@@ -111,24 +99,28 @@ export default {
this.init() this.init()
}, },
methods: { methods: {
init() { init(val) {
this.getSaleTrans() console.log(val)
this.paramsData = val
this.getSaletTotal(val)
this.getSaleTrans(val)
}, },
getSaleTrans() { getSaletTotal(val) {
const params = { const params = {
req: { req: {
corporateGroupName: '集团1', corporateGroupName: '集团1',
queryTime: '2022-06-23', queryTime: '2022-06-23',
queryType: 0 queryType: val.reportType
} }
} }
this.api.sales.saleTotal(params).then(res => { this.api.sales.saleTotal(params).then(res => {
// console.log(res.data) console.log(res.data)
if (res.code === '0') { if (res.code === '0') {
res.data.dataList[0].num.forEach((item, index) => { res.data.dataList[0].num.forEach((item, index) => {
this.funnelData[index].value = item this.funnelData[index].value = item
}) })
this.draw() this.hasData = res.data.dataList[0].num.every(i => i != 0)
if (this.hasData) this.draw()
} }
}) })
}, },
...@@ -144,7 +136,6 @@ export default { ...@@ -144,7 +136,6 @@ 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: ['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: [, , , , ].reverse(),
series: [ series: [
{ {
name: '漏斗图', name: '漏斗图',
...@@ -193,8 +184,81 @@ export default { ...@@ -193,8 +184,81 @@ export default {
this.echartsFunnel.setOption(this.option) this.echartsFunnel.setOption(this.option)
// 鼠标划入 // 鼠标划入
this.echartsFunnel.on('mouseover', data => { this.echartsFunnel.on('mouseover', data => {
// console.log(data.data) console.log(data.data, '---------')
this.getSaleTrans(this.paramsData, data.data.type)
}) })
},
getSaleTrans(val, queryItem = 'enter') {
const params = {
req: {
corporateGroupName: '集团1',
queryItem: queryItem,
queryTime: '2022-06-23',
queryType: val.reportType
}
}
this.api.sales.saleTrans(params).then(res => {
this.topList = [
{
id: 1,
name: '林则徐:苟利国家生死以岂因祸福避趋之',
num: 3323425
},
{
id: 2,
name: '林则徐',
num: 9999999
},
{
id: 3,
name: 'fg',
num: 33234
},
{
id: 4,
name: '售后客户价值分析',
num: 33234
},
{
id: 5,
name: '林则徐:苟利国家生死以岂因祸福避趋之',
num: 33234
}
]
this.lastList = [
{
id: 1,
name: '广汇集团BI数据看板-前端-交互',
num: 3323425
},
{
id: 2,
name: '广汇集团BI数据看板-前端-交互广汇集团BI数据看板-前端-交互',
num: 9999999
},
{
id: 3,
name: 'fsdfasdg',
num: 33234
},
{
id: 4,
name: '广汇集团BI数据看板-前端-交互',
num: 33234
},
{
id: 5,
name: '广汇集团BI数据看板-前端-交互',
num: 33234
}
]
this.flowData = this.topList
})
},
// 切换品牌排序
changeRank(val) {
this.isActive = val
this.flowData = val == 1 ? this.topList : this.lastList
} }
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!