uv-behavior.vue
5.91 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
<template>
<Card class="uv-top">
<div slot="title">
访客行为
</div>
<Row :gutter="20">
<Col span="12">
<Card :bordered="false" dis-hover :padding="0">
<div slot="title">
<h3>热门品牌TOP{{selNumModel_brand}}</h3>
</div>
<div slot="extra">
数量:
<Select v-model="selNumModel_brand" size="small" style="width:50px">
<Option v-for="num in selNum" :value="num" :key="num">{{ num }}</Option>
</Select>
</div>
<Table class="overview-table" :columns="overviewCol_brand" :data="overviewData_brand"></Table>
</Card>
</Col>
<Col span="12">
<Card :bordered="false" dis-hover :padding="0">
<div slot="title">
<h3>热门单品TOP{{selNumModel_product}}</h3>
</div>
<div slot="extra">
数量:
<Select v-model="selNumModel_product" size="small" style="width:50px">
<Option v-for="num in selNum" :value="num" :key="num">{{ num }}</Option>
</Select>
</div>
<Table class="overview-table" :columns="overviewCol_product" :data="overviewData_product"></Table>
</Card>
</Col>
</Row>
</Card>
</template>
<script>
import * as service from 'service.pc';
export default {
name: 'uv-behavior',
props: ['date','appEdition'],
data() {
return {
phone: 'apple',
selNumModel_product: 10,
selNumModel_brand: 10,
selNum: [
10,
20,
50
],
overviewCol_brand: [
{
title: '关键词',
key: 'url',
render(row) {
return `<span>${row.name}</span>`;
}
},
{
title: '访客数(人)',
key: 'num',
render(row) {
return `<p>${row.uv}</p><i-progress :percent="${row.percent}" hide-info status="normal"></i-progress>`; // eslint-disable-line
}
},
{
title: '引导下单转化率',
key: 'lv',
align: 'center',
render(row) {
return `<span>${row.order_rate}%</span>`;
}
}
],
overviewCol_product: [
{
title: '商品名称',
key: 'url',
render(row) {
return `<span>${row.name}</span>`;
}
},
{
title: '商品skn',
key: 'skn',
render(row) {
return `<p>${row.pid}</p>`; // eslint-disable-line
}
},
{
title: '访客数',
key: 'lv',
align: 'center',
render(row) {
return `<span>${row.uv}</span><i-progress :percent="${row.percent}" hide-info status="normal"></i-progress>`;
}
},
{
title: '下单转化率',
key: 'lvcg',
align: 'center',
render(row) {
return `<span>${row.order_rate}%</span>`;
}
}
],
overviewData_product: [],
overviewData_brand: []
};
},
components: {},
created(){
this.loadData();
},
watch: {
date() {
this.loadData();
},
appEdition() {
this.loadData();
},
selNumModel_product(){
this.loadData();
},
selNumModel_brand(){
this.loadData();
}
},
methods: {
loadData: function() {
//product
service.get('data-analysis-web/flowsurvey/action_rank', {
type: 'product',
date: this.date,
appEdition: this.appEdition,
top:this.selNumModel_product
}).then(result => {
result = result.data.content;
let uvs=_.map(result,'uv');
let maxUa=_.max(uvs);
result=result.map((item,index)=>{
item.percent=100*uvs[index]/maxUa-1;
return item;
});
this.overviewData_product=result;
});
//brand
service.get('data-analysis-web/flowsurvey/action_rank', {
type: 'brand',
date: this.date,
appEdition: this.appEdition,
top:this.selNumModel_brand
}).then(result => {
result = result.data.content;
let uvs=_.map(result,'uv');
let maxUa=_.max(uvs);
result=result.map((item,index)=>{
item.percent=100*uvs[index]/maxUa-1;
return item;
});
this.overviewData_brand=result;
});
}
}
};
</script>
<style lang="scss">
.uv-top {
.ivu-progress-inner {
background-color: transparent !important;
}
.num-green {
color: #00cc66;
}
.num-red {
color: #ff3300;
}
.op {
float: right;
}
.ivu-card-body {
padding-top: 0px;
}
}
</style>