Commit 3022b8bc by 李伟康

commit

1 parent e47ee55c
...@@ -10,5 +10,13 @@ export default { ...@@ -10,5 +10,13 @@ export default {
/*获取品牌---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */ /*获取品牌---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getBrandOveralltrend (req) { getBrandOveralltrend (req) {
return request.get('brand/overalltrend', { req }) return request.get('brand/overalltrend', { req })
} },
/* 获取门店总体相关信息 */
getMerchantOverallbase (req) {
return request.get('merchant/overallbase', { req })
},
/*获取门店---总体模块趋势图指标(包括:总客户:total,企微客户:wechat,企微群:wechatGroup,小程序:applet,公众号:publiccus) */
getMerchantOveralltrend (req) {
return request.get('merchant/overalltrend', { req })
},
} }
...@@ -37,6 +37,7 @@ export default { ...@@ -37,6 +37,7 @@ export default {
mounted () { mounted () {
setTimeout(() => { setTimeout(() => {
let { marqueeBox, marqueeText } = this.$refs let { marqueeBox, marqueeText } = this.$refs
if (!marqueeBox) return
let boxWidth = marqueeBox.offsetWidth, let boxWidth = marqueeBox.offsetWidth,
valueWidth = marqueeText.offsetWidth valueWidth = marqueeText.offsetWidth
this.valueWidth = valueWidth this.valueWidth = valueWidth
......
...@@ -96,6 +96,7 @@ export default { ...@@ -96,6 +96,7 @@ export default {
if (tabIndex == 1) brands.map(e => { if (tabIndex == 1) brands.map(e => {
if (e.active) params.brandName = e.brandName if (e.active) params.brandName = e.brandName
}) })
console.log(params)
this.$store.state.app.reportParams = params this.$store.state.app.reportParams = params
}, },
chooseBrand ({ i, index }) { chooseBrand ({ i, index }) {
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<div class="tabs-content-chart flex"> <div class="tabs-content-chart flex">
<div <div
class="line" class="line"
id="total-chart" ref="canvas"
></div> ></div>
<div class="table user-select pointer"> <div class="table user-select pointer">
<div class="table-head"> <div class="table-head">
...@@ -134,40 +134,43 @@ export default { ...@@ -134,40 +134,43 @@ export default {
wechatGroup: {}, wechatGroup: {},
applet: {}, applet: {},
publiccus: {} publiccus: {}
} },
canvas: null,
req: {}
} }
}, },
mounted () { mounted () {
}, },
methods: { methods: {
init (params) { init (params) {
console.log(params) params.queryType = params.reportType || 0
this.getBrandOverallbase('total') delete params.reportType
this.getBrandOverallbase('wechat') this.req = params
this.getBrandOverallbase('wechatGroup') this.getOverallbase('total')
this.getBrandOverallbase('applet') this.getOverallbase('wechat')
this.getBrandOverallbase('publiccus') this.getOverallbase('wechatGroup')
this.getBrandOveralltrend('total') this.getOverallbase('applet')
this.getOverallbase('publiccus')
this.getOveralltrend('total')
}, },
changeType (type) { changeType (type) {
console.log(type)
this.tabType = type this.tabType = type
this.getBrandOveralltrend(type) this.getOveralltrend(type)
}, },
changeTab (index) { changeTab (index) {
this.tabIndex = index this.tabIndex = index
}, },
getBrandOverallbase (queryItem) { getOverallbase (queryItem) {
let { req: { queryType }, req } = this
const params = { const params = {
queryItem, queryItem,
queryTime: '2022-06-23', queryTime: '2022-06-23',
corporateGroupName: '集团1', corporateGroupName: '集团1',
queryType: 0 ...req
} }
this.api.overview.getBrandOverallbase(params).then(({ code, data }) => { this.api.overview[queryType == 0 ? 'getBrandOverallbase' : 'getMerchantOverallbase'](params).then(({ code, data }) => {
if (code == 0) { if (code == 0) {
console.log(`________________${queryItem}_______________________`, data)
let [dataList] = data.dataList let [dataList] = data.dataList
dataList.top = this.ObjectToArray(dataList.topList) dataList.top = this.ObjectToArray(dataList.topList)
dataList.last = this.ObjectToArray(dataList.lastList) dataList.last = this.ObjectToArray(dataList.lastList)
...@@ -181,16 +184,113 @@ export default { ...@@ -181,16 +184,113 @@ export default {
Object.keys(obj).map(name => arr.push({ name, num: obj[name] })) Object.keys(obj).map(name => arr.push({ name, num: obj[name] }))
return arr return arr
}, },
getBrandOveralltrend (queryItem) { getOveralltrend (queryItem) {
let { req: { queryType }, req } = this
const params = { const params = {
queryItem, queryItem,
querystartTime: '2022-05-23', querystartTime: queryType == 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: '2022-06-23', queryendTime: queryType == 1 ? this.getNDate(-1) : this.getNMonth(-1),
corporateGroupName: '集团1', corporateGroupName: '集团1',
queryType: 0 ...req
}
this.api.overview[queryType == 0 ? 'getBrandOveralltrend' : 'getMerchantOveralltrend'](params).then(({ data, code }) => {
console.log(`________________${queryItem}_______________________`, data)
if (code == 0) {
this.canvas = echarts.init(this.$refs.canvas)
this.draw(data.dataList, queryType)
}
})
},
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}月`}` : e.statDate)
data.push(e.totalNum)
})
let options = {
tooltip: {
trigger: 'axis',
borderWidth: 0,
backgroundColor: 'rgba(68,68,68,0.80)',
textStyle: {
color: '#FFFFFF',
fontSize: '8px'
},
formatter: ([value]) => {
return `${title[tabType]}:${value.data}`
// `${value.name}${title[tabType]}:${value.data}`
}
},
xAxis: {
type: 'category',
axisLabel: {
color: '#606266',
fontSize: '0.8em'
},
data: xData
},
grid: {
left: '3%',
right: '4%',
top: '10%',
bottom: '1.2vh',
containLabel: true
},
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
}
]
} }
this.api.overview.getBrandOverallbase(params).then(res => { this.canvas.setOption(options)
console.log(`________________${queryItem}_______________________`, res) window.addEventListener('resize', () => {
this.canvas.resize()
}) })
} }
} }
...@@ -285,7 +385,6 @@ export default { ...@@ -285,7 +385,6 @@ export default {
gap: 0 8px; gap: 0 8px;
.line { .line {
flex: 7; flex: 7;
background: #022;
} }
.table { .table {
flex: 3; flex: 3;
......
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
}, },
methods:{ methods:{
pieAction(data){ pieAction(data){
console.log(this.distributionRank,'客户性别') // console.log(this.distributionRank,'客户性别')
this.brandList = this.distributionRank&&this.distributionRank[data.name]&&Object.keys(this.distributionRank[data.name]) this.brandList = this.distributionRank&&this.distributionRank[data.name]&&Object.keys(this.distributionRank[data.name])
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!