Commit a026bfca by 前端

Merge branch 'dev_v1.0.0' into 'develop'

Dev v1.0.0

See merge request !1
2 parents 207a581a 956df331
Showing 78 changed files with 4907 additions and 1146 deletions
......@@ -16,17 +16,14 @@
"core-js": "^3.6.4",
"dayjs": "^1.10.5",
"echarts": "^5.3.3",
"glsx-common": "^1.4.9",
"lib-flexible": "^0.3.2",
"postcss-loader": "^6.2.0",
"sha1": "^1.1.1",
"storejs": "^1.1.0",
"vant": "^2.12.21",
"vconsole": "^3.7.0",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0",
"webpack-spritesmith": "^1.1.0"
"vuex": "^3.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
......
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,12 +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'
import wxConfig from './wxConfig'
export {
wwbenchApi,
wxConfig,
}
\ 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 util from '@/utils/util'
import { Notify } from 'vant'
const url = '/rop-scrm-wechat/router'
const WxConfig = {
init (jsApiList) {
return new Promise((resolve, reject) => {
jsApiList.map(e => {
if (e == 'chooseImage') jsApiList.push('getLocalImgData')
})
let [redirectUrl] = window.location.href.split('#')
let { corpId } = util.getQuery()
if (!corpId) corpId = util.getLocalStorage('dj_scrm_corpId').corpId
/** 获取企微应用AgentConfig */
let data = {
corpId,
method: 'scrm.api.work.wechat.get.agent.config',
url: redirectUrl,
appCode: 'DJQWGJ'
}
window
.$HTTP({
url,
data
})
.then(obj => {
if (obj) {
setTimeout(() => {
console.log('wx.agentConfig:', wx.agentConfig)
wx.agentConfig({
corpid: obj.corpId, // 必填,企业微信的corpid,必须与当前登录的企业一致
agentid: obj.agentId, // 必填,企业微信的应用id (e.g. 1000247)
timestamp: obj.timestamp, // 必填,生成签名的时间戳
nonceStr: obj.nonceStr, // 必填,生成签名的随机串
signature: obj.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法,
jsApiList,
success (res) {
console.log(res, 'wx_config')
resolve()
},
fail (err) {
console.log(err, 'wx_config')
reject(err)
}
})
}, 500)
} else {
Notify('网络异常')
}
})
})
},
/**生成小程序短链 */
createMiniprogramUrlLink (data = {}) {
const { envVersion } = window.$fetchConfig
data.method = 'scrm.api.wechat.miniprogram.geturllink'
if (!data.envVersion) data.envVersion = envVersion
/**path 页面路径
* query 页面参数
* isExpire 过期类型 到期失效:true,永久有效:false
* expireType 失效类型 失效时间:0,失效间隔天数:1
* expireTime 失效时间
* expireInterval 失效间隔
* appId 微信应用ID
* envVersion 要打开的小程序版本。正式版为:release 体验版为:trial 开发版为:develop,仅在微信外打开时生效
*/
console.log('请求', data)
return window.$HTTP({
url,
data
})
},
getContext () {
/**
* entry String 场景值
* shareTicket String 仅当转发时设置了withShareTicket转发到会话的消息进入才返回该字段,详见私密消息
**/
return new Promise((resolve, reject) => {
wx.invoke('getContext', {}, res => {
console.log(res)
let { err_msg, entry, shareTicket } = res
/** entry 说明
*contact_profile 从联系人详情进入 3.0.24
*single_chat_tools 从单聊会话的工具栏进入 3.0.24
*group_chat_tools 从群聊会话的工具栏进入 3.0.24
*chat_attachment 从会话的聊天附件栏进入 3.1.6
*normal 除以上场景之外进入,例如工作台,聊天会话等 3.0.24
**/
if (err_msg == 'getContext:ok') {
//entry 返回进入H5页面的入口类型,目前有normal、contact_profile、single_chat_tools、group_chat_tools、chat_attachment
//shareTicket可用于调用getShareInfo接口
resolve({
entry,
shareTicket
})
} else {
reject()
}
})
})
},
/**获取当前外部联系人userid */
getCurExternalContact () {
return new Promise((resolve, reject) => {
wx.invoke('getCurExternalContact', {}, res => {
if (res.err_msg == 'getCurExternalContact:ok') {
resolve(res.userId)
} else {
reject(res)
}
})
})
},
/** 外部联系人选人接口 */
selectExternalContact (params = {
/**0表示展示全部外部联系人列表,
* 1表示仅展示未曾选择过的外部联系人。
* 默认值为0;除了0与1,
* 其他值非法。
* 在企业微信2.4.22及以后版本支持该参数
* */
filterType: 0
}) {
return new Promise(resolve => {
wx.invoke(
'selectExternalContact', params, res => {
if (res.err_msg == 'selectExternalContact:ok') {
resolve(res)
}
}
)
})
},
/**分享消息到当前会话 */
sendChatMessage (params) {
console.log(params)
return new Promise((resolve, reject) => {
wx.invoke('sendChatMessage', params, res => {
util.hideLoading()
if (res.err_msg == 'sendChatMessage:ok') {
resolve()
} else {
reject(res)
}
})
})
},
/**群发消息给客户 */
shareToExternalContact (params) {
console.log(params)
return new Promise(resolve => {
wx.invoke('shareToExternalContact', params, res => {
if (res.err_msg == 'shareToExternalContact:ok') {
resolve()
}
})
})
},
/**群发消息到客户群 */
shareToExternalChat (params) {
return new Promise(resolve => {
wx.invoke('shareToExternalChat', params, res => {
if (res.err_msg == 'shareToExternalChat:ok') {
resolve()
}
})
})
},
/**进入添加客户界面 */
navigateToAddCustomer () {
wx.invoke('navigateToAddCustomer')
},
/**发表内容到客户朋友圈 */
shareToExternalMoments (params) {
return new Promise((resolve, reject) => {
wx.invoke('shareToExternalMoments', params, res => {
if (res.err_msg == 'shareToExternalMoments:ok') {
resolve()
} else {
reject(res)
}
})
})
},
/**打开会话 */
openEnterpriseChat ({ externalUserIds = [], groupName = '', userIds = [], chatId = '' }) {
return new Promise((resolve, reject) => {
userIds = userIds.join(';')
externalUserIds = externalUserIds.join(';')
wx.openEnterpriseChat({
// 注意:userIds和externalUserIds至少选填一个。内部群最多2000人;外部群最多500人;如果有微信联系人,最多40人
userIds, //参与会话的企业成员列表,格式为userid1;userid2;...,用分号隔开。
externalUserIds, // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
groupName, // 会话名称。单聊时该参数传入空字符串""即可。
chatId, // 若要打开已有会话,需指定此参数。如果是新建会话,chatId必须为空串
success (res) {
resolve(res)
},
fail (res) {
if (res.errMsg.indexOf('function not exist') > -1) {
Notify('版本过低请升级')
}
reject()
}
})
})
},
/**企业微信扫一扫 */
scanQRCode (needResult) {
return new Promise(resolve => {
wx.scanQRCode({
desc: 'scanQRCode desc',
needResult, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果,
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是条形码(一维码),默认二者都有
success (res) {
resolve(res)
},
error: function (res) {
if (res.errMsg.indexOf('function_not_exist') > 0) {
alert('版本过低请升级')
}
}
})
})
},
/**获取本地图片接口 */
getLocalImgData (localId) {
return new Promise((resolve, reject) => {
wx.getLocalImgData({
localId, // 图片的
success (res) {
resolve(res) //localData是图片的base64数据,可以用img标签显示
},
fail (err) {
reject(err)
}
})
})
},
/**拍照或从手机相册中选图接口 */
chooseImage (count = 1) {
return new Promise(resolve => {
wx.chooseImage({
count, // 默认1
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success (res) {
let { localIds } = res
let imgs = []
localIds.map((e, index) => {
wx.getLocalImgData({
localId: e,
success (img) {
imgs.push(img)
if (index == localIds.length - 1) resolve(imgs)
}
})
})
}
})
})
},
/**预览图片接口 */
previewImage (obj) {
/**current 当前显示图片的http链接
* urls 需要预览的图片http链接列表
*/
wx.previewImage(obj)
},
/**上传图片接口 */
uploadImage (localId) {
return new Promise(resolve => {
wx.uploadImage({
localId, // 需要上传的图片的本地ID,由chooseImage接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示
success (res) {
resolve(res) // 返回图片的服务器端ID
/**备注:上传图片有效期3天,可用素材管理接口下载图片到自己的服务器,此处获得的 serverId 即 media_id。 */
}
})
})
},
/**下载图片接口 */
downloadImage (serverId) {
return new Promise(resolve => {
wx.downloadImage({
serverId, // 需要下载的图片的服务器端ID,由uploadImage接口获得
isShowProgressTips: 1, // 默认为1,显示进度提示
success (res) {
resolve(res) // 返回图片下载后的本地ID
}
})
})
},
/**使用企业微信内置地图查看位置接口 */
openLocation (obj) {
/**
latitude: 0, // 纬度,浮点数,范围为90 ~ -90
longitude: 0, // 经度,浮点数,范围为180 ~ -180。
name: '', // 位置名
address: '', // 地址详情说明
scale, // 地图缩放级别,整形值,范围从1~28。默认为16
*/
wx.openLocation(obj)
},
/**获取地理位置接口 */
getLocation (type = 'wgs84') {
return new Promise(resolve => {
wx.getLocation({
type, // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success (res) {
resolve(res)
}
})
})
},
/**自定义转发到会话 */
shareAppMessage (obj) {
// title: '', // 分享标题
// desc: '', // 分享描述
// link: '', // 分享链接
// imgUrl: '' // 分享封面
return new Promise((resolve, reject) => {
wx.invoke('shareAppMessage', obj, function (res) {
util.hideLoading()
if (res.err_msg == 'shareAppMessage:ok') {
resolve(res)
} else {
reject(res)
}
})
})
},
/**自定义转发到微信 */
shareWechatMessage (obj) {
// title: '', // 分享标题
// desc: '', // 分享描述
// link: '', // 分享链接
// imgUrl: '' // 分享封面
return new Promise(resolve => {
wx.invoke('shareWechatMessage', obj, function (res) {
if (res.err_msg == 'shareWechatMessage:ok') {
resolve(res)
} else {
reject(res)
}
})
})
}
}
export default WxConfig
@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-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>
<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 {
background: #fff;
}
</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' }]">
<slot :name="i"></slot>
</div>
</template>
</div>
</template>
<script type="text/ecmascript-6">
import datas from '../utils/data'
export default {
name: 'ViewLineGroup',
props: {
height: {
type: String,
default: datas.DefaultData.defaultLineHeight + 'vh'
},
hideMargin: Boolean
},
data() {
return {
items: [1, 2]
}
},
mounted() {
},
methods: {
}
}
</script>
<style scoped lang="scss">
.line-group {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 0 8px;
}
</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="tabs">
<div class="tab">
<div class="tab-left box"></div>
<div class="tab-right box"></div>
<div class="tab pointer">
<div
class="tab-left box"
@click="changeType('total')"
>
<div class="tab-total-box">
<div class="total-title-box flex">
<div class="title inline total">客户总数</div>
<div class="title inline"> {{req.queryType == 0 ?'上月':'昨日'}}新增</div>
<div class="title inline"> {{req.queryType == 0 ?'上月':'昨日'}}到店</div>
</div>
<div class="total-number-box flex">
<transition-number
:num="pageData.total.totalNum"
idKey="number-total"
class="number-total"
/>
<transition-number
:num="pageData.total.incrNum"
idKey="number-incr"
/>
<transition-number
:num="pageData.total.returnNum"
idKey="number-return"
/>
</div>
</div>
</div>
<div class="tab-right box">
<template v-for="(i,index) in tabs">
<div
:key="index"
class="item flex"
@click="changeType(i.key)"
>
<div class="item-title">{{i.title}}</div>
<transition-number
:num="pageData[i.key].totalNum"
:idKey="`number-${i.key}`"
class="item-total"
/>
<div :class="['item-incr flex',{'up':pageData[i.key].up},{'down':pageData[i.key].down}]">
{{req.queryType == 0 ?'上月':'昨日'}}
<template v-if="pageData[i.key].up || pageData[i.key].down">
<div class="arrow"></div>
</template>
<transition-number
:num="pageData[i.key].incrNum"
:idKey="`number-incr-${i.key}`"
class="item-incr-numer"
/>
</div>
</div>
</template>
</div>
</div>
<div class="tabs-content box">
<div class="tabs-title">客户增长趋势</div>
<div class="tabs-content-chart flex">
<div class="line flex">
<template v-if="flag">
<template v-if="isEmpty">
<div class="empty-img">
<img src="@/assets/images/empty.png" />
</div>
</template>
<template v-else>
<div
ref="canvas"
class="canvas"
></div>
</template>
</template>
</div>
<div class="table user-select pointer">
<div class="table-head">
<template v-for="(i,index) in tabHead">
<div
:class="['table-head-item flex',{'active':index == tabIndex}]"
:key="index"
@click="tabIndex = index"
>
{{i}}
</div>
</template>
</div>
<div class="table-body flex">
<template v-for="(i,index) in tabIndex == 0 ? pageData[tabType].top : pageData[tabType].last">
<div
class="table-body-item flex"
:key="index"
>
<div class="table-num flex">{{index + 1}}</div>
<div class="table-key">
<marquee
:direction="directionTimer"
:delay="delayTimer"
:text="i.name"
/>
</div>
<div class="table-value">{{i.num}}</div>
</div>
</template>
</div>
</div>
</div>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
const tabs = [
{
title: '企微客户',
key: 'wechat'
},
{
title: '企微群数',
key: 'wechatGroup'
},
{
title: '小程序客户数',
key: 'applet'
},
{
title: '公众号客户数',
key: 'publiccus'
}
]
import { changeMixin } from '@/mixins'
import * as echarts from 'echarts'
export default {
name: 'ViewTabs',
mixins: [changeMixin],
data () {
return {
tabs,
tabHead: [],
tabType: 'total',
tabIndex: 0,
delayTimer: 3000,
directionTimer: 3000,
pageData: {
total: {},
wechat: {},
wechatGroup: {},
applet: {},
publiccus: {}
},
canvas: null,
req: {},
isGroup: true,
isEmpty: true,
flag: false,
updata: Date.now()
}
},
mounted () {
},
methods: {
init (params) {
this.isGroup = true
let req = {
queryType: params.reportType || 0
}
if (params.brand) this.isGroup = false
this.req = req
this.isEmpty = true
this.getOverallbase('total')
this.getOverallbase('wechat')
this.getOverallbase('wechatGroup')
this.getOverallbase('applet')
this.getOverallbase('publiccus')
this.getOveralltrend('total')
},
changeType (type) {
this.tabType = type
this.getOveralltrend(type)
},
getOverallbase (queryItem) {
let { req: { queryType } } = this
const params = {
queryItem,
queryType,
queryTime: this.getNDate(-1)
}
this.tabHead = this.isGroup ? ['前5品牌', '后5品牌'] : ['前5门店', '后5门店']
this.api.overview[this.isGroup ? 'getBrandOverallbase' : 'getMerchantOverallbase'](params).then(({ code, data }) => {
this.pageData[queryItem] = {
top: [],
last: [],
incrNum: 0,
returnNum: 0,
totalNum: 0
}
if (code == 0) {
let [dataList] = data.dataList
if (dataList) {
if (dataList.incrNum > 0) dataList.up = true
if (dataList.incrNum < 0) {
dataList.down = true
dataList.incrNum = Math.abs(dataList.incrNum)
}
dataList.top = this.ObjectToArray(dataList.topList)
dataList.last = this.ObjectToArray(dataList.lastList)
} else {
dataList = {
top: [],
last: [],
incrNum: 0,
returnNum: 0,
totalNum: 0
}
}
this.pageData[queryItem] = dataList
}
})
},
ObjectToArray (obj) {
let arr = []
if (obj && obj !== 'null') {
obj = obj.replace('null', '"未知"')
let item = JSON.parse(obj)
if (Array.isArray(item)) item.map(e => {
Object.keys(e).map(name => arr.push({ name, num: e[name] }))
})
else Object.keys(item).map(name => arr.push({ name, num: item[name] }))
}
return arr
},
getOveralltrend (queryItem) {
let { req: { queryType } } = this
const params = {
queryItem,
queryType,
querystartTime: queryType == 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: queryType == 1 ? this.getNDate(-1) : this.getNMonth(-1),
}
this.api.overview[this.isGroup ? 'getBrandOveralltrend' : 'getMerchantOveralltrend'](params).then(({ data, code }) => {
this.flag = true
if (code == 0) {
if (!data.dataList.map(item => item.totalNum).every(item => item === 0)) {
this.isEmpty = false
this.$nextTick(() => {
this.canvas = echarts.init(this.$refs.canvas)
this.draw(data.dataList, queryType)
})
}
}
}).catch(() => {
this.flag = true
})
},
draw (lineData, queryType) {
let data = [],
xData = [],
title = {
'total': '客户总数',
'wechat': '企微客户数',
'wechatGroup': '企微群数',
'applet': '小程序客户数',
'publiccus': '公众号客户数'
},
{ tabType } = this
lineData.map(e => {
let month = new Date(e.statDate).getMonth()
xData.push(queryType == 0 ? `${month == 0 ? '1月' : `${Number(month) + 1}月`}` : new Date(e.statDate).format('MM-dd'))
data.push(e.totalNum)
})
let options = {
tooltip: {
trigger: 'axis',
borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)',
textStyle: {
color: '#FFFFFF',
fontSize: this.setChartFontSize(8)
},
show: true,
formatter: ([value]) => {
return `${value.name}<br/>${title[tabType]}:${value.data}`
}
},
xAxis: {
type: 'category',
axisLabel: {
show: true,
interval: queryType == 0 ? 0 : 6,
color: '#606266',
fontSize: this.setChartFontSize(10),
margin: 20,
showMaxLabel: true
},
data: xData,
axisTick: {
alignWithLabel: true
}
},
grid: {
left: '3%',
right: '4%',
top: '10%',
bottom: '1.2vh',
containLabel: true
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
color: '#606266'
}
},
axisLabel: {
fontSize: this.setChartFontSize(10)
},
splitNumber: 5
},
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
}
]
}
this.canvas.setOption(options)
window.addEventListener('resize', () => {
this.canvas.resize()
})
}
}
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.tabs {
margin-bottom: 0.5vh;
margin-bottom: 0.6vh;
.tab {
height: 7.8vh;
display: grid;
grid-template-columns: 41.5% 57.5%;
justify-content: space-between;
margin-bottom: 0.5vh;
overflow: hidden;
.tab-total-box {
height: 100%;
padding-left: 8px;
box-sizing: border-box;
.total-title-box {
.total {
width: 50%;
}
> div {
box-sizing: border-box;
width: 25%;
padding-left: 0;
}
}
.total-number-box {
.number-total {
font-size: 24px;
color: #eb6001;
font-weight: 700;
line-height: 3.7vh;
width: 50%;
}
> div {
width: 25%;
font-size: 14px;
color: #f5aa01;
}
}
}
&-right {
display: grid;
grid-template-columns: repeat(4, 25%);
height: 100%;
.item {
padding: 0 8px;
box-sizing: border-box;
flex-direction: column;
align-items: flex-start;
&-title {
font-size: 12px;
color: #e8e8e8;
padding-top: 0.5vh;
}
&-total {
font-size: 14px;
color: #eb6001;
font-weight: 700;
}
&-incr {
font-size: 12px;
color: #606266;
// padding-bottom: 0.5vh;
&-numer {
font-size: 10px;
color: #fff;
}
.arrow {
border-top: 2.5px solid transparent;
border-right: 2.5px solid transparent;
border-bottom: 2.5px solid transparent;
border-left: 2.5px solid transparent;
}
}
.up {
.arrow {
border-bottom-color: #e60115;
}
.item-incr-numer {
color: #e60115;
}
}
.down {
.arrow {
border-top-color: #00b900;
}
.item-incr-numer {
color: #00b900;
}
}
> div {
flex-shrink: 0;
}
}
}
}
&-content {
height: 24.4vh;
box-sizing: border-box;
padding: 1vh 8px;
display: flex;
flex-direction: column;
.tabs-title {
font-size: 12px;
color: #e8e8e8;
}
&-chart {
height: 20.2vh;
margin-top: auto;
justify-content: space-between;
gap: 0 8px;
.line {
flex: 7;
justify-content: center;
.canvas {
width: 100%;
height: 100%;
}
.empty-img {
max-width: 20vh;
height: 9.5vh;
}
}
.table {
flex: 3;
background: #262525;
&-head {
display: grid;
grid-template-columns: repeat(2, 50%);
height: 2.4vh;
&-item {
height: 100%;
font-size: 10px;
background: #353535;
color: rgba($color: #fff, $alpha: 0.7);
justify-content: center;
&:hover {
opacity: 0.9;
}
}
.active {
background: #eb6001;
color: #fff;
}
}
&-body {
height: calc(100% - 2.4vh);
flex-direction: column;
justify-content: space-between;
&-item {
line-height: 3.4vh;
width: 100%;
font-size: 10px;
color: #ffffff;
.table-num {
width: 22px;
justify-content: center;
color: #606266;
}
.table-key {
width: calc(100% - 96px);
}
.tab-value {
width: 52px;
margin-left: auto;
padding-right: 4px;
}
}
}
}
> div {
height: 100%;
}
}
}
}
</style>
\ No newline at end of file
</style>
<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,9 +20,6 @@ import { fetchConfig, cfg } from '@/config'
import '@/assets/css/index.scss'
import './utils/util'
import 'components'
import { components } from '@/plugins/vant'
components.forEach(component => Vue.use(component))
Vue.prototype.api = api
Vue.prototype.to = function (name, params) {
if (name === -1) {
router.go(-1)
......@@ -42,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()
})
}
}
}
/*
* @Descripttion:
* @version:
* @Author: limin
* @Date: 2021-06-07 14:12:32
* @LastEditors: limin
* @LastEditTime: 2021-06-23 11:44:59
*/
// 按需全局引入 vant组件
import {
Button,
List,
Cell,
Tabbar,
TabbarItem,
NavBar,
Lazyload,
Toast,
Search,
ActionSheet,
CellGroup,
Image as VanImage,
Tag,
Field,
Stepper,
Divider,
Step,
Steps,
NoticeBar,
RadioGroup,
Radio,
Uploader,
Tab,
Tabs,
DropdownMenu,
DropdownItem,
Grid,
GridItem,
Popup,
Calendar,
Cascader,
Checkbox,
CheckboxGroup,
Notify,
Icon,
Empty,
PullRefresh,
Picker,
Dialog
} from 'vant'
export const components = [
Button,
List,
Cell,
Tabbar,
TabbarItem,
NavBar,
Search,
ActionSheet,
CellGroup,
VanImage,
Tag,
Field,
Stepper,
Divider,
Step,
Steps,
NoticeBar,
RadioGroup,
Radio,
Uploader,
Tab,
Tabs,
DropdownMenu,
DropdownItem,
Grid,
GridItem,
Popup,
Calendar,
Cascader,
Checkbox,
CheckboxGroup,
Notify,
Icon,
Empty,
PullRefresh,
Picker,
Dialog
]
......@@ -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
})
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
'use strict';
var replace = String.prototype.replace;
var percentTwenties = /%20/g;
module.exports = {
'default': 'RFC3986',
formatters: {
RFC1738: function (value) {
return replace.call(value, percentTwenties, '+');
},
RFC3986: function (value) {
return value;
}
},
RFC1738: 'RFC1738',
RFC3986: 'RFC3986'
};
},{}],2:[function(require,module,exports){
'use strict';
var stringify = require('./stringify');
var parse = require('./parse');
var formats = require('./formats');
module.exports = {
formats: formats,
parse: parse,
stringify: stringify
};
},{"./formats":1,"./parse":3,"./stringify":4}],3:[function(require,module,exports){
'use strict';
var utils = require('./utils');
var has = Object.prototype.hasOwnProperty;
var defaults = {
allowDots: false,
allowPrototypes: false,
arrayLimit: 20,
decoder: utils.decode,
delimiter: '&',
depth: 5,
parameterLimit: 1000,
plainObjects: false,
strictNullHandling: false
};
var parseValues = function parseQueryStringValues(str, options) {
var obj = {};
var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
var parts = cleanStr.split(options.delimiter, limit);
for (var i = 0; i < parts.length; ++i) {
var part = parts[i];
var bracketEqualsPos = part.indexOf(']=');
var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
var key, val;
if (pos === -1) {
key = options.decoder(part, defaults.decoder);
val = options.strictNullHandling ? null : '';
} else {
key = options.decoder(part.slice(0, pos), defaults.decoder);
val = options.decoder(part.slice(pos + 1), defaults.decoder);
}
if (has.call(obj, key)) {
obj[key] = [].concat(obj[key]).concat(val);
} else {
obj[key] = val;
}
}
return obj;
};
var parseObject = function (chain, val, options) {
var leaf = val;
for (var i = chain.length - 1; i >= 0; --i) {
var obj;
var root = chain[i];
if (root === '[]') {
obj = [];
obj = obj.concat(leaf);
} else {
obj = options.plainObjects ? Object.create(null) : {};
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
var index = parseInt(cleanRoot, 10);
if (
!isNaN(index)
&& root !== cleanRoot
&& String(index) === cleanRoot
&& index >= 0
&& (options.parseArrays && index <= options.arrayLimit)
) {
obj = [];
obj[index] = leaf;
} else {
obj[cleanRoot] = leaf;
}
}
leaf = obj;
}
return leaf;
};
var parseKeys = function parseQueryStringKeys(givenKey, val, options) {
if (!givenKey) {
return;
}
// Transform dot notation to bracket notation
var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
// The regex chunks
var brackets = /(\[[^[\]]*])/;
var child = /(\[[^[\]]*])/g;
// Get the parent
var segment = brackets.exec(key);
var parent = segment ? key.slice(0, segment.index) : key;
// Stash the parent if it exists
var keys = [];
if (parent) {
// If we aren't using plain objects, optionally prefix keys
// that would overwrite object prototype properties
if (!options.plainObjects && has.call(Object.prototype, parent)) {
if (!options.allowPrototypes) {
return;
}
}
keys.push(parent);
}
// Loop through children appending to the array until we hit depth
var i = 0;
while ((segment = child.exec(key)) !== null && i < options.depth) {
i += 1;
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
if (!options.allowPrototypes) {
return;
}
}
keys.push(segment[1]);
}
// If there's a remainder, just add whatever is left
if (segment) {
keys.push('[' + key.slice(segment.index) + ']');
}
return parseObject(keys, val, options);
};
module.exports = function (str, opts) {
var options = opts ? utils.assign({}, opts) : {};
if (options.decoder !== null && options.decoder !== undefined && typeof options.decoder !== 'function') {
throw new TypeError('Decoder has to be a function.');
}
options.ignoreQueryPrefix = options.ignoreQueryPrefix === true;
options.delimiter = typeof options.delimiter === 'string' || utils.isRegExp(options.delimiter) ? options.delimiter : defaults.delimiter;
options.depth = typeof options.depth === 'number' ? options.depth : defaults.depth;
options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : defaults.arrayLimit;
options.parseArrays = options.parseArrays !== false;
options.decoder = typeof options.decoder === 'function' ? options.decoder : defaults.decoder;
options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : defaults.allowDots;
options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : defaults.plainObjects;
options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : defaults.allowPrototypes;
options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : defaults.parameterLimit;
options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
if (str === '' || str === null || typeof str === 'undefined') {
return options.plainObjects ? Object.create(null) : {};
}
var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
var obj = options.plainObjects ? Object.create(null) : {};
// Iterate over the keys and setup the new object
var keys = Object.keys(tempObj);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
var newObj = parseKeys(key, tempObj[key], options);
obj = utils.merge(obj, newObj, options);
}
return utils.compact(obj);
};
},{"./utils":5}],4:[function(require,module,exports){
'use strict';
var utils = require('./utils');
var formats = require('./formats');
var arrayPrefixGenerators = {
brackets: function brackets(prefix) { // eslint-disable-line func-name-matching
return prefix + '[]';
},
indices: function indices(prefix, key) { // eslint-disable-line func-name-matching
return prefix + '[' + key + ']';
},
repeat: function repeat(prefix) { // eslint-disable-line func-name-matching
return prefix;
}
};
var toISO = Date.prototype.toISOString;
var defaults = {
delimiter: '&',
encode: true,
encoder: utils.encode,
encodeValuesOnly: false,
serializeDate: function serializeDate(date) { // eslint-disable-line func-name-matching
return toISO.call(date);
},
skipNulls: false,
strictNullHandling: false
};
var stringify = function stringify( // eslint-disable-line func-name-matching
object,
prefix,
generateArrayPrefix,
strictNullHandling,
skipNulls,
encoder,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
) {
var obj = object;
if (typeof filter === 'function') {
obj = filter(prefix, obj);
} else if (obj instanceof Date) {
obj = serializeDate(obj);
} else if (obj === null) {
if (strictNullHandling) {
return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder) : prefix;
}
obj = '';
}
if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean' || utils.isBuffer(obj)) {
if (encoder) {
var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder);
return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder))];
}
return [formatter(prefix) + '=' + formatter(String(obj))];
}
var values = [];
if (typeof obj === 'undefined') {
return values;
}
var objKeys;
if (Array.isArray(filter)) {
objKeys = filter;
} else {
var keys = Object.keys(obj);
objKeys = sort ? keys.sort(sort) : keys;
}
for (var i = 0; i < objKeys.length; ++i) {
var key = objKeys[i];
if (skipNulls && obj[key] === null) {
continue;
}
if (Array.isArray(obj)) {
values = values.concat(stringify(
obj[key],
generateArrayPrefix(prefix, key),
generateArrayPrefix,
strictNullHandling,
skipNulls,
encoder,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
));
} else {
values = values.concat(stringify(
obj[key],
prefix + (allowDots ? '.' + key : '[' + key + ']'),
generateArrayPrefix,
strictNullHandling,
skipNulls,
encoder,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
));
}
}
return values;
};
module.exports = function (object, opts) {
var obj = object;
var options = opts ? utils.assign({}, opts) : {};
if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') {
throw new TypeError('Encoder has to be a function.');
}
var delimiter = typeof options.delimiter === 'undefined' ? defaults.delimiter : options.delimiter;
var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : defaults.strictNullHandling;
var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : defaults.skipNulls;
var encode = typeof options.encode === 'boolean' ? options.encode : defaults.encode;
var encoder = typeof options.encoder === 'function' ? options.encoder : defaults.encoder;
var sort = typeof options.sort === 'function' ? options.sort : null;
var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots;
var serializeDate = typeof options.serializeDate === 'function' ? options.serializeDate : defaults.serializeDate;
var encodeValuesOnly = typeof options.encodeValuesOnly === 'boolean' ? options.encodeValuesOnly : defaults.encodeValuesOnly;
if (typeof options.format === 'undefined') {
options.format = formats['default'];
} else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {
throw new TypeError('Unknown format option provided.');
}
var formatter = formats.formatters[options.format];
var objKeys;
var filter;
if (typeof options.filter === 'function') {
filter = options.filter;
obj = filter('', obj);
} else if (Array.isArray(options.filter)) {
filter = options.filter;
objKeys = filter;
}
var keys = [];
if (typeof obj !== 'object' || obj === null) {
return '';
}
var arrayFormat;
if (options.arrayFormat in arrayPrefixGenerators) {
arrayFormat = options.arrayFormat;
} else if ('indices' in options) {
arrayFormat = options.indices ? 'indices' : 'repeat';
} else {
arrayFormat = 'indices';
}
var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
if (!objKeys) {
objKeys = Object.keys(obj);
}
if (sort) {
objKeys.sort(sort);
}
for (var i = 0; i < objKeys.length; ++i) {
var key = objKeys[i];
if (skipNulls && obj[key] === null) {
continue;
}
keys = keys.concat(stringify(
obj[key],
key,
generateArrayPrefix,
strictNullHandling,
skipNulls,
encode ? encoder : null,
filter,
sort,
allowDots,
serializeDate,
formatter,
encodeValuesOnly
));
}
var joined = keys.join(delimiter);
var prefix = options.addQueryPrefix === true ? '?' : '';
return joined.length > 0 ? prefix + joined : '';
};
},{"./formats":1,"./utils":5}],5:[function(require,module,exports){
'use strict';
var has = Object.prototype.hasOwnProperty;
var hexTable = (function () {
var array = [];
for (var i = 0; i < 256; ++i) {
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
}
return array;
}());
var compactQueue = function compactQueue(queue) {
var obj;
while (queue.length) {
var item = queue.pop();
obj = item.obj[item.prop];
if (Array.isArray(obj)) {
var compacted = [];
for (var j = 0; j < obj.length; ++j) {
if (typeof obj[j] !== 'undefined') {
compacted.push(obj[j]);
}
}
item.obj[item.prop] = compacted;
}
}
return obj;
};
var arrayToObject = function arrayToObject(source, options) {
var obj = options && options.plainObjects ? Object.create(null) : {};
for (var i = 0; i < source.length; ++i) {
if (typeof source[i] !== 'undefined') {
obj[i] = source[i];
}
}
return obj;
};
var merge = function merge(target, source, options) {
if (!source) {
return target;
}
if (typeof source !== 'object') {
if (Array.isArray(target)) {
target.push(source);
} else if (typeof target === 'object') {
if (options.plainObjects || options.allowPrototypes || !has.call(Object.prototype, source)) {
target[source] = true;
}
} else {
return [target, source];
}
return target;
}
if (typeof target !== 'object') {
return [target].concat(source);
}
var mergeTarget = target;
if (Array.isArray(target) && !Array.isArray(source)) {
mergeTarget = arrayToObject(target, options);
}
if (Array.isArray(target) && Array.isArray(source)) {
source.forEach(function (item, i) {
if (has.call(target, i)) {
if (target[i] && typeof target[i] === 'object') {
target[i] = merge(target[i], item, options);
} else {
target.push(item);
}
} else {
target[i] = item;
}
});
return target;
}
return Object.keys(source).reduce(function (acc, key) {
var value = source[key];
if (has.call(acc, key)) {
acc[key] = merge(acc[key], value, options);
} else {
acc[key] = value;
}
return acc;
}, mergeTarget);
};
var assign = function assignSingleSource(target, source) {
return Object.keys(source).reduce(function (acc, key) {
acc[key] = source[key];
return acc;
}, target);
};
var decode = function (str) {
try {
return decodeURIComponent(str.replace(/\+/g, ' '));
} catch (e) {
return str;
}
};
var encode = function encode(str) {
// This code was originally written by Brian White (mscdex) for the io.js core querystring library.
// It has been adapted here for stricter adherence to RFC 3986
if (str.length === 0) {
return str;
}
var string = typeof str === 'string' ? str : String(str);
var out = '';
for (var i = 0; i < string.length; ++i) {
var c = string.charCodeAt(i);
if (
c === 0x2D // -
|| c === 0x2E // .
|| c === 0x5F // _
|| c === 0x7E // ~
|| (c >= 0x30 && c <= 0x39) // 0-9
|| (c >= 0x41 && c <= 0x5A) // a-z
|| (c >= 0x61 && c <= 0x7A) // A-Z
) {
out += string.charAt(i);
continue;
}
if (c < 0x80) {
out = out + hexTable[c];
continue;
}
if (c < 0x800) {
out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
continue;
}
if (c < 0xD800 || c >= 0xE000) {
out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
continue;
}
i += 1;
c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
out += hexTable[0xF0 | (c >> 18)]
+ hexTable[0x80 | ((c >> 12) & 0x3F)]
+ hexTable[0x80 | ((c >> 6) & 0x3F)]
+ hexTable[0x80 | (c & 0x3F)];
}
return out;
};
var compact = function compact(value) {
var queue = [{ obj: { o: value }, prop: 'o' }];
var refs = [];
for (var i = 0; i < queue.length; ++i) {
var item = queue[i];
var obj = item.obj[item.prop];
var keys = Object.keys(obj);
for (var j = 0; j < keys.length; ++j) {
var key = keys[j];
var val = obj[key];
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
queue.push({ obj: obj, prop: key });
refs.push(val);
}
}
}
return compactQueue(queue);
};
var isRegExp = function isRegExp(obj) {
return Object.prototype.toString.call(obj) === '[object RegExp]';
};
var isBuffer = function isBuffer(obj) {
if (obj === null || typeof obj === 'undefined') {
return false;
}
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
};
module.exports = {
arrayToObject: arrayToObject,
assign: assign,
compact: compact,
decode: decode,
encode: encode,
isBuffer: isBuffer,
isRegExp: isRegExp,
merge: merge
};
},{}]},{},[2])(2)
});
import Vue from 'vue'
import {
Toast,
Dialog
} from 'vant'
import { Toast, Dialog } from 'vant'
/**
* 日期格式化
* let time = new Date().format('yyyy-MM-dd hh:mm:ss')
*/
Date.prototype.format = function(fmt) {
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
}
const throttle = (fn, gapTime) => {
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
let _lastTime = null
return function() {
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments)
_lastTime = _nowTime
}
}
if (gapTime == null || gapTime == undefined) {
gapTime = 1500
}
/**防止重复点击 */
const showLoading = (title = '加载中...', callBack, custom) => {
Toast({
type: 'loading',
message: title,
forbidClick: true,
duration: 0
})
if (callBack && typeof callBack == 'function') {
if (!custom) Toast.clear()
callBack()
let _lastTime = null
return function () {
let _nowTime = +new Date()
if (_nowTime - _lastTime > gapTime || !_lastTime) {
fn.apply(this, arguments)
_lastTime = _nowTime
}
}
}
const hideLoading = () => {
Toast.clear()
}
/**num:要转换的数值,fixed:精确几位小数 */
/**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,24 +4,11 @@ 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)
/**
* 雪碧图插件
*/
const SpritesmithPlugin = require('webpack-spritesmith')
const spritesmithFunction = data => {
let { spritesheet, sprites } = data
let shared = `.sprite-icon { background-image: url(${data.sprites[0].image});background-size: ${spritesheet.width / 2}px ${spritesheet.height / 2}px;}`
let perSprite = sprites.map(sprite => {
let { name, width, height, offset_x, offset_y } = sprite
return `.icon-${name} { width: ${width / 2}px; height: ${height / 2}px; background-position: ${offset_x / 2}px ${offset_y / 2}px;}`
}).join('\n')
return `${shared}\n${perSprite}`
}
module.exports = {
publicPath: IS_PROD ? './' : '/dj-scrm-wx-work-lwk/', // 署应用包时的基本 URL。 vue-router hash 模式使用
// publicPath: '/dj-scrm-wx-work-main/', // 署应用包时的基本 URL。 vue-router history模式使用 微信开发环境需打开
......@@ -31,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 代码)。
......@@ -67,42 +66,13 @@ module.exports = {
configureWebpack: config => {
config.name = name
config.resolve.modules = ['node_modules', './src/assets/spritesmith']
const Plugins = [
new SpritesmithPlugin({
// 引入图片文件夹
src: {
cwd: path.resolve(__dirname, './src/assets/spritesmith'),
glob: ['*.png', '*.jpg']
},
// 生成图片的路径
target: {
image: path.resolve(__dirname, './src/assets/images/sprite.png'),
// 生成SCSS
css: [
[path.resolve(__dirname, './src/assets/css/sprite.scss'), {
format: 'function_based_template'
}]
]
},
customTemplates: {
'function_based_template': spritesmithFunction,
},
//background引用路径
apiOptions: {
cssImageRef: '../images/sprite.png'
},
// 每个图片间距
spritesmithOptions: {
padding: 20
}
})
]
const Plugins = []
config.plugins = [...config.plugins, ...Plugins]
// 为生产环境修改配置...
// if (IS_PROD) {
// // externals
// config.externals = externals
// }
// 为生产环境修改配置...
// if (IS_PROD) {
// // externals
// config.externals = externals
// }
},
chainWebpack: config => {
......@@ -143,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',
......@@ -191,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!