Browse Source

fix gameBucket wallet

ethan 6 years ago
parent
commit
3a9604a932
1 changed files with 8 additions and 3 deletions
  1. 8 3
      src/views/room/gameHistory/index.vue

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

35
           </el-table-column>
35
           </el-table-column>
36
           <el-table-column label="錢包" align="center">
36
           <el-table-column label="錢包" align="center">
37
             <template slot-scope="scope">
37
             <template slot-scope="scope">
38
-              <span :style="moneyColor(scope.row.wallet)">{{scope.row.wallet}}</span>
38
+              <span>{{scope.row.wallet}}</span>
39
             </template>
39
             </template>
40
           </el-table-column>
40
           </el-table-column>
41
           <el-table-column align="center" label="操作" width="250">
41
           <el-table-column align="center" label="操作" width="250">
167
       //this.list = []
167
       //this.list = []
168
       await fetchGameHistory(this.data.thirdLayer, this.listQuery).then(response => {
168
       await fetchGameHistory(this.data.thirdLayer, this.listQuery).then(response => {
169
         this.chipLogList = response.data
169
         this.chipLogList = response.data
170
-        console.log('wallet', this.chipLogList,this.data.thirdLayer)
171
         this.tempCurrentChips = []
170
         this.tempCurrentChips = []
172
         this.chipLogList.map((item) => {
171
         this.chipLogList.map((item) => {
173
           fetchCurrentChips(item['GambleGame-Bucket'], this.data.thirdLayer).then(response => {
172
           fetchCurrentChips(item['GambleGame-Bucket'], this.data.thirdLayer).then(response => {
173
+            item.earned = _.sumBy(response.data, item => {
174
+              return item.earned - item.serviceFees
175
+            })
176
+            let round = _.groupBy(response.data, 'round')
177
+            round = Object.values(round)
178
+            item.currentChips = _.sumBy(round[round.length-1], 'chips') + round[round.length-1][0].currentChips
174
             this.list.unshift({
179
             this.list.unshift({
175
               id: item.game,
180
               id: item.game,
176
               createdAt: item['GambleGame-Bucket'].createdAt,
181
               createdAt: item['GambleGame-Bucket'].createdAt,
177
               type: '遊戲',
182
               type: '遊戲',
178
               amount: item.earned,
183
               amount: item.earned,
179
-              wallet: response.data.currentChips
184
+              wallet: item.currentChips
180
             })
185
             })
181
              
186
              
182
           })
187
           })