Commit 10774cb2 by 王志慧

commit

1 parent fb99243c
...@@ -137,54 +137,33 @@ color: #333333; ...@@ -137,54 +137,33 @@ color: #333333;
} }
.line-tooltip {
opacity: 0;
// tooltip样式
.chart-wrapper {
position: relative;
background-color:#fff ;
padding: 5px;
border-radius: 3px;
text-align: center;
width:160px;
height:100px;
}
.f2-tooltip {
box-shadow: 0px 3px 10px 0px rgba(223, 228, 234, 0.81);
border-radius: 4px;
position: absolute; position: absolute;
// width: 140px;
// height: 70px;
border-radius: 6px;
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.05);
background: #ffffff;
z-index: 99; z-index: 99;
background-color: #fff; flex-direction: column;
padding: 5px; font-size: 12px;
border-radius: 3px; box-sizing: border-box;
text-align: center; padding: 10px;
width: 120px; left: 0;
opacity: 0; top: 0;
.time{ /deep/.time {
font-size: 10px; color: #a9a9a9;
font-weight: 400;
color: #666666;
line-height: 15px;
text-align:left;
}
span {
font-size: 11px;
color: #333333;
line-height: 15px;
margin-top:4px;
.info{
margin-left:2px;
color:#333333;
} }
/deep/.item,
/deep/.time {
width: 100%;
text-align: left;
font-size: 12px;
} }
/deep/.arc {
border-radius: 100%;
font-size: 8px;
margin-right: 4px;
} }
// .f2-tooltip
// .f2-tooltip span:nth-child(1) {
// marg: 11px !important;
// }
// .f2-tooltip span:nth-child(2) {
// font-size: 13px !important;
// }
// .van-swipe{
// overflow: visible!important;
// }
\ No newline at end of file \ No newline at end of file
}
\ No newline at end of file \ No newline at end of file
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
.icon-icondown { width: 5px; height: 8px; background-position: -323px -244px;} .icon-icondown { width: 5px; height: 8px; background-position: -323px -244px;}
.icon-iconup { width: 5px; height: 8px; background-position: -338px -244px;} .icon-iconup { width: 5px; height: 8px; background-position: -338px -244px;}
.icon-liushi { width: 40px; height: 44px; background-position: -100px -190px;} .icon-liushi { width: 40px; height: 44px; background-position: -100px -190px;}
.icon-masonry { width: 26px; height: 26px; background-position: -109px -244px;}
.icon-message { width: 14px; height: 13px; background-position: -277px -244px;} .icon-message { width: 14px; height: 13px; background-position: -277px -244px;}
.icon-production { width: 40px; height: 44px; background-position: -150px -190px;} .icon-production { width: 40px; height: 44px; background-position: -150px -190px;}
.icon-proportion { width: 26px; height: 26px; background-position: -109px -244px;} .icon-proportion { width: 26px; height: 26px; background-position: -145px -244px;}
.icon-Qy { width: 40px; height: 44px; background-position: -200px -190px;} .icon-Qy { width: 40px; height: 44px; background-position: -200px -190px;}
.icon-qycustomer { width: 26px; height: 26px; background-position: -145px -244px;} .icon-qycustomer { width: 26px; height: 26px; background-position: -181px -244px;}
.icon-rank { width: 27px; height: 26px; background-position: 0px -244px;} .icon-rank { width: 27px; height: 26px; background-position: 0px -244px;}
.icon-speed { width: 26px; height: 26px; background-position: -181px -244px;} .icon-speed { width: 26px; height: 26px; background-position: -217px -244px;}
.icon-totalCu { width: 40px; height: 44px; background-position: -250px -190px;} .icon-totalCu { width: 40px; height: 44px; background-position: -250px -190px;}
.icon-wechat-customers { width: 40px; height: 44px; background-position: -300px -190px;} .icon-wechat-customers { width: 40px; height: 44px; background-position: -300px -190px;}
\ No newline at end of file \ No newline at end of file
.icon-masonry { width: 26px; height: 26px; background-position: -217px -244px;}
\ No newline at end of file \ No newline at end of file

