浏览代码

fix gameBucket wallet

ethan 6 年之前
父节点
当前提交
3a9604a932
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      src/views/room/gameHistory/index.vue

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

@@ -35,7 +35,7 @@
35 35
           </el-table-column>
36 36
           <el-table-column label="錢包" align="center">
37 37
             <template slot-scope="scope">
38
-              <span :style="moneyColor(scope.row.wallet)">{{scope.row.wallet}}</span>
38
+              <span>{{scope.row.wallet}}</span>
39 39
             </template>
40 40
           </el-table-column>
41 41
           <el-table-column align="center" label="操作" width="250">
@@ -167,16 +167,21 @@ export default {
167 167
       //this.list = []
168 168
       await fetchGameHistory(this.data.thirdLayer, this.listQuery).then(response => {
169 169
         this.chipLogList = response.data
170
-        console.log('wallet', this.chipLogList,this.data.thirdLayer)
171 170
         this.tempCurrentChips = []
172 171
         this.chipLogList.map((item) => {
173 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 179
             this.list.unshift({
175 180
               id: item.game,
176 181
               createdAt: item['GambleGame-Bucket'].createdAt,
177 182
               type: '遊戲',
178 183
               amount: item.earned,
179
-              wallet: response.data.currentChips
184
+              wallet: item.currentChips
180 185
             })
181 186
              
182 187
           })