Blame view

yanshouban/src/views/analysis/refund/index.vue 12 KB
6ee6b0b7   杨鑫   '最新'
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">
8550d958   杨鑫   '最新'
12
            <el-form ref="formParams" :inline="true" :model="pageIndex">
6ee6b0b7   杨鑫   '最新'
13
14
                <el-form-item label="渠道">
                <el-select  placeholder="全部"
8550d958   杨鑫   '最新'
15
                  v-model="pageIndex.ticketChannel"
6ee6b0b7   杨鑫   '最新'
16
                  style="width: 168px;margin-right: 15px">
8550d958   杨鑫   '最新'
17
18
19
20
                  <el-option label="大麦" value="大麦" />
                  <el-option label="猫眼" value="猫眼" />
                  <el-option label="携程" value="携程" />
                  <el-option label="美团" value="美团" />
6ee6b0b7   杨鑫   '最新'
21
22
23
24
                </el-select>
                </el-form-item>
                <el-form-item label="票种">
                <el-select  placeholder="全部"
8550d958   杨鑫   '最新'
25
                            v-model="pageIndex.ticketType"
6ee6b0b7   杨鑫   '最新'
26
                  style="width: 168px;margin-right: 15px">
8550d958   杨鑫   '最新'
27
28
                  <el-option label="电影票" value="电影票" />
                  <el-option label="演唱会票" value="演唱会票" />
6ee6b0b7   杨鑫   '最新'
29
30
31
32
                </el-select>
                </el-form-item>
              <el-form-item label="日期">
                <el-date-picker
8550d958   杨鑫   '最新'
33
                  v-model="pageIndex.list"
6ee6b0b7   杨鑫   '最新'
34
35
36
37
38
39
40
41
42
43
                  type="daterange"
  
                  range-separator="至"
                  start-placeholder="开始时间"
                  end-placeholder="结束时间"
                  value-format="yyyy-MM-dd"
                />
              </el-form-item>
  
              <el-form-item label-width="0">
8550d958   杨鑫   '最新'
44
45
                <el-button   @click="search" style="background-color: #3F9B6A;color: #fff">查询</el-button>
                <el-button  @click="clear"  class="buttonHover"
6ee6b0b7   杨鑫   '最新'
46
47
48
49
50
51
52
53
54
55
56
                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:15%;border-right:1px solid #F2F3F5">
                  <div style="margin-bottom: 10px;font-weight: 600;">渠道数量</div>
8550d958   杨鑫   '最新'
57
                  <div style="font-weight: 600;">4</div>
6ee6b0b7   杨鑫   '最新'
58
59
60
                </div>
                <div style="width:15%;border-right:1px solid #F2F3F5">
                   <div style="margin-bottom: 10px;font-weight: 600;">票种数量</div>
8550d958   杨鑫   '最新'
61
                  <div style="font-weight: 600;">2</div>
6ee6b0b7   杨鑫   '最新'
62
63
64
                </div>
                <div style="width:15%;border-right:1px solid #F2F3F5">
                   <div style="margin-bottom: 10px;font-weight: 600;">退票总数(张)</div>
8550d958   杨鑫   '最新'
65
                   <div style="font-weight: 600;">{{numOne}}</div>
6ee6b0b7   杨鑫   '最新'
66
67
68
                </div>
                <div style="width:15%;border-right:1px solid #F2F3F5">
                  <div style="margin-bottom: 10px;font-weight: 600;">退票总额(元)</div>
8550d958   杨鑫   '最新'
69
                   <div style="font-weight: 600;">{{moyeOne}}</div>
6ee6b0b7   杨鑫   '最新'
70
71
72
                </div>
                <div>
                  <div style="margin-bottom: 10px;font-weight: 600;">平均退票率(%)</div>
8550d958   杨鑫   '最新'
73
                   <div style="font-weight: 600;">38.43%</div>
6ee6b0b7   杨鑫   '最新'
74
75
76
77
78
79
80
                </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>
8550d958   杨鑫   '最新'
81
              <!-- <el-select  placeholder="全部证件"
6ee6b0b7   杨鑫   '最新'
82
83
                style="width: 120px;margin-right: 15px">
                <el-option label="1" value="1" />
8550d958   杨鑫   '最新'
84
85
              </el-select> -->
              <el-button     style="background-color: #3F9B6A;color: #fff;height: 27.5px;" @click="daochu">导出</el-button>
6ee6b0b7   杨鑫   '最新'
86
87
88
89
90
91
            </div>
            <div class="table">
              <el-table
              :summary-method="getSummaries"
                :span-method="objectSpanMethod"
                 show-summary
8550d958   杨鑫   '最新'
92
                :data="tableData"
