Преглед на файлове

add gameHistory detail index

ethan преди 6 години
родител
ревизия
25ce44185f
променени са 3 файла, в които са добавени 181 реда и са изтрити 212 реда
  1. 1 2
      src/router/index.js
  2. 177 209
      src/views/room/detail/index.vue
  3. 3 1
      src/views/room/gameHistory/index.vue

+ 1 - 2
src/router/index.js

@@ -82,7 +82,7 @@ export const constantRouterMap = [
82 82
                 },
83 83
                 children: [
84 84
                   {
85
-                    path: '/room/index/gambleMember/index/gameHistory/detail/index',
85
+                    path: '/room/index/gambleMember/index/gameHistory/index/detail/index',
86 86
                     name: 'bucketHistory',
87 87
                     component: _import('room/detail/index'),
88 88
                     hidden: true,
@@ -181,7 +181,6 @@ export const constantRouterMap = [
181 181
                   title: '歷史紀錄'
182 182
                   // role: ['dd']
183 183
                 }
184
-                
185 184
               }
186 185
             ]
187 186
           }

+ 177 - 209
src/views/room/detail/index.vue

@@ -42,12 +42,14 @@
42 42
             <template slot-scope="scope">
43 43
                 <div>{{scope.row.MemberRecord.wagerServiceFees}}</div>
44 44
             </template>
45
-          </el-table-column>      
45
+          </el-table-column> 
46
+          <!-- 
46 47
           <el-table-column label="莊輸贏">
47 48
             <template slot-scope="scope">
48 49
               <div :style="moneyColor(scope.row.MemberRecord.earned)">{{scope.row.MemberRecord.earned}}</div>
49 50
             </template>
50
-          </el-table-column>     
51
+          </el-table-column>
52
+          -->
51 53
           <el-table-column label="莊贏抽水">
52 54
               <template slot-scope="scope">
53 55
                 <div>{{scope.row.MemberRecord.serviceFees}}</div>
@@ -57,7 +59,12 @@
57 59
             <template slot-scope="scope">
58 60
               <div :style="moneyColor(scope.row.bookieResult)">{{scope.row.bookieResult}}</div>
59 61
             </template>
60
-          </el-table-column>    
62
+          </el-table-column>
63
+          <el-table-column label="最終積分">
64
+            <template slot-scope="scope">
65
+              <div>{{scope.row.currentChips}}</div>
66
+            </template>
67
+          </el-table-column>  
61 68
         </el-table-column>             
62 69
       </el-table-column>                   
63 70
     </el-table>
@@ -177,37 +184,28 @@
177 184
 </template>
178 185
 
179 186
 <script>
180
-import { mapGetters, mapActions } from "vuex";
181
-import {
182
-  fetchDetails,
183
-  fetchRoundCount,
184
-  fetchDealingRecords,
185
-  fetchMemberRecords,
186
-  fetchRoundRecord,
187
-  fetchGameBid,
188
-  fetchWagerRecord,
189
-  fetchMemberInfo,
190
-  fetchPunishmentRecord
191
-} from "@/api/gambleGameBucket";
192
-import { fetchGambleMemberList } from "@/api/gambleMember";
193
-import { ponitTransform } from "@/utils/point";
194
-import _ from "lodash";
195
-import moment from "moment-timezone";
187
+
188
+import { mapGetters, mapActions } from 'vuex'
189
+import { fetchDetails, fetchRoundCount, fetchDealingRecords, fetchMemberRecords, fetchRoundRecord, fetchGameBid, fetchWagerRecord, fetchMemberInfo, fetchPunishmentRecord } from '@/api/gambleGameBucket'
190
+import { fetchGambleMemberList } from '@/api/gambleMember'
191
+import { ponitTransform } from '@/utils/point'
192
+import _ from 'lodash'
193
+import moment from 'moment-timezone'
196 194
 
