Blame view

admin-web-master/src/views/analysis/special/index.vue 15.1 KB
3f535f30   杨鑫   '初始'
1
2
3
4
5
6
7
8
9
10
  <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">
60d9bf40   杨鑫   '1'
11
            <el-form ref="formParams" :inline="true" :model="pageIndex">
3f535f30   杨鑫   '初始'
12
13
                <el-form-item label="渠道">
                <el-select  placeholder="全部"
60d9bf40   杨鑫   '1'
14
                  v-model="pageIndex.ticketChannel"
3f535f30   杨鑫   '初始'
15
                  style="width: 168px;margin-right: 15px">
60d9bf40   杨鑫   '1'
16
17
18
19
                  <el-option label="大麦" value="大麦" />
                  <el-option label="猫眼" value="猫眼" />
                  <el-option label="携程" value="携程" />
                  <el-option label="美团" value="美团" />
3f535f30   杨鑫   '初始'
20
21
22
23
                </el-select>
                </el-form-item>
                <el-form-item label="票种">
                <el-select  placeholder="全部"
60d9bf40   杨鑫   '1'
24
                  v-model="pageIndex.ticketType"
3f535f30   杨鑫   '初始'
25
                  style="width: 168px;margin-right: 15px">
60d9bf40   杨鑫   '1'
26
27
                  <el-option label="电影票" value="电影票" />
                  <el-option label="演唱会票" value="演唱会票" />
3f535f30   杨鑫   '初始'
28
29
30
31
                </el-select>
                </el-form-item>
                <el-form-item label="证件">
                <el-select  placeholder="全部"
60d9bf40   杨鑫   '1'
32
                  v-model="pageIndex.type"
3f535f30   杨鑫   '初始'
33
                  style="width: 168px;margin-right: 15px">
60d9bf40   杨鑫   '1'
34
35
36
37
38
39
40
                  <el-option label="正常购票" value="0" />
                  <el-option label="学生证" value="1" />
                  <el-option label="老年证" value="2" />
                  <el-option label="军官证" value="3" />
                  <el-option label="警官证" value="4" />
                  <el-option label="残疾证" value="5" />
                  <el-option label="护照" value="6" />
3f535f30   杨鑫   '初始'
41
42
43
44
                </el-select>
                </el-form-item>
              <el-form-item label="日期">
                <el-date-picker
60d9bf40   杨鑫   '1'
45
                  v-model="pageIndex.list"
3f535f30   杨鑫   '初始'
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
                  type="daterange"
  
                  range-separator="至"
                  start-placeholder="开始时间"
                  end-placeholder="结束时间"
                  value-format="yyyy-MM-dd"
                />
              </el-form-item>
  
              <el-form-item label-width="0">
                <el-button   @click="search('formParams')"  style="background-color: #3F9B6A;color: #fff;">查询</el-button>
                <el-button  @click="clear('formParams')"  class="buttonHover"
                style="color: #606266;border: 1px solid #dddfe5;background-color: #fff;">重置</el-button>
              </el-form-item>
            </el-form>
          </div>
           </div>
          <!-- 表格 -->
          <div class="content_table" style="padding: 15px 10px 10px 20px;background-color:#F2F3F5">
            <div style='padding:20px 10px;background-color:#fff;margin-bottom: 10px;'>
              <div style="display:flex;font-size:14px;justify-content: space-around">
                <div style="width:12%;border-right:1px solid #F2F3F5">
                  <div style="margin-bottom: 10px;font-weight: 600;">学生证购票数量(张)</div>
60d9bf40   杨鑫   '1'
69
                  <div style="font-weight: 600;">{{numOne}}</div>
3f535f30   杨鑫   '初始'
70
71
72
                </div>
                <div style="width:12%;border-right:1px solid #F2F3F5">
                   <div style="margin-bottom: 10px;font-weight: 600;">学生证购票总额(元)</div>
60d9bf40   杨鑫   '1'
73
                  <div style="font-weight: 600;">{{moyeOne}}</div>
3f535f30   杨鑫   '初始'
74
                </div>
60d9bf40   杨鑫   '1'
75
76
  
  
3f535f30   杨鑫   '初始'
77
78
                <div style="width:12%;border-right:1px solid #F2F3F5">
                   <div style="margin-bottom: 10px;font-weight: 600;">老年证购票数量(张)</div>
60d9bf40   杨鑫   '1'
79
                   <div style="font-weight: 600;">{{numTwo}}</div>
3f535f30   杨鑫   '初始'
80
81
82
                </div>
                <div style="width:12%;border-right:1px solid #F2F3F5">
                  <div style="margin-bottom: 10px;font-weight: 600;">老年证购票总额(元)</div>
60d9bf40   杨鑫   '1'
83
                   <div style="font-weight: 600;">{{moyeTwo}}</div>
3f535f30   杨鑫   '初始'
84
85
86
                </div>
                <div style="width:12%;border-right:1px solid #F2F3F5">
                  <div style="margin-bottom: 10px;font-weight: 600;">军官证购票数量(张)</div>
