Commit 14a1ec47 by 王志慧

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

2 parents 77daaa03 b1ddc7eb
......@@ -10,8 +10,7 @@ export default {
getBrandList () {
return request.get('brand/getBrandName', {
req: {
corporateGroupName: '集团1',
queryTime: '2022-06-23'
queryTime: window.vm.getCurrentDate()
}
})
}
......
......@@ -4,7 +4,11 @@ var request = new Request()
// window.$HTTP
export default {
/**获取品牌---总体模块信息(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus 的基础数据 和 前五排行/后五排行 ) */
getBrandOverallbase(params){
return request.get('brand/overallbase', params)
getBrandOverallbase (req) {
return request.get('brand/overallbase', { req })
},
/*获取品牌---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getBrandOveralltrend (req) {
return request.get('brand/overalltrend', { req })
}
}
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2022-06-28 14:58:30
* @LastEditors: huyue
* @LastEditTime: 2022-06-29 15:56:22
* @LastEditTime: 2022-06-30 14:27:04
*/
import Request from '../request'
const request = new Request()
......@@ -23,6 +23,11 @@ const saleTrans = params => {
return request.get('brand/saleTrans', params)
}
// 获取品牌客流转化趋势
const saleTransTrend = params => {
return request.get('brand/saleTransTrend', params)
}
// 门店相关
// 获取门店销售转化总数据
const storeTotal = params => {
......@@ -37,11 +42,18 @@ const storeSaleTrans = params => {
const getMerchantSales = params => {
return request.get('merchant/sale', params)
}
// 获取门店客流转化趋势
const storeTransTrend = params => {
return request.get('merchant/saleTransTrend', params)
}
export default {
getSales,
saleTotal,
saleTrans,
storeTotal,
storeSaleTrans,
getMerchantSales
getMerchantSales,
saleTransTrend,
storeTransTrend
}
......@@ -3,13 +3,13 @@ class Request {
constructor(_request_) {
this.DOMAIN = _request_ ? _request_.baseURL : this.DOMAIN
}
get(url, params, returnAll) {
get (url, params, returnAll) {
return this.request('GET', url, params, returnAll)
}
post(url, params, returnAll) {
post (url, params, returnAll) {
return this.request('POST', url, params, returnAll)
}
request(method, url, params, returnAll) {
request (method, url, params, returnAll) {
var requestConfig = {
headers: {
// 'Content-Type': method == 'GET' ? 'application/json' : 'application/x-www-form-urlencoded; charset=UTF-8'
......@@ -17,7 +17,7 @@ class Request {
},
method
}
params.req.corporateGroupName = '集团1'
if (method === 'GET') {
var paramsArray = []
Object.keys(params.req).forEach(key => paramsArray.push('req.' + key + '=' + params.req[key]))
......@@ -39,9 +39,9 @@ class Request {
.then(res => {
return res.json()
})
// .catch(error => {
// alert(error)
// })
// .catch(error => {
// alert(error)
// })
}
}
......
......@@ -85,6 +85,9 @@ export default {
},
methods: {
resetRankList() {
this.rankList = new Array(5).fill({ label: '-', value: '-' })
},
tooltipFormatter(obj) {
var currentItem = this.dataList[obj[0].dataIndex]
var txt = ''
......@@ -139,7 +142,7 @@ export default {
},
getRankList(idx, attrName = 'topList') {
this.$set(this, 'rankList', this.dataList[idx][attrName])
this.dataList[idx][attrName].length ? this.$set(this, 'rankList', this.dataList[idx][attrName]) : this.resetRankList()
},
drawLine() {
......
<template>
<div class="tabs">
<div class="tab pointer">
<div class="tab-left box">
<div
class="tab-left box"
@click="changeType('total')"
>
<div class="tab-total-box">
<div class="total-title-box flex">
<div class="title inline total">客户总数</div>
......@@ -29,6 +32,7 @@
<div
:key="index"
class="item flex"
@click="changeType(i.key)"
>
<div class="item-title">{{i.title}}</div>
<transition-number
......@@ -48,41 +52,82 @@
</template>
</div>
</div>
<div class="
tabs-content
box">
<div class="title inline">客户增长趋势</div>
<div class="tabs-content box">
<div class="tabs-title">客户增长趋势</div>
<div class="tabs-content-chart flex">
<div
class="line"
id="total-chart"
></div>
<div class="table user-select pointer">
<div class="table-head">
<template v-for="(i,index) in tabHead">
<div
:class="['table-head-item flex',{'active':index == tabIndex}]"
:key="index"
@click="changeTab(index)"
>
{{i}}
</div>
</template>
</div>
<div class="table-body flex">
<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>
<div class="table-key">
<marquee
:direction="directionTimer"
:delay="delayTimer"
:text="i.name"
/>
</div>
<div class="table-value">{{i.num}}</div>
</div>
</template>
</div>
</div>
</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
const tabs = [
{
title: '企微客户',
key: 'wechat'
},
{
title: '企微群数',
key: 'wechatGroup'
},
{
title: '小程序客户数',
key: 'applet'
},
{
title: '公众号客户数',
key: 'publiccus'
}
]
let tabHead = ['前5品牌', '后5品牌']
import { changeMixin } from '@/mixins'
import * as echarts from 'echarts'
export default {
name: 'ViewTabs',
mixins: [changeMixin],
data () {
return {
tabs: [
{
title: '企微客户',
key: 'wechat'
},
{
title: '企微群数',
key: 'wechatGroup'
},
{
title: '小程序客户数',
key: 'applet'
},
{
title: '公众号客户数',
key: 'publiccus'
}
],
queryItem: 'total',
id: '10086',
tabs,
tabHead,
tabType: 'total',
tabIndex: 0,
delayTimer: 3000,
directionTimer: 3000,
pageData: {
total: {},
wechat: {},
......@@ -104,24 +149,49 @@ export default {
this.getBrandOverallbase('wechatGroup')
this.getBrandOverallbase('applet')
this.getBrandOverallbase('publiccus')
this.getBrandOveralltrend('total')
},
changeType (type) {
console.log(type)
this.tabType = type
this.getBrandOveralltrend(type)
},
changeTab (index) {
this.tabIndex = index
},
getBrandOverallbase (queryItem) {
const params = {
req: {
queryItem,
queryTime: '2022-06-23',
corporateGroupName: '集团1',
queryType: 0
}
queryItem,
queryTime: '2022-06-23',
corporateGroupName: '集团1',
queryType: 0
}
this.api.overview.getBrandOverallbase(params).then(res => {
const { code, data } = res
this.api.overview.getBrandOverallbase(params).then(({ code, data }) => {
if (code == 0) {
let [dataList] = data.dataList
console.log(`________________${queryItem}_______________________`, data)
dataList.top = this.ObjectToArray(dataList.topList)
dataList.last = this.ObjectToArray(dataList.lastList)
this.pageData[queryItem] = dataList
}
})
},
ObjectToArray (obj) {
let arr = []
obj = JSON.parse(obj)
Object.keys(obj).map(name => arr.push({ name, num: obj[name] }))
return arr
},
getBrandOveralltrend (queryItem) {
const params = {
queryItem,
querystartTime: '2022-05-23',
queryendTime: '2022-06-23',
corporateGroupName: '集团1',
queryType: 0
}
this.api.overview.getBrandOverallbase(params).then(res => {
console.log(`________________${queryItem}_______________________`, res)
})
}
}
}
......@@ -200,6 +270,74 @@ export default {
}
&-content {
height: 24.4vh;
box-sizing: border-box;
padding: 1vh 8px;
display: flex;
flex-direction: column;
.tabs-title {
font-size: 12px;
color: #e8e8e8;
}
&-chart {
height: 20.2vh;
margin-top: auto;
justify-content: space-between;
gap: 0 8px;
.line {
flex: 7;
background: #022;
}
.table {
flex: 3;
background: #262525;
&-head {
display: grid;
grid-template-columns: repeat(2, 50%);
height: 2.4vh;
&-item {
height: 100%;
font-size: 10px;
background: #353535;
color: rgba($color: #fff, $alpha: 0.7);
justify-content: center;
&:hover {
opacity: 0.9;
}
}
.active {
background: #eb6001;
color: #fff;
}
}
&-body {
height: calc(100% - 2.4vh);
flex-direction: column;
justify-content: space-between;
&-item {
line-height: 3.4vh;
width: 100%;
font-size: 10px;
color: #ffffff;
.table-num {
width: 22px;
justify-content: center;
color: #606266;
}
.table-key {
width: calc(100% - 96px);
}
.tab-value {
width: 52px;
margin-left: auto;
padding-right: 4px;
}
}
}
}
> div {
height: 100%;
}
}
}
}
</style>
......@@ -43,7 +43,6 @@ export default {
},
methods: {
init(val) {
// console.log(val)
this.isEmpty = true
var params = {
req: {
......
......@@ -3,7 +3,7 @@
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-29 19:45:27
* @LastEditTime: 2022-06-30 10:59:56
-->
<template>
<div>
......@@ -95,7 +95,6 @@ export default {
window.addEventListener('resize', () => {
this.echartsFunnel.resize()
})
this.init()
},
methods: {
init(val) {
......
/*
* @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
......@@ -3,16 +3,191 @@
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:08:12
* @LastEditTime: 2022-06-30 14:38:18
-->
<template>
<div>
<div class="title">转化趋势</div>
<!-- <div class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div> -->
<div id="lineTrend" :style="{ height: height - 4.1 + 'vh' }"></div>
</div>
</template>
<script>
import * as echarts from 'echarts'
import { changeMixin } from '@/mixins'
export default {
name: 'Trend'
name: 'Trend',
props: ['height'],
mixins: [changeMixin],
data() {
return {
echartsTrend: {},
option: {},
dataList: [],
paramsData: []
}
},
mounted() {
this.echartsTrend = echarts.init(document.getElementById('lineTrend'))
},
methods: {
init(val) {
this.getChartData(val)
},
getChartData(val) {
var params = {
req: {
corporateGroupName: '集团1',
queryItem: 'enter',
querystartTime: +val.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +val.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: val.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.sales[brandName ? 'storeTransTrend' : 'saleTransTrend'](params).then(res => {
var { code, data } = res
console.log(res)
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.dealList(data.dataList)
this.$nextTick(() => {
this.draw()
})
}
break
}
})
},
draw() {
this.option = {
tooltip: {
trigger: 'axis',
borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)',
position: [20, 20],
textStyle: {
color: '#FFFFFF',
fontSize: 8
},
extraCssText: 'width: 60px;',
// formatter: this.tooltipFormatter
formatter: e => {
console.log(e)
var txt = ''
e.forEach(item => {
if (txt) {
txt = txt + '<br>'
}
txt = txt + item.seriesName + ':' + item.value
})
return txt
}
},
color: ['#4FA0FF', '#7CFFB2', '#FDF006', '#EB6001', '#F5AA01', '#BF98FF', '#58D9F9'],
grid: {
left: '3%',
right: '4%',
top: '10%',
bottom: '10%',
containLabel: true
},
xAxis: {
type: 'category',
axisLabel: {
color: '#606266',
fontSize: '0.8em'
},
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: '#606266'
}
}
},
series: [
{
name: '客流',
type: 'line',
symbol: 'none',
smooth: true,
stack: 'Total',
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '留档',
type: 'line',
smooth: true,
symbol: 'none',
stack: 'Total',
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: '试驾',
type: 'line',
symbol: 'none',
smooth: true,
stack: 'Total',
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: '订单',
type: 'line',
symbol: 'none',
smooth: true,
stack: 'Total',
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: '成交',
type: 'line',
symbol: 'none',
smooth: true,
stack: 'Total',
data: [820, 932, 901, 934, 1290, 1330, 1320]
}
// {
// type: 'line',
// itemStyle: {
// color: '#F5AA01'
// },
// // 节点,平滑曲线
// symbol: 'none',
// smooth: true,
// // 折线背景色
// data: []
// }
]
}
this.option.xAxis.data = this.dataList.map(item => item.statDate)
this.option.series[0].data = this.dataList.map(item => item.num)
console.log(this.option)
this.echartsTrend.setOption(this.option)
},
dealList(list) {
list.forEach(item => {
this.dataList.push({
num: item.num || 0,
hrate: item.hrate || 0,
trate: item.trate || 0,
statDate: item.statDate
})
})
}
}
}
</script>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!