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 @@
* @Author: huyue
* @Date: 2022-06-28 14:58:30
* @LastEditors: huyue
* @LastEditTime: 2022-06-28 18:10:58
* @LastEditTime: 2022-06-29 15:56:22
*/
import Request from '../request'
const request = new Request()
// 集团相关
// 获取品牌销售模块其他相关信息
const getSales = params => {
return request.get('brand/sale', params)
return request.get('brand/saleothers', params)
}
// 获取品牌销售转化总数居
const 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 {
getSales,
saleTotal
saleTotal,
saleTrans,
storeTotal,
storeSaleTrans
}
......@@ -101,3 +101,15 @@ img {
.container{
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
......@@ -3,7 +3,7 @@
<div id="line-chart" class="line-chart"></div>
<div class="rank-box">
<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>
</div>
<div class="rank-block">
......@@ -23,15 +23,11 @@ import getLineOptions from './lineOptions'
export default {
name: 'LineChart',
props: {
apiName: {
type: String,
default: ''
},
storeOrBrandTxt: {
type: String,
default: '门店'
},
rankList: {
dataList: {
type: Array,
default: () => []
}
......@@ -41,13 +37,10 @@ export default {
return {
directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer,
rankFlag: 'first',
rankFlag: 'top',
lineOptions: [],
xAxisLabel: {
monthList: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
},
rankList: [],
echartsLine: '',
dataList: [1, 2, 3, 10, 5, 2, 7, 8, 9, 10, 11, 12],
moveAttr: {
speed: 900,
seriesIndex: 0,
......@@ -65,18 +58,18 @@ export default {
this.lineDom = document.getElementById('line-chart')
this.echartsLine = echarts.init(this.lineDom)
this.chartBindEvent()
},
this.drawLine()
watch: {
dataList() {
this.drawLine()
}
},
methods: {
dealxAxisLabel() {
this.lineOptions.xAxis.data = this.xAxisLabel.monthList
},
tooltipFormatter(obj) {
var currentItem = this.dataList[obj[0].dataIndex]
return `数量:${currentItem}<br>环比:${currentItem}<br>同比:${currentItem}`
return `数量:${currentItem.num}<br>环比:${currentItem.hrate}%<br>同比:${currentItem.trate}%`
},
autoMove() {
......@@ -86,8 +79,10 @@ export default {
if (this.moveAttr.dataIndex === this.dataList.length) {
this.moveAttr.dataIndex = 0
}
this.chartAction()
this.autoMove()
this.getRankList(this.moveAttr.dataIndex, this.rankFlag + 'List')
}, this.moveAttr.speed)
},
......@@ -118,19 +113,25 @@ export default {
})
},
getRankList(idx, attrName = 'topList') {
this.rankList = this.dataList[idx][attrName]
},
drawLine() {
this.dealxAxisLabel()
this.lineOptions.series[0].data = this.dataList
this.lineOptions.xAxis.data = this.dataList.map(item => item.statDate)
this.lineOptions.series[0].data = this.dataList.map(item => item.num)
this.echartsLine.setOption(this.lineOptions)
console.log(this.echartsLine)
this.getRankList(0)
this.autoMove()
},
handleRankChange(value) {
this.rankFlag = value
this.$emit('handleRankChange', value)
this.getRankList(this.moveAttr.seriesIndex, this.rankFlag + 'List')
}
}
}
......@@ -192,7 +193,7 @@ p {
padding-bottom: 0.6vh;
}
}
.rank-line:first-child {
.rank-line:top-child {
border-width: 0;
}
}
......
<template>
<div class="content flex box">
<div class="content flex">
<div class="logo user-select">
<img
src="@/assets/images/logo.svg"
......@@ -47,6 +47,8 @@ export default {
box-sizing: border-box;
padding: 0 24px;
position: relative;
background: #1d1c1c;
z-index: 9999999999;
.view-title {
color: transparent;
background: linear-gradient(left, #e60115 10%, #eb6001 25%, #f5aa01 50%, #fdf006 100%);
......
function getLineOptions(obj) {
const { tooltipFormatter } = obj
console.log(obj)
var lineOptions = {
tooltip: {
trigger: 'axis',
......
import Vue from 'vue'
import {
Toast,
Dialog
} from 'vant'
import { Toast, Dialog } from 'vant'
/**
* 日期格式化
......@@ -17,14 +14,14 @@ Date.prototype.format = function (fmt) {
's+': this.getSeconds(), //秒
//季度
'q+': Math.floor((this.getMonth() + 3) / 3),
'S': this.getMilliseconds() //毫秒
};
S: this.getMilliseconds() //毫秒
}
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length))
}
for (let k in o) {
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
......@@ -99,7 +96,6 @@ const setLocalStorage = (key, item) => {
const getLocalStorage = key => {
return JSON.parse(window.localStorage.getItem(key))
// return JSON.parse(sessionStorage.getItem(key))
}
const removeLocalStorage = key => {
window.localStorage.removeItem(key)
......@@ -116,7 +112,7 @@ const makePhoneCall = phoneNumber => {
/**是否全面屏 */
const isFullSucreen = () => {
let result = false;
let result = false
const rate = window.screen.height / window.screen.width
let limit = window.screen.height == window.screen.availHeight ? 1.8 : 1.65 // 临界判断值
result = rate > limit
......@@ -164,7 +160,7 @@ const toTop = () => {
const getParams = () => {
return window.vm.$route.params
}
const getQuery = (name) => {
const getQuery = name => {
let [url, paramsList] = window.location.href.split('?')
if (!paramsList) return name ? null : {}
let param = paramsList.split('&')
......@@ -189,6 +185,22 @@ const getCurrentDate = (fmt = 'yyyy-MM-dd') => {
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 = {
removeLocalStorage,
setClipboardData,
......@@ -214,7 +226,9 @@ const utils = {
dialog,
toTop,
numAddSymbol,
getCurrentDate
getCurrentDate,
getNDate,
getNMonth
}
Object.keys(utils).map(key => {
......
......@@ -8,7 +8,7 @@
<template>
<div>
<div class="title">售后档案客户</div>
<LineChart @handleRankChange="handleRankChange" :rankList="rankList"></LineChart>
<LineChart :dataList="dataList"></LineChart>
</div>
</template>
......@@ -25,28 +25,7 @@ export default {
},
data() {
return {
rankList: [
{
name: '奥迪',
num: 599604
},
{
name: '宝马',
num: 599604
},
{
name: '现代起亚',
num: 599604
},
{
name: '奔驰',
num: 599604
},
{
name: '沃尔沃',
num: 599604
}
]
dataList: []
}
},
mounted() {
......@@ -54,30 +33,57 @@ export default {
},
methods: {
init(val) {
console.log(val)
// console.log(val)
var params = {
req: {
corporateGroupName: '广汇',
queryItem: 'file',
queryTime: '2022-06-25',
queryType: 0
querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: val.reportType || 0
}
}
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)
}
})
},
// 折线图数据
getList() { },
// 排名数据
getRankList() { },
dealList() {
this.rankList.forEach(item => {
item.num = this.numAddSymbol(item.num)
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = JSON.parse(item.topList)
const lastTempList = 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
})
})
},
handleRankChange(value) {
// console.log(value)
}
}
}
......
......@@ -3,71 +3,55 @@
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-28 18:41:37
* @LastEditTime: 2022-06-29 15:47:23
-->
<template>
<div class="flow-box">
<div class="flow-left">
<div class="title inline">客流转化</div>
<div class="chart-box">
<div id="flow" :style="{ height: height - 4.1 + 'vh' }"></div>
</div>
</div>
<div class="flow-right">
<div class="ranking-title">
<div @click="isActive = 1" :class="isActive == 1 ? 'active' : ''">前5品牌</div>
<div @click="isActive = 2" :class="isActive == 2 ? 'active' : ''">后5品牌</div>
<div>
<div v-if="hasData" class="flow-box">
<div class="flow-left">
<div class="title inline" style="padding-left: 0">客流转化</div>
<div class="chart-box">
<div id="flow" :style="{ height: height - 4.1 + 'vh' }"></div>
</div>
</div>
<div class="ranking-content">
<div class="ranking-item" v-for="(item, index) in flowData" :key="index">
<span>{{ item.id }}</span>
<span class="ranking-name">
<marquee :direction="directionTimer" :delay="delayTimer" :text="item.name" />
</span>
<span class="ranking-text">{{ item.num }}</span>
<div class="flow-right">
<div class="ranking-title">
<div @click="changeRank(1)" :class="isActive == 1 ? 'active' : ''">前5品牌</div>
<div @click="changeRank(2)" :class="isActive == 2 ? 'active' : ''">后5品牌</div>
</div>
<div class="ranking-content">
<div class="ranking-item" v-for="(item, index) in flowData" :key="index">
<span>{{ item.id }}</span>
<span class="ranking-name">
<marquee :direction="directionTimer" :delay="delayTimer" :text="item.name" />
</span>
<span class="ranking-text">{{ item.num }}</span>
</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>
<script>
import { changeMixin } from '@/mixins'
import datas from '../../utils/data'
import * as echarts from 'echarts'
export default {
name: 'Flow',
mixins: [changeMixin],
props: ['height'],
data() {
return {
directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer,
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
}
],
flowData: [],
isActive: 1,
funnelData: [
{
......@@ -98,7 +82,11 @@ export default {
],
option: {},
echartsFunnel: '',
funnelDom: ''
funnelDom: '',
hasData: true,
paramsData: {},
topList: [],
lastList: []
}
},
mounted() {
......@@ -111,24 +99,28 @@ export default {
this.init()
},
methods: {
init() {
this.getSaleTrans()
init(val) {
console.log(val)
this.paramsData = val
this.getSaletTotal(val)
this.getSaleTrans(val)
},
getSaleTrans() {
getSaletTotal(val) {
const params = {
req: {
corporateGroupName: '集团1',
queryTime: '2022-06-23',
queryType: 0
queryType: val.reportType
}
}
this.api.sales.saleTotal(params).then(res => {
// console.log(res.data)
console.log(res.data)
if (res.code === '0') {
res.data.dataList[0].num.forEach((item, index) => {
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 {
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: [, , , , ].reverse(),
series: [
{
name: '漏斗图',
......@@ -193,8 +184,81 @@ export default {
this.echartsFunnel.setOption(this.option)
// 鼠标划入
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!