3f535f30
杨鑫
'初始'
|
1
2
3
4
5
6
7
8
9
10
11
|
<template>
<div style="background-color:#f7f7f7;padding:10px 10px;">
<div class="history">
<div style="height:58px;line-height:58px;">
<div style="color:#0006"> <span>渠道售票统计分析</span> <span style="padding:0 5px;">></span> <span
style="color:#000000e6">销售情况排名</span></div>
</div>
<div>
<!-- 顶部搜索 -->
<div class="toolbar">
|
e7a2677d
杨鑫
'更新'
|
12
|
<el-form :inline="true">
|
249d13ce
杨鑫
最新
|
13
14
15
16
17
18
|
<el-form-item label="渠道">
<el-select placeholder="全部" v-model="pageIndex.ticketChannel"
style="width: 120px;margin-right: 15px">
<el-option v-for="(item,index) in type" :label="item==1?'有赞':'其他'" :value="item" />
</el-select>
</el-form-item>
|
3f535f30
杨鑫
'初始'
|
19
20
|
<el-form-item label="日期">
<el-date-picker
|
60d9bf40
杨鑫
'1'
|
21
|
v-model="list"
|
3f535f30
杨鑫
'初始'
|
22
23
24
25
26
27
28
29
30
31
|
type="daterange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="yyyy-MM-dd"
/>
</el-form-item>
<el-form-item label-width="0">
|
60d9bf40
杨鑫
'1'
|
32
33
|
<el-button @click="search" style="background-color: #3F9B6A;color: #fff">查询</el-button>
<el-button @click="clear" class="buttonHover"
|
3f535f30
杨鑫
'初始'
|
34
35
36
37
38
39
|
style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;">重置</el-button>
</el-form-item>
</el-form>
</div>
</div>
<!-- 表格 -->
|
52fc03a8
杨鑫
'最新'
|
40
|
<div class="content_table" style="padding: 15px 10px 10px 10px;background-color:#F2F3F5">
|
3f535f30
杨鑫
'初始'
|
41
42
43
|
<div style="background-color: #fff;padding: 10px;margin-bottom: 20px;">
<div style="display: flex;margin-bottom: 20px;">
<div style="width: 100%;padding: 10px 0;">销售排名</div>
|
249d13ce
杨鑫
最新
|
44
|
<!-- <el-select placeholder="全部渠道"
|
60d9bf40
杨鑫
'1'
|
45
|
style="width: 120px;margin-right: 15px" v-model = "pageIndex.ticketChannel" @change="changepiao">
|
87726dd1
杨鑫
'最新'
|
46
47
|
<el-option v-for="(item,index) in type" :label="item==1?'有赞':'其他'" :value="item" />
|
249d13ce
杨鑫
最新
|
48
|
</el-select> -->
|
e7a2677d
杨鑫
'更新'
|
49
|
<el-button style="background-color: #3F9B6A;color: #fff;" @click="daochu">导出</el-button>
|
3f535f30
杨鑫
'初始'
|
50
51
52
53
54
55
56
57
|
</div>
<div class="table">
<el-table
:summary-method="getSummaries"
show-summary
:data="tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)"
:header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
>
|
87726dd1
杨鑫
'最新'
|
58
|
<el-table-column label="排名" min-width="50">
|
60d9bf40
杨鑫
'1'
|
59
|
<template slot-scope="scope">
|
87726dd1
杨鑫
'最新'
|
60
61
|
{{ (currentPage - 1) * pageSize + scope.$index + 1 }}
</template>
|
3f535f30
杨鑫
'初始'
|
62
|
</el-table-column>
|
87726dd1
杨鑫
'最新'
|
63
|
<el-table-column label="内容" min-width="200" prop="ticketDetails" :show-overflow-tooltip="true">
|
60d9bf40
杨鑫
'1'
|
64
65
|
</el-table-column>
|
87726dd1
杨鑫
'最新'
|
66
67
68
69
|
<el-table-column prop="ticketChannel" label="渠道" min-width="60">
<template slot-scope="scope">
{{scope.row.ticketChannel == '1'?'有赞':'其他'}}
</template>
|
3f535f30
杨鑫
'初始'
|
70
|
</el-table-column>
|
87726dd1
杨鑫
'最新'
|
71
72
73
74
|
<el-table-column prop="ticketType" label="票种" min-width="60" />
<el-table-column prop="ticketName" label="票名" min-width="120" :show-overflow-tooltip="true"/>
<el-table-column prop="num" label="销售数量(张)" min-width="80"/>
<el-table-column prop="ticketPrice" label="客单价(元)" min-width="60"/>
|
60d9bf40
杨鑫
'1'
|
75
|
<el-table-column prop="price" label="销售金额(元)" />
|
3f535f30
杨鑫
'初始'
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
<!-- <el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" style="background-color: transparent;color: #3F9B6A;;border: none;">详情</el-button>
<el-button type="text" style="background-color: transparent;color: #3F9B6A;;border: none;">删除</el-button>
</template>
</el-table-column> -->
</el-table>
</div>
<!-- 分页 -->
<div class="fenye">
<el-pagination class="pagination" :hide-on-single-page="flag" background small :current-page="currentPage"
:page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total,prev, pager,next" :total="total "
@size-change="handleSizeChange" @current-change="handleCurrentChange" />
</div>
</div>
</div>
</div>
</div>
</template>
<script>
|
60d9bf40
杨鑫
'1'
|
98
|
import {QuestionGetAll,excelToSalesSituation} from '@/api/piaowu'
|
3f535f30
杨鑫
'初始'
|
99
100
101
|
export default {
data() {
return {
|
52fc03a8
杨鑫
'最新'
|
102
|
flag:false,
|
3f535f30
杨鑫
'初始'
|
103
104
105
106
|
list: [],
total: 1,
pageSize: 10,
currentPage: 1,
|
60d9bf40
杨鑫
'1'
|
107
108
|
tipsList: [],
tableData: [],
|
87726dd1
杨鑫
'最新'
|
109
|
type:[],
|
60d9bf40
杨鑫
'1'
|
110
111
112
113
114
115
116
117
118
|
pageIndex:{
page: 1,
pageSize: 10,
startTime:"",
endTime:"",
ticketChannel:"",
ticketType:""
}
|
3f535f30
杨鑫
'初始'
|
119
120
121
122
123
|
}
},
mounted() {
this.getAll()
|
52fc03a8
杨鑫
'最新'
|
124
|
QuestionGetAll(this.pageIndex).then(res=>{
|
3c4666ce
杨鑫
'最新'
|
125
|
this.type = this.extractAndDeduplicateTicketChannels(res.data.content)
|
52fc03a8
杨鑫
'最新'
|
126
|
})
|
3f535f30
杨鑫
'初始'
|
127
128
|
},
methods: {
|
60d9bf40
杨鑫
'1'
|
129
130
|
async getAll(){
let res = await QuestionGetAll(this.pageIndex)
|
3c4666ce
杨鑫
'最新'
|
131
132
|
this.tableData = res.data.content
this.total = res.data.numberOfElements
|
52fc03a8
杨鑫
'最新'
|
133
|
|
60d9bf40
杨鑫
'1'
|
134
135
136
137
138
139
|
},
search(){
if(this.list.length !=0){
this.pageIndex.startTime = this.list[0]
this.pageIndex.endTime = this.list[1]
}
|
0e7a57c2
杨鑫
'最新'
|
140
|
this.currentPage = 1
|
60d9bf40
杨鑫
'1'
|
141
142
|
this.getAll()
},
|
87726dd1
杨鑫
'最新'
|
143
144
145
146
147
148
149
150
151
|
extractAndDeduplicateTicketChannels(arr) {
const ticketChannels = [];
for (let i = 0; i < arr.length; i++) {
if (arr[i].hasOwnProperty('ticketChannel')) {
ticketChannels.push(arr[i].ticketChannel);
}
}
return [...new Set(ticketChannels)];
},
|
60d9bf40
杨鑫
'1'
|
152
153
154
155
156
157
158
159
160
|
clear(){
this.pageIndex = {
page: 1,
pageSize: 10,
startTime:"",
endTime:"",
ticketChannel:"",
ticketType:""
}
|
0e7a57c2
杨鑫
'最新'
|
161
|
this.currentPage = 1
|
60d9bf40
杨鑫
'1'
|
162
163
164
165
166
167
|
this.list= []
this.getAll()
},
changepiao(){
this.getAll()
},
|
3f535f30
杨鑫
'初始'
|
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
getSummaries(param) {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总计';
return;
}
if (['销售数量(张)', '客单价(元)', '销售金额(元)'].includes(column.label)) {
const values = data.map(item => Number(item[column.property]));
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
|
3c4666ce
杨鑫
'最新'
|
182
|
return parseFloat((prev + value).toFixed(2));
|
3f535f30
杨鑫
'初始'
|
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
} else {
return prev;
}
}, 0);
} else {
sums[index] = '';
}
} else {
sums[index] = '';
}
});
return sums;
},
|
60d9bf40
杨鑫
'1'
|
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
|
async daochu(){
let res = await excelToSalesSituation(this.pageIndex)
if(!res){
return
}
const blob = new Blob([res], { type: 'application/vnd.ms-excel' })
const fileName = '销售排名表.xls'
if ('download' in document.createElement('a')) {
// 非IE下载
const elink = document.createElement('a')
elink.download = fileName
elink.style.display = 'none'
elink.href = URL.createObjectURL(blob)
document.body.appendChild(elink)
elink.click()
URL.revokeObjectURL(elink.href) // 释放URL 对象
document.body.removeChild(elink)
} else {
// IE10+下载
navigator.msSaveBlob(blob, fileName)
}
this.$message({
message: '导出成功',
type: 'success'
})
},
|
3f535f30
杨鑫
'初始'
|
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
handleCurrentChange(val) {
this.currentPage = val
},
handleSizeChange(val) {
this.pageSize = val
},
},
}
</script>
<style lang='scss' scoped>
.history{
padding: 0 20px 20px 20px;
min-height: calc(100vh - 50px - 20px);
background-color: #Fff;
}
::v-deep .el-form-item__label{
font-weight: normal;
font-size: 14px;
}
::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active {
background-color: #3F9B6A;
}
</style>
<style scoped>
.history /deep/ .el-table .cell.el-tooltip img {
max-height: 100px;
}
.pagination {
text-align: right;
line-height: 20px;
}
.greens {
color: #3F9B6A;
}
/deep/ .el-table__row {
font-size: 14px;
color:#000000e6;
height:42px;
}
.fenye {
margin-top: 20px;
display: flex;
justify-content: flex-end;
}
::v-deep .el-pagination__total{
position: absolute;
left: 60px;
}
::v-deep .buttonHover:hover{
color:#3f9b6a !important;
border-color: #c5e1d2 !important;
background-color: #ecf5f0 !important;
outline: none;
}
</style>
<style>
.el-tooltip__popper {
max-width: 50%;
}
</style>
|