Browse Source

TODO vue arry problem

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

+ 8 - 28
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 sortable="true"  :default-sort = "{prop: 'createdAt', order: 'descending'}" label="時間" align="center">
21
+          <el-table-column label="時間" align="center">
22
             <template slot-scope="scope" prop="createdAt">
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>
163
     ]),
163
     ]),
164
     getList() {
164
     getList() {
165
       this.listLoading = true
165
       this.listLoading = true
166
-      this.list = []
166
+      //this.list = []
167
       fetchGameHistory(this.data.thirdLayer, this.listQuery).then(response => {
167
       fetchGameHistory(this.data.thirdLayer, this.listQuery).then(response => {
168
         this.chipLogList = response.data
168
         this.chipLogList = response.data
169
         console.log('wallet', this.chipLogList,this.data.thirdLayer)
169
         console.log('wallet', this.chipLogList,this.data.thirdLayer)
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,{
173
+            this.list.unshift({
174
               id: item.game,
174
               id: item.game,
175
               createdAt: item['GambleGame-Bucket'].createdAt,
175
               createdAt: item['GambleGame-Bucket'].createdAt,
176
               type: '遊戲',
176
               type: '遊戲',
177
               amount: item.earned,
177
               amount: item.earned,
178
               wallet: response.data.currentChips
178
               wallet: response.data.currentChips
179
             })
179
             })
180
-            /**
181
-            this.list.push({
182
-              id: item.game,
183
-              createdAt: item['GambleGame-Bucket'].createdAt,
184
-              type: '遊戲',
185
-              amount: item.earned,
186
-              wallet: response.data.currentChips
187
-            })
188
-             */
180
+             
189
           })
181
           })
190
         })
182
         })
191
-        this.listLoading = false
192
       })
183
       })
193
       fetchChipsHistory(this.data.thirdLayer, this.listQuery).then(response => {
184
       fetchChipsHistory(this.data.thirdLayer, this.listQuery).then(response => {
194
         this.gameRecordList = response.data
185
         this.gameRecordList = response.data
196
           if(item.type === config.const.GambleMemberChipsLog.type.deposit) item.type =  '上 / 下 分';
187
           if(item.type === config.const.GambleMemberChipsLog.type.deposit) item.type =  '上 / 下 分';
197
           if(item.type === config.const.GambleMemberChipsLog.type.reward) item.type =  '獎勵 / 懲罰';
188
           if(item.type === config.const.GambleMemberChipsLog.type.reward) item.type =  '獎勵 / 懲罰';
198
           if(item.type === config.const.GambleMemberChipsLog.type.reset) item.type =  '歸零';
189
           if(item.type === config.const.GambleMemberChipsLog.type.reset) item.type =  '歸零';
199
-          this.$set(this.list,this.list.length, {
190
+          this.list.unshift({
200
             id: item.id,
191
             id: item.id,
201
             createdAt: item.createdAt,
192
             createdAt: item.createdAt,
202
             type: item.type,
193
             type: item.type,
203
             amount: item.chips,
194
             amount: item.chips,
204
             wallet: item.totalChips
195
             wallet: item.totalChips
205
           })
196
           })
206
-          /*
207
-          this.list.push({
208
-            id: item.id,
209
-            createdAt: item.createdAt,
210
-            type: item.type,
211
-            amount: item.chips,
212
-            wallet: item.totalChips
213
-          })
214
-          */
215
         })
197
         })
216
-
217
       })
198
       })
218
-            console.log('this.' ,this.list.__ob__)
199
+      console.log('wwwwwwww', this.list)
219
       this.list.sort(function compare(a, b) {
200
       this.list.sort(function compare(a, b) {
220
         const dateA = new Date(a.createdAt);
201
         const dateA = new Date(a.createdAt);
221
         const dateB = new Date(b.createdAt);
202
         const dateB = new Date(b.createdAt);
222
         return  dateB - dateA;
203
         return  dateB - dateA;
223
       });
204
       });
224
-            console.log('that.',this.list)
225
-        this.total = this.list.length
226
-        this.listLoading = false
205
+      this.total = this.list.length
206
+      this.listLoading = false
227
     },
207
     },
228
     handlePersonDetail(row) {
208
     handlePersonDetail(row) {
229
       this.listLoading = true
209
       this.listLoading = true