|
@@ -0,0 +1,258 @@
|
|
1
|
+<template>
|
|
2
|
+ <div v-loading="loading">
|
|
3
|
+ <div class="screenBox flex">
|
|
4
|
+ <div class="flex">
|
|
5
|
+ <date-picker title="自定义" :quickFlag='true' :afferent_time="default_time" :clearFlag='false' @changeTime="changeTime"></date-picker>
|
|
6
|
+ <self-channel title="公众号" type='thePublic' @channelDefine="(val)=>{account_id = val;init(1)}"></self-channel>
|
|
7
|
+ </div>
|
|
8
|
+ <el-button type="primary" size="mini" @click="init(1,'export')">导出Excel</el-button>
|
|
9
|
+ </div>
|
|
10
|
+ <div class="dataInfoBox">
|
|
11
|
+ <div class="dataInfoItem" v-for="(item,index) in dataInfoArrs" :key="index">
|
|
12
|
+ <div class="dataItemTitle">
|
|
13
|
+ <img src="@/assets/img/icon/累计消耗@2x.png" style="height:14px" class="titleIcon" alt="">
|
|
14
|
+ <span>{{item.label}}</span>
|
|
15
|
+ </div>
|
|
16
|
+ <div class="dataItem-data">{{dataInfo&&(dataInfo[item.prop]||dataInfo[item.prop]==0)?$formatNum(dataInfo[item.prop]):'-'}}</div>
|
|
17
|
+ </div>
|
|
18
|
+ </div>
|
|
19
|
+ <ux-grid ref="plxTable" :border="false" @row-click="()=>{return}" :header-cell-style="()=>{return { backgroundColor: '#FFFFFF !important', border: 'none!important' }}" :height="height" show-footer-overflow="tooltip" show-overflow="tooltip" size="mini">
|
|
20
|
+ <ux-table-column v-for="item in desCol" :key="item.prop" :resizable="true" :field="item.prop" :title="item.label" :min-width="item.min_width?item.min_width:120" :fixed="item.fixed?item.fixed:''" align="center">
|
|
21
|
+ <template #header>
|
|
22
|
+ <div :class="['flex-align-jus-center',item.sort?'pointer':'',sort_field==item.prop?'sortFieldStyle':'']" @click="item.sort?sortFieldEvent(item.prop):''">{{item.label}}<i class="el-icon-caret-bottom" v-if="item.sort"></i>
|
|
23
|
+ <el-tooltip v-if="item.notes" :content="item.notes" placement="top">
|
|
24
|
+ <div><i class="el-icon-question"></i></div>
|
|
25
|
+ </el-tooltip>
|
|
26
|
+ </div>
|
|
27
|
+ </template>
|
|
28
|
+ <template v-slot="{ row }">
|
|
29
|
+ <span :class="sort_field==item.prop?'sortFieldStyle':''">{{row[item.prop]||row[item.prop]==0?$formatNum(row[item.prop]):'-' }}</span>
|
|
30
|
+ </template>
|
|
31
|
+ </ux-table-column>
|
|
32
|
+ </ux-grid>
|
|
33
|
+ <div class="pagination" v-show="total>0">
|
|
34
|
+ <el-pagination background :current-page="page" @current-change="handleCurrentChange" layout="prev, pager, next" :page-count='Number(pages)'>
|
|
35
|
+ </el-pagination>
|
|
36
|
+ </div>
|
|
37
|
+ </div>
|
|
38
|
+</template>
|
|
39
|
+<script>
|
|
40
|
+import datePicker from '@/components/assembly/screen/datePicker.vue'
|
|
41
|
+import selfChannel from '@/components/assembly/screen/channel.vue'
|
|
42
|
+export default {
|
|
43
|
+ components: { datePicker, selfChannel },
|
|
44
|
+ data () {
|
|
45
|
+ return {
|
|
46
|
+ loading: false,
|
|
47
|
+ page: 1,
|
|
48
|
+ pages: 0,
|
|
49
|
+ total: 0,
|
|
50
|
+ page_size: 20,
|
|
51
|
+ sort_field: 'charge_total',
|
|
52
|
+ dataInfoArrs:[
|
|
53
|
+ {
|
|
54
|
+ prop:'',
|
|
55
|
+ label:'首日ROI',
|
|
56
|
+ },
|
|
57
|
+ {
|
|
58
|
+ prop:'',
|
|
59
|
+ label:'当天总消耗',
|
|
60
|
+ },
|
|
61
|
+ {
|
|
62
|
+ prop:'',
|
|
63
|
+ label:'企微关注数',
|
|
64
|
+ },
|
|
65
|
+ {
|
|
66
|
+ prop:'',
|
|
67
|
+ label:'企微关注成本',
|
|
68
|
+ },
|
|
69
|
+ {
|
|
70
|
+ prop:'',
|
|
71
|
+ label:'当日总回收',
|
|
72
|
+ },
|
|
73
|
+ {
|
|
74
|
+ prop:'',
|
|
75
|
+ label:'累计充值金额',
|
|
76
|
+ },
|
|
77
|
+ {
|
|
78
|
+ prop:'',
|
|
79
|
+ label:'新增用户',
|
|
80
|
+ },
|
|
81
|
+ {
|
|
82
|
+ prop:'',
|
|
83
|
+ label:'回本率',
|
|
84
|
+ },
|
|
85
|
+ {
|
|
86
|
+ prop:'',
|
|
87
|
+ label:'充值人数',
|
|
88
|
+ },
|
|
89
|
+ {
|
|
90
|
+ prop:'',
|
|
91
|
+ label:'总充值人数',
|
|
92
|
+ },
|
|
93
|
+ {
|
|
94
|
+ prop:'',
|
|
95
|
+ label:'充值次数',
|
|
96
|
+ },
|
|
97
|
+ {
|
|
98
|
+ prop:'',
|
|
99
|
+ label:'总充值次数',
|
|
100
|
+ },
|
|
101
|
+ {
|
|
102
|
+ prop:'',
|
|
103
|
+ label:'充值用户成本',
|
|
104
|
+ },
|
|
105
|
+ ],
|
|
106
|
+ dataInfo: {},
|
|
107
|
+ default_time: [this.$getDay(-7, false), this.$getDay(0, false)],
|
|
108
|
+ time: [],
|
|
109
|
+ account_id: '',
|
|
110
|
+ height: '',
|
|
111
|
+ desCol: [
|
|
112
|
+ { prop: "account_name", label: "时间", fixed: 'left' },
|
|
113
|
+ { prop: "account_name", label: "公众号", fixed: 'left' },
|
|
114
|
+ { prop: "promoter_name", label: "首日ROI" },
|
|
115
|
+ { prop: "start_paid", label: "当天消耗" },
|
|
116
|
+ { prop: "end_paid", label: "企微关注数" },
|
|
117
|
+ { prop: 'paid_total', label: "企微关注成本", },
|
|
118
|
+ { prop: 'charge_total', label: "当日回收", },
|
|
119
|
+ { prop: 'margin_rate', label: "累计充值金额", },
|
|
120
|
+ { prop: 'cost_recovery_rate', label: "新增用户", },
|
|
121
|
+ { prop: 'follow_total', label: "回本率(%)", },
|
|
122
|
+ { prop: 'average_follow_paid', label: "充值人数",},
|
|
123
|
+ { prop: 'charge_user_total', label: "总充值人数", },
|
|
124
|
+ { prop: 'charge_transform', label: "充值次数", },
|
|
125
|
+ { prop: 'charge_transform_cost', label: "总充值次数", },
|
|
126
|
+ { prop: 'today', label: "充值用户成本", notes:'充值用户成本=当天消耗/充值人数' },
|
|
127
|
+ ]
|
|
128
|
+ }
|
|
129
|
+ },
|
|
130
|
+ created () {
|
|
131
|
+ this.time = this.default_time
|
|
132
|
+ this.height = document.documentElement.clientHeight - 350 > 400 ? document.documentElement.clientHeight - 350 : 400
|
|
133
|
+ this.init(1)
|
|
134
|
+ },
|
|
135
|
+ methods: {
|
|
136
|
+ changeTime (time) {//筛选时间变化
|
|
137
|
+ if (!time || time && time.length == 0) {
|
|
138
|
+ this.time = []
|
|
139
|
+ } else {
|
|
140
|
+ this.time = time
|
|
141
|
+ }
|
|
142
|
+ this.init(1)
|
|
143
|
+ },
|
|
144
|
+ init (page, type) {
|
|
145
|
+ if (type != 'export') {
|
|
146
|
+ this.page = page ? page : this.page;
|
|
147
|
+ } else {
|
|
148
|
+ if (this.total == 0) {
|
|
149
|
+ this.$message({
|
|
150
|
+ message: '暂无数据可导出',
|
|
151
|
+ type: "warning"
|
|
152
|
+ })
|
|
153
|
+ return
|
|
154
|
+ }
|
|
155
|
+ }
|
|
156
|
+ this.loading = true
|
|
157
|
+ this.$axios.get(this.URL.BASEURL + this.URL.statistics_wechatAccountData, {
|
|
158
|
+ params: {
|
|
159
|
+ sort_field: this.sort_field,
|
|
160
|
+ start_date: this.time[0],
|
|
161
|
+ end_date: this.time[1],
|
|
162
|
+ account_id: this.account_id,
|
|
163
|
+ page: type == 'export' ? 1 : this.page,
|
|
164
|
+ page_size: type == 'export' ? this.$store.state.exportNumber : this.page_size,
|
|
165
|
+ }
|
|
166
|
+ }).then((res) => {
|
|
167
|
+ var res = res.data
|
|
168
|
+ this.loading = false
|
|
169
|
+ if (res && res.errno == 0) {
|
|
170
|
+ if (type == 'export') {
|
|
171
|
+ this.exportEvent(res.rst.data.list)
|
|
172
|
+ } else {
|
|
173
|
+ this.datas = res.rst.data.list // 知道为啥datas不在 data()方法里面定义吗?嘻嘻
|
|
174
|
+ this.$refs.plxTable.reloadData(this.datas)
|
|
175
|
+ this.dataInfo = res.rst.data.total;
|
|
176
|
+ this.total = res.rst.pageInfo.total;
|
|
177
|
+ this.pages = res.rst.pageInfo.pages;
|
|
178
|
+ }
|
|
179
|
+ } else if (res.errno != 4002) {
|
|
180
|
+ this.$message({
|
|
181
|
+ message: res.err,
|
|
182
|
+ type: "warning"
|
|
183
|
+ })
|
|
184
|
+ }
|
|
185
|
+ }).catch((err) => {
|
|
186
|
+ this.loading = false
|
|
187
|
+ });
|
|
188
|
+ },
|
|
189
|
+ handleCurrentChange (val) {
|
|
190
|
+ this.init(val)
|
|
191
|
+ },
|
|
192
|
+ sortFieldEvent (type) {
|
|
193
|
+ this.sort_field = type;
|
|
194
|
+ this.init(1)
|
|
195
|
+ },
|
|
196
|
+ exportEvent (data) {
|
|
197
|
+ let list = data;
|
|
198
|
+ let tHeader = this.desCol.map((v) => {
|
|
199
|
+ return v.label;
|
|
200
|
+ })
|
|
201
|
+ let filterVal = this.desCol.map((v) => {
|
|
202
|
+ return v.prop;
|
|
203
|
+ })
|
|
204
|
+ let excelDatas = [
|
|
205
|
+ {
|
|
206
|
+ tHeader: tHeader, // sheet表一头部
|
|
207
|
+ filterVal: filterVal, // 表一的数据字段
|
|
208
|
+ tableDatas: list, // 表一的整体json数据
|
|
209
|
+ sheetName: ''// 表一的sheet名字
|
|
210
|
+ }
|
|
211
|
+ ]
|
|
212
|
+ this.$exportOrder({ excelDatas, name: `公众号数据(导出时间:${this.$getDay(0)})` })
|
|
213
|
+ }
|
|
214
|
+ }
|
|
215
|
+}
|
|
216
|
+</script>
|
|
217
|
+<style lang="scss" scoped>
|
|
218
|
+.screenBox {
|
|
219
|
+ background: #fff;
|
|
220
|
+ padding: 5px 20px;
|
|
221
|
+}
|
|
222
|
+.dataInfoBox {
|
|
223
|
+ display: flex;
|
|
224
|
+ margin-top: 10px;
|
|
225
|
+ flex-wrap: wrap;
|
|
226
|
+ .dataInfoItem {
|
|
227
|
+ background: #ffffff;
|
|
228
|
+ border-radius: 8px;
|
|
229
|
+ margin-right: 10px;
|
|
230
|
+ margin-bottom: 10px;
|
|
231
|
+ padding: 0 19px;
|
|
232
|
+ height: 70px;
|
|
233
|
+ display: flex;
|
|
234
|
+ flex-direction: column;
|
|
235
|
+ justify-content: center;
|
|
236
|
+ align-items: center;
|
|
237
|
+ .dataItemTitle {
|
|
238
|
+ display: flex;
|
|
239
|
+ align-items: center;
|
|
240
|
+ color: #6f6f6f;
|
|
241
|
+ font-size: 13px;
|
|
242
|
+ line-height: 17px;
|
|
243
|
+ font-weight: bold;
|
|
244
|
+ .titleIcon {
|
|
245
|
+ height: 16px;
|
|
246
|
+ margin-right: 4px;
|
|
247
|
+ }
|
|
248
|
+ }
|
|
249
|
+ .dataItem-data {
|
|
250
|
+ color: #000000;
|
|
251
|
+ font-size: 19px;
|
|
252
|
+ line-height: 28px;
|
|
253
|
+ font-weight: bold;
|
|
254
|
+ margin-top: 2px;
|
|
255
|
+ }
|
|
256
|
+ }
|
|
257
|
+}
|
|
258
|
+</style>
|