60d9bf40   杨鑫   '1'
87
                   <div style="font-weight: 600;">{{numthree}}</div>
3f535f30   杨鑫   '初始'
88
89
90
                </div>
                <div>
                  <div style="margin-bottom: 10px;font-weight: 600;">军官证购票总额(元)</div>
60d9bf40   杨鑫   '1'
91
                   <div style="font-weight: 600;">{{moyethree}}</div>
3f535f30   杨鑫   '初始'
92
93
94
95
96
97
98
                </div>
              </div>
            </div>
            <div style='padding:20px 10px;background-color:#fff;margin-bottom: 10px;'>
              <div style="display:flex;font-size:14px;justify-content: space-around">
                <div style="width:12%;border-right:1px solid #F2F3F5">
                  <div style="margin-bottom: 10px;font-weight: 600;">警官证购票数量(张)</div>
60d9bf40   杨鑫   '1'
99
                  <div style="font-weight: 600;">{{numfour}}</div>
3f535f30   杨鑫   '初始'
100
101
102
                </div>
                <div style="width:12%;border-right:1px solid #F2F3F5">
                   <div style="margin-bottom: 10px;font-weight: 600;">警官证购票总额(元)</div>
60d9bf40   杨鑫   '1'
103
                  <div style="font-weight: 600;">{{moyefour}}</div>
3f535f30   杨鑫   '初始'
104
105
106
                </div>
                <div style="width:12%;border-right:1px solid #F2F3F5">
                   <div style="margin-bottom: 10px;font-weight: 600;">残疾证购票数量(张)</div>
60d9bf40   杨鑫   '1'
107
                   <div style="font-weight: 600;">{{numfive}}</div>
3f535f30   杨鑫   '初始'
108
109
110
                </div>
                <div style="width:12%;border-right:1px solid #F2F3F5">
                  <div style="margin-bottom: 10px;font-weight: 600;">残疾证购票总额(元)</div>
60d9bf40   杨鑫   '1'
111
                   <div style="font-weight: 600;">{{moyefive}}</div>
3f535f30   杨鑫   '初始'
112
113
114
                </div>
                <div style="width:12%;border-right:1px solid #F2F3F5">
                  <div style="margin-bottom: 10px;font-weight: 600;">护照购票数量(张)</div>
60d9bf40   杨鑫   '1'
115
                   <div style="font-weight: 600;">{{numsix}}</div>
3f535f30   杨鑫   '初始'
116
117
118
                </div>
                <div>
                  <div style="margin-bottom: 10px;font-weight: 600;">护照购票总额(元)</div>
60d9bf40   杨鑫   '1'
119
                   <div style="font-weight: 600;">{{moyesix}}</div>
3f535f30   杨鑫   '初始'
120
121
122
123
124
125
                </div>
              </div>
            </div>
               <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>
60d9bf40   杨鑫   '1'
126
              <!-- <el-select  placeholder="全部证件"
3f535f30   杨鑫   '初始'
127
128
                style="width: 120px;margin-right: 15px">
                <el-option label="1" value="1" />
60d9bf40   杨鑫   '1'
129
130
              </el-select> -->
              <el-button  style="background-color: #3F9B6A;color: #fff;" @click="daochu">导出</el-button>
3f535f30   杨鑫   '初始'
131
132
133
134
135
136
            </div>
            <div class="table">
              <el-table
              :summary-method="getSummaries"
                :span-method="objectSpanMethod"
                 show-summary
60d9bf40   杨鑫   '1'
137
                :data="tableData"
3f535f30   杨鑫   '初始'
138
139
               :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
              >
60d9bf40   杨鑫   '1'
140
141
142
143
144
                <el-table-column label="序号" >
                <template slot-scope="scope">
                    {{scope.$index +1}}
                                    </template>
                </el-table-column>
3f535f30   杨鑫   '初始'
145
                <el-table-column label="证件名称" :show-overflow-tooltip="true">
60d9bf40   杨鑫   '1'
146
147
148
149
150
                <template slot-scope="scope">
                    {{scope.row.type == '0'?'正常购票':scope.row.type == '1'?'学生证':scope.row.type == '2'?'老年证':scope.row.type == '3'?'军官证':scope.row.type == '4'?'警官证':scope.row.type == '5'?'残疾证':'护照'}}
  
  
                                    </template>
3f535f30   杨鑫   '初始'
151
                </el-table-column>
60d9bf40   杨鑫   '1'
152
153
                <el-table-column prop="ticketChannel" label="渠道">
  
3f535f30   杨鑫   '初始'
154
                </el-table-column>
60d9bf40   杨鑫   '1'
155
156
157
158
159
                <el-table-column prop="ticketType" label="票种" />
       <el-table-column prop="ticketName" label="票名" />
       <el-table-column prop="num" label="销售数量(张)" />
       <el-table-column prop="ticketPrice" label="客单价(元)" />
       <el-table-column prop="price" label="销售金额(元)" />
3f535f30   杨鑫   '初始'
160
161
162
163
164
165
166
167
168
169
170
171
                <!-- <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"