197 195
 export default {
198 196
   data() {
199 197
     return {
200 198
       list: null,
201 199
       listLoading: true,
202
-      listQuery: {
203
-        round: 1
204
-      },
200
+      listQuery: { 
201
+        round: 1 
202
+      }, 
205 203
       detail: [],
206 204
       group: [],
207
-      statement: "",
205
+      statement: '',
208 206
       rowspan: 0,
209 207
       colspan: 0,
210
-      func: "",
208
+      func: '',
211 209
       rowIndex: 0,
212 210
       colIndex: 0,
213 211
       roundOptions: [],
@@ -220,290 +218,260 @@ export default {
220 218
       punishmentRecord: [],
221 219
       memberRecordTemp: [],
222 220
       wagerRecord: [],
223
-      roundTime: 0
224
-    };
221
+      roundTime: 0,
222
+    }
225 223
   },
226
-  created() {
224
+  async created() {
225
+    console.log('eqweqw')
226
+    await fetchRoundCount(this.data.fourLayer).then((response) => {
227
+      this.listQuery.round = response.data
228
+      for (let i = 1; i <= response.data; i++) {
229
+        this.roundOptions.push({ label: `第 ${i} 關`, key: i })
230
+      }
231
+    })
227 232
     fetchRoundRecord(this.data.fourLayer, this.listQuery).then(response => {
228
-      this.roundTime = response.data.createdAt;
229
-      this.door = response.data.initialDoor;
230
-    });
231
-    // fetchGameBid(this.data.secondLayer).then(response => {
233
+      this.roundTime = response.data.createdAt
234
+      this.door = response.data.initialDoor
235
+    })
236
+    // fetchGameBid(this.data.fourLayer).then(response => {
232 237
     //   this.bidChips = response.data
233 238
     // })
234
-    fetchRoundCount(this.data.fourLayer).then(response => {
235
-      this.listQuery.round = response.data;
236
-      for (let i = 1; i <= response.data; i++) {
237
-        this.roundOptions.push({ label: `第 ${i} 關`, key: i });
238
-      }
239
-    });
240
-    this.SetVisible(4);
241
-    this.getList();
239
+    this.SetVisible(4)
240
+    this.getList()
242 241
   },
243 242
   computed: {
244 243
     ...mapGetters([
245
-      "visible",
246
-      "data"
244
+      'visible',
245
+      'data',
247 246
       // 'query'
248 247
     ])
249 248
   },