6ee6b0b7   杨鑫   '最新'
93
94
                 :header-cell-style="{fontSize: '14px',color:'#0009',fontWeight: 'normal',backgroundColor:'#F2F3F5'}"
              >
8550d958   杨鑫   '最新'
95
96
97
98
                <el-table-column label="序号" >
                <template slot-scope="scope">
                    {{scope.$index +1}}
                                    </template>
6ee6b0b7   杨鑫   '最新'
99
                </el-table-column>
8550d958   杨鑫   '最新'
100
101
102
103
104
105
106
107
108
109
110
111
              <el-table-column prop="ticketChannel" label="渠道">
  
                       </el-table-column>
                       <el-table-column prop="ticketType" label="票种" />
              <el-table-column prop="ticketName" label="票名" />
              <el-table-column prop="num" label="退票数(张)" />
              <el-table-column prop="price" label="退票金额(元)" />
              <el-table-column prop="refundRate" label="退票率(%)" >
              <template slot-scope="scope">
                  {{scope.row.refundRate}}%
                                  </template>
              </el-table-column>
6ee6b0b7   杨鑫   '最新'
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
                <!-- <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>
8550d958   杨鑫   '最新'
135
  import {getRefundData,excelToRefundData} from '@/api/piaowu'
6ee6b0b7   杨鑫   '最新'
136
137
138
139
140
141
142
143
  
  export default {
    data() {
      return {
        list: [],
        total: 1,
        pageSize: 10,
        currentPage: 1,
8550d958   杨鑫   '最新'
144
145
146
147
148
149
150
151
152
153
154
155
156
157
        tipsList: [],
         tableData: [],
     pageIndex:{
          list: [],
              page: 1,
              pageSize: 10,
             startTime: "",
      endTime: "",
      ticketChannel: "",
      ticketType: "",
      type:""
          },
          numOne:0,
          moyeOne:0,
6ee6b0b7   杨鑫   '最新'
158
159
160
161
162
163
      }
    },
    mounted() {
      this.getAll()
    },
    methods: {
8550d958   杨鑫   '最新'
164
165
166
167
      async getAll(){
          let res =   await getRefundData(this.pageIndex)
          this.tableData = res.data.list
          this.total = res.data.total
a5801e96   杨鑫   '最新'
168
169
170
171
172
          this.tableData.map(res=>{
            res.dataIntegrity = this.$decrypt(res.dataIntegrity)
            res.price = this.$decrypt(res.price)
            res.ticketPrice = this.$decrypt(res.ticketPrice)
          })
8550d958   杨鑫   '最新'
173
174
175
176
177
         let numOne= 0
         let moyeOne =0
         this.tableData.map(item=>{
           if(item.type == '1'){
              numOne += item.num
a5801e96   杨鑫   '最新'
178
             moyeOne +=Number(item.price)
8550d958   杨鑫   '最新'
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
232
233
234
235
236
           }
  
  
         })
         this.numOne = numOne
         this.moyeOne = moyeOne
  
          },
          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()
          },
          async daochu(){
            let res = await excelToRefundData(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'
            })
          },
6ee6b0b7   杨鑫   '最新'
237
238
239
240
241
242
243
244
      getSummaries(param) {
            const { columns, data } = param;
            const sums = [];
            columns.forEach((column, index) => {
              if (index === 0) {
                sums[index] = '总计';
                return;
              }
8550d958   杨鑫   '最新'
245
              if (['退票数(张)', '退票金额(元)'].includes(column.label)) {
6ee6b0b7   杨鑫   '最新'
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
                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;
8550d958   杨鑫   '最新'
265
  
6ee6b0b7   杨鑫   '最新'
266
          },
8550d958   杨鑫   '最新'
267
         async handleCurrentChange(val) {
6ee6b0b7   杨鑫   '最新'
268
            this.currentPage = val
8550d958   杨鑫   '最新'
269
270
271
272
273
             this.pageIndex.page = val
            try {
               const res = await getRefundData(this.pageIndex);
               this.tableData = res.data.list;
               this.total = res.data.total;
a5801e96   杨鑫   '最新'
274
275
276
277
278
              this.tableData.map(res=>{
                res.dataIntegrity = this.$decrypt(res.dataIntegrity)
                res.price = this.$decrypt(res.price)
                res.ticketPrice = this.$decrypt(res.ticketPrice)
              })
8550d958   杨鑫   '最新'
279
280
281
             } catch (error) {
               console.error('Error fetching data:', error);
             }
6ee6b0b7   杨鑫   '最新'
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
          },
          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
                      };
                    }
                  }
                }
8550d958   杨鑫   '最新'
301
                       }
6ee6b0b7   杨鑫   '最新'
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
329
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
358
359
   }
  </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>