Browse Source

all current chips

EthnaYeh 6 years ago
parent
commit
a30e13f26e
2 changed files with 20 additions and 25 deletions
  1. 6 0
      src/api/gambleGameBucket.js
  2. 14 25
      src/views/gambleGameBucket/detail/index.vue

+ 6 - 0
src/api/gambleGameBucket.js

71
     method: 'get'
71
     method: 'get'
72
   })
72
   })
73
 }
73
 }
74
+export function fetchMemberInfo(data, query = { round: 1 }) {
75
+  return request({
76
+    url: `/gambleGameBuckets/${data.id}/round/${query.round}/memberInfo`,
77
+    method: 'get'
78
+  })
79
+}
74
 // export function fetchRoundRecord(data) {
80
 // export function fetchRoundRecord(data) {
75
 //   return request({
81
 //   return request({
76
 //     url: `/gambleGameBuckets/${data.id}/initDoor`,
82
 //     url: `/gambleGameBuckets/${data.id}/initDoor`,

+ 14 - 25
src/views/gambleGameBucket/detail/index.vue

122
             <div :style="moneyColor(scope.row.totalChips)">{{scope.row.totalChips}}</div>
122
             <div :style="moneyColor(scope.row.totalChips)">{{scope.row.totalChips}}</div>
123
           </template>
123
           </template>
124
         </el-table-column>
124
         </el-table-column>
125
-        <el-table-column prop="MemberRecord.currentChips" label="最終積分">
125
+        <el-table-column label="最終積分">
126
+          <template slot-scope="scope">
127
+            <div>{{scope.row.MemberRecord.currentChips+scope.row.MemberRecord.chips}}</div>
128
+          </template>
126
         </el-table-column>
129
         </el-table-column>
127
       </el-table-column>      
130
       </el-table-column>      
128
     </el-table>
131
     </el-table>
155
 <script>
158
 <script>
156
 
159
 
157
 import { mapGetters, mapActions } from 'vuex'
160
 import { mapGetters, mapActions } from 'vuex'
158
-import { fetchDetails, fetchRoundCount, fetchDealingRecords, fetchMemberRecords, fetchRoundRecord, fetchGameBid, fetchWagerRecord } from '@/api/gambleGameBucket'
161
+import { fetchDetails, fetchRoundCount, fetchDealingRecords, fetchMemberRecords, fetchRoundRecord, fetchGameBid, fetchWagerRecord, fetchMemberInfo } from '@/api/gambleGameBucket'
159
 import { fetchGambleMemberList } from '@/api/gambleMember'
162
 import { fetchGambleMemberList } from '@/api/gambleMember'
160
 import { ponitTransform } from '@/utils/point'
163
 import { ponitTransform } from '@/utils/point'
161
 import _ from 'lodash'
164
 import _ from 'lodash'
274
         this.bookie[0].effectiveWagger = _.sumBy(this.detail, item => {
277
         this.bookie[0].effectiveWagger = _.sumBy(this.detail, item => {
275
           return Math.abs(item.MemberRecord.earned) ;
278
           return Math.abs(item.MemberRecord.earned) ;
276
         })
279
         })
280
+        console.log('ssss', this.detail)
277
         this.bookie[0].bookieResult = this.bookie[0].MemberRecord.earned - this.bookie[0].MemberRecord.serviceFees
281
         this.bookie[0].bookieResult = this.bookie[0].MemberRecord.earned - this.bookie[0].MemberRecord.serviceFees
278
         // console.log('bookie', this.bookie[0].effectiveWagger)
282
         // console.log('bookie', this.bookie[0].effectiveWagger)
279
         this.group.map((item, itemIndex) => {
283
         this.group.map((item, itemIndex) => {
310
         this.func = eval(`(function() {${this.statement}})`)
314
         this.func = eval(`(function() {${this.statement}})`)
311
       })
315
       })
312
 
316
 
313
-      fetchGambleMemberList({ page: 1, limit: 9999999999, chipsSort: 'DESC' }).then(response => {
314
-        let { rows } = response.data
315
-        this.members = [];
317
+      fetchMemberInfo(this.data.secondLayer, this.listQuery).then(response => {
318
+        let { data } = response
319
+    
316
         let members = {}
320
         let members = {}
317
-        // TODO refactor
318
-        let recordMembers = _.groupBy(this.memberRecordTemp, record => {
319
-          return record.GambleMember.id
320
-        })
321
-        recordMembers = Object.values(recordMembers)
322
-        let roundMembers = []
323
-        recordMembers.map(member => {
324
-          let roundMember = {}
325
-          roundMember.chips = member[0].currentChips
326
-          roundMember.name = member[0].GambleMember.name
327
-          roundMember.id = member[0].GambleMember.id
328
-          roundMembers.push(roundMember)
329
-        })
330
-        rows = _.unionBy(roundMembers, rows, "id");
331
-        rows = _.sortBy(rows, 'chips').reverse()
332
-        rows.map((person, index) => {
321
+        data.map((person, index) => {
333
           if (index % 4 === 0) {
322
           if (index % 4 === 0) {
334
-            members.name_0 = person.name
323
+            members.name_0 = person.GambleMember.name
335
             members.chips_0 = person.chips
324
             members.chips_0 = person.chips
336
             index === response.data.count - 1 ? this.members.push(members) : false
325
             index === response.data.count - 1 ? this.members.push(members) : false
337
           } else if (index % 4 === 1) {
326
           } else if (index % 4 === 1) {
338
-            members.name_1 = person.name
327
+            members.name_1 = person.GambleMember.name
339
             members.chips_1 = person.chips
328
             members.chips_1 = person.chips
340
             index === response.data.count - 1 ? this.members.push(members) : false
329
             index === response.data.count - 1 ? this.members.push(members) : false
341
           } else if (index % 4 === 2) {
330
           } else if (index % 4 === 2) {
342
-            members.name_2 = person.name
331
+            members.name_2 = person.GambleMember.name
343
             members.chips_2 = person.chips
332
             members.chips_2 = person.chips
344
             index === response.data.count - 1 ? this.members.push(members) : false
333
             index === response.data.count - 1 ? this.members.push(members) : false
345
           } else if (index % 4 === 3) {
334
           } else if (index % 4 === 3) {
346
-            members.name_3 = person.name
335
+            members.name_3 = person.GambleMember.name
347
             members.chips_3 = person.chips
336
             members.chips_3 = person.chips
348
             this.members.push(members)
337
             this.members.push(members)
349
             members = {}
338
             members = {}