250 249
   methods: {
251 250
     ...mapActions([
252
-      "SetVisible",
253
-      "SetData"
251
+      'SetVisible',
252
+      'SetData',
254 253
       // 'SetQuery'
255 254
     ]),
256 255
     getList() {
257
-      this.listLoading = true;
258
-      let detailTemp, dealingTemp, memberRecordTemp;
259
-      this.detail = [];
256
+      this.listLoading = true
257
+      let detailTemp, dealingTemp, memberRecordTemp
258
+      this.detail = []
260 259
       fetchWagerRecord(this.data.fourLayer, this.listQuery).then(response => {
261
-        this.wagerRecord = response.data;
262
-      });
263
-      fetchDealingRecords(this.data.fourLayer, this.listQuery).then(
264
-        response => {
265
-          dealingTemp = response.data.rows.filter(record => {
266
-            return record.door !== -1;
267
-          });
260
+        this.wagerRecord = response.data
261
+      })
262
+      fetchDealingRecords(this.data.fourLayer, this.listQuery).then(response => {
263
+        dealingTemp = response.data.rows.filter(record => {
264
+          return record.door !== -1
265
+        })
268 266
 
269
-          const deal = {};
270
-          const member = {};
271
-          dealingTemp.map((record, index) => {
272
-            deal[`door_${index % 6}`] = record.door;
273
-            deal[`point1_${index % 6}`] = record.point1;
274
-            deal[`point2_${index % 6}`] = record.point2;
275
-            deal[`totalPoints_${index % 6}`] = record.totalPoints;
276
-            record.GambleMember
277
-              ? (member[`member_${index % 6}`] = record.GambleMember.name)
278
-              : false;
279
-            if (index % 6 === 5) {
280
-              this.dealing.push(deal);
281
-              this.dealing.push(member);
282
-            }
283
-          });
284
-        }
285
-      );
286
-      fetchMemberRecords(this.data.fourLayer, this.listQuery).then(
287
-        response => {
288
-          this.memberRecordTemp = response.data.rows;
289
-          let memberRecordTemp = _.groupBy(response.data.rows, record => {
290
-            return record.door;
291
-          });
292
-          this.memberRecord = Object.values(memberRecordTemp);
293
-        }
294
-      );
267
+        const deal = {}
268
+        const member = {}
269
+        dealingTemp.map((record, index) => {
270
+          deal[`door_${index % 6}`] = record.door
271
+          deal[`point1_${index % 6}`] = record.point1
272
+          deal[`point2_${index % 6}`] = record.point2
273
+          deal[`totalPoints_${index % 6}`] = record.totalPoints
274
+          record.GambleMember ? member[`member_${index % 6}`] = record.GambleMember.name : false
275
+          if (index % 6 === 5) {
276
+            this.dealing.push(deal)
277
+            this.dealing.push(member)
278
+          }
279
+        })
280
+      })
281
+      fetchMemberRecords(this.data.fourLayer, this.listQuery).then(response => {
282
+        this.memberRecordTemp = response.data.rows
283
+        let memberRecordTemp = _.groupBy(response.data.rows, record => {
284
+          return record.door
285
+        })
286
+        this.memberRecord = Object.values(memberRecordTemp )
287
+      })
295 288
       fetchDetails(this.data.fourLayer, this.listQuery).then(response => {
296 289
         detailTemp = response.data.rows.filter(record => {
297
-          return (
298
-            record.DealingRecord.door !== -1 &&
290
+          return record.DealingRecord.door !== -1 &&
299 291
             record.MemberRecord.door !== -1 &&
300 292
             record.MemberRecord.door === record.DealingRecord.door
301
-          );
302
-        });
293
+        })
303 294
 
304 295
         this.bookie = response.data.rows.filter(record => {
305
-          return (
306
-            record.DealingRecord.door === -1 &&
296
+          return record.DealingRecord.door === -1 &&
307 297
             record.MemberRecord.door === -1 &&
308 298
             record.MemberRecord.door === record.DealingRecord.door
309
-          );
310
-        });
299
+        })
311 300
         // console.log('this', this.memberRecord)
312
-        // this.bidChips ? this.bookie[0].bidChips = this.bidChips : false
301
+        // this.bidChips ? this.bookie[0].bidChips = this.bidChips : false        
313 302
         this.group = _.groupBy(detailTemp, record => {
314
-          return record.MemberRecord.GambleMember.name;
315
-        });
316
-        this.group = Object.values(this.group);
317
-        console.log("wwww", this.group);
318
-
303
+          return record.MemberRecord.GambleMember.name
304
+        })
305
+        this.group = Object.values(this.group)
306
+        console.log('wwww', this.group)
307
+        
319 308
         this.group.map(member => {
320 309
           // console.log('aaaaa', member)
321
-          let currentChips =
322
-            _.sumBy(member, record => {
323
-              return record.MemberRecord.chips;
324
-            }) + member[0].MemberRecord.currentChips;
325
-          for (const item of member) {
326
-            item.MemberRecord.currentChips = currentChips;
310
+          let currentChips = _.sumBy(member, record => {
311
+            return record.MemberRecord.chips
312
+          }) + member[0].MemberRecord.currentChips
313
+          for(const item of member) {
314
+            item.MemberRecord.currentChips = currentChips
327 315
           }
328
-        });
316
+        })
329 317
         this.detail = this.group.reduce((arr, element) => {
330
-          return arr.concat(element);
331
-        }, []);
332
-        console.log("eee", this.detail);
318
+          return arr.concat(element)
319
+        }, [])
320
+        console.log('eee', this.detail)
333 321
         this.bookie[0].effectiveWagger = _.sumBy(this.detail, item => {
334
-          return Math.abs(item.MemberRecord.earned);
335
-        });
336
-        console.log("ssss", this.detail);
337
-        this.bookie[0].bookieResult =
338
-          this.bookie[0].MemberRecord.earned -
339
-          this.bookie[0].MemberRecord.serviceFees;
322
+          return Math.abs(item.MemberRecord.earned) ;
323
+        })
324
+        console.log('ssss', this.detail)
325
+        this.bookie[0].currentChips = Number(this.bookie[0].MemberRecord.currentChips) + Number(this.bookie[0].MemberRecord.chips)
326
+        this.bookie[0].bookieResult = this.bookie[0].MemberRecord.earned - this.bookie[0].MemberRecord.serviceFees - this.bookie[0].MemberRecord.wagerServiceFees -this.bookie[0].MemberRecord.FixedServiceFees
340 327
         // console.log('bookie', this.bookie[0].effectiveWagger)
