|
@@ -13,7 +13,7 @@
|
13
|
13
|
</el-option>
|
14
|
14
|
</el-select>
|
15
|
15
|
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜尋</el-button>
|
16
|
|
- <el-button class="filter-item" @click="handleCreate" type="primary" icon="el-icon-edit">創建</el-button>
|
|
16
|
+ <!-- <el-button class="filter-item" @click="handleCreate" type="primary" icon="el-icon-edit">創建</el-button> -->
|
17
|
17
|
</div>
|
18
|
18
|
<el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row
|
19
|
19
|
style="width: 100%">
|
|
@@ -34,9 +34,9 @@
|
34
|
34
|
</el-table-column>
|
35
|
35
|
<el-table-column align="center" label="操作" width="350">
|
36
|
36
|
<template slot-scope="scope">
|
37
|
|
- <el-button type="primary" size="mini" icon="el-icon-edit" @click="handleDeposit(scope.row)">上下分</el-button>
|
|
37
|
+ <el-button type="primary" size="mini" icon="el-icon-edit" @click="handleChipsMangement(scope.row)">分數管理</el-button>
|
38
|
38
|
<router-link to="/room/index/gambleMember/index/chipsHistory">
|
39
|
|
- <el-button type="primary" size="mini" icon="el-icon-tickets" @click="handleLog(scope.row)">上下分紀錄</el-button>
|
|
39
|
+ <el-button type="primary" size="mini" icon="el-icon-tickets" @click="handleLog(scope.row)">分數紀錄</el-button>
|
40
|
40
|
</router-link>
|
41
|
41
|
<router-link to="/room/index/gambleMember/index/gameHistory">
|
42
|
42
|
<el-button type="primary" size="mini" icon="el-icon-tickets" @click="handlePage(scope.row)">歷史查詢</el-button>
|
|
@@ -51,27 +51,45 @@
|
51
|
51
|
</el-pagination>
|
52
|
52
|
</div>
|
53
|
53
|
|
54
|
|
- <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" center>
|
55
|
|
- <el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
|
56
|
|
- <el-form-item v-if="dialogStatus=='deposit'" label="ID" prop="id">
|
57
|
|
- <el-input v-model="temp.id" :disabled="true"></el-input>
|
58
|
|
- </el-form-item>
|
59
|
|
- <el-form-item label="名稱" prop="name">
|
60
|
|
- <el-input v-if="dialogStatus=='deposit'" v-model="temp.name" :disabled="true"></el-input>
|
61
|
|
- <el-input v-if="dialogStatus=='create'" v-model="temp.name"></el-input>
|
62
|
|
- </el-form-item>
|
63
|
|
- <el-form-item label="點數" prop="chips">
|
64
|
|
- <el-input v-if="dialogStatus=='deposit'" v-model="temp.chips" :disabled="true"></el-input>
|
65
|
|
- <el-input v-if="dialogStatus=='create'" v-model="temp.chips"></el-input>
|
66
|
|
- </el-form-item>
|
67
|
|
- <el-form-item v-if="dialogStatus=='deposit'" label="上下分" prop="depositChips">
|
68
|
|
- <el-input placeholder="請輸入上下分" v-model="temp.depositChips">
|
69
|
|
- </el-input>
|
70
|
|
- </el-form-item>
|
71
|
|
- </el-form>
|
|
54
|
+ <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" :before-close="handleClose" center>
|
|
55
|
+ <el-tabs v-model="activeName" @tab-click="handleClick">
|
|
56
|
+ <el-tab-pane label="上下分" name="deposit">
|
|
57
|
+ <el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
|
|
58
|
+ <el-form-item label="ID" prop="id">
|
|
59
|
+ <el-input v-model="temp.id" :disabled="true"></el-input>
|
|
60
|
+ </el-form-item>
|
|
61
|
+ <el-form-item label="名稱" prop="name">
|
|
62
|
+ <el-input v-if="dialogStatus=='deposit'" v-model="temp.name" :disabled="true"></el-input>
|
|
63
|
+ </el-form-item>
|
|
64
|
+ <el-form-item label="點數" prop="chips">
|
|
65
|
+ <el-input v-model="temp.chips" :disabled="true"></el-input>
|
|
66
|
+ </el-form-item>
|
|
67
|
+ <el-form-item v-if="dialogStatus=='deposit'" label="上下分" prop="depositChips">
|
|
68
|
+ <el-input placeholder="請輸入上下分" v-model="temp.depositChips"></el-input>
|
|
69
|
+ </el-form-item>
|
|
70
|
+ </el-form>
|
|
71
|
+ </el-tab-pane>
|
|
72
|
+ <el-tab-pane label="獎懲" name="reward">
|
|
73
|
+ <el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
|
|
74
|
+ <el-form-item label="ID" prop="id">
|
|
75
|
+ <el-input v-model="temp.id" :disabled="true"></el-input>
|
|
76
|
+ </el-form-item>
|
|
77
|
+ <el-form-item label="名稱" prop="name">
|
|
78
|
+ <el-input v-model="temp.name" :disabled="true"></el-input>
|
|
79
|
+ </el-form-item>
|
|
80
|
+ <el-form-item label="點數" prop="chips">
|
|
81
|
+ <el-input v-model="temp.chips" :disabled="true"></el-input>
|
|
82
|
+ </el-form-item>
|
|
83
|
+ <el-form-item v-if="dialogStatus=='reward'" label="獎懲" prop="rewardChips">
|
|
84
|
+ <el-input placeholder="請輸入獎懲點數" v-model="temp.rewardChips"></el-input>
|
|
85
|
+ </el-form-item>
|
|
86
|
+ </el-form>
|
|
87
|
+ </el-tab-pane>
|
|
88
|
+ </el-tabs>
|
|
89
|
+
|
72
|
90
|
<div slot="footer" class="dialog-footer">
|
73
|
91
|
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
74
|
|
- <el-button v-if="dialogStatus=='create'" type="primary" @click="createData">確 定</el-button>
|
|
92
|
+ <el-button v-if="dialogStatus=='reward'" type="primary" @click="rewardChips">確 定</el-button>
|
75
|
93
|
<el-button v-if="dialogStatus=='deposit'" type="primary" @click="depositChips">確 定</el-button>
|
76
|
94
|
</div>
|
77
|
95
|
</el-dialog>
|
|
@@ -84,7 +102,7 @@
|
84
|
102
|
|
85
|
103
|
import { mapGetters, mapActions } from 'vuex'
|
86
|
104
|
// TODO 需更改抓取此房間人員
|
87
|
|
-import { fetchList, updateChips, createGambleMember } from '@/api/gambleMember'
|
|
105
|
+import { fetchList, chipsDeposit, chipsReward, createGambleMember } from '@/api/gambleMember'
|
88
|
106
|
import waves from '@/directive/waves' // 水波纹指令
|
89
|
107
|
|
90
|
108
|
export default {
|
|
@@ -107,22 +125,25 @@ export default {
|
107
|
125
|
id: '',
|
108
|
126
|
name: '',
|
109
|
127
|
chips: '',
|
110
|
|
- depositChips: ''
|
|
128
|
+ depositChips: '',
|
|
129
|
+ rewardChips: '',
|
111
|
130
|
},
|
112
|
131
|
dialogFormVisible: false,
|
113
|
132
|
dialogStatus: '',
|
114
|
133
|
textMap: {
|
115
|
|
- deposit: '儲值',
|
116
|
|
- create: '新增'
|
|
134
|
+ deposit: '上下分',
|
|
135
|
+ reward: '獎懲'
|
117
|
136
|
},
|
118
|
137
|
member: {},
|
119
|
138
|
chipsSortOptions: [{ label: '多 -> 少', key: 'DESC' }, { label: '少 -> 多', key: 'ASC' }],
|
120
|
139
|
updatedSortOptions: [{ label: '新 -> 舊', key: 'DESC' }, { label: '舊 -> 新', key: 'ASC' }],
|
121
|
140
|
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
|
|
- }
|
|
141
|
+ rewardChips: [{ pattern: /^-?\d+$/, required: true, message: '請輸入整數', trigger: 'change' }],
|
|
142
|
+ depositChips: [{ pattern: /^-?\d+$/, required: true, message: '請輸入整數', trigger: 'change' }],
|
|
143
|
+ // chips: [{ pattern: /^(0|[1-9][0-9]*)$/, required: true, message: '請輸入整數', trigger: 'change' }],
|
|
144
|
+ // name: [{ type: 'string', required: true, message: '必填', trigger: 'change' }]
|
|
145
|
+ },
|
|
146
|
+ activeName: 'deposit'
|
126
|
147
|
}
|
127
|
148
|
},
|
128
|
149
|
created() {
|
|
@@ -149,7 +170,7 @@ export default {
|
149
|
170
|
this.listLoading = false
|
150
|
171
|
})
|
151
|
172
|
},
|
152
|
|
- handleDeposit(row) {
|
|
173
|
+ handleChipsMangement(row) {
|
153
|
174
|
this.temp = Object.assign({}, row) // copy obj
|
154
|
175
|
this.dialogStatus = 'deposit'
|
155
|
176
|
this.dialogFormVisible = true
|
|
@@ -161,7 +182,7 @@ export default {
|
161
|
182
|
this.$refs['dataForm'].validate((valid) => {
|
162
|
183
|
if (valid) {
|
163
|
184
|
const tempData = Object.assign({}, this.temp)
|
164
|
|
- updateChips(tempData).then(() => {
|
|
185
|
+ chipsDeposit(tempData).then(() => {
|
165
|
186
|
for (const v of this.list) {
|
166
|
187
|
if (v.id === this.temp.id) {
|
167
|
188
|
const index = this.list.indexOf(v)
|
|
@@ -189,30 +210,31 @@ export default {
|
189
|
210
|
depositChips: ''
|
190
|
211
|
}
|
191
|
212
|
},
|
192
|
|
- handleCreate() {
|
193
|
|
- this.resetTemp()
|
194
|
|
- this.dialogStatus = 'create'
|
195
|
|
- this.dialogFormVisible = true
|
196
|
|
- this.$nextTick(() => {
|
197
|
|
- this.$refs['dataForm'].clearValidate()
|
198
|
|
- })
|
199
|
|
- },
|
200
|
|
- createData() {
|
201
|
|
- this.$refs['dataForm'].validate((valid) => {
|
202
|
|
- if (valid) {
|
203
|
|
- createGambleMember(this.temp).then((response) => {
|
204
|
|
- this.list.unshift(response.data)
|
205
|
|
- this.dialogFormVisible = false
|
206
|
|
- this.$notify({
|
207
|
|
- title: '成功',
|
208
|
|
- message: '創建成功',
|
209
|
|
- type: 'success',
|
210
|
|
- duration: 2000
|
211
|
|
- })
|
212
|
|
- })
|
213
|
|
- }
|
214
|
|
- })
|
215
|
|
- },
|
|
213
|
+ // handleCreate() {
|
|
214
|
+ // this.resetTemp()
|
|
215
|
+ // this.dialogStatus = 'create'
|
|
216
|
+ // this.dialogFormVisible = true
|
|
217
|
+ // this.$nextTick(() => {
|
|
218
|
+ // this.$refs['dataForm'].clearValidate()
|
|
219
|
+ // })
|
|
220
|
+ // },
|
|
221
|
+ // createData() {
|
|
222
|
+ // this.$refs['dataForm'].validate((valid) => {
|
|
223
|
+ // if (valid) {
|
|
224
|
+ // createGambleMember(this.temp).then((response) => {
|
|
225
|
+ // this.list.unshift(response.data)
|
|
226
|
+ // this.dialogFormVisible = false
|
|
227
|
+ // this.activeName = 'depoist';
|
|
228
|
+ // this.$notify({
|
|
229
|
+ // title: '成功',
|
|
230
|
+ // message: '創建成功',
|
|
231
|
+ // type: 'success',
|
|
232
|
+ // duration: 2000
|
|
233
|
+ // })
|
|
234
|
+ // })
|
|
235
|
+ // }
|
|
236
|
+ // })
|
|
237
|
+ // },
|
216
|
238
|
handlePage(row) {
|
217
|
239
|
const temp = Object.assign({}, row) // copy obj
|
218
|
240
|
this.SetVisible(3)
|
|
@@ -234,7 +256,43 @@ export default {
|
234
|
256
|
handleCurrentChange(val) {
|
235
|
257
|
this.listQuery.page = val
|
236
|
258
|
this.getList()
|
|
259
|
+ },
|
|
260
|
+ handleClick(tab, event) {
|
|
261
|
+ this.dialogStatus = tab.name;
|
|
262
|
+ },
|
|
263
|
+ handleClose() {
|
|
264
|
+ this.activeName = 'deposit';
|
|
265
|
+ this.dialogFormVisible = false;
|
|
266
|
+ },
|
|
267
|
+ rewardChips() {
|
|
268
|
+ this.$refs['dataForm'].validate((valid) => {
|
|
269
|
+ if (valid) {
|
|
270
|
+ const tempData = Object.assign({}, this.temp)
|
|
271
|
+ chipsReward(tempData).then(() => {
|
|
272
|
+ for (const v of this.list) {
|
|
273
|
+ if (v.id === this.temp.id) {
|
|
274
|
+ const index = this.list.indexOf(v)
|
|
275
|
+ this.list.splice(index, 1, this.temp)
|
|
276
|
+ break
|
|
277
|
+ }
|
|
278
|
+ }
|
|
279
|
+ this.dialogFormVisible = false
|
|
280
|
+ this.$notify({
|
|
281
|
+ title: '成功',
|
|
282
|
+ message: '操作成功',
|
|
283
|
+ type: 'success',
|
|
284
|
+ duration: 2000
|
|
285
|
+ })
|
|
286
|
+ this.getList()
|
|
287
|
+ })
|
|
288
|
+ }
|
|
289
|
+ })
|
237
|
290
|
}
|
238
|
|
- }
|
|
291
|
+ },
|
|
292
|
+ // watch: {
|
|
293
|
+ // activeName: (val) => {
|
|
294
|
+ // console.log('test', val);
|
|
295
|
+ // }
|
|
296
|
+ // }
|
239
|
297
|
}
|
240
|
298
|
</script>
|