| 
				
			 | 
			
			
				@@ -18,7 +18,7 @@ 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				18
			 | 
			
			
				       </el-table-column> 
			 | 
		
	
		
			
			| 
				19
			 | 
			
				19
			 | 
			
			
				       <el-table-column align="center" label="操作"> 
			 | 
		
	
		
			
			| 
				20
			 | 
			
				20
			 | 
			
			
				         <template slot-scope="scope"> 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				
			 | 
			
			
				-          <!-- <span>{{scope.row.display_time}}</span> --> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				21
			 | 
			
			
				+            <el-button type="primary" size="mini" @click="handleDeposit(scope.row)">儲值</el-button> 
			 | 
		
	
		
			
			| 
				22
			 | 
			
				22
			 | 
			
			
				         </template> 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				23
			 | 
			
			
				       </el-table-column> 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				24
			 | 
			
			
				     </el-table> 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -28,11 +28,34 @@ 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				28
			 | 
			
			
				         :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total"> 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				29
			 | 
			
			
				       </el-pagination> 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				30
			 | 
			
			
				     </div> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				31
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				+    <el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				+      <el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+        <el-form-item label="ID" prop="id"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				35
			 | 
			
			
				+          <el-input v-model="temp.id" :disabled="true"></el-input> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				+        </el-form-item> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				37
			 | 
			
			
				+        <el-form-item label="名稱" prop="name"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				38
			 | 
			
			
				+          <el-input v-model="temp.name" :disabled="true"></el-input> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				39
			 | 
			
			
				+        </el-form-item> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				40
			 | 
			
			
				+        <el-form-item label="點數" prop="chips"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+          <el-input v-model="temp.chips" :disabled="true"></el-input> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+        </el-form-item> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+        <el-form-item label="加值點數" prop="depositChips"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+          <el-input placeholder="請輸入加值金額" v-model="temp.depositChips"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+          </el-input> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+        </el-form-item> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+      </el-form> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				48
			 | 
			
			
				+      <div slot="footer" class="dialog-footer"> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				49
			 | 
			
			
				+        <el-button @click="dialogFormVisible = false">取 消</el-button> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				50
			 | 
			
			
				+        <el-button v-if="dialogStatus=='create'" type="primary" @click="createData">確 定</el-button> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				51
			 | 
			
			
				+        <el-button v-if="dialogStatus=='deposit'" type="primary" @click="depositChips">確 定</el-button> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				52
			 | 
			
			
				+      </div> 
			 | 
		
	
		
			
			| 
				
			 | 
			
				53
			 | 
			
			
				+    </el-dialog> 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				54
			 | 
			
			
				   </div> 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				55
			 | 
			
			
				 </template> 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				56
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				34
			 | 
			
				57
			 | 
			
			
				 <script> 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				
			 | 
			
			
				-import { fetchList } from '@/api/gambleMember' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				58
			 | 
			
			
				+import { fetchList, updateChips } from '@/api/gambleMember' 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				59
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				37
			 | 
			
				60
			 | 
			
			
				 export default { 
			 | 
		
	
		
			
			| 
				38
			 | 
			
				61
			 | 
			
			
				   data() { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -47,6 +70,24 @@ export default { 
			 | 
		
	
		
			
			| 
				47
			 | 
			
				70
			 | 
			
			
				         title: undefined, 
			 | 
		
	
		
			
			| 
				48
			 | 
			
				71
			 | 
			
			
				         type: undefined, 
			 | 
		
	
		
			
			| 
				49
			 | 
			
				72
			 | 
			
			
				         sort: '+id' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				73
			 | 
			
			
				+      }, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				74
			 | 
			
			
				+      temp: { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				75
			 | 
			
			
				+        id: undefined, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				76
			 | 
			
			
				+        importance: 1, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				77
			 | 
			
			
				+        remark: '', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				78
			 | 
			
			
				+        timestamp: new Date(), 
			 | 
		
	
		
			
			| 
				
			 | 
			
				79
			 | 
			
			
				+        title: '', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				80
			 | 
			
			
				+        type: '', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				81
			 | 
			
			
				+        status: 'published' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				82
			 | 
			
			
				+      }, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				83
			 | 
			
			
				+      dialogFormVisible: false, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				84
			 | 
			
			
				+      dialogStatus: '', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				85
			 | 
			
			
				+      textMap: { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				86
			 | 
			
			
				+        deposit: '儲值', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				87
			 | 
			
			
				+        create: '新增' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				88
			 | 
			
			
				+      }, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				89
			 | 
			
			
				+      rules: { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				90
			 | 
			
			
				+        depositChips: [{pattern: /^\+?[1-9][0-9]*$/, required: true, message: '只能儲值整數', trigger: 'change' }], 
			 | 
		
	
		
			
			| 
				50
			 | 
			
				91
			 | 
			
			
				       } 
			 | 
		
	
		
			
			| 
				51
			 | 
			
				92
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				93
			 | 
			
			
				   }, 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -62,6 +103,39 @@ export default { 
			 | 
		
	
		
			
			| 
				62
			 | 
			
				103
			 | 
			
			
				         this.listLoading = false 
			 | 
		
	
		
			
			| 
				63
			 | 
			
				104
			 | 
			
			
				       }) 
			 | 
		
	
		
			
			| 
				64
			 | 
			
				105
			 | 
			
			
				     }, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				106
			 | 
			
			
				+    handleDeposit(row) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				107
			 | 
			
			
				+      this.temp = Object.assign({}, row) // copy obj 
			 | 
		
	
		
			
			| 
				
			 | 
			
				108
			 | 
			
			
				+      this.temp.timestamp = new Date(this.temp.timestamp) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				109
			 | 
			
			
				+      this.dialogStatus = 'deposit' 
			 | 
		
	
		
			
			| 
				
			 | 
			
				110
			 | 
			
			
				+      this.dialogFormVisible = true 
			 | 
		
	
		
			
			| 
				
			 | 
			
				111
			 | 
			
			
				+      this.$nextTick(() => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				112
			 | 
			
			
				+        this.$refs['dataForm'].clearValidate() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				113
			 | 
			
			
				+      }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				114
			 | 
			
			
				+    }, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				115
			 | 
			
			
				+    depositChips() { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				116
			 | 
			
			
				+      this.$refs['dataForm'].validate((valid) => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				117
			 | 
			
			
				+        if (valid) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				118
			 | 
			
			
				+          const tempData = Object.assign({}, this.temp) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				119
			 | 
			
			
				+          updateChips(tempData).then(() => { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				120
			 | 
			
			
				+            for (const v of this.list) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				121
			 | 
			
			
				+              if (v.id === this.temp.id) { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				122
			 | 
			
			
				+                const index = this.list.indexOf(v) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				123
			 | 
			
			
				+                this.list.splice(index, 1, this.temp) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				124
			 | 
			
			
				+                break 
			 | 
		
	
		
			
			| 
				
			 | 
			
				125
			 | 
			
			
				+              } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				126
			 | 
			
			
				+            } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				127
			 | 
			
			
				+            this.dialogFormVisible = false 
			 | 
		
	
		
			
			| 
				
			 | 
			
				128
			 | 
			
			
				+            this.$notify({ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				129
			 | 
			
			
				+              title: '成功', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				130
			 | 
			
			
				+              message: '儲值成功', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				131
			 | 
			
			
				+              type: 'success', 
			 | 
		
	
		
			
			| 
				
			 | 
			
				132
			 | 
			
			
				+              duration: 2000 
			 | 
		
	
		
			
			| 
				
			 | 
			
				133
			 | 
			
			
				+            }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				134
			 | 
			
			
				+            this.getList() 
			 | 
		
	
		
			
			| 
				
			 | 
			
				135
			 | 
			
			
				+          }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				136
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				137
			 | 
			
			
				+      }) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				138
			 | 
			
			
				+    }, 
			 | 
		
	
		
			
			| 
				65
			 | 
			
				139
			 | 
			
			
				     handleSizeChange(val) { 
			 | 
		
	
		
			
			| 
				66
			 | 
			
				140
			 | 
			
			
				       this.listQuery.limit = val 
			 | 
		
	
		
			
			| 
				67
			 | 
			
				141
			 | 
			
			
				       this.getList() 
			 |