Commit 9abe597e by 胡悦

提交转化趋势

1 parent 58016170
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @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-29 15:56:22 * @LastEditTime: 2022-06-30 14:27:04
*/ */
import Request from '../request' import Request from '../request'
const request = new Request() const request = new Request()
...@@ -23,6 +23,11 @@ const saleTrans = params => { ...@@ -23,6 +23,11 @@ const saleTrans = params => {
return request.get('brand/saleTrans', params) return request.get('brand/saleTrans', params)
} }
// 获取品牌客流转化趋势
const saleTransTrend = params => {
return request.get('brand/saleTransTrend', params)
}
// 门店相关 // 门店相关
// 获取门店销售转化总数据 // 获取门店销售转化总数据
const storeTotal = params => { const storeTotal = params => {
...@@ -37,11 +42,18 @@ const storeSaleTrans = params => { ...@@ -37,11 +42,18 @@ const storeSaleTrans = params => {
const getMerchantSales = params => { const getMerchantSales = params => {
return request.get('merchant/sale', params) return request.get('merchant/sale', params)
} }
// 获取门店客流转化趋势
const storeTransTrend = params => {
return request.get('merchant/saleTransTrend', params)
}
export default { export default {
getSales, getSales,
saleTotal, saleTotal,
saleTrans, saleTrans,
storeTotal, storeTotal,
storeSaleTrans, storeSaleTrans,
getMerchantSales getMerchantSales,
saleTransTrend,
storeTransTrend
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @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-29 19:45:27 * @LastEditTime: 2022-06-30 10:59:56
--> -->
<template> <template>
<div> <div>
...@@ -95,7 +95,6 @@ export default { ...@@ -95,7 +95,6 @@ export default {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.echartsFunnel.resize() this.echartsFunnel.resize()
}) })
this.init()
}, },
methods: { methods: {
init(val) { 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 \ No newline at end of file
...@@ -3,16 +3,191 @@ ...@@ -3,16 +3,191 @@
* @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-23 17:08:12 * @LastEditTime: 2022-06-30 14:38:18
--> -->
<template> <template>
<div> <div>
<div class="title">转化趋势</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> </div>
</template> </template>
<script> <script>
import * as echarts from 'echarts'
import { changeMixin } from '@/mixins'
export default { 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> </script>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!