60d9bf40   杨鑫   '1'
172
                :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" layout="total,prev, pager,next" :total="total"
3f535f30   杨鑫   '初始'
173
174
175
176
177
178
179
180
181
                @size-change="handleSizeChange" @current-change="handleCurrentChange" />
            </div>
         </div>
          </div>
        </div>
    </div>
  </template>
  
  <script>
60d9bf40   杨鑫   '1'
182
  import {getCertificatePurchase,excelToGetCertificatePurchase} from '@/api/piaowu'
3f535f30   杨鑫   '初始'
183
184
185
  export default {
    data() {
      return {
60d9bf40   杨鑫   '1'
186
      flag:false,
3f535f30   杨鑫   '初始'
187
188
189
        total: 1,
        pageSize: 10,
        currentPage: 1,
60d9bf40   杨鑫   '1'
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
        tipsList: [],
         tableData: [],
        pageIndex:{
          list: [],
              page: 1,
              pageSize: 10,
             startTime: "",
      endTime: "",
      ticketChannel: "",
      ticketType: "",
      type:""
          },
          numOne:0,
          moyeOne:0,
          numTwo:0,
          moyeTwo:0,
          numthree:0,
          moyethree:0,
          numfour:0,
          moyefour:0,
          numfive:0,
          moyefive:0,
          numsix:0,
          moyesix:0
3f535f30   杨鑫   '初始'
214
215
216
217
218
219
220
  
      }
    },
    mounted() {
      this.getAll()
    },
    methods: {
60d9bf40   杨鑫   '1'
221
222
223
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
291
292
293
294
295
296
297
298
299
300
      async getAll(){
      let res =   await getCertificatePurchase(this.pageIndex)
      this.tableData = res.data.list
      this.total = res.data.total
  
     let numOne= 0
     let moyeOne =0
     let numTwo = 0
     let moyeTwo = 0
     let numthree = 0
     let moyethree = 0
     let numfour = 0
     let moyefour =0
     let numfive = 0
     let moyefive =0
      let numsix = 0
     let moyesix=0
     this.tableData.map(item=>{
       if(item.type == '1'){
          numOne += item.num
         moyeOne += Number(item.price)
       }
      if(item.type == '2'){
         numTwo += item.num
        moyeTwo += Number(item.price)
      }
      if(item.type == '3'){
         numthree += item.num
        moyethree += Number(item.price)
      }
      if(item.type == '4'){
         numfour += item.num
        moyefour += Number(item.price)
      }
      if(item.type == '5'){
         numfive += item.num
        moyefive += Number(item.price)
      }
      if(item.type == '6'){
         numsix += item.num
        moyesix += Number(item.price)
      }
     })
     this.numOne = numOne
     this.moyeOne = moyeOne
     this.numTwo = numTwo
     this.moyeTwo = moyeTwo
     this.numthree = numthree
     this.moyethree = moyethree
     this.numfour = numfour
     this.moyefour = moyefour
     this.numfive = numfive
     this.moyefive = moyefive
     this.numsix = numsix
     this.moyesix = moyesix
      },
      search(){
        if(this.pageIndex.list.length !=0){
          this.pageIndex.startTime = this.pageIndex.list[0]
          this.pageIndex.endTime = this.pageIndex.list[1]
        }
        this.getAll()
      },
      clear(){
        this.pageIndex = {
          list: [],
              page: 1,
              pageSize: 10,
             startTime: "",
      endTime: "",
      ticketChannel: "",
      ticketType: "",
      type:""
          }
  
          this.getAll()
      },
      changepiao(){
        this.getAll()
      },
3f535f30   杨鑫   '初始'
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
      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)) {
                      return prev + curr;
                    } else {
                      return prev;
                    }
                  }, 0);
                } else {
                  sums[index] = '';
                }
              } else {
                sums[index] = '';
              }
            });
  
            return sums;
3f535f30   杨鑫   '初始'
329
          },
60d9bf40   杨鑫   '1'
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
   async daochu(){
    let res = await excelToGetCertificatePurchase(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'
    })
  },
  
         async handleCurrentChange(val) {
3f535f30   杨鑫   '初始'
358
            this.currentPage = val
60d9bf40   杨鑫   '1'
359
360
361
362
363
364
365
366
367
             this.pageIndex.page = val
            try {
               const res = await getCertificatePurchase(this.pageIndex);
               this.tableData = res.data.list;
               this.total = res.data.total;
  
             } catch (error) {
               console.error('Error fetching data:', error);
             }
3f535f30   杨鑫   '初始'
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
          },
          handleSizeChange(val) {
            this.pageSize = val
          },
           objectSpanMethod({ row, column, rowIndex, columnIndex }) {
                  if (columnIndex === 0) {
                    if (rowIndex % 2 === 0) {
                      return {
                        rowspan: 2,
                        colspan: 1
                      };
                    } else {
                      return {
                        rowspan: 0,
                        colspan: 0
                      };
                    }
                  }
                }
60d9bf40   杨鑫   '1'
387
                     },
3f535f30   杨鑫   '初始'
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
   }
  </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>