Pārlūkot izejas kodu

TODO array problem

ethan 6 gadi atpakaļ
vecāks
revīzija
6852abd323
1 mainītis faili ar 27 papildinājumiem un 10 dzēšanām
  1. 27 10
      src/views/room/gameHistory/index.vue

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

@@ -18,8 +18,8 @@
18 18
       </div>
19 19
       <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row>
20 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 23
               <span>{{moment(scope.row.createdAt)}}</span>
24 24
             </template>
25 25
           </el-table-column>
@@ -170,6 +170,14 @@ export default {
170 170
         this.tempCurrentChips = []
171 171
         this.chipLogList.map((item) => {
172 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 181
             this.list.push({
174 182
               id: item.game,
175 183
               createdAt: item['GambleGame-Bucket'].createdAt,
@@ -177,6 +185,7 @@ export default {
177 185
               amount: item.earned,
178 186
               wallet: response.data.currentChips
179 187
             })
188
+             */
180 189
           })
181 190
         })
182 191
         this.listLoading = false
@@ -187,7 +196,14 @@ export default {
187 196
           if(item.type === config.const.GambleMemberChipsLog.type.deposit) item.type =  '上 / 下 分';
188 197
           if(item.type === config.const.GambleMemberChipsLog.type.reward) item.type =  '獎勵 / 懲罰';
189 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 207
           this.list.push({
192 208
             id: item.id,
193 209
             createdAt: item.createdAt,
@@ -195,18 +211,19 @@ export default {
195 211
             amount: item.chips,
196 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 225
         this.total = this.list.length
208 226
         this.listLoading = false
209
-      
210 227
     },
211 228
     handlePersonDetail(row) {
212 229
       this.listLoading = true