341 328
         this.group.map((item, itemIndex) => {
342
-          let totalChips = 0;
329
+          let totalChips = 0
343 330
           item.map((person, personIndex) => {
344
-            totalChips =
345
-              totalChips +
346
-              person.MemberRecord.earned -
347
-              person.MemberRecord.serviceFees;
348
-            item.length - 1 === personIndex
349
-              ? (this.detail[this._sum(itemIndex)].totalChips = totalChips)
350
-              : false;
351
-          });
352
-        });
331
+            totalChips = totalChips + person.MemberRecord.earned - person.MemberRecord.serviceFees
332
+            item.length - 1 === personIndex ? this.detail[this._sum(itemIndex)].totalChips = totalChips : false
333
+          })
334
+        })
353 335
 
354 336
         for (let i = 0; i < this.group.length; i++) {
355 337
           if (i === 0) {
356
-            this.statement = `if(this.rowIndex === ${i}){
338
+            this.statement =
339
+            `if(this.rowIndex === ${i}){
357 340
               this.rowspan = ${this.group[i].length},
358 341
               this.colspan = 1
359
-            }`;
342
+            }`
360 343
           } else {
361
-            this.statement += `else if(this.rowIndex === ${this._sum(i)}){
344
+            this.statement +=
345
+            `else if(this.rowIndex === ${this._sum(i)}){
362 346
               this.rowspan = ${this.group[i].length},
363 347
               this.colspan = 1 
364
-            }`;
348
+            }`
365 349
           }
366 350
           if (i === this.group.length - 1) {
367
-            this.statement += `else {
351
+            this.statement +=
352
+            `else {
368 353
               this.rowspan = 0,
369 354
               this.colspan = 0
370
-            }`;
355
+            }`
371 356
           }
372 357
         }
373 358
 
374
-        this.func = eval(`(function() {${this.statement}})`);
375
-      });
376
-      fetchPunishmentRecord(this.data.fourLayer, this.listQuery).then(
377
-        response => {
378
-          this.punishmentRecord = response.data;
379
-        }
380
-      );
359
+        this.func = eval(`(function() {${this.statement}})`)
360
+      })
361
+      fetchPunishmentRecord(this.data.fourLayer, this.listQuery).then(response => {
362
+        this.punishmentRecord = response.data
363
+      })
381 364
       fetchMemberInfo(this.data.fourLayer, this.listQuery).then(response => {
382
-        let { data } = response;
383
-        let members = {};
384
-        this.members = [];
365
+        let { data } = response
366
+        let members = {}
367
+        this.members = []
385 368
         data.map((person, index) => {
386 369
           if (index % 4 === 0) {
387
-            members.name_0 = person.GambleMember.name;
388
-            members.chips_0 = person.chips;
389
-            index === data.length - 1 ? this.members.push(members) : false;
370
+            members.name_0 = person.GambleMember.name
371
+            members.chips_0 = person.chips
372
+            index === data.length - 1 ? this.members.push(members) : false
390 373
           } else if (index % 4 === 1) {
391
-            members.name_1 = person.GambleMember.name;
392
-            members.chips_1 = person.chips;
393
-            index === data.length - 1 ? this.members.push(members) : false;
374
+            members.name_1 = person.GambleMember.name
375
+            members.chips_1 = person.chips
376
+            index === data.length - 1 ? this.members.push(members) : false
394 377
           } else if (index % 4 === 2) {
395
-            members.name_2 = person.GambleMember.name;
396
-            members.chips_2 = person.chips;
397
-            index === data.length - 1 ? this.members.push(members) : false;
378
+            members.name_2 = person.GambleMember.name
379
+            members.chips_2 = person.chips
380
+            index === data.length - 1 ? this.members.push(members) : false
398 381
           } else if (index % 4 === 3) {
399
-            members.name_3 = person.GambleMember.name;
400
-            members.chips_3 = person.chips;
401
-            this.members.push(members);
402
-            members = {};
382
+            members.name_3 = person.GambleMember.name
383
+            members.chips_3 = person.chips
384
+            this.members.push(members)
385
+            members = {}
403 386
           }
404
-        });
405
-      });
387
+        })
388
+      })
406 389
 
