Browse Source

history page 1st version

EthnaYeh 7 years ago
parent
commit
9291e06817
2 changed files with 27 additions and 17 deletions
  1. 8 0
      src/api/gambleMember.js
  2. 19 17
      src/views/gambleMember/detail/index.vue

+ 8 - 0
src/api/gambleMember.js

34
     }
34
     }
35
   })
35
   })
36
 }
36
 }
37
+
38
+export function fetchHistory(data, query) {
39
+  return request({
40
+    url: `/gambleMembers/${data.id}/history`,
41
+    method: 'get'
42
+    // params: {}
43
+  })
44
+}

+ 19 - 17
src/views/gambleMember/detail/index.vue

1
 <template>
1
 <template>
2
   <div class="app-container">
2
   <div class="app-container">
3
     <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row>
3
     <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row>
4
-      <el-table-column align="center" label='ID' width="95">
4
+      <el-table-column label="場" align="center">
5
         <template slot-scope="scope">
5
         <template slot-scope="scope">
6
-          {{scope.$index}}
6
+          {{scope.row.game}}
7
         </template>
7
         </template>
8
       </el-table-column>
8
       </el-table-column>
9
-      <el-table-column label="名稱">
9
+      <el-table-column label="點數" align="center">
10
         <template slot-scope="scope">
10
         <template slot-scope="scope">
11
-          {{scope.row.name}}
11
+          <span>{{scope.row.chips}}</span>
12
         </template>
12
         </template>
13
       </el-table-column>
13
       </el-table-column>
14
-      <el-table-column label="點數" width="110" align="center">
14
+      <el-table-column label="輸贏" align="center">
15
         <template slot-scope="scope">
15
         <template slot-scope="scope">
16
-          <span>{{scope.row.chips}}</span>
16
+          <span>{{scope.row.earned}}</span>
17
         </template>
17
         </template>
18
       </el-table-column>
18
       </el-table-column>
19
-      <el-table-column align="center" prop="created_at" label="操作" width="200">
19
+      <el-table-column label="時間" align="center">
20
         <template slot-scope="scope">
20
         <template slot-scope="scope">
21
-          <!-- <span>{{scope.row.display_time}}</span> -->
21
+          <span>{{scope.row.createdAt}}</span>
22
         </template>
22
         </template>
23
       </el-table-column>
23
       </el-table-column>
24
     </el-table>
24
     </el-table>
28
 <script>
28
 <script>
29
 
29
 
30
 import { mapGetters, mapActions } from 'vuex'
30
 import { mapGetters, mapActions } from 'vuex'
31
-// import { getList } from '@/api/table'
31
+import { fetchHistory } from '@/api/gambleMember'
32
 
32
 
33
 export default {
33
 export default {
34
   data() {
34
   data() {
38
     }
38
     }
39
   },
39
   },
40
   created() {
40
   created() {
41
-    // this.fetchData()
41
+    this.fetchData()
42
   },
42
   },
43
+  props: ['member'],
43
   methods: {
44
   methods: {
44
     ...mapActions([
45
     ...mapActions([
45
       'SetVisble'
46
       'SetVisble'
46
     ]),
47
     ]),
47
-    // fetchData() {
48
-    //   this.listLoading = true
49
-    //   getList(this.listQuery).then(response => {
50
-    //     this.list = response.data
51
-    //     this.listLoading = false
52
-    //   })
53
-    // }
48
+    fetchData() {
49
+      this.listLoading = true
50
+      fetchHistory(this.member).then(response => {
51
+        this.list = response.data
52
+        console.log(response.data)
53
+        this.listLoading = false
54
+      })
55
+    }
54
   },
56
   },
55
   destroyed() {
57
   destroyed() {
56
     this.SetVisble(true)
58
     this.SetVisble(true)