浏览代码

TODO array problem

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

+ 27 - 10
src/views/room/gameHistory/index.vue

18
       </div>
18
       </div>
19
       <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row>
19
       <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row>
20
         <el-table-column :label="data.thirdLayer.name" align="center">
20
         <el-table-column :label="data.thirdLayer.name" align="center">
21
-          <el-table-column label="時間" align="center">
22
-            <template slot-scope="scope">
21
+          <el-table-column sortable="true"  :default-sort = "{prop: 'createdAt', order: 'descending'}" label="時間" align="center">
22
+            <template slot-scope="scope" prop="createdAt">
23
               <span>{{moment(scope.row.createdAt)}}</span>
23
               <span>{{moment(scope.row.createdAt)}}</span>
24
             </template>
24
             </template>
25
           </el-table-column>
25
           </el-table-column>
170
         this.tempCurrentChips = []
170
         this.tempCurrentChips = []
171
         this.chipLogList.map((item) => {
171
         this.chipLogList.map((item) => {
172
           fetchCurrentChips(item['GambleGame-Bucket'], this.data.thirdLayer).then(response => {
172
           fetchCurrentChips(item['GambleGame-Bucket'], this.data.thirdLayer).then(response => {
173
+            this.$set(this.list,this.list.length,{
174
+              id: item.game,
175
+              createdAt: item['GambleGame-Bucket'].createdAt,
176
+              type: '遊戲',
177
+              amount: item.earned,
178
+              wallet: response.data.currentChips
179
+            })
180
+            /**
173
             this.list.push({
181
             this.list.push({
174
               id: item.game,
182
               id: item.game,
175
               createdAt: item['GambleGame-Bucket'].createdAt,
183
               createdAt: item['GambleGame-Bucket'].createdAt,
177
               amount: item.earned,
185
               amount: item.earned,
178
               wallet: response.data.currentChips
186
               wallet: response.data.currentChips
179
             })
187
             })
188
+             */
180
           })
189
           })
181
         })
190
         })
182
         this.listLoading = false
191
         this.listLoading = false
187
           if(item.type === config.const.GambleMemberChipsLog.type.deposit) item.type =  '上 / 下 分';
196
           if(item.type === config.const.GambleMemberChipsLog.type.deposit) item.type =  '上 / 下 分';
188
           if(item.type === config.const.GambleMemberChipsLog.type.reward) item.type =  '獎勵 / 懲罰';
197
           if(item.type === config.const.GambleMemberChipsLog.type.reward) item.type =  '獎勵 / 懲罰';
189
           if(item.type === config.const.GambleMemberChipsLog.type.reset) item.type =  '歸零';
198
           if(item.type === config.const.GambleMemberChipsLog.type.reset) item.type =  '歸零';
190
-  
199
+          this.$set(this.list,this.list.length, {
200
+            id: item.id,
201
+            createdAt: item.createdAt,
202
+            type: item.type,
203
+            amount: item.chips,
204
+            wallet: item.totalChips
205
+          })
206
+          /*
191
           this.list.push({
207
           this.list.push({
192
             id: item.id,
208
             id: item.id,
193
             createdAt: item.createdAt,
209
             createdAt: item.createdAt,
195
             amount: item.chips,
211
             amount: item.chips,
196
             wallet: item.totalChips
212
             wallet: item.totalChips
197
           })
213
           })
214
+          */
198
         })
215
         })
199
 
216
 
200
       })
217
       })
201
-      console.log('eeeesdsad',this.list)
202
-        this.list.sort(function compare(a, b) {
203
-          const dateA = new Date(a.createdAt);
204
-          const dateB = new Date(b.createdAt);
205
-          return  dateB - dateA;
206
-        });
218
+            console.log('this.' ,this.list.__ob__)
219
+      this.list.sort(function compare(a, b) {
220
+        const dateA = new Date(a.createdAt);
221
+        const dateB = new Date(b.createdAt);
222
+        return  dateB - dateA;
223
+      });
224
+            console.log('that.',this.list)
207
         this.total = this.list.length
225
         this.total = this.list.length
208
         this.listLoading = false
226
         this.listLoading = false
209
-      
210
     },
227
     },
211
     handlePersonDetail(row) {
228
     handlePersonDetail(row) {
212
       this.listLoading = true
229
       this.listLoading = true