AddValue.vue
3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!--
* @Author: yangming yangming@didihu.com.cn
* @Date: 2023-09-14 10:26:24
* @LastEditors: yangming yangming@didihu.com.cn
* @LastEditTime: 2023-11-24 15:10:36
* @FilePath: \scrm-micro-home\src\views\home\components\AddValue.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
<div class="analysis-main" v-if="chartList.length">
<div class="analysis-head">
增值业务分析
</div>
<div class="analysis-body">
<div class="analysis-item" v-for="(item, index) in chartList" :key="index">
<analysis-line :analysisData="item">
<line-chart :lineList="item" :domId="'analysis' + index"></line-chart>
</analysis-line>
</div>
</div>
</div>
</template>
<script>
import analysisLine from './AnalysisLine'
import util from '@/utils/util'
export default {
components: {
analysisLine
},
data() {
return {
chartList: [
{
title: '轻改业务-精品升级',
backgroundColor: 'linear-gradient(179deg, #F5F7FF 1%, #F9FBFF 100%)',
color: ['#A29EFF', '#5850FF'],
url: '/appreciation/inSale/upgrade',
isShow: () => util.isShowBtn('/inSale/upgrade', null),
value: 0,
isFlag: true,
lineList: []
},
{
title: '轻改业务-售后众筹',
backgroundColor: 'linear-gradient(179deg, #EFF8FF 1%, #F4FAFF 1%, #F6FCFF 100%)',
color: ['#83D8FF', '#0087FA'],
url: '/store/orderManage/index?order=4',
isShow: () => util.isShowBtn('/orderManage/index', null),
value: 154.9,
isFlag: true,
lineList: []
},
{
title: '保险业务-会员权益升级',
backgroundColor: 'linear-gradient(179deg, #FFF8F0 1%, #FFFCF9 100%)',
color: ['#FFCF8D', '#FF8D0A'],
url: '/appreciation/beforeSale/checkSet',
isShow: () => util.isShowBtn('/beforeSale/checkSet', null),
value: 101.5,
isFlag: true,
lineList: []
}
]
}
},
mounted() {
this.getLineList()
},
methods: {
//产值、柱状图数据
async getLineList() {
const res = await Promise.all([this.$apis.home.tendency({ merchantId: this.$globalState.session.merchantId }), this.$apis.home.activityOutputTrend({ merchantId: this.$globalState.session.merchantId })])
const output = {
...res[0],
...res[1]
}
console.log(res, 'res')
const mapData = {
0: ['totalShopProfitMoney', 'diagramList', 'isOpen'],
1: ['crowdfundingOutput', 'crowdfundingOutputTrend', 'crowdfundingFlag'],
2: ['membershipOutput', 'membershipOutputTrend', 'membershipFlag']
}
this.chartList.forEach((item, index) => {
item.value = output[mapData[index][0]]
item.lineList = output[mapData[index][1]]
item.isFlag = output[mapData[index][2]]
})
this.chartList = this.chartList.filter(i => i.isFlag)
console.log(this.chartList)
}
}
}
</script>
<style lang="scss" scoped>
.analysis-main {
background: #fff;
margin-top: 16px;
.analysis-head {
font-size: 24px;
color: #333333;
padding-left: 20px;
height: 65px;
line-height: 65px;
border-bottom: 1px solid #f0f0fb;
}
.analysis-body {
padding: 16px 20px;
display: grid;
grid-template-columns: repeat(3, 32.66%);
column-gap: 1%;
}
}
</style>