|
@@ -3,16 +3,8 @@
|
3
|
3
|
<div class="app-container calendar-list-container">
|
4
|
4
|
<div v-show="visible">
|
5
|
5
|
<div class="app-container">
|
6
|
|
- <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="名稱" v-model="listQuery.name">
|
|
6
|
+ <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="房間名" v-model="listQuery.name">
|
7
|
7
|
</el-input>
|
8
|
|
- <el-select clearable @change='handleFilter' style="width: 120px" class="filter-item" v-model="listQuery.chipsSort" placeholder="點數">
|
9
|
|
- <el-option v-for="item in chipsSortOptions" :key="item.label" :label="item.label" :value="item.key">
|
10
|
|
- </el-option>
|
11
|
|
- </el-select>
|
12
|
|
- <el-select clearable @change='handleFilter' style="width: 120px" class="filter-item" v-model="listQuery.updatedSort" placeholder="更新時間">
|
13
|
|
- <el-option v-for="item in updatedSortOptions" :key="item.label" :label="item.label" :value="item.key">
|
14
|
|
- </el-option>
|
15
|
|
- </el-select>
|
16
|
8
|
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜尋</el-button>
|
17
|
9
|
<el-button class="filter-item" @click="handleCreate" type="primary" icon="el-icon-edit">創建</el-button>
|
18
|
10
|
</div>
|
|
@@ -23,24 +15,20 @@
|
23
|
15
|
{{scope.row.id}}
|
24
|
16
|
</template>
|
25
|
17
|
</el-table-column>
|
26
|
|
- <el-table-column label="名稱" align="center">
|
|
18
|
+ <el-table-column label="房間" align="center">
|
27
|
19
|
<template slot-scope="scope">
|
28
|
20
|
{{scope.row.name}}
|
29
|
21
|
</template>
|
30
|
22
|
</el-table-column>
|
31
|
|
- <el-table-column label="點數" align="center">
|
|
23
|
+ <el-table-column label="時間" align="center">
|
32
|
24
|
<template slot-scope="scope">
|
33
|
|
- <span>{{scope.row.chips}}</span>
|
|
25
|
+ <span>{{moment(scope.row.createdAt)}}</span>
|
34
|
26
|
</template>
|
35
|
27
|
</el-table-column>
|
36
|
28
|
<el-table-column align="center" label="操作" width="350">
|
37
|
29
|
<template slot-scope="scope">
|
38
|
|
- <el-button type="primary" size="mini" icon="el-icon-edit" @click="handleDeposit(scope.row)">上下分</el-button>
|
39
|
|
- <router-link to="/gambleMember/index/chipsHistory">
|
40
|
|
- <el-button type="primary" size="mini" icon="el-icon-tickets" @click="handleLog(scope.row)">上下分紀錄</el-button>
|
41
|
|
- </router-link>
|
42
|
|
- <router-link to="/gambleMember/index/gameHistory">
|
43
|
|
- <el-button type="primary" size="mini" icon="el-icon-tickets" @click="handlePage(scope.row)">歷史查詢</el-button>
|
|
30
|
+ <router-link to="/room/index/gambleMember/index">
|
|
31
|
+ <el-button type="primary" size="mini" icon="el-icon-tickets" @click="handlePage(scope.row)">會員管理</el-button>
|
44
|
32
|
</router-link>
|
45
|
33
|
</template>
|
46
|
34
|
</el-table-column>
|
|
@@ -52,30 +40,6 @@
|
52
|
40
|
</el-pagination>
|
53
|
41
|
</div>
|
54
|
42
|
|
55
|
|
- <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
56
|
|
- <el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
|
57
|
|
- <el-form-item v-if="dialogStatus=='deposit'" label="ID" prop="id">
|
58
|
|
- <el-input v-model="temp.id" :disabled="true"></el-input>
|
59
|
|
- </el-form-item>
|
60
|
|
- <el-form-item label="名稱" prop="name">
|
61
|
|
- <el-input v-if="dialogStatus=='deposit'" v-model="temp.name" :disabled="true"></el-input>
|
62
|
|
- <el-input v-if="dialogStatus=='create'" v-model="temp.name"></el-input>
|
63
|
|
- </el-form-item>
|
64
|
|
- <el-form-item label="點數" prop="chips">
|
65
|
|
- <el-input v-if="dialogStatus=='deposit'" v-model="temp.chips" :disabled="true"></el-input>
|
66
|
|
- <el-input v-if="dialogStatus=='create'" v-model="temp.chips"></el-input>
|
67
|
|
- </el-form-item>
|
68
|
|
- <el-form-item v-if="dialogStatus=='deposit'" label="上下分" prop="depositChips">
|
69
|
|
- <el-input placeholder="請輸入上下分" v-model="temp.depositChips">
|
70
|
|
- </el-input>
|
71
|
|
- </el-form-item>
|
72
|
|
- </el-form>
|
73
|
|
- <div slot="footer" class="dialog-footer">
|
74
|
|
- <el-button @click="dialogFormVisible = false">取 消</el-button>
|
75
|
|
- <el-button v-if="dialogStatus=='create'" type="primary" @click="createData">確 定</el-button>
|
76
|
|
- <el-button v-if="dialogStatus=='deposit'" type="primary" @click="depositChips">確 定</el-button>
|
77
|
|
- </div>
|
78
|
|
- </el-dialog>
|
79
|
43
|
</div>
|
80
|
44
|
<router-view :member="member"></router-view>
|
81
|
45
|
</div>
|
|
@@ -84,8 +48,9 @@
|
84
|
48
|
<script>
|
85
|
49
|
|
86
|
50
|
import { mapGetters, mapActions } from 'vuex'
|
87
|
|
-import { fetchList, updateChips, createGambleMember } from '@/api/gambleMember'
|
|
51
|
+import { fetchWechatRooms } from '@/api/room'
|
88
|
52
|
import waves from '@/directive/waves' // 水波纹指令
|
|
53
|
+import moment from 'moment-timezone'
|
89
|
54
|
|
90
|
55
|
export default {
|
91
|
56
|
name: 'gambleMemberTable',
|
|
@@ -100,29 +65,13 @@ export default {
|
100
|
65
|
listQuery: {
|
101
|
66
|
page: 1,
|
102
|
67
|
limit: 20,
|
103
|
|
- chipsSort: '',
|
104
|
|
- updatedSort: ''
|
105
|
68
|
},
|
106
|
69
|
temp: {
|
107
|
70
|
id: '',
|
108
|
71
|
name: '',
|
109
|
72
|
chips: '',
|
110
|
|
- depositChips: ''
|
111
|
|
- },
|
112
|
|
- dialogFormVisible: false,
|
113
|
|
- dialogStatus: '',
|
114
|
|
- textMap: {
|
115
|
|
- deposit: '儲值',
|
116
|
|
- create: '新增'
|
117
|
73
|
},
|
118
|
74
|
member: {},
|
119
|
|
- chipsSortOptions: [{ label: '多 -> 少', key: 'DESC' }, { label: '少 -> 多', key: 'ASC' }],
|
120
|
|
- updatedSortOptions: [{ label: '新 -> 舊', key: 'DESC' }, { label: '舊 -> 新', key: 'ASC' }],
|
121
|
|
- rules: {
|
122
|
|
- depositChips: [{ pattern: /^-?\d+$/, required: true, message: '請輸入整數', trigger: 'change' }],
|
123
|
|
- chips: [{ pattern: /^(0|[1-9][0-9]*)$/, required: true, message: '請輸入整數', trigger: 'change' }],
|
124
|
|
- name: [{ type: 'string', required: true, message: '必填', trigger: 'change' }]
|
125
|
|
- }
|
126
|
75
|
}
|
127
|
76
|
},
|
128
|
77
|
created() {
|
|
@@ -140,85 +89,19 @@ export default {
|
140
|
89
|
]),
|
141
|
90
|
getList() {
|
142
|
91
|
this.listLoading = true
|
143
|
|
- fetchList(this.listQuery).then(response => {
|
144
|
|
- this.list = response.data.rows
|
145
|
|
- this.total = response.data.count
|
|
92
|
+ fetchWechatRooms(this.listQuery).then(response => {
|
|
93
|
+ this.list = response.data
|
|
94
|
+ this.total = response.data.length
|
146
|
95
|
this.listLoading = false
|
147
|
96
|
})
|
148
|
97
|
},
|
149
|
|
- handleDeposit(row) {
|
150
|
|
- this.temp = Object.assign({}, row) // copy obj
|
151
|
|
- this.dialogStatus = 'deposit'
|
152
|
|
- this.dialogFormVisible = true
|
153
|
|
- this.$nextTick(() => {
|
154
|
|
- this.$refs['dataForm'].clearValidate()
|
155
|
|
- })
|
156
|
|
- },
|
157
|
|
- depositChips() {
|
158
|
|
- this.$refs['dataForm'].validate((valid) => {
|
159
|
|
- if (valid) {
|
160
|
|
- const tempData = Object.assign({}, this.temp)
|
161
|
|
- updateChips(tempData).then(() => {
|
162
|
|
- for (const v of this.list) {
|
163
|
|
- if (v.id === this.temp.id) {
|
164
|
|
- const index = this.list.indexOf(v)
|
165
|
|
- this.list.splice(index, 1, this.temp)
|
166
|
|
- break
|
167
|
|
- }
|
168
|
|
- }
|
169
|
|
- this.dialogFormVisible = false
|
170
|
|
- this.$notify({
|
171
|
|
- title: '成功',
|
172
|
|
- message: '操作成功',
|
173
|
|
- type: 'success',
|
174
|
|
- duration: 2000
|
175
|
|
- })
|
176
|
|
- this.getList()
|
177
|
|
- })
|
178
|
|
- }
|
179
|
|
- })
|
180
|
|
- },
|
181
|
|
- resetTemp() {
|
182
|
|
- this.temp = {
|
183
|
|
- id: undefined,
|
184
|
|
- name: '',
|
185
|
|
- chips: '',
|
186
|
|
- depositChips: ''
|
187
|
|
- }
|
188
|
|
- },
|
189
|
|
- handleCreate() {
|
190
|
|
- this.resetTemp()
|
191
|
|
- this.dialogStatus = 'create'
|
192
|
|
- this.dialogFormVisible = true
|
193
|
|
- this.$nextTick(() => {
|
194
|
|
- this.$refs['dataForm'].clearValidate()
|
195
|
|
- })
|
196
|
|
- },
|
197
|
|
- createData() {
|
198
|
|
- this.$refs['dataForm'].validate((valid) => {
|
199
|
|
- if (valid) {
|
200
|
|
- createGambleMember(this.temp).then((response) => {
|
201
|
|
- this.list.unshift(response.data)
|
202
|
|
- this.dialogFormVisible = false
|
203
|
|
- this.$notify({
|
204
|
|
- title: '成功',
|
205
|
|
- message: '創建成功',
|
206
|
|
- type: 'success',
|
207
|
|
- duration: 2000
|
208
|
|
- })
|
209
|
|
- })
|
210
|
|
- }
|
211
|
|
- })
|
212
|
|
- },
|
213
|
98
|
handlePage(row) {
|
214
|
99
|
const temp = Object.assign({}, row) // copy obj
|
215
|
100
|
this.SetVisible(false)
|
216
|
101
|
this.member = temp
|
217
|
102
|
},
|
218
|
|
- handleLog(row) {
|
219
|
|
- const temp = Object.assign({}, row) // copy obj
|
220
|
|
- this.SetVisible(false)
|
221
|
|
- this.member = temp
|
|
103
|
+ handleCreate() {
|
|
104
|
+ //TODO 了解wechat 的 room 關聯
|
222
|
105
|
},
|
223
|
106
|
handleFilter() {
|
224
|
107
|
this.listQuery.page = 1
|
|
@@ -231,7 +114,10 @@ export default {
|
231
|
114
|
handleCurrentChange(val) {
|
232
|
115
|
this.listQuery.page = val
|
233
|
116
|
this.getList()
|
234
|
|
- }
|
|
117
|
+ },
|
|
118
|
+ moment(time) {
|
|
119
|
+ return moment(time).tz('Asia/Taipei').format('YYYY-MM-DD HH:mm:ss')
|
|
120
|
+ },
|
235
|
121
|
}
|
236
|
122
|
}
|
237
|
123
|
</script>
|