175 KB | W: | H:

175 KB | W: | H:

src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
src/assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -22,13 +22,14 @@ export default { ...@@ -22,13 +22,14 @@ export default {
watch: { watch: {
tabIndex: { tabIndex: {
handler() { handler() {
this.initData() this.initTextData()
}, },
immediate: true immediate: true
}, },
outputData: { outputData: {
handler() { handler() {
this.initTextData() this.initTextData()
}, },
deep: true, deep: true,
immediate: true immediate: true
...@@ -67,6 +68,7 @@ export default { ...@@ -67,6 +68,7 @@ export default {
this.text = time[1]&&time[1].split('')[1] + '月' this.text = time[1]&&time[1].split('')[1] + '月'
} }
} }
this.initData()
}, },
initData() { initData() {
let { let {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
(userInfo.accountLevel == 4 && reportType == 1 && tabType.index == 0 && tabIndex == 0 && trendChartList.length > 0) (userInfo.accountLevel == 4 && reportType == 1 && tabType.index == 0 && tabIndex == 0 && trendChartList.length > 0)
" "
></canvas> ></canvas>
<div class="line-tooltip flex" ref="lineCustomerTooltip"></div>
<!-- 产值的折线图 --> <!-- 产值的折线图 -->
<canvas <canvas
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
(tabIndex == 1 && userInfo.accountLevel == 4 && reportType == 1 && tabType.index == 0 && trendList.length > 0) (tabIndex == 1 && userInfo.accountLevel == 4 && reportType == 1 && tabType.index == 0 && trendList.length > 0)
" "
></canvas> ></canvas>
<div class="line-tooltip flex" ref="lineTooltip"></div>
<canvas class="canvas" id="pieChart" v-show="tabIndex == 1 && tabType.index == 1 && productionValueReportList.length > 0"></canvas> <canvas class="canvas" id="pieChart" v-show="tabIndex == 1 && tabType.index == 1 && productionValueReportList.length > 0"></canvas>
<template <template
...@@ -117,7 +117,10 @@ export default { ...@@ -117,7 +117,10 @@ export default {
}) })
}, },
initLineChart(id = 'lineChart') { initLineChart(id = 'lineChart') {
let { tabIndex } = this let { trendList } = this
trendList.forEach(item => {
item.type = '新增产值'
})
this.lineChart && this.lineChart.clear() this.lineChart && this.lineChart.clear()
this.lineChart = null this.lineChart = null
this.lineChart = new F2.Chart({ this.lineChart = new F2.Chart({
...@@ -125,69 +128,7 @@ export default { ...@@ -125,69 +128,7 @@ export default {
padding: [50, 50, 20, 50], padding: [50, 50, 20, 50],
pixelRatio: window.devicePixelRatio pixelRatio: window.devicePixelRatio
}) })
if (tabIndex == 0) {
this.lineChart.source([], {
date: {
range: [0, 1]
},
number: {
type: 'linear',
formatter(e) {
return Math.ceil(e)
}
}
})
this.lineChart.axis('date', {
label(text, index, total) {
const textCfg = {}
if (index === 0) {
textCfg.textAlign = 'left'
} else if (index === total - 1) {
textCfg.textAlign = 'end'
}
return textCfg
}
})
const tooltipEl = this.$refs.lineTooltip
this.lineChart.tooltip({
custom: true,
showCrosshairs: false,
onChange(ev) {
const currentData = ev.items[0]
const text = currentData.value
tooltipEl.innerHTML = `<div class="time">2021年10月27日</div>
<div class="item flex"><span class="arc" style="color:#3975C6;">●</span>新增企微客户:23</div>
<div class="item flex"><span class="arc" style="color:#FA7C0B;">●</span>流失客户:23</div>`
tooltipEl.style.opacity = 1
// tooltipEl.style.left = currentData.x - 140 / 2 + 'px'
// tooltipEl.style.top = currentData.y - 70 - 15 + 'px'
},
onHide() {
tooltipEl.style.opacity = 0
}
})
this.lineChart.legend(false)
this.lineChart
.area()
.position('date*number')
.color('country', val => {
if (val == '新增企微客户') return ['#DADAFF', '#F7F7F7']
return ['#FFECDB', '#F7F7F7']
})
.adjust('stack')
this.lineChart
.line()
.position('date*number')
.color('country', val => {
if (val == '新增企微客户') return '#3975C6'
return '#FA7C0B'
})
.adjust('stack')
} else {
let { trendList } = this
trendList.forEach(item => {
item.type = '新增产值'
})
this.lineChart.source(trendList, { this.lineChart.source(trendList, {
dataDateStr: { dataDateStr: {
type: 'timeCat', type: 'timeCat',
...@@ -208,13 +149,30 @@ export default { ...@@ -208,13 +149,30 @@ export default {
return textCfg return textCfg
} }
}) })
// this.lineChart.tooltip({
// showTitle: true, // 展示 tooltip 的标题
// layout: 'vertical'
// })
const tooltipEl = this.$refs.lineTooltip
this.lineChart.tooltip({ this.lineChart.tooltip({
showTitle: true, // 展示 tooltip 的标题 custom: true,
layout: 'vertical' showCrosshairs: false,
onChange(ev) {
const currentData = ev.items[0]
let reg = /(\d{4})-(\d{1,2})-(\d{1,2})/
const time = currentData.origin.dataDateStr.replace(reg, '$1年$2月$3日')
tooltipEl.innerHTML = `<div class="time">${time}</div>
<div class="item flex"><span class="arc" style="color:#3975C6;">●</span>新增产值:${ev.items[0].value}</div>`
tooltipEl.style.opacity = 1
tooltipEl.style.left = currentData.x - 140 / 2 + 'px'
tooltipEl.style.top = currentData.y - 30 - 15 + 'px'
},
onHide() {
tooltipEl.style.opacity = 0
}
}) })
this.lineChart.legend(false) this.lineChart.legend(false)
this.lineChart.line().position('dataDateStr*orderMoneyTotalSum').shape('smooth').color('type', ['#3975C6']) this.lineChart.line().position('dataDateStr*orderMoneyTotalSum').shape('smooth').color('type', ['#3975C6'])
}
const textObj = { const textObj = {
top: true, top: true,
position() { position() {
...@@ -236,7 +194,7 @@ export default { ...@@ -236,7 +194,7 @@ export default {
...textObj, ...textObj,
content: '产值', content: '产值',
offsetX: -10, offsetX: -10,
offsetY: -175 offsetY: -165
}) })
this.lineChart.render() this.lineChart.render()
}, },
...@@ -269,10 +227,10 @@ export default { ...@@ -269,10 +227,10 @@ export default {
this.chart.pieLabel({ this.chart.pieLabel({
sidePadding: 10, sidePadding: 10,
activeShape: true, activeShape: true,
label1(data) { label1(data, color) {
return { return {
text: `${orderSource[data.orderSource]}-占${data.newProductionValueRate}`, text: `${orderSource[data.orderSource]}-占${data.newProductionValueRate}`,
fill: '#333' fill: color
} }
}, },
label2(data) { label2(data) {
...@@ -293,8 +251,6 @@ export default { ...@@ -293,8 +251,6 @@ export default {
this.chart.render() this.chart.render()
}, },
lineCustomerChart(id = 'lineCustomerChart') { lineCustomerChart(id = 'lineCustomerChart') {
// var tooltipEl = document.createElement('div')
// var dom = document.getElementById('lineCustomerChart')
this.lineChartCustomer && this.lineChartCustomer.clear() this.lineChartCustomer && this.lineChartCustomer.clear()
this.lineChartCustomer = null this.lineChartCustomer = null
this.lineChartCustomer = new F2.Chart({ this.lineChartCustomer = new F2.Chart({
...@@ -304,7 +260,6 @@ export default { ...@@ -304,7 +260,6 @@ export default {
}) })
let trendList = [] let trendList = []
let { trendChartList } = this let { trendChartList } = this
trendChartList.forEach(item => { trendChartList.forEach(item => {
trendList.push( trendList.push(
{ {
...@@ -344,50 +299,31 @@ export default { ...@@ -344,50 +299,31 @@ export default {
} }
}) })
// Tooltip 配置 // Tooltip 配置
this.lineChartCustomer.tooltip({
showTitle: true, // 展示 tooltip 的标题
layout: 'vertical'
})
// this.lineChartCustomer.tooltip({ // this.lineChartCustomer.tooltip({
// custom: true, // showTitle: true, // 展示 tooltip 的标题
// showCrosshairs: false, // layout: 'vertical'
// onChange(ev) {
// console.log(ev)
// const currentData = ev.items
// const text = currentData.value
// tooltipEl.className = 'f2-tooltip'
// tooltipEl.innerHTML = `<div class="time">${ev.items[0].title}</div>
// <div class="item flex"><span class="arc" style="color:${ev.items[0].color};">●<span class="info">${ev.items[0].name}: ${ev.items[0].value}</span></span></div>
// <div class="item flex"><span class="arc" style="color:${ev.items[1].color};">●<span class="info">${ev.items[1].name}: ${ev.items[1].value}</span></span></div>`
// dom.parentNode.insertBefore(tooltipEl, dom)
// tooltipEl.style.opacity = 1
// // const canvasOffsetTop = dom.scrollTop
// // console.log(canvasOffsetTop)
// // const canvasOffsetLeft = dom.scrollLeft
// // tooltipEl.style.left = canvasOffsetLeft + currentData.x + 'px'
// // tooltipEl.style.top = canvasOffsetTop + currentData.y + 'px'
// },
// onHide() {
// // tooltipEl.style.opacity = 0
// }
// }) // })
const tooltipEl = this.$refs.lineCustomerTooltip
this.lineChartCustomer.tooltip({
custom: true,
showCrosshairs: false,
onChange(ev) {
const currentData = ev.items[0]
let reg = /(\d{4})-(\d{1,2})-(\d{1,2})/
const time = currentData.origin.dayTime.replace(reg, '$1年$2月$3日')
tooltipEl.innerHTML = `<div class="time">${time}</div>
<div class="item flex"><span class="arc" style="color:#3975C6;">●</span>新增企微客户:${ev.items[0].value}</div>
<div class="item flex"><span class="arc" style="color:#FA7C0B;">●</span>流失客户:${ev.items[1].value}</div>`
tooltipEl.style.opacity = 1
tooltipEl.style.left = currentData.x - 140 / 2 + 'px'
tooltipEl.style.top = currentData.y - 30 - 15 + 'px'
},
onHide() {
tooltipEl.style.opacity = 0
}
})
this.lineChartCustomer.line().position('dayTime*value').shape('smooth').color('type', ['#3975C6', '#FA7C0B']) this.lineChartCustomer.line().position('dayTime*value').shape('smooth').color('type', ['#3975C6', '#FA7C0B'])
this.lineChartCustomer.legend(false) this.lineChartCustomer.legend(false)
// this.lineChartCustomer.area()
// .position('time*tem')
// .color('l(90) 0:FA7C0B 1:#f7f7f7')
// .shape('smooth');
// this.lineChartCustomer
// .area()
// .position('dayTime*value')
// .color('type', val => {
// if (val == '新增企微客户数') return 'l(90) 0:3975C6 1:#ffffff'
// return 'l(90) 0:FA7C0B 1:#ffffff'
// })
// .shape('smooth')
const textObj = { const textObj = {
top: true, top: true,
position() { position() {
...@@ -398,13 +334,6 @@ export default { ...@@ -398,13 +334,6 @@ export default {
fontSize: '10' // 文本大小 fontSize: '10' // 文本大小
} }
} }
// this.lineChartCustomer.guide().text({
// ...textObj,
// content: '日期',
// offsetX: window.screen.width - 70,
// offsetY: 14
// })
this.lineChartCustomer.guide().text({ this.lineChartCustomer.guide().text({
...textObj, ...textObj,
content: '数量', content: '数量',
...@@ -418,6 +347,7 @@ export default { ...@@ -418,6 +347,7 @@ export default {
</script> </script>
<style scoped lang='scss'> <style scoped lang='scss'>
@import '@/assets/css/statistics.scss';
.canvas { .canvas {
width: 345px; width: 345px;
height: 195px; height: 195px;
......
...@@ -35,6 +35,11 @@ export default { ...@@ -35,6 +35,11 @@ export default {
userInfo: state => state.report.userInfo userInfo: state => state.report.userInfo
}) })
}, },
watch: {
reportData() {
this.initFastData()
}
},
methods: { methods: {
initFastData() { initFastData() {
let { let {
...@@ -59,7 +64,8 @@ export default { ...@@ -59,7 +64,8 @@ export default {
? '精品升级' ? '精品升级'
: '权益提单' : '权益提单'
} }
console.log(fastOrderSource)
console.log(text)
if (accountLevel !== 4) { if (accountLevel !== 4) {
this.fastData.push( this.fastData.push(
{ text: '增长速度最快的业务:', info: text, icon: 'rank' }, { text: '增长速度最快的业务:', info: text, icon: 'rank' },
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<van-swipe-item class="container" :key="add.id + 'new'"> <van-swipe-item class="container" :key="add.id + 'new'">
<div class="text-message">{{ add.title }}</div> <div class="text-message">{{ add.title }}</div>
<div class="flex-between"> <div class="flex-between">
<span class="add-count">{{ add.value(reportData) }}</span> <span class="add-count"><label v-if="tabIndex == 1">¥</label>{{ add.value(reportData) }}</span>
<template v-if="add.sequential(reportData)"> <template v-if="add.sequential(reportData)">
<div class="ratio text-message flex"> <div class="ratio text-message flex">
<!-- {{ reportType == 0 ? '周环比' : '月环比' }} --> <!-- {{ reportType == 0 ? '周环比' : '月环比' }} -->
...@@ -80,7 +80,7 @@ export default { ...@@ -80,7 +80,7 @@ export default {
...mapState({ ...mapState({
reportData: state => state.report.reportData, reportData: state => state.report.reportData,
statisticsObj: state => state.report.statisticsObj, statisticsObj: state => state.report.statisticsObj,
// reportType: state => state.report.reportType tabIndex: state => state.report.tabIndex
}) })
}, },
mounted() {}, mounted() {},
......
...@@ -118,18 +118,18 @@ export default { ...@@ -118,18 +118,18 @@ export default {
this.chart.axis(false) this.chart.axis(false)
this.chart.legend(false) this.chart.legend(false)
this.chart.tooltip(false) this.chart.tooltip(false)
this.chart.guide().html({ // this.chart.guide().html({
position: ['50%', '50%'], // position: ['50%', '50%'],
html: '<div style="text-align: center;width:150px;height: 50px;">\n <p style="font-size: 12px;color: #999;margin: 0" id="title"></p>\n <p style="font-size: 18px;color: #343434;margin: 0;font-weight: bold;" id="money"></p>\n </div>' // html: '<div style="text-align: center;width:150px;height: 50px;">\n <p style="font-size: 12px;color: #999;margin: 0" id="title"></p>\n <p style="font-size: 18px;color: #343434;margin: 0;font-weight: bold;" id="money"></p>\n </div>'
}) // })
this.chart.interval().position('count*newProductionValue').adjust('stack').color('orderSource', ['#3975C6', '#43B899', '#FFC667', '#FF9DAA']) this.chart.interval().position('count*newProductionValue').adjust('stack').color('orderSource', ['#3975C6', '#43B899', '#FFC667', '#FF9DAA'])
this.chart.pieLabel({ this.chart.pieLabel({
sidePadding: 10, sidePadding: 10,
activeShape: true, activeShape: true,
label1(data) { label1(data,color) {
return { return {
text: `${orderSource[data.orderSource]}-占${data.newProductionValueRate}`, text: `${orderSource[data.orderSource]}-占${data.newProductionValueRate}`,
fill: '#333' fill: color
} }
}, },
label2(data) { label2(data) {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div> <div>
<div class="top flex"> <div class="top flex">
<div class="report-name text-hide"> <div class="report-name text-hide">
{{ userInfo.merchantName || 'XXXX商户名称-10月小结' }} {{ userInfo.merchantName || 'XXXX商户名称-10月小结' }}-<span>{{text}}</span>小结
</div> </div>
<template v-if="outputData.reportTimeStart && reportType == 0"> <template v-if="outputData.reportTimeStart && reportType == 0">
<div class="time small-text" @click="showDateSelect = true"> <div class="time small-text" @click="showDateSelect = true">
...@@ -29,7 +29,8 @@ export default { ...@@ -29,7 +29,8 @@ export default {
data() { data() {
return { return {
showDateSelect: false, showDateSelect: false,
dateColumns: [] dateColumns: [],
text:''
} }
}, },
computed: { computed: {
...@@ -84,7 +85,23 @@ export default { ...@@ -84,7 +85,23 @@ export default {
this.SET_START_TIME({ this.SET_START_TIME({
reportTimeStart: this.dateColumns[this.dateColumns.length - 1] + '-01' reportTimeStart: this.dateColumns[this.dateColumns.length - 1] + '-01'
}) })
}
this.initTextData()
},
initTextData() {
let { reportType, outputData } = this
if (reportType == 0) {
this.text = '本周'
} else {
let time = outputData.reportTimeStart.split('-')
if (parseInt(time[1]) > 9) {
this.text = time[1] + '月'
} else {
this.text = time[1]&&time[1].split('')[1] + '月'
} }
}
}, },
confirmDate(e) { confirmDate(e) {
let { let {
...@@ -141,6 +158,7 @@ export default { ...@@ -141,6 +158,7 @@ export default {
} }
}) })
} }
this.initTextData()
this.SET_TABTYPE_INDEX({ index: 0 }) this.SET_TABTYPE_INDEX({ index: 0 })
this.showDateSelect = false this.showDateSelect = false
} }
......
...@@ -112,7 +112,7 @@ const actions = { ...@@ -112,7 +112,7 @@ const actions = {
}) })
} else { } else {
util.showLoading() util.showLoading()
let { appid } = getParams('corpId') //从链接获取 let { appid } = getParams('corpId')?getParams('corpId'):'' //从链接获取
let dj_scrm = util.getLocalStorage('dj_scrm_corpId') let dj_scrm = util.getLocalStorage('dj_scrm_corpId')
if (!appid) appid = (dj_scrm && dj_scrm.corpId) || 'ww7ee69c648ae1b7e6' if (!appid) appid = (dj_scrm && dj_scrm.corpId) || 'ww7ee69c648ae1b7e6'
util.setLocalStorage('dj_scrm_corpId', { corpId: appid }) util.setLocalStorage('dj_scrm_corpId', { corpId: appid })
......
...@@ -167,7 +167,7 @@ export default { ...@@ -167,7 +167,7 @@ export default {
sequential: obj => { sequential: obj => {
return obj.newProductionValueSequential return obj.newProductionValueSequential
}, },
icon: 'production', icon: 'equity',
up: obj => { up: obj => {
return obj.newProductup return obj.newProductup
} }
...@@ -181,7 +181,7 @@ export default { ...@@ -181,7 +181,7 @@ export default {
sequential: obj => { sequential: obj => {
return obj.newEquityBillLadingSequential return obj.newEquityBillLadingSequential
}, },
icon: 'equity', icon: 'production',
up: obj => { up: obj => {
return obj.newEquityup return obj.newEquityup
} }
......
...@@ -50,8 +50,6 @@ export default { ...@@ -50,8 +50,6 @@ export default {
}, },
mounted() { mounted() {
this.getData() this.getData()
// this.$refs.canvasTab.initData()
scriptData().then(res => {})
}, },
created() { created() {
let reportType = this.getQuery().reportType ? this.getQuery().reportType : JSON.parse(window.localStorage.getItem('reportType')).reportType let reportType = this.getQuery().reportType ? this.getQuery().reportType : JSON.parse(window.localStorage.getItem('reportType')).reportType
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!