407
-      this.listLoading = false;
390
+      this.listLoading = false
408 391
     },
409 392
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
410
-      if (
411
-        columnIndex === 0 ||
412
-        columnIndex === 5 ||
413
-        columnIndex === 6 ||
414
-        columnIndex === 7 ||
415
-        columnIndex === 8
416
-      ) {
417
-        this.rowIndex = rowIndex;
418
-        this.columnIndex = columnIndex;
419
-        const that = this;
393
+      if (columnIndex === 0 || columnIndex === 5 || columnIndex === 6 || columnIndex === 7 || columnIndex === 8) {
394
+        this.rowIndex = rowIndex
395
+        this.columnIndex = columnIndex
396
+        const that = this
420 397
 
421
-        this.func();
398
+        this.func()
422 399
         return {
423 400
           rowspan: this.rowspan,
424 401
           colspan: this.colspan
425
-        };
402
+        }
426 403
       }
427 404
     },
428 405
     getSummaries() {
429
-      const sums = [];
430
-      this.wagerRecord.map((door, index) => {
431
-        if (index === 0) sums[index] = "總押注";
432
-        sums[index + 1] = door.chips;
433
-      });
434
-      return sums;
406
+      const sums = []
407
+        this.wagerRecord.map((door, index) => {
408
+          if (index === 0) sums[index] = '總押注'
409
+          sums[index+1] = door.chips
410
+        })
411
+      return sums
435 412
     },
436 413
     handleFilter() {
437 414
       fetchRoundRecord(this.data.fourLayer, this.listQuery).then(response => {
438
-        this.roundTime = response.data.createdAt;
439
-        this.door = response.data.initialDoor;
440
-      });
441
-      // this.SetQuery({layer:2, query: {round: this.query.secondLayer.round}})
442
-      this.dealing = [];
443
-      this.getList();
415
+        this.roundTime = response.data.createdAt        
416
+        this.door = response.data.initialDoor
417
+      })
418
+      console.log('door', this.door)
419
+      // this.SetQuery({layer:2, query: {round: this.query.fourLayer.round}})      
420
+      this.dealing = []
421
+      this.getList()
444 422
     },
445 423
     moment(time) {
446
-      return moment(time)
447
-        .tz("Asia/Taipei")
448
-        .format("YYYY-MM-DD HH:mm:ss");
424
+      return moment(time).tz('Asia/Taipei').format('YYYY-MM-DD HH:mm:ss')
449 425
     },
450 426
     moneyColor(money) {
451
-      return money >= 0 ? { color: "#67C23A" } : { color: "#FA5555" };
427
+      return money >= 0 ? { color: '#67C23A' } : { color: '#FA5555' }
452 428
     },
453 429
     // TODO refactor
