Commit 268a7b9a by 李伟康

commit

1 parent 2f938b11
......@@ -18,6 +18,11 @@ class Request {
method
}
params.req.corporateGroupName = '广汇'
const { reportParams } = window.vm.$store.state.app
if (reportParams) {
params.req.queryType = reportParams.reportType || 0
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]))
......
......@@ -55,10 +55,17 @@
<div class="tabs-content box">
<div class="tabs-title">客户增长趋势</div>
<div class="tabs-content-chart flex">
<div
class="line"
ref="canvas"
></div>
<template v-if="isEmpty">
<div class="empty">
<img src="@/assets/images/empty.png" />
</div>
</template>
<template v-else>
<div
class="line"
ref="canvas"
></div>
</template>
<div class="table user-select pointer">
<div class="table-head">
<template v-for="(i,index) in tabHead">
......@@ -136,23 +143,27 @@ export default {
publiccus: {}
},
canvas: null,
req: {}
req: {},
isGroup: true,
isEmpty: true
}
},
mounted () {
},
methods: {
init (params) {
console.log(params)
// params.queryType = params.reportType || 0
// delete params.reportType
// this.req = params
// this.getOverallbase('total')
// this.getOverallbase('wechat')
// this.getOverallbase('wechatGroup')
// this.getOverallbase('applet')
// this.getOverallbase('publiccus')
// this.getOveralltrend('total')
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
......@@ -162,15 +173,11 @@ export default {
this.tabIndex = index
},
getOverallbase (queryItem) {
let { req: { queryType }, req } = this
const params = {
queryItem,
queryTime: '2022-06-23',
// queryTime: this.getCurrentDate(),
corporateGroupName: '集团1',
...req
queryTime: this.getCurrentDate(),
}
this.api.overview[queryType == 0 ? 'getBrandOverallbase' : 'getMerchantOverallbase'](params).then(({ code, data }) => {
this.api.overview[this.isGroup ? 'getBrandOverallbase' : 'getMerchantOverallbase'](params).then(({ code, data }) => {
if (code == 0) {
let [dataList] = data.dataList
if (dataList) {
......@@ -191,23 +198,28 @@ export default {
},
ObjectToArray (obj) {
let arr = []
obj = JSON.parse(obj)
Object.keys(obj).map(name => arr.push({ name, num: obj[name] }))
JSON.parse(obj).map(e => {
Object.keys(e).map(name => arr.push({ name, num: e[name] }))
})
return arr
},
getOveralltrend (queryItem) {
let { req: { queryType }, req } = this
let { req: { queryType } } = this
const params = {
queryItem,
querystartTime: queryType == 1 ? this.getNDate(-30) : this.getNMonth(-12),
queryendTime: queryType == 1 ? this.getNDate(-1) : this.getNMonth(-1),
corporateGroupName: '集团1',
...req
}
this.api.overview[queryType == 0 ? 'getBrandOveralltrend' : 'getMerchantOveralltrend'](params).then(({ data, code }) => {
this.api.overview[this.isGroup ? 'getBrandOveralltrend' : 'getMerchantOveralltrend'](params).then(({ data, code }) => {
if (code == 0) {
this.canvas = echarts.init(this.$refs.canvas)
this.draw(data.dataList, queryType)
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)
})
}
}
})
},
......@@ -393,7 +405,8 @@ export default {
margin-top: auto;
justify-content: space-between;
gap: 0 8px;
.line {
.line,
.empty {
flex: 7;
}
.table {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!