index.vue
8.67 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<template>
<div class='layout'>
<view-container>
<template #title>
<view-title :title='bussinessTitle'>
</view-title>
</template>
<template #content>
<sass-plus-content @click='hideTitle' />
</template>
</view-container>
</div>
</template>
<script>
import SassPlusContent from 'views/sassPlus/componts/sassPlusContent'
export default {
// name: 'index'
components: {
SassPlusContent
},
data() {
return {
bussinessTitle: '1.1转换+业务',
bussinessType: 'transWork',
// isShowTransWork:true,
systemType: 'gl',
month: ''
}
},
async created() {
await this.bussinessInit(this.bussinessType)
},
mounted() {
this.$bus.$on('changeBussiness', data => {
const { bussinessType, bussinessTitle } = data
this.bussinessTitle = bussinessTitle
this.bussinessType = bussinessType
this.bussinessInit(bussinessType)
// this.isShowTransWork = bussinessType == 'transWork' || bussinessType == 'noWorries'
// if (bussinessType == 'transWork' || bussinessType == 'noWorries') {
// this.bussinessInit(bussinessType)
// }
// if (bussinessType == 'expandedGold' || bussinessType == 'crowdFunding') {
// const { systemType } = this
// this.crowdFundingInit(bussinessType, systemType, '')
// }
})
// this.$bus.$off('changeSystem')
// this.$bus.$on('changeSystem', data => {
// this.systemType = data.systemType
// const { systemType, bussinessType, month } = this
// this.crowdFundingInit(bussinessType, systemType, month)
// })
this.$bus.$on('changeMonths', data => {
this.month = data.month
// const { bussinessType, systemType, month } = this
// if (bussinessType == 'expandedGold' || bussinessType == 'crowdFunding') {
// this.getActivitiesMonthly(bussinessType, systemType, month)
// this.getTop5CouponMonthly(bussinessType, systemType, month)
// }
})
},
methods: {
// 1.1转换+ 2.1无忧的初始化
async bussinessInit(bussinessType) {
await this.getTotal(bussinessType) // 获取订单详情
await this.getMonth(bussinessType) // 获取可选月份
await this.getOrderMonthlyTrend(bussinessType) // 获取月度趋势
await this.getAllGoodsDistribution(bussinessType) // 获取商品统计——整体品类分布
this.$bus.$emit('orderinfoMonthly', { bussinessType }) // 切换业务时更新各类商品每月订单数
},
// 1.2 1.3的初始化
// crowdFundingInit(bussinessType, systemType, month) {
// this.getMonth(bussinessType) // 获取可选月份
// this.getTotal(bussinessType, systemType) // 获取订单详情
// this.getOrderMonthlyTrend(bussinessType, systemType) // 获取月度趋势
// this.getActivitiesMonthly(bussinessType, systemType, month) // 获取页面左边排名前五的数据
// this.getTop5CouponMonthly(bussinessType, systemType, month)// 获取页面右边排名前五的数据
// this.getTop10Coupon(bussinessType, systemType) // 获取页面右边排名前10的数据
// this.getTop10Acitivity(bussinessType, systemType)// 获取页面左边排名前10的数据
// },
// 获取订单总数、今年新增订单数、收入总额
getTotal(val, type) {
// val 通过不同业务调用不同的接口
// transWork 1.1业务 expandedGold 1.2业务 crowdFunding 1.3 noWorries 2.1
// type 通过不同系统调用不同的接口
// gl 广联 广汇 gh
const params = type ? { queryItem: type } : '' // 1.1 2.1没有参数
this.api[val].getTotal(params).then(res => {
if (res.code == 0) {
const orderList = res.data.dataList[0]
this.$bus.$emit('orderList', { orderList })
}
})
},
// 获取不同业务的月份
async getMonth(val) {
// val 通过不同业务调用不同的接口
// transWork 1.1业务 expandedGold 1.2业务 crowdFunding 1.3 noWorries 2.1
await this.api[val].getMonth().then(res => {
if (res.code == 0) {
const monthList = res.data.dataList
// if (this.bussinessType == 'transWork' || this.bussinessType == 'noWorries') {
// monthList.unshift({ month: '' })
// }
monthList.unshift({ month: '' })
this.$bus.$emit('monthList', { monthList })
}
})
},
// 获取订单月度趋势
getOrderMonthlyTrend(val, queryItem) {
// val 通过不同业务调用不同的接口
// transWork 1.1业务 expandedGold 1.2业务 crowdFunding 1.3 noWorries 2.1
// queryItem 通过不同系统调用不同的接口
// gl 广联 gh 广汇
const params = queryItem ? { queryItem } : ''
this.api[val].getOrderMonthlyTrend(params).then(res => {
if (res.code == 0) {
const orderMonthlyTrend = res.data.dataList
this.$bus.$emit('orderMonthlyTrend', { orderMonthlyTrend })
}
})
},
// 获取商品统计——整体品类分布
getAllGoodsDistribution(val) {
// val 通过不同业务调用不同的接口
// transWork 1.1业务 expandedGold 1.2业务 crowdFunding 1.3 noWorries 2.1
this.api[val].getAllGoodsDistribution().then(res => {
if (res.code == 0) {
const allGoodsDistribution = res.data.dataList
this.$bus.$emit('allGoodsDistribution', { allGoodsDistribution, bussinessType: this.bussinessType })
}
})
},
// 点击了别处隐藏菜单选择
hideTitle() {
this.$bus.$emit('hideEvent', { title: '111' })
},
// 获取排名前十的数据 右边
// getTop10Coupon(bussinessType, queryItem) {
// // bussinessType 通过不同业务调用不同的接口
// // expandedGold 1.2业务 crowdFunding 1.3
// // queryItem 系统参数
// // gl 广联 gh 广汇
// bussinessType == 'expandedGold'
// ? this.getTopTenData(bussinessType, 'getTop10Coupon', queryItem, 'Top10Right')
// : this.getTopTenData(bussinessType, 'getVehicleBrandRanking', queryItem, 'Top10Right')
// },
// 获取排名前十的数据 左边
// getTop10Acitivity(bussinessType, queryItem) {
// // bussinessType 通过不同业务调用不同的接口
// // expandedGold 1.2业务 crowdFunding 1.3
// // queryItem 系统参数
// // gl 广联 gh 广汇
// bussinessType == 'expandedGold'
// ? this.getTopTenData(bussinessType, 'getTop5Activities', queryItem, 'Top10Left')
// : this.getTopTenData(bussinessType, 'getAllGoodsDistribution', queryItem, 'Top10Left')
// },
// 获取前十的数据
// getTopTenData(bussinessType, method, queryItem, emitName) {
// const params = { queryItem }
// this.api[bussinessType][method](params).then(res => {
// if (res.code == 0) {
// this.$bus.$emit(emitName, { list: res.data.dataList, bussinessType })
// }
// })
// },
// 获取排名前5的数据 -左边
// getActivitiesMonthly(bussinessType, systemType, month) {
// // bussinessType 通过不同业务调用不同的接口
// // expandedGold 1.2业务 crowdFunding 1.3
// // systemType 系统参数
// // gl 广联 gh 广汇
// bussinessType == 'expandedGold'
// ? this.getMonthlyRankingData(bussinessType, 'getActivitiesMonthly', month, systemType, 'topFiveRankingTopLeft')
// : this.getMonthlyRankingData(bussinessType, 'getGoodsTop5Monthly', month, systemType, 'topFiveRankingTopLeft')
// },
// 获取排名前5的数据 -右边
// getTop5CouponMonthly(bussinessType, systemType, month) {
// bussinessType == 'expandedGold'
// ? this.getMonthlyRankingData(bussinessType, 'getTop5CouponMonthly', month, systemType, 'topFiveRankingTopRight')
// : this.getMonthlyRankingData(bussinessType, 'getVehicleBrandTop5Monthly', month, systemType, 'topFiveRankingTopRight')
// },
// 获取排名前五数据
// getMonthlyRankingData(bussinessType, method, month, queryItem, emitName) {
// let getmonth = month
// if (!getmonth) {
// const date = new Date() // 获取时间
// const year = date.getFullYear() // 获取年
// const month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1// 获取月
// getmonth = year + '-' + month
// }
// const params = {
// month: getmonth,
// queryItem
// }
// this.api[bussinessType][method](params).then(res => {
// if (res.code == 0) {
// this.$bus.$emit(emitName, { list: res.data.dataList, bussinessType })
// }
// })
// }
}
}
</script>
<style scoped>
</style>