454 430
     doorTableSwitch(rowIndex, colIndex) {
455 431
       if (rowIndex === 0) {
456
-        return `${this.dealing[0][`point1_${colIndex}`]} | ${
457
-          this.dealing[0][`point2_${colIndex}`]
458
-        } / ${this.point({
459
-          point1: this.dealing[0][`point1_${colIndex}`],
460
-          point2: this.dealing[0][`point2_${colIndex}`],
461
-          totalPoints: this.dealing[0][`totalPoints_${colIndex}`]
462
-        })}`;
432
+        return `${this.dealing[0][`point1_${colIndex}`]} | ${this.dealing[0][`point2_${colIndex}`]} / ${this.point({point1: this.dealing[0][`point1_${colIndex}`] ,point2: this.dealing[0][`point2_${colIndex}`] ,totalPoints: this.dealing[0][`totalPoints_${colIndex}`]})}`
463 433
       }
464 434
       if (rowIndex === 1) {
465
-        return this.dealing[1][`member_${colIndex}`]
466
-          ? `${this.dealing[1][`member_${colIndex}`]}`
467
-          : "從缺";
435
+        return this.dealing[1][`member_${colIndex}`] ? `${this.dealing[1][`member_${colIndex}`]}` : '從缺'
468 436
       }
469 437
     },
470 438
     _sum(i) {
471
-      let count = 0;
439
+      let count = 0
472 440
       for (let j = 0; j < i; j++) {
473
-        count += this.group[j].length;
441
+        count += this.group[j].length
474 442
       }
475
-      return count;
443
+      return count
476 444
     },
477 445
     point(dealingRecord) {
478
-      return ponitTransform(dealingRecord);
446
+      return ponitTransform(dealingRecord)
479 447
     },
480
-    initDoor({ row, column, rowIndex, columnIndex }) {
481
-      return columnIndex === this.door ? { color: "#F56C6C" } : ``;
448
+    initDoor({row, column, rowIndex, columnIndex}) {
449
+      return  columnIndex === this.door ? { color: '#F56C6C' } : ``
482 450
     },
483
-    reason(reason) {
484
-      switch (reason) {
485
-        case "NO_DRAW_RIGHTS":
486
-          return "亂抽紅包";
487
-          break;
488
-        case "NO_RESPONSE":
489
-          return "門主未抽紅包";
490
-          break;
451
+    reason(reason ){
452
+      switch(reason) {
453
+        case 'NO_DRAW_RIGHTS':
454
+          return '亂抽紅包'
455
+        break;
456
+        case 'NO_RESPONSE':
457
+          return '門主未抽紅包'
458
+        break;
491 459
         default:
492
-          return "請找客服";
460
+          return '請找客服'
493 461
       }
494 462
     },
495 463
     hasPunishment(data) {
496
-      return data.length !== 0 ? true : false;
464
+      return data.length !== 0 ? true : false
497 465
     }
498 466
   },
499 467
   destroyed() {
500
-    this.SetVisible(3);
468
+    this.SetVisible(3)
501 469
   }
502
-};
470
+}
503 471
 </script>
504 472
 <style>
505
-div {
473
+div{
506 474
   font-weight: bold;
507
-  font-size: 25px;
475
+  font-size: 25px
508 476
 }
509 477
 </style>

+ 3 - 1
src/views/room/gameHistory/index.vue

@@ -41,7 +41,9 @@
41 41
           <el-table-column align="center" label="操作" width="250">
42 42
             <template slot-scope="scope">
43 43
                 <el-button v-show="scope.row.type==='遊戲'" type="primary" size="mini" icon="el-icon-tickets" @click="handlePersonDetail(scope.row)">個人明細</el-button>  
44
-                <el-button v-show="scope.row.type==='遊戲'" type="primary" size="mini" icon="el-icon-tickets" @click="handleGameDetail(scope.row)">此場明細</el-button>                
44
+                <router-link to="/room/index/gambleMember/index/gameHistory/index/detail/index">
45
+                  <el-button v-show="scope.row.type==='遊戲'" type="primary" size="mini" icon="el-icon-tickets" @click="handleGameDetail(scope.row)">此場明細</el-button>                
46
+                </router-link>
45 47
             </template>
46 48
           </el-table-column>
47 49
         </el-table-column>