Commit 4c1289d1 by 前端

Merge branch 'develop' into 'master'

Develop

See merge request !2
2 parents 682f096f a026bfca
Showing 76 changed files with 3718 additions and 635 deletions
No preview for this file type
......@@ -18,8 +18,6 @@
to continue.</strong>
</noscript>
<div id="app"></div>
<script src="//res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="//open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js"></script>
<!-- 使用CDN加速的JS文件,配置在vue.config.js下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
......
......@@ -3,10 +3,14 @@
* @version: 1.0.0
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-17 18:23:27
* @LastEditors: huyue
* @LastEditTime: 2022-06-28 15:12:48
*/
import wwbenchApi from './wwbenchApi'
export {
wwbenchApi,
}
\ No newline at end of file
const modulesFiles = require.context('./modules', true, /\.js$/)
const modules = modulesFiles.keys().reduce((modules, modulePath) => {
const moduleName = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1')
const value = modulesFiles(modulePath)
modules[moduleName] = value.default
return modules
}, {})
export default modules
/*
* @Description: 售后数据
* @Author: huyue
* @Date: 2022-06-28 16:55:48
* @LastEditors: huyue
* @LastEditTime: 2022-06-28 19:13:34
*/
// 品牌-售后档案客户
const getAfterSale = params => {
return window.$HTTP.get('brand/aftersale', params)
}
// 门店-售后档案客户
const getMerchantAfterSale = params => {
return window.$HTTP.get('merchant/aftersale', params)
}
// 获取品牌售后其他信息
const aftersaleother = params => {
return window.$HTTP.get('brand/aftersaleother', params)
}
// 获取门店品牌售后其他信息
const afterMerchantSaleother = params => {
return window.$HTTP.get('merchant/aftersaleother', params)
}
export default { getAfterSale, aftersaleother, afterMerchantSaleother, getMerchantAfterSale }
// window.$HTTP
export default {
/**获取品牌名称*/
getBrandList () {
return window.$HTTP.get('brand/getBrandName', {
req: {
queryTime: window.vm.getCurrentDate()
}
})
}
}
// 获取品牌年龄/性别/购车年限
const overalldistribution = params => {
return window.$HTTP.get('brand/overalldistribution', params)
}
// 获取门店年龄/性别/购车年限
const merchantOveralldistribution = params => {
return window.$HTTP.get('merchant/overalldistribution', params)
}
export default {
overalldistribution,
merchantOveralldistribution
}
// window.$HTTP
export default {
/**获取品牌---总体模块信息(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus 的基础数据 和 前五排行/后五排行 ) */
getBrandOverallbase (req) {
return window.$HTTP.get('brand/overallbase', { req })
},
/*获取品牌---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getBrandOveralltrend (req) {
return window.$HTTP.get('brand/overalltrend', { req })
},
/* 获取门店总体相关信息 */
getMerchantOverallbase (req) {
return window.$HTTP.get('merchant/overallbase', { req })
},
/*获取门店---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getMerchantOveralltrend (req) {
return window.$HTTP.get('merchant/overalltrend', { req })
},
}
/*
* @Description: 获取品牌销售相关信息
* @Author: huyue
* @Date: 2022-06-28 14:58:30
* @LastEditors: huyue
* @LastEditTime: 2022-06-30 14:27:04
*/
// 集团相关
// 获取品牌销售模块其他相关信息
const getSales = params => {
return window.$HTTP.get('brand/saleothers', params)
}
// 获取品牌销售转化总数居
const saleTotal = params => {
return window.$HTTP.get('brand/saletotal', params)
}
// 获取品牌销售转化信息
const saleTrans = params => {
return window.$HTTP.get('brand/saleTrans', params)
}
// 获取品牌客流转化趋势
const saleTransTrend = params => {
return window.$HTTP.get('brand/saleTransTrend', params)
}
// 门店相关
// 获取门店销售转化总数据
const storeTotal = params => {
return window.$HTTP.get('merchant/saletotal', params)
}
// 获取门店销售转化相关信息
const storeSaleTrans = params => {
return window.$HTTP.get('merchant/saleTrans', params)
}
// 获取门店销售相关信息
const getMerchantSales = params => {
return window.$HTTP.get('merchant/sale', params)
}
// 获取门店客流转化趋势
const storeTransTrend = params => {
return window.$HTTP.get('merchant/saleTransTrend', params)
}
export default {
getSales,
saleTotal,
saleTrans,
storeTotal,
storeSaleTrans,
getMerchantSales,
saleTransTrend,
storeTransTrend
}
class Request {
DOMAIN = 'http://192.168.1.152:8081'
DOMAIN = '/dev'
constructor(_request_) {
this.DOMAIN = _request_.baseURL
this.DOMAIN = _request_ ? _request_.baseURL : this.DOMAIN
}
get (url, params, returnAll) {
return this.request('GET', url, params, returnAll)
......@@ -10,16 +10,43 @@ class Request {
return this.request('POST', url, params, returnAll)
}
request (method, url, params, returnAll) {
return window.fetch(`/${url}`, {
var requestConfig = {
headers: {
// 'Content-Type': method == 'GET' ? 'application/json' : 'application/x-www-form-urlencoded; charset=UTF-8'
'Content-Type': 'application/json'
},
body: params,
method,
}).then(res => res.json())
}
}
method
}
params.req.corporateGroupName = '广汇'
const { reportParams } = window.vm.$store.state.app
if (reportParams) {
if (reportParams.brand) params.req.brandName = reportParams.brand.name
}
if (method === 'GET') {
var paramsArray = []
Object.keys(params.req).forEach(key => paramsArray.push('req.' + key + '=' + params.req[key]))
if (url.search(/\?/) === -1) {
url += '?' + paramsArray.join('&')
} else {
url += '&' + paramsArray.join('&')
}
}
if (method === 'POST') {
Object.defineProperty(requestConfig, 'body', {
value: JSON.stringify(params)
})
}
return window
.fetch(this.DOMAIN + `/${url}`, requestConfig)
.then(res => {
return res.json()
})
// .catch(error => {
// alert(error)
// })
}
}
export default Request
\ No newline at end of file
export default Request
const url = '/rop-scrm-wwbench/router'
export default {
/**统计我的待办数据 */
getTaskData (data = {}) {
data.method = 'scrm.api.wwbench.user.task.list.count'
return window.$HTTP({
url,
data
})
},
/** 查询我的待办 */
getTasksList (data = {}) {
data.method = 'scrm.api.wwbench.user.task.list.get'
data.taskTypes = [3, 4, 5, 6, 8]
return window.$HTTP({
url,
data,
returnAll: true
})
},
/**更新待办状态 */
updateTasks (data = {}) {
data.method = 'scrm.api.wwbench.user.task.list.update'
return window.$HTTP({
url,
data
})
}
}
@import './normalize.scss';
@import './sprite.scss';
@font-face {
font-family: 'PingFangSC-Regular';
src: url('../font/PingFang-Regular.ttf');
}
html,
body .app {
color: #333333;
font-family: Arial, Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, sans-serif;
background-color: #FFF;
font-family: 'PingFangSC-Regular', Arial, Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, sans-serif;
background-color: #fff;
-webkit-overflow-scrolling: touch;
height: 100%;
// overflow: hidden;
--themeColor: #3975C6;
--themeColor: #3975c6;
}
img {
......@@ -69,6 +73,56 @@ img {
.pointer {
cursor: pointer;
}
.box{
background: #1D1C1C;
.box {
background: #1d1c1c;
// overflow: hidden;
}
.inline {
display: inline-block;
}
.title {
font-size: 0.75vw;
color: #e8e8e8;
// line-height: 2.1vh;
font-weight: 400;
padding: 0.5vh 8px;
user-select: none;
box-sizing: border-box;
height: 3.1vh;
overflow: hidden;
}
.title-icon {
display: flex;
align-items: center;
.icon {
display: inline-block;
width: 4px;
height: 4px;
background: #eb6001;
box-shadow: 0px 0px 5px 5px rgba(255, 104, 0, 0.3);
border-radius: 1px;
margin-right: 6px;
}
}
.container {
margin: 0 8px;
}
.empty {
display: flex;
width: 100%;
height: calc(100% - 4.1vh);
align-items: center;
justify-content: center;
img {
max-width: 20vh;
height: 9.5vh;
}
}
\ No newline at end of file
.sprite-icon { background-image: url(../images/sprite.png);background-size: 139px 104px;}
.icon-default-avatar { width: 44px; height: 44px; background-position: 0px 0px;}
.icon-down { width: 12px; height: 12px; background-position: -96px -63px;}
.icon-eye { width: 13px; height: 8px; background-position: 0px -96px;}
.icon-file { width: 26px; height: 26px; background-position: -42px -54px;}
.icon-index-tips { width: 23px; height: 23px; background-position: -96px 0px;}
.icon-link { width: 32px; height: 32px; background-position: 0px -54px;}
.icon-pdf { width: 32px; height: 34px; background-position: -54px 0px;}
.icon-PYQ { width: 21px; height: 20px; background-position: -96px -33px;}
.icon-send { width: 10px; height: 10px; background-position: -129px 0px;}
\ No newline at end of file
No preview for this file type
<?xml version="1.0" encoding="UTF-8"?>
<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>时间</title>
<g id="飞机稿" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="广汇BI设计稿" transform="translate(-1250.000000, -8.000000)" fill-rule="nonzero">
<g id="编组-2备份-8" transform="translate(159.000000, 6.000000)">
<g id="编组-14" transform="translate(1091.000000, 0.000000)">
<g id="时间" transform="translate(0.000000, 2.000000)">
<rect id="矩形" fill="#000000" opacity="0" x="0" y="0" width="16" height="16"></rect>
<path d="M13.72,11.4261667 C13.5778787,11.6629587 13.2707088,11.7397046 13.0339167,11.5975833 C12.7971246,11.455462 12.7203787,11.1482921 12.8625,10.9115 C13.3904053,10.0322179 13.6684418,9.02558172 13.6666667,8 C13.6666667,4.87033333 11.1296667,2.33333333 8,2.33333333 C4.87033333,2.33333333 2.33333333,4.87033333 2.33333333,8 C2.33333333,11.1296667 4.87033333,13.6666667 8,13.6666667 C9.02543715,13.6684819 10.0319479,13.3905634 10.9111667,12.8628333 C11.0643443,12.7709268 11.2549178,12.7677209 11.4111001,12.8544233 C11.5672823,12.9411257 11.6653454,13.1045643 11.6683501,13.2831733 C11.6713547,13.4617823 11.5788443,13.6284268 11.4256667,13.7203333 C10.3910338,14.3413182 9.20668308,14.6684926 8,14.6666743 C4.31816667,14.6666743 1.33333333,11.6818333 1.33333333,8 C1.33333333,4.31816667 4.31816667,1.33333333 8,1.33333333 C11.6818333,1.33333333 14.6666667,4.31816666 14.6666667,8 C14.6666667,9.22333333 14.3361667,10.3995 13.72,11.4261667 Z M5.1465,10.1465 L7.5,7.79283333 L7.5,5 C7.5,4.72385763 7.72385763,4.5 8,4.5 C8.27614237,4.5 8.5,4.72385763 8.5,5 L8.5,8 C8.5,8.13259741 8.44727469,8.25975363 8.3535,8.3535 L5.8535,10.8535 C5.72796276,10.9834783 5.54206105,11.0356063 5.36724634,10.9898486 C5.19243162,10.9440909 5.05590914,10.8075684 5.01015142,10.6327537 C4.9643937,10.4579389 5.01652171,10.2720372 5.1465,10.1465 L5.1465,10.1465 Z" id="形状" fill="#EB6001"></path>
</g>
</g>
</g>
</g>
</g>
</svg>
\ No newline at end of file
<template>
<div class="line-box">
<div :id="domId" class="line-chart"></div>
<div class="rank-box">
<div class="rank-title-block">
<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">
<div class="rank-line" v-for="(item, index) in rankList" :key="index">
<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>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import datas from '@/utils/data'
import * as echarts from 'echarts'
import getLineOptions from './lineOptions'
export default {
name: 'LineChart',
props: {
domId: {
type: String,
default: 'line-chart'
},
storeOrBrandTxt: {
type: String,
default: '品牌'
},
dataList: {
type: Array,
default: () => []
},
queryType: {
type: Number,
default: 0
},
tooltipFormatterObj: {
type: Array,
default: () => {
return [
{
label: '数量',
attrName: 'num'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
}
},
data() {
return {
directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer,
rankFlag: 'top',
lineOptions: [],
rankList: [],
echartsLine: '',
moveAttr: {
// speed: 900,
seriesIndex: 0,
dataIndex: 0
},
timer: null
}
},
created() {
this.lineOptions = getLineOptions({ tooltipFormatter: this.tooltipFormatter })
},
mounted() {
this.lineDom = document.getElementById(this.domId)
this[this.domId] = echarts.init(this.lineDom)
this.chartBindEvent()
},
methods: {
resetRankList() {
this.rankList = new Array(5).fill({ label: '- -', value: '- -' })
},
tooltipFormatter(obj) {
var currentItem = this.dataList[obj[0].dataIndex]
var txt = ''
txt = currentItem.statDate
this.tooltipFormatterObj.forEach(item => {
if (txt) {
txt = txt + '<br>'
}
txt = txt + item.label + ':' + currentItem[item.attrName] + (item.addSymbol || '')
})
return txt
},
chartBindEvent() {
// resize
window.addEventListener('resize', () => {
this[this.domId].resize()
})
// 鼠标划入
this[this.domId].on('mouseover', data => {
this.moveAttr.dataIndex = data.dataIndex
this.getRankList(this.moveAttr.dataIndex, this.rankFlag + 'List')
})
// 绑定点击事件
this[this.domId].getZr().on('mouseover', params => {
const pointInPixel = [params.offsetX, params.offsetY]
if (this[this.domId].containPixel('grid', pointInPixel)) {
var xIndex = this[this.domId].convertFromPixel({ seriesIndex: 0 }, [params.offsetX, params.offsetY])[0]
/* 事件处理代码书写位置 */
this.moveAttr.dataIndex = xIndex
this.getRankList(this.moveAttr.dataIndex, this.rankFlag + 'List')
}
})
// 移除图表
// this[this.domId].on('globalout', () => {
// this.chartAction()
// })
},
// chartAction(type) {
// this[this.domId].dispatchAction({
// type: type || 'showTip',
// seriesIndex: +this.moveAttr.seriesIndex,
// dataIndex: +this.moveAttr.dataIndex
// })
// },
getRankList(idx, attrName = 'topList') {
this.dataList[idx][attrName].length ? this.$set(this, 'rankList', this.dataList[idx][attrName]) : this.resetRankList()
},
drawLine() {
this.lineOptions.xAxis.data = []
this.dataList.map(e => {
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)
this[this.domId].setOption(this.lineOptions)
// 默认展示tooltip
// this.chartAction()
this.getRankList(0)
},
handleRankChange(value) {
this.rankFlag = value
this.getRankList(this.moveAttr.dataIndex, this.rankFlag + 'List')
}
}
}
</script>
<style lang="scss" scoped>
p {
margin: 0 0;
}
.line-box {
height: 100%;
color: #ffffff;
// padding: 4px 8px;
font-size: 0.75em;
overflow: hidden;
.txt-orange {
color: #eb6001;
}
.line-chart {
width: 100%;
height: calc(100% - 3.1vh - 4.6vh);
}
.rank-box {
box-sizing: border-box;
display: flex;
height: 4.6vh;
padding: 0.5vh 0.87vh;
border-top: 1px solid #373739;
.rank-title-block {
// flex: 0 0 55px;
width: 55px;
.rank-title {
box-sizing: border-box;
width: 100%;
text-align: center;
// font-size: 0.6em;
font-size: 9px;
background: #353535;
padding: 0.2vh 5px;
height: 1.8vh;
opacity: 0.7;
cursor: pointer;
}
.rank-title-active {
opacity: 1;
width: 100%;
color: #ffffff;
background: #eb6001;
}
}
.rank-block {
width: calc(100% - 55px);
display: flex;
.rank-line {
box-sizing: border-box;
width: 20%;
padding: 0 6px;
border-left: 1px solid rgba(96, 98, 102, 0.4);
.line-item {
height: 1.8vh;
width: 100%;
font-size: 0.55vw;
padding-bottom: 0.3vh;
}
.line-item:last-of-type {
padding-bottom: 0;
}
}
.rank-line:first-of-type {
border-width: 0;
}
}
}
}
::v-deep.line-chart {
width: 100%;
height: 100%;
div {
&:nth-child(1) {
width: 100% !important;
height: 100% !important;
canvas {
width: 100% !important;
height: 100% !important;
}
}
}
}
</style>
<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>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'Marquee',
props: {
text: String,
direction: {
type: Number,
default: 5000
},
delay: {
type: Number,
default: 1000
}
},
data () {
return {
move: false,
valueWidth: 0,
target: 0,
boxWidth: 0,
speed: 0
}
},
mounted () {
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)
}, this.delay)
},
methods: {
run () {
let { valueWidth, direction } = this
this.target = `-${valueWidth}px`
this.move = true
this.speed = direction / 1000
setTimeout(() => {
this.again()
}, direction)
},
again () {
let { boxWidth, valueWidth, direction } = this
this.move = false
this.target = `${boxWidth}px`
setTimeout(() => {
this.speed = direction * (boxWidth / valueWidth).toFixed(2) / 1000
this.move = true
this.reset()
}, 500)
},
reset () {
let awaitTime = (this.speed + 2) * this.delay
this.target = 0
setTimeout(() => {
this.run()
}, awaitTime)
}
}
}
</script>
<style scoped lang='scss'>
.marquee-box {
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
.marquee {
position: absolute;
white-space: nowrap;
display: flex;
align-items: center;
}
.move {
transform: translateX(-100%);
}
}
</style>
\ No newline at end of file
<template>
<div class="pie-box">
<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>
</template>
<script>
import * as echarts from 'echarts'
export default {
name: 'PieChart',
props: {
id: {
type: String,
default: ''
},
keys: {
type: Array,
default: () => ['name', 'value']
},
height: {
type: String,
default: '12.7vh'
},
list: {
type: Array,
default: () => []
},
radius: {
type: Array,
default: () => ['55%', '75%']
},
colors: {
type: Array,
default: () => ['#4FA0FF', '#FF6E76', '#7CFFB2', '#FDF006', '#EB6001', '#F5AA01', '#BF98FF', '#58D9F9']
},
size: {
type: String,
default: '0.6vw'
}
},
data() {
return {
option: '',
echartsPie: '',
mTime: '',
viewData: [],
text: '',
subtext: '',
currentIndex: -1,
mainValue: 0,
numDesc: ''
}
},
watch: {
list: {
handler(newVal) {
if (newVal.length > 0) {
this.initData()
this.$nextTick(() => {
this.draw()
})
}
},
immediate: true
}
},
mounted() {
// this.initData()
// this.draw()
},
methods: {
//初始化数据
initData() {
let { list, keys } = this
this.viewData = []
list.forEach(item => {
this.viewData.push({
name: item[keys[0]],
value: item[keys[1]]
})
})
},
draw() {
if (this.mTime) clearInterval(this.mTime)
this.echartsPie = echarts.init(document.getElementById(this.id))
window.addEventListener('resize', () => {
this.echartsPie.resize()
})
// 指定图表的配置项和数据
this.option = {
// tooltip: {
// trigger: 'item'
// },
color: this.colors,
series: [
{
name: '客户年龄分布',
type: 'pie',
radius: this.radius,
center: ['50%', '50%'],
avoidLabelOverlap: false,
label: {
normal: {
show: false,
position: 'center'
},
show: false,
position: 'center'
},
emphasis: {
label: {
show: false,
fontSize: '14',
fontWeight: 'bold'
}
},
labelLine: {
show: false
},
data: this.viewData,
minAngle: 30
}
]
}
this.echartsPie.clear()
this.mainValue = 0
this.numDesc = ''
// this.setAnamiteText()
this.echartsPie.setOption(this.option)
this.pieActive()
this.mTime = setInterval(this.pieActive, 15000)
// 鼠标划出
this.echartsPie.on('mouseout', () => {
if (this.mTime) clearInterval(this.mTime)
this.mTime = setInterval(this.pieActive, 15000)
})
this.echartsPie.on('mouseover', data => {
this.mainValue = data.data.value
this.numDesc = data.data.name
this.setAnamiteText()
// 停止定时器,清除之前的高亮
clearInterval(this.mTime)
this.currentIndex = data.dataIndex
this.highlightPie()
this.emitEvent(data.data)
})
},
// 事件触发
emitEvent(data) {
this.text = data.name
this.subtext = data.value
this.echartsPie.setOption(this.option)
this.$emit('pieAction', data)
},
highlightPie() {
// 取消所有高亮并高亮当前图形
// 遍历饼图数据,取消所有图形的高亮效果
for (var idx in this.option.series[0].data)
this.echartsPie.dispatchAction({
type: 'downplay',
seriesIndex: 0,
dataIndex: idx
})
// 高亮当前图形
this.echartsPie.dispatchAction({
type: 'highlight',
seriesIndex: 0,
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.setAnamiteText()
},
setAnamiteText() {
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)
},
//高亮
pieActive() {
const dataLen = this.option.series[0].data.length
this.currentIndex = (this.currentIndex + 1) % dataLen
this.highlightPie()
this.emitEvent(this.viewData[this.currentIndex])
}
}
}
</script>
<style lang="scss" scoped>
.pie-box {
// background: #262525;
position: relative;
flex: 1;
.center-content {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
max-width: 40%;
&-num {
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;
&::before {
content: counter(count);
}
}
&-desc {
font-size: 0.5vw;
color: #606266;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
animation: rotateIn 3s infinite;
}
}
.pie-chart {
}
}
@property --step {
syntax: '<integer>';
inherits: false;
initial-value: 15;
}
@keyframes rotateIn {
from {
transform: rotateY(0turn);
}
to {
transform: rotateY(-1turn);
}
}
</style>
<!--
* @Description:
* @Author: huyue
* @Date: 2022-06-28 15:20:14
* @LastEditors: huyue
* @LastEditTime: 2022-07-08 19:03:36
-->
<template>
<div class="ranking-container">
<div class="ranking-title">{{ this.$store.state.app.reportParams.brand ? '门店' : '品牌' }}排名</div>
<div class="ranking">
<div class="brand flex" v-for="(item, index) in brandList" :key="index">
<span class="brand-num">{{ index + 1 }}</span>
<marquee class="marquee" :direction="directionTimer" :delay="delayTimer" :text="item" />
</div>
</div>
</div>
</template>
<script>
export default {
name: 'RanKing',
props: {
list: {
type: Array,
default: () => []
}
},
watch: {
list: {
handler(newVal) {
this.brandList = newVal
}
}
},
data() {
return {
delayTimer: 3000,
directionTimer: 3000,
brandList: this.list,
isBrandName: false
}
}
}
</script>
<style lang="scss" scoped>
.ranking-container {
flex: 1;
margin-left: 0.6vw;
box-sizing: border-box;
height: 12.7vh;
background: #262525;
.ranking-title {
background: rgba(53, 53, 53, 0.6);
font-size: 0.694vw;
color: #eb6001;
font-weight: 400;
padding: 0.4vh 0 0.4vh 20%;
box-sizing: border-box;
}
.ranking {
font-size: 0.694vw;
color: #ffffff;
letter-spacing: 0;
font-weight: 400;
padding: 0.2vh 0 0.3vh 8px;
.brand {
// line-height: 1.9vh;
height: 1.9vh;
display: flex;
align-items: center;
.brand-num {
color: #606266;
margin-right: 0.6vw;
display: inline-block;
width: 0.3vw;
text-align: center;
}
.marquee {
width: 80%;
height: 1.9vh;
font-weight: 400;
}
}
}
}
</style>
<template>
<div class="number-box flex">
<template v-if="numList.length">
<template v-for="(i,index) in numList">
<div :key="index">
{{i}}
</div>
<template v-if="index != numList.length - 1">,</template>
</template>
</template>
<template v-else>
<div
class="transition-number"
:id="idKey"
>
</div>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'TransitionNumber',
props: {
num: [String, Number],
idKey: String,
split: Boolean
},
data () {
return {
numList: []
}
},
watch: {
num (n) {
this.numList = []
setTimeout(() => {
if (n > 0) {
document.querySelector(`#${this.idKey}`).style = `--step:${n}`
setTimeout(() => {
this.numList = this.setPrice(n)
}, 1000)
} else document.querySelector(`#${this.idKey}`).style = `--step:0`
}, 200)
}
},
mounted () {
},
methods: {
setPrice (price) {
let number = (price.toString() || 0).toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
return number.split(',')
}
}
}
</script>
<style scoped lang='scss'>
.number-box {
}
.transition-number {
color: inherit;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
--step: 0;
counter-reset: count var(--step);
z-index: var(--step);
transition: --step 1s;
font-size: inherit;
&::before {
content: counter(count);
}
}
@property --step {
syntax: '<integer>';
inherits: false;
initial-value: 15;
}
</style>
\ No newline at end of file
......@@ -23,10 +23,16 @@ export default {
height: 100%;
box-sizing: border-box;
position: relative;
padding: 1vh 24px 2vh;
display: grid;
grid-template-columns: repeat(2, 1fr);
padding: 1vh 24px 1.1vh;
// display: grid;
// grid-template-columns: 688px 680px;
gap: 0 24px;
display: flex;
justify-content: space-between;
> div {
height: 100%;
flex: 1;
}
&::after {
content: '';
position: absolute;
......
......@@ -3,31 +3,62 @@
<div class="top">
<view-sub-title title="集团客户总览" />
<view-tabs />
<view-pie-group />
<view-pie-group>
<div slot="1"><Age :height="defaultHeight"></Age></div>
<div slot="2"><Sex :height="defaultHeight"></Sex></div>
<div slot="3"><BuyCar :height="defaultHeight"></BuyCar></div>
</view-pie-group>
</div>
<div class="bottom">
<view-sub-title title="销售数据总览" />
<view-line-group height="14.9vh" />
<view-pie-group />
<view-line-group height="15.9vh">
<div slot="1"><Flow height="15.9"></Flow></div>
<div slot="2"><Trend height="15.9"></Trend></div>
</view-line-group>
<view-pie-group>
<div slot="1"><EnterCategory :height="defaultHeight"></EnterCategory></div>
<div slot="2"><InfoFrom :height="defaultHeight"></InfoFrom></div>
<div slot="3"><CustomerCategory :height="defaultHeight"></CustomerCategory></div>
</view-pie-group>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
import datas from '../utils/data'
import Age from '../views/customer/age'
import BuyCar from '../views/customer/buyCar'
import Sex from '../views/customer/sex'
import Flow from '../views/salesData/flow'
import Trend from '../views/salesData/trend'
import CustomerCategory from '../views/salesData/customerCategory'
import InfoFrom from '../views/salesData/infoFrom'
import EnterCategory from '../views/salesData/enterCategory'
export default {
name: 'ViewContentLeft',
data () {
components: {
Age,
BuyCar,
Sex,
Flow,
Trend,
CustomerCategory,
InfoFrom,
EnterCategory
},
data() {
return {
defaultHeight: datas.DefaultData.defaultPieHeight
}
},
mounted () {
mounted() {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.left {
display: flex;
flex-direction: column;
......@@ -37,8 +68,8 @@ export default {
}
.bottom {
// height: calc(41% - 16px);
height: 35.9vh;
height: 36.8vh;
margin-top: auto;
}
}
</style>
\ No newline at end of file
</style>
<!--
* @Description:
* @Author: huyue
* @Date: 2022-06-23 10:52:23
* @LastEditors: huyue
* @LastEditTime: 2022-06-24 14:44:50
-->
<template>
<div class="right">
<view-sub-title title="售后数据总览" />
<view-line-group />
<view-line-group />
<view-line-group />
<view-line-group height="25.6vh" hideMargin />
<view-line-group>
<div slot="1"><File :height="defaultHeight"></File></div>
<div slot="2"><Efficient :height="defaultHeight"></Efficient></div>
</view-line-group>
<view-line-group>
<div slot="1"><Keep :height="defaultHeight"></Keep></div>
<div slot="2"><Lost :height="defaultHeight"></Lost></div>
</view-line-group>
<view-line-group>
<div slot="1"><First :height="defaultHeight"></First></div>
<div slot="2"><Sadayasu :height="defaultHeight"></Sadayasu></div>
</view-line-group>
<view-line-group height="26.5vh" hideMargin>
<div slot="1"><Analyze height="26.5"></Analyze></div>
<div slot="2"><Mileage height="26.5"></Mileage></div>
</view-line-group>
</div>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
import datas from '../utils/data'
import Analyze from '../views/afterSales/analyze'
import Efficient from '../views/afterSales/efficient'
import File from '../views/afterSales/file'
import First from '../views/afterSales/first'
import Keep from '../views/afterSales/keep'
import Lost from '../views/afterSales/lost'
import Mileage from '../views/afterSales/mileage'
import Sadayasu from '../views/afterSales/sadayasu'
export default {
name: 'ViewContentRight',
data () {
components: {
Analyze,
Efficient,
File,
First,
Keep,
Lost,
Mileage,
Sadayasu
},
data() {
return {
defaultHeight: datas.DefaultData.defaultLineHeight
}
},
mounted () {
mounted() {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.right {
}
</style>
\ No newline at end of file
</style>
......@@ -3,23 +3,39 @@
<div class="left flex user-select pointer">
<template v-for="(i,index) in tab">
<div
:class="['item flex',index == 0?'text-center':'brand',{'active':i.active}]"
:class="['item flex',index == 0?'text-center':'brand',{'active':tabIndex == index}]"
:key="index"
@click="chooseBrand(index)"
@click="change(index)"
>
{{i.text}}
<div class="text text-hide">
{{i}}
</div>
<template v-if="index == 1">
<div class="arrow"></div>
</template>
</div>
</template>
<div
class="options-box"
v-show="showBrand"
></div>
:key="brandsKey"
ref="brands"
>
<template v-for="(i,index) in brands">
<div
:class="['options-item flex',{'active':i.active}]"
:key="index"
@click="chooseBrand({i,index})"
>
<div class="text-hide">{{i.brandName}}</div>
</div>
</template>
</div>
</div>
<div class="right y-center flex user-select pointer">
<template v-for="(i,index) in options">
<div
:key="index"
@click="choose(index)"
@click="reportChange(index)"
:class="['item text-center',{'active':reportIndex == index}]"
>
{{i}}
......@@ -35,27 +51,68 @@ export default {
name: 'ViewControl',
data () {
return {
tab: [{ text: '广汇集团', active: true }, { text: '品牌概览' }],
tab: ['广汇集团', '品牌概览'],
tabIndex: 0,
options: ['日表', '月表'],
reportIndex: 1,
showBrand: false
brands: [],
brandsKey: Date.now()
}
},
mounted () {
this.api.common.getBrandList().then(({ code, data }) => {
let brands = []
if (code == 0) {
data.dataList.map(e => {
brands.push({
brandName: e,
active: false
})
})
}
this.brands = brands
})
},
methods: {
chooseBrand (index) {
let { tab } = this
tab.map(e => e.active = false)
tab[index].active = true
this.showBrand = index == 1
change (index, item) {
let { tabIndex } = this
if (index == 0) {
if (tabIndex == index) return
this.tab = ['广汇集团', '品牌概览']
this.brands.map(e => e.active = false)
} else {
if (!item) return
this.tab[1] = item.brandName
}
this.tabIndex = index
this.emit()
},
choose (index) {
reportChange (index) {
let { reportIndex } = this
if (reportIndex == index) return
this.reportIndex = index
}
this.emit()
},
emit () {
let { reportIndex, tabIndex, brands } = this
let params = {
reportType: reportIndex == 0 ? 1 : 0 //月表0,日表1
}
if (tabIndex == 1) brands.map(e => {
if (e.active) params.brand = {
name: e.brandName
}
})
this.$store.state.app.reportParams = params
},
chooseBrand ({ i, index }) {
let { brands } = this
brands.map(e => e.active = false)
brands[index].active = true
// this.brandsKey = Date.now()
// this.$refs.brands.style.display = 'none'
this.change(1, i)
},
}
}
</script>
......@@ -76,25 +133,96 @@ export default {
border-radius: 4px 0px 0px 4px;
}
.brand {
padding-left: 16px;
padding: 0 16px;
border-radius: 0 4px 4px 0;
.text {
width: calc(100% - 20px);
}
&:hover ~ .options-box {
display: block;
}
.arrow {
position: relative;
top: 4.5px;
border-top: 4.5px solid #eb6001;
border-right: 4.5px solid transparent;
border-bottom: 4.5px solid transparent;
border-left: 4.5px solid transparent;
margin-left: auto;
transition: all 0.25s;
}
&:hover {
.arrow {
transform: rotate(-180deg);
top: 0;
}
}
}
.active {
color: #fff;
background: #eb6001;
.arrow {
border-top-color: #fff;
transform: rotate(-180deg);
top: 0;
}
}
.options-box {
display: none;
position: absolute;
top: 32px;
top: 4.1vh;
right: 0;
width: 50%;
height: 30vh;
max-height: 30vh;
background: #383737;
border: 1px solid rgba(96, 98, 102, 1);
box-shadow: 0px 3px 2px 1px rgba(0, 0, 0, 0.5);
border-radius: 4px;
box-sizing: border-box;
z-index: 2;
overflow-y: scroll;
&:hover {
display: block;
}
&:hover .brand {
background-color: #096;
}
.options-item {
height: 2.9vh;
font-size: 12px;
color: #ffffff;
padding-left: 19px;
position: relative;
}
.active,
.options-item:hover {
background: #1e1e1e;
color: #eb6001;
&::after {
position: absolute;
left: 0;
top: 0;
width: 4px;
height: 100%;
content: '';
background-color: #eb6001;
}
}
.active{
position: sticky;
top: 0;
z-index: 2;
left: 0;
}
}
::-webkit-scrollbar {
background-color: #383737;
width: 6px;
position: absolute;
}
::-webkit-scrollbar-thumb {
background: #464646;
border-radius: 3px;
}
}
.right {
......@@ -135,7 +263,7 @@ export default {
box-sizing: border-box;
transition: all 0.25s;
&:hover {
opacity: 0.9;
opacity: 0.75;
}
}
}
......
<!--
* @Description: 一行两个一组
* @Author: huyue
* @Date: 2022-06-23 11:28:03
* @LastEditors: huyue
* @LastEditTime: 2022-06-24 14:57:41
-->
<template>
<div class="line-group">
<template v-for="(i,index) in items">
<div
class="box"
:key="index"
:style="[{'height':height},{'margin-bottom':hideMargin?0:'1vh'}]"
></div>
<template v-for="(i, index) in items">
<div class="box" :key="index" :style="[{ height: height }, { 'margin-bottom': hideMargin ? 0 : '1vh' }]">
<slot :name="i"></slot>
</div>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
import datas from '../utils/data'
export default {
name: 'ViewLineGroup',
props: {
height: {
type: String,
default: '19.8vh'
default: datas.DefaultData.defaultLineHeight + 'vh'
},
hideMargin: Boolean
},
data () {
data() {
return {
items: [1, 2]
}
},
mounted () {
mounted() {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.line-group {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0 8px;
}
</style>
\ No newline at end of file
</style>
<template>
<div class="pie-group">
<template v-for="(i,index) in items">
<div
class="box"
:key="index"
></div>
<template v-for="(i, index) in items">
<div class="box" :key="index">
<slot :name="i"></slot>
</div>
</template>
</div>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
export default {
name: 'ViewPieGroup',
props: {},
data () {
data() {
return {
items: [1, 2, 3]
}
},
mounted () {
mounted() {
},
methods: {
}
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.pie-group {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 0 8px;
.box{
.box {
height: 16.6vh;
}
}
</style>
\ No newline at end of file
</style>
......@@ -25,7 +25,6 @@ export default {
// height: 24px;
height: 2.9vh;
font-size: 14px;
line-height: 20px;
margin-bottom: .5vh;
.logo{
width: 14px;
......
<template>
<div class="content flex box">
<div class="content flex">
<div class="logo user-select">
<img
src="@/assets/images/logo.svg"
alt="logo"
>
<img src="@/assets/images/logo.svg" alt="logo" />
</div>
<div class="title flex user-select">广汇集团客户池数据大屏</div>
<div class="view-title flex user-select">广汇集团客户池数据大屏</div>
<div class="time">
<div class="top">{{now}}</div>
<div class="bottom">数据截止至 {{yesterday}}</div>
<div class="top flex">
<img src="@/assets/images/time.svg" class="icon" />
<div class="now">{{ now }}</div>
</div>
<div class="bottom flex">
<div class="merchant">已同步门店数:160</div>
数据截止至 {{ yesterday }}
</div>
</div>
<div class="center-control">
<view-control />
......@@ -17,7 +20,7 @@
</div>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
export default {
name: 'ViewTitle',
data () {
......@@ -40,14 +43,16 @@ export default {
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.content {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 0 24px;
position: relative;
.title {
background: #1d1c1c;
z-index: 9999999999;
.view-title {
color: transparent;
background: linear-gradient(left, #e60115 10%, #eb6001 25%, #f5aa01 50%, #fdf006 100%);
-webkit-background-clip: text;
......@@ -66,10 +71,34 @@ export default {
text-align: right;
font-size: 14px;
color: #ffffff;
.top {
justify-content: flex-end;
}
.icon {
width: 16px;
height: 16px;
margin-right: 8px;
}
.bottom {
font-size: 10px;
color: #eb6001;
line-height: 16px;
color: #fff;
.merchant {
color: #eb6001;
margin-right: 10px;
padding-right: 10px;
position: relative;
&::after {
position: absolute;
right: 0;
top: 50%;
transform: translateY(-50%);
width: 1px;
height: 1.5vh;
content: '';
background-color: #606266;
}
}
}
}
.center-control {
......@@ -80,4 +109,4 @@ export default {
z-index: 2;
}
}
</style>
\ No newline at end of file
</style>
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'
},
formatter: tooltipFormatter || '',
confine:true
},
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'
}
},
splitNumber: 4
},
series: [
{
type: 'line',
symbol: 'circle',
itemStyle: {
color: '#F5AA01'
},
// 平滑曲线
smooth: true,
showSymbol: false,
// 折线背景色
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
......@@ -11,7 +11,8 @@ module.exports = {
envVersion: 'trial',
title: '广汇汽车服务',
request: {
baseURL: 'http://scrm.dev.glsx.com.cn', // 本地测试项目地址,
// baseURL: 'http://192.168.3.126:8081', // 本地测试项目地址,
baseURL: 'http://192.168.1.152:8081', // 本地开发项目地址,
// 设置超时时间
timeout: 180000,
// 携带凭证
......@@ -28,4 +29,4 @@ module.exports = {
logout_function: 'reLogin',
code_message_map: {}
},
}
\ No newline at end of file
}
......@@ -15,8 +15,8 @@ export const fetchConfig = function (isEnv = true) {
Object.assign(request, { timeout })
return Promise.resolve(config)
}
// /**测试mock */ return window.fetch('https://oss-config.dev.glsx.com.cn/mock/617918601072f92988f05a11/base/scrm-wx-work-main-config', {}).then(res => res.json())
/**生产 */ return window.fetch('https://oss-config.test.glsx.com.cn/mock/617918601072f92988f05a11/base/scrm-wx-work-main-config', {}).then(res => res.json())
/**测试mock */ return window.fetch('https://oss-config.dev.glsx.com.cn/mock/62bd8142304f1311a3b76a04/data-view/config', {}).then(res => res.json())
// /**生产 */ return window.fetch('https://oss-config.test.glsx.com.cn/mock/617918601072f92988f05a11/base/scrm-wx-work-main-config', {}).then(res => res.json())
}
export const cfg = {
install (vue, config) {
......
......@@ -20,7 +20,6 @@ import { fetchConfig, cfg } from '@/config'
import '@/assets/css/index.scss'
import './utils/util'
import 'components'
Vue.prototype.api = api
Vue.prototype.to = function (name, params) {
if (name === -1) {
router.go(-1)
......@@ -40,6 +39,7 @@ fetchConfig(!isMock).then(res => {
Vue.use(cfg)
// if (res.vconsole) new VConsole()
window.$HTTP = new Request(res.request)
Vue.prototype.api = api
window.vm = new Vue({
el: '#app',
router,
......
export default {
watch: {
watchReportParams: {
immediate: true,
handler(newval) {
this && this.init && this.init(newval)
}
}
},
computed: {
watchReportParams() {
return this.$store.state.app.reportParams
}
}
}
import { changeMixin } from './index'
export default {
data() {
return {
clientData: [],
brandList: [],
distributionRank: '',
isBrand: false,
brandName: ''
}
},
mixins: [changeMixin],
created() {
// this.getClientData()
},
methods: {
getClientData() {
let clientApi = !this.isBrand ? 'overalldistribution' : 'merchantOveralldistribution'
const params = {
req: {
queryItem: this.type,
queryTime: this.getCurrentDate()
}
}
if (this.isBrand) params.req.brandName = this.brandName
this.api.customer[clientApi](params).then(res => {
this.clientData = []
this.brandList = []
this.distributionRank = ''
if (res.data.dataList.length > 0) {
let distribution = JSON.parse(res.data.dataList[0].distribution)
const keys = Object.keys(distribution)
keys.forEach((item, index) => {
this.clientData.push({
name: item,
value: distribution[item]
})
})
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
}
})
},
init(newVal) {
this.isBrand = false
if (newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getClientData()
},
pieAction(data) {
this.brandList = []
let array = this.distributionRank && this.distributionRank[data.name]
if (array&&array.length > 0) {
for (let i of array) {
this.brandList.push(i && Object.keys(i)[0])
}
}
}
}
}
import indexMixin from './indexMixin'
import shareMixin from './shareMixin'
import changeMixin from './changeMixin'
import clientMixin from './clientMixin'
import salesMixin from './salesMixin'
export {
indexMixin,
shareMixin
changeMixin,
clientMixin,
salesMixin
}
\ No newline at end of file
import { Notify, Dialog } from 'vant'
import { wwbenchApi, ssoApi, sopApi } from '@/api'
const { subsystemInfo, text } = window.$fetchConfig
export default {
data () {
return {
statusEnum: {
0: '去处理',
1: '处理中',
2: '已完成'
},
taskTypeEnum: {
// 1: '批量添加客户好友',
2: '直播群发任务',
3: '客户群发',
4: '客户群群发',
5: '客户资料完善',
6: '营销sop-任务',
8: '线索跟进-任务',
},
userInfo: {},
accountList: [],
tasksList: [],
taskCountData: {},
showCalendar: false,
taskType: '',
status: '',
statusOption: [
{ text: '全部', value: '' },
{ text: '待处理', value: 0 },
{ text: '处理中', value: 1 },
{ text: '已处理', value: 2 }
],
taskTypeOption: [
{ text: '全部', value: '' },
// { text: '批量添加客户好友', value: 1 },
// { text: '直播群发任务', value: 2 },
{ text: '客户群发', value: 3 },
{ text: '客户群群发', value: 4 },
{ text: '客户资料完善', value: 5 },
{ text: '营销sop', value: 6 },
{ text: '线索跟进', value: 8 }
],
list: [
{
text: '未完成任务',
key: 'unFinishTaskCount'
},
{
text: '已完成任务',
key: 'finishTaskCount'
},
{
text: '完成率',
isCanvas: true
}
],
dateRange: '',
minDate: new Date(),
maxDate: new Date(),
default_Date: null,
dateRangeFormat: 'yyyy.MM.dd',
startDate: '',
endDate: '',
tasksFlag: false
}
},
mounted () {
this.init()
},
methods: {
init () {
this.userInfo = this.getLocalStorage('dj_scrm_userInfo')
let accountList = this.getLocalStorage('dj_scrm_accountList')
if (accountList) {
accountList.map(e => {
e.text = e.merchantName
e.value = e.merchantId
})
console.log(accountList)
this.accountList = accountList
}
this.getTaskData()
this.initDate()
},
getTaskData () {
wwbenchApi.getTaskData().then(data => {
let sum = Number(data.finishTaskCount + data.unFinishTaskCount) || 0
let num = Math.round(Number((Number(data.finishTaskCount) / sum) * 100)) || 0
data.num = num
data.sum = sum
this.taskCountData = data
})
},
initDate () {
let { dateRangeFormat } = this
let now = new Date()
let minDate = new Date(new Date().setDate(now.getDate() - 30))
this.minDate = minDate
this.default_Date = [minDate, now]
let startDate = minDate.format(dateRangeFormat)
let endDate = now.format(dateRangeFormat)
this.dateRange = `${startDate}-${endDate}`
this.getTasksList({
startDate,
endDate
})
},
onConfirmCalendar (e) {
let { dateRangeFormat } = this
let [start, end] = e
let startDate = start.format(dateRangeFormat)
let endDate = end.format(dateRangeFormat)
this.dateRange = `${startDate}-${endDate}`
this.showCalendar = false
this.tasksFlag = false
this.getTasksList({
startDate,
endDate
})
},
changeType (e, target) {
let { dateRange } = this
let [startDate, endDate] = dateRange.split('-')
this[target] = e
this.tasksFlag = false
this.getTasksList({
startDate,
endDate
})
},
getTasksList ({ startDate = '', endDate = '' }) {
this.showLoading()
let { status, taskType } = this
if (startDate) startDate = `${startDate.replace(/\./g, '-')} 00:00:00`
if (endDate) endDate = `${endDate.replace(/\./g, '-')} 23:59:59`
let obj = {
status,
taskType,
startDate,
endDate
}
console.log(obj)
wwbenchApi.getTasksList(obj).then(({ code, data, message }) => {
this.hideLoading()
if (code == 0) {
this.tasksList = data
} else {
Notify(message)
}
this.tasksFlag = true
})
},
changeAccount (id) {
console.log(id)
let { accountList } = this
try {
accountList.map(e => {
if (e.value == id) throw e
})
} catch (e) {
this.showLoading('切换中...')
ssoApi
.changeLoginAccount({
loginAccount: e.accountName,
merchantId: id
})
.then(({ code, data, message }) => {
this.hideLoading()
if (code == '0') {
this.setLocalStorage('dj_scrm_userInfo', data)
console.log(data)
this.init()
} else {
Notify(message)
}
})
}
},
click (e) {
let { status, id, taskType } = e
if (status == 2 && (taskType != 6 || taskType != 8)) return
if (taskType == 6 || taskType == 8) {
this.jump(e)
} else {
wwbenchApi.updateTasks({ id }).then(res => {
if (taskType == 3 || taskType == 4) {
Dialog.alert({
message: `请去企业微信“消息”列表-“${text}”中进行转发`,
theme: 'round-button',
confirmButtonText: '我知道了',
confirmButtonColor: '#3975C6'
})
} else {
this.jump(e)
}
})
}
},
jump (e) {
let { taskId, taskType } = e
let sessionId = this.getSessionId()
let { corpId } = this.getLocalStorage('dj_scrm_corpId')
let link = {
1: 'customerDetails',
2: 'customerGroup/mass',
5: 'customer/information',
6: 'home',
8: 'clew/detail'
}[taskType]
let { path } = subsystemInfo[{
5: 'customer',
6: 'sop',
8: 'clew'
}[taskType]]
if (link) {
if (!['prod', 'production'].includes(process.env.NODE_ENV)) path = '/dj-scrm-wx-work-main-lwk/#/'
let url = `${path}${link}?sessionId=${sessionId}&corpId=${corpId}`
if (taskId) url = `${url}&taskId=${taskId}`
window.location.href = url
}
}
}
}
import { changeMixin } from './index'
export default {
data() {
return {
salesData: [],
brandList: [],
typeRanking: '',
isBrand: false,
brandName: ''
}
},
mixins: [changeMixin],
created() {
// this.getSalesData()
},
methods: {
getSalesData() {
let salesApi = !this.isBrand ? 'getSales' : 'getMerchantSales'
const params = {
req: {
queryItem: this.type,
queryTime: this.getCurrentDate(),
queryType: this.watchReportParams.reportType
}
}
if (this.isBrand) params.req.brandName = this.brandName
this.api.sales[salesApi](params).then(res => {
this.salesData = []
this.typeRanking = ''
this.brandList = []
if (res.data.dataList.length > 0) {
let typeNum = JSON.parse(res.data.dataList[0].typeNum)
Object.keys(typeNum).forEach((item, index) => {
this.salesData.push({
name: item,
value: typeNum[item]
})
})
this.typeRanking = JSON.parse(res.data.dataList[0].typeRanking)
}
})
},
init(newVal) {
this.isBrand = false
if (newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getSalesData()
},
pieAction(data) {
this.brandList = []
let array = this.typeRanking && this.typeRanking[data.name]
if (array&&array.length > 0) {
for (let i of array) {
this.brandList.push(i && Object.keys(i)[0])
}
}
}
}
}
import { wxConfig, marketingApi } from '@/api'
export default {
data () {
return {
entry: 'normal'
}
},
mounted () {
this.wxInit()
},
methods: {
wxInit () {
let _this = this
wxConfig.init(['getContext', 'shareAppMessage', 'shareToExternalMoments'])
},
shareToExternalMoments (i) {
this.sendMessage(i, true)
},
sendMessage (i, isPyq) {
const { shopmall_appid, envVersion } = window.$fetchConfig
const path = 'pages/psdView/psdView'
const { merchantId, uuid, sapCode } = this.getLocalStorage('dj_scrm_userInfo')
const { entry } = this
const { materialName, id, titleUrl, materialTitle, description } = i
const imgUrl = 'https://img01.glsx.com.cn/weapp/resource/scrm-mobile/test/test.jpg'
let query = `merchantId=${merchantId}&id=${id}&staffUuid=${uuid}&shareTime=${Date.now()}`
if (sapCode) query = `${query}&storeCode=${sapCode}`
wxConfig.createMiniprogramUrlLink({
path,
query,
appId: shopmall_appid,
envVersion
})
.then(link => {
this.showLoading()
if (isPyq) {
console.log('朋友圈')
wxConfig.shareToExternalMoments({
attachments: [
{
msgtype: 'link', // 消息类型,必填
link: {
title: materialTitle || materialName, // H5消息标题
imgUrl: titleUrl || imgUrl, // H5消息封面图片URL
url: link // H5消息页面url 必填
},
}
]
}).then(() => {
this.sendReadBuriedPoint({ id, merchantId, uuid })
this.hideLoading()
})
.catch(err => {
this.hideLoading()
})
} else {
let params = {
link,
title: materialTitle || materialName,
desc: description || '',
imgUrl: titleUrl || imgUrl
}
this.shareAppMessage(params, { id, merchantId, uuid })
}
})
},
sendReadBuriedPoint ({ id, merchantId, uuid }) {
marketingApi.sendReadBuriedPoint({
materialId: id,
type: 1,
merchantId,
staffUuid: uuid
})
},
shareAppMessage (params, sendParams) {
wxConfig
.shareAppMessage(params)
.then(() => {
this.sendReadBuriedPoint(sendParams)
this.hideLoading()
})
.catch(() => {
this.hideLoading()
})
}
}
}
......@@ -7,9 +7,9 @@
* @LastEditTime: 2021-07-06 12:02:21
*/
const state = {
pageMeta: '',
keepAlives: [],
lastPath: ''
reportParams: {
reportType: 0 //月表0,日表1
}
}
const mutations = {
SET_PAGE_META (state, meta) {
......
/*
* @Description: 公共数据
* @Author: huyue
* @Date: 2022-06-23 17:38:33
* @LastEditors: huyue
* @LastEditTime: 2022-06-29 19:47:34
*/
const DefaultData = {
defaultLineHeight: '19.8',
defaultPieHeight: '16.6',
directionTimer: 3000,
delayTimer: 3000
}
const Customer = {
age: {
name: '年龄区间',
value: [
{ name: '未知', value: 0 },
{ name: '18~25', value: 1 },
{ name: '26~30', value: 2 },
{ name: '31~35', value: 3 },
{ name: '36~40', value: 4 },
{ name: '41~45', value: 5 },
{ name: '46~50', value: 6 },
{ name: '50+', value: 7 }
]
},
sex: {
name: '性别',
value: [
{ name: '未知', value: 0 },
{ name: '男', value: 1 },
{ name: '女', value: 2 }
]
},
carPeriod: {
name: '购车年限',
value: [
{ name: '未知', value: 0 },
{ name: '1年内', value: 0 },
{ name: '1年', value: 0 },
{ name: '2年', value: 0 },
{ name: '3年', value: 0 },
{ name: '4年', value: 0 },
{ name: '5年', value: 0 },
{ name: '5年+', value: 0 }
]
},
enterCategory: {
name: '进店类型',
value: [
{ name: '展厅客户', value: 15 },
{ name: '网电客户', value: 16 },
{ name: '其他客户', value: 17 }
]
},
infoFrom: {
name: '信息来源',
value: [
{ name: '自然进店', value: 25 },
{ name: '报纸', value: 26 },
{ name: '电台', value: 27 },
{ name: '网络', value: 28 },
{ name: '朋友介绍', value: 31 },
{ name: '广告牌', value: 32 },
{ name: '车展', value: 35 },
{ name: '其他', value: 36 }
]
},
level: {
name: '客户级别',
value: [
{ name: 'H(一周內)', value: 37 },
{ name: 'A(半个月內)', value: 38 },
{ name: 'B(1个月内)', value: 39 },
{ name: 'C(3个月内)', value: 40 },
{ name: 'N(3个月后 )', value: 41 },
{ name: 'F(战败)', value: 42 },
{ name: 'O(订车)', value: 43 }
]
},
valueType: {
name: '价值类型',
value: [
{ name: '重要价值', value: 1 },
{ name: '重要发展', value: 2 },
{ name: '重要召回', value: 3 },
{ name: '重要挽留', value: 4 },
{ name: '一般价值', value: 5 },
{ name: '一般发展', value: 6 },
{ name: '一般召回', value: 7 },
{ name: '一般挽留', value: 8 }
]
}
}
export default Object.freeze({
DefaultData,
Customer
})
import Vue from 'vue'
import {
Toast,
Dialog
} from 'vant'
import { Toast, Dialog } from 'vant'
/**
* 日期格式化
......@@ -10,21 +7,21 @@ import {
*/
Date.prototype.format = function (fmt) {
let o = {
'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日
'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分
's+': this.getSeconds(), //秒
//季度
'M+': this.getMonth() + 1, //月份
'd+': this.getDate(), //日
'h+': this.getHours(), //小时
'm+': this.getMinutes(), //分
'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
......@@ -42,114 +39,13 @@ const throttle = (fn, gapTime) => {
}
}
}
/**防止重复点击 */
const showLoading = (title = '加载中...', callBack, custom) => {
// Toast({
// type: 'loading',
// message: title,
// forbidClick: true,
// duration: 0
// })
// if (callBack && typeof callBack == 'function') {
// if (!custom) Toast.clear()
// callBack()
// }
}
const hideLoading = () => {
// Toast.clear()
}
/**num:要转换的数值,fixed:精确几位小数 */
const decimal = (num, fixed) => {
let pow = Math.pow(10, fixed)
return Math.round(num * pow) / pow
}
const showToast = (message = '', callBack) => {
// let params = {
// message,
// forbidClick: true,
// duration: 1500
// }
// Toast(params)
// if (callBack && typeof callBack == 'function') {
// setTimeout(() => {
// callBack()
// }, 1500)
// }
}
/**触摸样式 */
const touchstart = e => {
e.target.classList.add('btn-on-leave')
}
const touchend = e => {
e.target.classList.remove('btn-on-leave')
}
const setSessionId = val => {
window.localStorage.setItem('dj_scrm_session_id', val)
}
const getSessionId = () => {
return window.localStorage.getItem('dj_scrm_session_id')
}
const clearSessionId = () => {
window.localStorage.removeItem('dj_scrm_session_id')
}
const setLocalStorage = (key, item) => {
window.localStorage.setItem(key, JSON.stringify(item))
// sessionStorage.setItem(key, JSON.stringify(item))
}
const getLocalStorage = key => {
return JSON.parse(window.localStorage.getItem(key))
// return JSON.parse(sessionStorage.getItem(key))
}
const removeLocalStorage = key => {
window.localStorage.removeItem(key)
// sessionStorage.removeItem(key)
}
const dialog = (params = {}) => {
// if (!params.confirmButtonColor) params.confirmButtonColor = '#FF7336'
// return Dialog.confirm(params)
}
/**拨打电话 */
const makePhoneCall = phoneNumber => {
window.location.href = `tel://${phoneNumber}`
}
/**是否全面屏 */
const isFullSucreen = () => {
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
return result
}
const jumpChildrenPage = (to, params) => {
let { name } = window.vm._route
window.vm.$router.push({ name: `${name}.${to}`, params })
}
/**拷贝 */
const setClipboardData = data => {
let transfer = document.createElement('input')
document.body.appendChild(transfer)
transfer.value = data
transfer.focus()
transfer.select()
if (document.execCommand('copy')) document.execCommand('copy')
transfer.blur()
// Toast('内容已复制')
document.body.removeChild(transfer)
}
/**接口请求时失败让用户刷新 */
const refreshPage = (message = '系统异常') => {
// return Dialog.alert({
// message,
// theme: 'round-button',
// confirmButtonText: '点击重试',
// confirmButtonColor: '#FF7336'
// })
}
const toTop = () => {
let bodySrcollTop = document.body.scrollTop
if (bodySrcollTop !== 0) {
......@@ -164,7 +60,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('&')
......@@ -175,37 +71,62 @@ const getQuery = (name) => {
})
return name ? obj[name] : obj
}
const closeWindow = () => {
wx.closeWindow()
/** 三个数字加一个逗号 */
const numAddSymbol = val => {
return (val + '').replace(/\B(?=(?:\d{3})+\b)/g, ',')
}
// 获取当前时间
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 debounce = function (func, wait = 200) {
let timeout
return function (event) {
clearTimeout(timeout)
timeout = setTimeout(() => {
func.call(this, event)
}, wait)
}
}
const setChartFontSize = fontSize => {
let clientWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
if (!clientWidth) return fontSize
return fontSize * clientWidth / 1440
}
const utils = {
removeLocalStorage,
setClipboardData,
jumpChildrenPage,
setLocalStorage,
getLocalStorage,
clearSessionId,
makePhoneCall,
isFullSucreen,
setSessionId,
getSessionId,
showLoading,
closeWindow,
hideLoading,
refreshPage,
touchstart,
showToast,
getParams,
getQuery,
touchend,
throttle,
decimal,
dialog,
toTop
toTop,
numAddSymbol,
getCurrentDate,
getNDate,
getNMonth,
debounce,
setChartFontSize
}
Object.keys(utils).map(key => {
Vue.prototype[key] = utils[key]
})
export default utils
\ No newline at end of file
export default utils
<!--
* @Description: 售后客户价值分析
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-29 19:47:17
-->
<template>
<div>
<div class="title">售后客户价值分析</div>
<template v-if="barData.length > 0">
<div class="analyze-content" :style="{ height: height - 5 + 'vh' }">
<div class="content-left">
<div id="analyzeBar" style="height: 100%"></div>
</div>
<div class="contetn-right">
<pie-chart :id="chart.id" :list="analyzeData" :height="height - 5 + 'vh'" :radius="chart.radius" :size="chart.size"></pie-chart>
</div>
</div>
</template>
<div class="empty" :style="{ height: height - 4.9 + 'vh' }" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</template>
<script>
import * as echarts from 'echarts'
import datas from '../../utils/data'
import { changeMixin } from '../../mixins/index'
export default {
name: 'Analyze',
props: ['height'],
mixins: [changeMixin],
data() {
return {
analyzeData: [],
chart: {
id: 'analyzePie',
radius: ['60%', '78%'],
size:'0.8vw'
},
barChart: '',
option: {},
barData: [],
key: '重要价值',
isBrand: false,
brandName: ''
}
},
mounted() {},
methods: {
getChart() {
this.barChart = echarts.init(document.getElementById('analyzeBar'))
// resize
window.addEventListener('resize', () => {
this.barChart.resize()
})
this.option = {
grid: {
left: '3%',
right: '4%',
top: '2%',
bottom: '2%',
containLabel: true
},
yAxis: {
type: 'category',
data: datas.Customer.valueType.value.map(item => item.name).reverse(),
splitLine: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
}
},
xAxis: {
type: 'value',
splitLine: {
show: false
},
axisLabel: {
show: false
}
},
series: [
{
// data: [120, 200, 150, 80, 70, 110, 130, 300],
data: this.barData.reverse(),
type: 'bar',
barWidth: 12,
itemStyle: {
normal: {
label: {
show: true,
position: 'center',
textStyle: {
fontSize: '12',
color: '#fff',
height: '12',
padding: [1, 0, 0, 0]
}
},
color: new echarts.graphic.LinearGradient(1, 0, 0, 0, [
{
offset: 0,
color: '#F79902'
},
{
offset: 1,
color: '#EB6001'
}
])
}
}
}
]
}
this.barChart.clear()
this.barChart.setOption(this.option)
// 鼠标划入
this.barChart.on('mouseover', data => {
this.initPieData(data.name)
})
},
getValueType() {
let analyzeApi = !this.isBrand ? 'aftersaleother' : 'afterMerchantSaleother'
const params = {
req: {
queryItem: 'valueanalyse',
// queryTime: "2022-06-23",
queryTime: this.getCurrentDate(),
queryType: this.watchReportParams.reportType
}
}
if (this.isBrand) params.req.brandName = this.brandName
this.api.afterSales[analyzeApi](params).then(res => {
this.analyzeData = []
this.barData = []
if (res.data.dataList.length > 0) {
const reqData = JSON.parse(res.data.dataList[0].distribution)
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
this.barData = []
for (let i in reqData) {
this.barData.push(reqData[i])
}
this.$nextTick(() => {
this.getChart()
this.initPieData(this.key)
})
}
})
},
initPieData(name) {
this.analyzeData = []
datas.Customer.valueType.value.map(item => {
if (item.name == name) {
const distributionRank = this.distributionRank[item.value]
Object.keys(distributionRank).forEach(item => {
this.analyzeData.push({
name: item,
value: distributionRank[item]
})
})
}
})
},
init(newVal) {
this.isBrand = false
if (newVal && newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getValueType()
}
}
}
</script>
<style lang="scss" scoped>
.title {
padding: 1vh 8px;
height: 4vh;
}
.analyze-content {
display: flex;
padding: 0 8px;
box-sizing: border-box;
.bg {
background-color: #262525;
}
.content-left {
flex: 1;
height: 100%;
}
.contetn-right {
width: 50%;
margin-left: 8px;
}
}
</style>
<!--
* @Description: 有效客户
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:21:17
-->
<template>
<div>
<div class="title">有效客户</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="efficientChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt" :queryType="queryType"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'Efficient',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
dataList: []
}
},
mounted() { },
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'valid',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].num ? this.numAddSymbol(topTempList[item].num) : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].num ? this.numAddSymbol(lastTempList[item].num) : '- -'
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate.toFixed(2) || 0,
trate: item.trate.toFixed(2) || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 售后档案客户
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:21:39
-->
<template>
<div>
<div class="title">售后档案客户</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="fileChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt" :queryType="queryType"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'File',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
dataList: []
}
},
mounted() {
// this.dealList()
},
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'file',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].num ? this.numAddSymbol(topTempList[item].num) : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].num ? this.numAddSymbol(lastTempList[item].num) : '- -'
})
})
this.dataList.push({
num: item.num || 0,
hrate: item.hrate.toFixed(2) || 0,
trate: item.trate.toFixed(2) || 0,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 首保回店
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:21:59
-->
<template>
<div>
<div class="title">首保回店</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="firstChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt" :tooltipFormatterObj="tooltipFormatterObj" :queryType="queryType"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'First',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
tooltipFormatterObj: [
{
label: '回店数',
attrName: 'num'
},
{
label: '回店率',
attrName: 'rate',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
],
dataList: []
}
},
mounted() { },
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'first',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(2) + '%' : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(2) + '%' : '- -'
})
})
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,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 客户保持
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:22:21
-->
<template>
<div>
<div class="title">客户保持</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="keepChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt" :tooltipFormatterObj="tooltipFormatterObj" :queryType="queryType"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'Keep',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
dataList: [],
tooltipFormatterObj: [
{
label: '保持数',
attrName: 'num'
},
{
label: '保持率',
attrName: 'rate',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
},
mounted() {},
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'retain',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(2) + '%' : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(2) + '%' : '- -'
})
})
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,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 客户流失
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:22:34
-->
<template>
<div>
<div class="title">客户流失</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart v-else ref="lineChartRef" domId="lostChart" :dataList.sync="dataList" :storeOrBrandTxt="storeOrBrandTxt" :queryType="queryType" :tooltipFormatterObj="tooltipFormatterObj"></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'Lost',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
dataList: [],
tooltipFormatterObj: [
{
label: '流失数',
attrName: 'num'
},
{
label: '流失率',
attrName: 'rate',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
]
}
},
mounted() {},
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'loss',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(2) + '%' : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(2) + '%' : '- -'
})
})
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,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 售后车辆里程
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-07-11 11:00:49
-->
<template>
<div>
<div class="title">售后车辆里程</div>
<template v-if="mileageData.length > 0">
<div class="flex container">
<pie-chart :id="chart.id" :list="mileageData" :height="height - 5 + 'vh'" :radius="chart.radius" @pieAction="pieAction" :size="chart.size"></pie-chart>
<div class="ranking-container">
<div class="ranking-title">
<div class="ranking-title-brand">{{ this.$store.state.app.reportParams.brand ? '门店' : '品牌' }}</div>
<div>客户数</div>
</div>
<div class="ranking">
<div class="brand flex" v-for="(item, index) in rankingData.slice(0, 5)" :key="index">
<span class="brand-num">{{ index + 1 }}</span>
<marquee class="marquee" :direction="directionTimer" :delay="delayTimer" :text="item.brand" />
<span>{{ item.value }}</span>
</div>
</div>
</div>
</div>
</template>
<div class="empty" :style="{ height: height - 4.9 + 'vh' }" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</template>
<script>
import { changeMixin } from '../../mixins/index'
export default {
name: 'Mileage',
props: ['height'],
mixins: [changeMixin],
data() {
return {
mileageData: [],
distributionRank: '',
rankingData: [],
chart: {
id: 'mileagePie',
radius: ['60%', '78%'],
size: '0.8vw'
},
delayTimer: 3000,
directionTimer: 3000,
brandList: this.list,
isBrand: false,
brandName: ''
}
},
mounted() {
this.getValueType()
},
methods: {
getValueType() {
let mileageApi = !this.isBrand ? 'aftersaleother' : 'afterMerchantSaleother'
const params = {
req: {
queryItem: 'mileage',
queryTime: this.getCurrentDate(),
queryType: this.watchReportParams.reportType
}
}
if (this.isBrand) params.req.brandName = this.brandName
this.api.afterSales[mileageApi](params).then(res => {
this.mileageData = []
this.rankingData = []
if (res.data.dataList.length > 0) {
let distribution = JSON.parse(res.data.dataList[0].distribution)
// console.log()
const keys = Object.keys(distribution)
keys.forEach((item, index) => {
this.mileageData.push({
name: item,
value: distribution[item]
})
})
this.distributionRank = JSON.parse(res.data.dataList[0].distributionRank)
}
})
},
pieAction(data) {
let distributionRank = this.distributionRank[data.name]
this.rankingData = []
for (const key in distributionRank) {
this.rankingData.push({
brand: key,
value: distributionRank[key]
})
}
this.rankingData.sort(function (a, b) {
return b.value - a.value //倒序
})
},
init(newVal) {
this.isBrand = false
if (newVal && newVal.brand) {
this.isBrand = true
this.brandName = newVal.brand.name
}
this.getValueType()
}
}
}
</script>
<style lang="scss" scoped>
.title {
padding: 1vh 8px;
height: 4vh;
}
.ranking-container {
flex: 1;
margin-left: 0.6vw;
box-sizing: border-box;
height: 21.5vh;
width: 10.8vw;
background: #262525;
.ranking-title {
padding: 0.5vh 1.5vw 0.4vh 1.5vw;
font-size: 0.833vw;
color: #eb6001;
letter-spacing: 0;
font-weight: 400;
background: rgba(53, 53, 53, 0.6);
display: flex;
align-items: center;
div {
white-space: nowrap;
}
.ranking-title-brand {
width: 4.9vw;
margin-right: 0.6vw;
}
}
.ranking {
font-size: 0.694vw;
color: #ffffff;
letter-spacing: 0;
font-weight: 400;
padding: 0.1vh 0 0.4vh 8px;
height: 18.5vh;
box-sizing: border-box;
.brand {
line-height: 3.6vh;
.brand-num {
color: #606266;
margin-right: 8px;
display: inline-block;
width: 0.3vw;
text-align: center;
}
.marquee {
width: 4.9vw;
height: 3.6vh;
margin-right: 0.6vw;
}
}
}
}
</style>
<!--
* @Description: 定保回店
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:23:11
-->
<template>
<div>
<div class="title">定保回店</div>
<div v-if="!dataList.length" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<div v-else>
<div v-if="isEmpty" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
<LineChart
v-else
ref="lineChartRef"
domId="sadayasuChart"
:dataList.sync="dataList"
:storeOrBrandTxt="storeOrBrandTxt"
:tooltipFormatterObj="tooltipFormatterObj"
:queryType="queryType"
></LineChart>
</div>
</div>
</template>
<script>
import { changeMixin } from '@/mixins'
export default {
name: 'Sadayasu',
mixins: [changeMixin],
props: {
height: {
type: String,
default: '19.8vh'
}
},
data() {
return {
isEmpty: true,
storeOrBrandTxt: '品牌',
queryType: 0,
tooltipFormatterObj: [
{
label: '回店数',
attrName: 'num'
},
{
label: '回店率',
attrName: 'rate',
addSymbol: '%'
},
{
label: '环比',
attrName: 'hrate',
addSymbol: '%'
},
{
label: '同比',
attrName: 'trate',
addSymbol: '%'
}
],
dataList: []
}
},
mounted() {},
methods: {
init(val) {
this.isEmpty = true
this.queryType = +this.watchReportParams.reportType
var params = {
req: {
queryItem: 'regular',
querystartTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: +this.watchReportParams.reportType === 1 ? this.getNDate(-1) : this.getNMonth(-1),
queryType: this.watchReportParams.reportType || 0
}
}
var brandName = val.brand ? val.brand.name : ''
this.storeOrBrandTxt = brandName ? '门店' : '品牌'
if (brandName) {
params.req.brandName = brandName
}
this.api.afterSales[brandName ? 'getMerchantAfterSale' : 'getAfterSale'](params).then(res => {
var { code, data } = res
switch (+code) {
case 0:
this.dataList = []
if (!data.dataList.map(item => item.num).every(item => item === 0)) {
this.isEmpty = false
this.dealList(data.dataList)
this.$nextTick(() => {
this.$refs.lineChartRef.drawLine()
})
}
break
}
})
},
dealList(list) {
var topList = []
var lastList = []
list.forEach(item => {
const topTempList = item.topList === 'null' ? [] : JSON.parse(item.topList)
const lastTempList = item.lastList === 'null' ? [] : JSON.parse(item.lastList)
topList = []
lastList = []
Object.keys(topTempList).forEach(item => {
topList.push({
label: item,
value: topTempList[item].rate ? topTempList[item].rate.toFixed(2) + '%' : '- -'
})
})
Object.keys(lastTempList).forEach(item => {
lastList.push({
label: item,
value: lastTempList[item].rate ? lastTempList[item].rate.toFixed(2) + '%' : '- -'
})
})
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,
statDate: item.statDate,
topList: topList,
lastList: lastList
})
})
}
}
}
</script>
<!--
* @Description: 客户年龄分布
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 16:45:11
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>客户年龄分布</span>
</div>
<div class="container flex">
<template v-if="clientData.length > 0">
<pie-chart :id="chart.id" :list="clientData" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height:12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { clientMixin } from '../../mixins/index'
export default {
name: 'Age',
mixins: [clientMixin],
data() {
return {
type: 'age',
chart: {
id: 'age-pie'
}
}
}
}
</script>
<!--
* @Description: 客户购车年限
* @Author: huyue
* @Date: 2022-06-23 15:06:32
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:03:19
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>客户购车年限</span>
</div>
<div class="container flex">
<template v-if="clientData.length > 0">
<pie-chart :id="chart.id" :list="clientData" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height:12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { clientMixin } from '../../mixins/index'
export default {
name: 'BuyCar',
mixins: [clientMixin],
data() {
return {
type: 'buycarRange',
chart: {
id: 'car-pie'
}
}
}
}
</script>
<!--
* @Description: 客户性别
* @Author: huyue
* @Date: 2022-06-23 15:05:57
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:02:58
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>客户性别</span>
</div>
<div class="container flex">
<template v-if="clientData.length > 0">
<pie-chart :id="chart.id" :list="clientData" :colors="chart.colors" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height: 12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { clientMixin } from '../../mixins/index'
export default {
name: 'Sex',
mixins: [clientMixin],
data() {
return {
type: 'gender',
chart: {
id: 'sex-pie',
colors: ['#EB6001', '#BF98FF', '#FF6E76']
}
}
}
}
</script>
<!-- home -->
<template>
<div class="container">
<div class="data-view-container">
<transition name="fade">
<keep-alive v-if="$route.meta.keepAlive">
<router-view></router-view>
......
<!--
* @Description: 客户级别
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:13:49
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>客户级别</span>
</div>
<div class="flex container">
<template v-if="salesData.length > 0">
<pie-chart :id="chart.id" :list="salesData" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height:12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { salesMixin } from '../../mixins/index'
export default {
name: 'CustomerCategory',
mixins: [salesMixin],
data() {
return {
type: 'customerlevel',
chart: {
id: 'customerCategory-pie'
}
}
},
methods: {
// pieAction(data) {
// console.log(data,'客户级别')
// console.log(this.typeRanking)
// this.brandList = this.typeRanking&&this.typeRanking[data.name]&&Object.keys(this.typeRanking[data.name])
// }
}
}
</script>
<!--
* @Description: 进店类型
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:13:03
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>进店类型</span>
</div>
<div class="flex container">
<template v-if="salesData.length > 0">
<pie-chart :id="chart.id" :list="salesData" :colors="chart.colors" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height: 12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { salesMixin } from '../../mixins/index'
export default {
name: 'EnterCategory',
mixins: [salesMixin],
data() {
return {
type: 'entertype',
chart: {
id: 'enterCategory-pie',
colors: ['#F5AA01', '#FF6E76', '#4FA0FF']
}
}
},
}
</script>
<!--
* @Description: 客流转化
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-07-07 17:27:53
-->
<template>
<div>
<div v-show="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="flow-right">
<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>
<div class="ranking-content">
<div class="ranking-item" v-for="(item, index) in flowData" :key="index">
<span class="ranking-sort">{{ index + 1 }}</span>
<span class="ranking-name">
<marquee :direction="directionTimer" :delay="delayTimer" :text="item.brand" />
</span>
<span class="ranking-text">{{ item.value }}</span>
</div>
</div>
</div>
</div>
<div v-show="!hasData">
<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 utils from '../../utils/util'
import * as echarts from 'echarts'
export default {
name: 'Flow',
mixins: [changeMixin],
props: ['height'],
data() {
return {
directionTimer: datas.DefaultData.directionTimer,
delayTimer: datas.DefaultData.delayTimer,
flowData: [],
isActive: 1,
funnelData: [
{
name: '客流',
type: 'enter',
value: 100
},
{
name: '留档',
type: 'stayfile',
value: 80
},
{
name: '试驾',
type: 'test',
value: 60
},
{
name: '订单',
type: 'placeorder',
value: 40
},
{
name: '成交',
type: 'success',
value: 20
}
],
option: {},
echartsFunnel: '',
hasData: true,
paramsData: {},
topList: [],
lastList: [],
isBrand: false
}
},
mounted() {
this.echartsFunnel = echarts.init(document.getElementById('flow'))
// resize
window.addEventListener('resize', () => {
this.echartsFunnel.resize()
})
},
methods: {
init(val) {
this.paramsData = this.$store.state.app.reportParams
this.isBrand = this.paramsData.brand && this.paramsData.brand.name
this.getSaletTotal(this.paramsData)
this.getSaleTrans(this.paramsData)
},
getSaletTotal(val) {
const params = {
req: {
queryTime: this.getCurrentDate(),
queryType: val.reportType
}
}
var brandName = val.brand ? val.brand.name : ''
this.api.sales[brandName ? 'storeTotal' : 'saleTotal'](params)
.then(res => {
if (res.code === '0') {
if (res.data.dataList.length) {
res.data.dataList[0].num.forEach((item, index) => {
this.funnelData[index].num = item
})
this.hasData = !res.data.dataList[0].num.every(i => i == 0)
if (this.hasData) this.draw()
} else {
this.hasData = false
}
}
})
.catch(() => {
this.hasData = false
})
},
draw() {
this.option = {
tooltip: {
trigger: 'item',
backgroundColor: 'rgba(68,68,68,0.8)',
formatter: e => {
return `${e.data.name}: ${e.data.num}`
},
textStyle: {
color: '#fff',
fontSize: 8
},
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)'],
series: [
{
name: '漏斗图',
type: 'funnel',
left: 0,
top: 8,
bottom: 8,
width: '100%',
minSize: '30%',
maxSize: '100%',
sort: 'descending',
gap: 2,
label: {
show: true,
position: 'inside',
color: '#fff'
},
labelLine: {
length: 10,
lineStyle: {
width: 1,
type: 'solid'
}
},
itemStyle: {
borderColor: '#fff',
borderWidth: 0
},
emphasis: {
label: {
fontSize: 20
}
},
data: this.funnelData
// ]
}
]
}
this.echartsFunnel.setOption(this.option)
this.echartsFunnel.on(
'mouseover',
utils.debounce(data => {
this.getSaleTrans(this.paramsData, data.data.type)
}),
1000 / 60
)
},
getSaleTrans(val, queryItem = 'enter') {
const params = {
req: {
queryItem: queryItem,
queryTime: this.getCurrentDate(),
queryType: val.reportType
}
}
let api = 'saleTrans'
if (val.brand && val.brand.name) {
params.req.brandName = '品牌1'
api = 'storeSaleTrans'
}
this.api.sales[api](params).then(res => {
this.topList = []
this.lastList = []
if (res.data.dataList.length) {
let { topList, lastList } = res.data.dataList[0]
topList = topList ? JSON.parse(topList) : []
lastList = lastList ? JSON.parse(lastList) : []
for (const key in topList) {
this.topList.push({
brand: key,
value: topList[key]
})
}
for (const key in lastList) {
this.lastList.push({
brand: key,
value: lastList[key]
})
}
}
this.flowData = this.isActive == 1 ? this.topList : this.lastList
})
},
// 切换品牌排序
changeRank(val) {
this.isActive = val
this.flowData = val == 1 ? this.topList : this.lastList
}
}
}
</script>
<style lang="scss" scoped>
.flow-box {
display: flex;
padding: 0 8px 1vh;
box-sizing: border-box;
.flow-left {
padding-bottom: 0.9vh;
width: 50%;
}
.flow-right {
flex: 1;
color: #fff;
font-size: 10px;
padding: 1vh 0 0.9vh 20px;
.ranking-title {
display: flex;
width: 100%;
margin-right: 20px;
cursor: default;
.active {
background-color: #eb6001;
color: #fff;
}
div {
width: 50%;
text-align: center;
background-color: #353535;
line-height: 2.4vh;
}
}
.ranking-content {
background-color: #262525;
}
.ranking-item {
display: flex;
width: 100%;
align-items: center;
line-height: 2.1vh;
height: 2.1vh;
.ranking-sort {
display: inline-block;
width: 0.3vw;
text-align: center;
}
.ranking-name {
width: calc(100% - 33% - 28px);
}
.ranking-text {
width: 33%;
padding-left: 4px;
// width: calc(100% - 50px);
}
span {
display: inline-block;
&:first-child {
padding: 0 8px;
}
}
}
}
}
.chart-box {
width: 100%;
box-sizing: border-box;
// height: 11.7vh;
padding: 0 25px;
}
</style>
<!--
* @Description: 信息来源
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-06-23 17:13:23
-->
<template>
<div>
<div class="title title-icon">
<span class="icon"></span>
<span>信息来源</span>
</div>
<div class="flex container">
<template v-if="salesData.length > 0">
<pie-chart :id="chart.id" :list="salesData" @pieAction="pieAction"></pie-chart>
<ran-king :list="brandList"></ran-king>
</template>
<div class="empty" style="height: 12.7vh" v-else>
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</div>
</template>
<script>
import { salesMixin } from '../../mixins/index'
export default {
name: 'InfoFrom',
mixins: [salesMixin],
data() {
return {
type: 'infosource',
chart: {
id: 'infoFrom-pie',
}
}
},
}
</script>
/*
* @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
<!--
* @Description: 转化趋势
* @Author: huyue
* @Date: 2022-06-23 15:05:21
* @LastEditors: huyue
* @LastEditTime: 2022-07-06 15:07:56
-->
<template>
<div>
<div class="title">转化趋势</div>
<div v-show="hasData" class="linetrend-box">
<div id="lineTrend" :style="{ height: height - 4.1 + 'vh' }"></div>
</div>
<div v-show="!hasData" class="empty">
<img src="../../assets/images/empty.png" alt="" />
</div>
</div>
</template>
<script>
import * as echarts from 'echarts'
import { changeMixin } from '@/mixins'
export default {
name: 'Trend',
props: ['height'],
mixins: [changeMixin],
data() {
return {
echartsTrend: {},
option: {},
dataList: [],
paramsData: [],
list: ['enter', 'stayfile', 'test', 'placeorder', 'success'],
hasData: true
}
},
mounted() {
this.echartsTrend = echarts.init(document.getElementById('lineTrend'))
window.addEventListener('resize', () => {
this.echartsTrend.resize()
})
},
methods: {
init(val) {
this.getChartData(val)
},
getChartData(val) {
var params = {
req: {
// 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 ? '门店' : '品牌'
const api = brandName ? 'storeTransTrend' : 'saleTransTrend'
const p = []
this.list.forEach((i, idx) => {
p[idx] = new Promise((resolve, reject) => {
params.req.queryItem = i
this.api.sales[api](params)
.then(res => {
resolve(res.data.dataList)
})
.catch(err => {
reject(err)
})
})
})
Promise.all([p[0], p[1], p[2], p[3], p[4]])
.then(results => {
this.dataList = results
const flag = results.map(item => {
if (item.length) {
return item.map(i => i.num).some(j => j != 0)
} else {
return false
}
})
this.$set(this, 'hasData', !flag.every(i => !i))
this.draw(val.reportType)
})
.catch(() => {
this.hasData = false
})
},
draw(reportType) {
this.option = {
tooltip: {
trigger: 'axis',
show: true,
borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)',
confine: true,
textStyle: {
color: '#FFFFFF',
fontSize: 8
},
extraCssText: 'width: 80px;',
formatter: e => {
const index = e[0].dataIndex
const date = this.dataList[0][index].statDate
var txt = date + '<br />'
e.forEach(item => {
txt = txt + item.seriesName + ':' + item.value + '<br />'
})
return txt
}
},
color: ['#4FA0FF', '#FF6E76', '#7CFFB2', '#FDF006', '#EB6001'],
grid: {
left: '3%',
right: '4%',
top: '10%',
bottom: '10%',
containLabel: true
},
xAxis: {
type: 'category',
axisLabel: {
color: '#606266',
fontSize: 10
},
data: []
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: '#606266'
}
},
splitNumber: 4
},
series: [
{
name: '客流',
type: 'line',
symbol: 'circle',
smooth: true,
showSymbol: false,
data: []
},
{
name: '留档',
type: 'line',
symbol: 'circle',
smooth: true,
showSymbol: false,
data: []
},
{
name: '试驾',
type: 'line',
symbol: 'circle',
smooth: true,
showSymbol: false,
data: []
},
{
name: '订单',
type: 'line',
symbol: 'circle',
showSymbol: false,
smooth: true,
data: []
},
{
name: '成交',
type: 'line',
symbol: 'circle',
showSymbol: false,
smooth: true,
data: []
}
]
}
const xData = []
this.option.xAxis.data = xData
this.dataList[0].map(e => {
const month = new Date(e.statDate).getMonth()
xData.push(reportType == 0 ? `${month == 0 ? '1月' : `${Number(month) + 1}月`}` : e.statDate)
})
this.list.forEach((i, index) => {
this.option.series[index].data = this.dataList[index].map(item => item.num)
})
this.echartsTrend.setOption(this.option)
}
}
}
</script>
<style lang="scss" scoped>
.linetrend-box {
width: 100%;
overflow: hidden;
}
</style>
......@@ -4,9 +4,9 @@ const defaultSettings = require('./src/config/conf.js')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const resolve = dir => path.join(__dirname, dir)
// page title
// page title
const name = defaultSettings.title || 'vue mobile template'
// 生产环境,测试和正式
// 生产环境,测试和正式
const IS_PROD = ['production', 'prod'].includes(process.env.NODE_ENV)
module.exports = {
......@@ -18,25 +18,37 @@ module.exports = {
productionSourceMap: false, // 如果不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: {
disableHostCheck: true,
host: '0.0.0.0',
port: 9527, // 端口
open: false, // 启动后打开浏览器.
public:'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-lwk/#/',
// public: 'http://scrm.dev.glsx.com.cn/dj-scrm-wx-work-lwk/#/',
overlay: {
// 当出现编译器错误或警告时,在浏览器中显示全屏覆盖层
warnings: false,
errors: true
},
proxy: {
'/dev': {
target: 'http://192.168.1.152:8081',
changeOrigin: true,
ws: true,
pathRewrite: {
'^/dev': ''
},
onProxyReq: (proxyReq, req, res) => {
}
},
'/test': {
target: 'http://192.168.3.126:8081',
changeOrigin: true,
ws: true,
pathRewrite: {
'^/test': ''
},
onProxyReq: (proxyReq, req, res) => {
}
}
}
// proxy: {
// //配置跨域
// '/api': {
// target: "https://test.xxx.com",
// // ws:true,
// changOrigin:true,
// pathRewrite:{
// '^/api':'/'
// }
// }
// }
},
css: {
extract: IS_PROD, // 是否将组件中的 CSS 提取至一个独立的 CSS 文件中 (而不是动态注入到 JavaScript 中的 inline 代码)。
......@@ -54,14 +66,13 @@ module.exports = {
configureWebpack: config => {
config.name = name
config.resolve.modules = ['node_modules', './src/assets/spritesmith']
const Plugins = [
]
const Plugins = []
config.plugins = [...config.plugins, ...Plugins]
// 为生产环境修改配置...
// if (IS_PROD) {
// // externals
// config.externals = externals
// }
// 为生产环境修改配置...
// if (IS_PROD) {
// // externals
// config.externals = externals
// }
},
chainWebpack: config => {
......@@ -102,26 +113,30 @@ module.exports = {
return options
})
.end()
/**
* 打包分析
*/
/**
* 打包分析
*/
if (IS_PROD) {
config.plugin('webpack-report').use(BundleAnalyzerPlugin, [{
analyzerMode: 'static'
}])
config.plugin('webpack-report').use(BundleAnalyzerPlugin, [
{
analyzerMode: 'static'
}
])
}
config
// https://webpack.js.org/configuration/devtool/#development
// https://webpack.js.org/configuration/devtool/#development
.when(!IS_PROD, config => config.devtool('cheap-source-map'))
config.when(IS_PROD, config => {
config
.plugin('ScriptExtHtmlWebpackPlugin')
.after('html')
.use('script-ext-html-webpack-plugin', [{
// 将 runtime 作为内联引入不单独存在
inline: /runtime\..*\.js$/
}])
.use('script-ext-html-webpack-plugin', [
{
// 将 runtime 作为内联引入不单独存在
inline: /runtime\..*\.js$/
}
])
.end()
config.optimization.splitChunks({
chunks: 'all',
......@@ -150,4 +165,4 @@ module.exports = {
config.optimization.runtimeChunk('single')
})
}
}
\ No newline at end of file
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!