EthnaYeh %!s(int64=6) %!d(string=hace) años
padre
commit
9488e49842
Se han modificado 2 ficheros con 61 adiciones y 3 borrados
  1. 11 0
      src/api/room.js
  2. 50 3
      src/views/room/wechatMember/index.vue

+ 11 - 0
src/api/room.js

@@ -54,3 +54,14 @@ export function resetWechatRoomMembersChips(data) {
54 54
     method: 'put'
55 55
   })
56 56
 }
57
+
58
+export function createWechatMember(data, query) {
59
+  return request({
60
+    url: `/gambleMembers`,
61
+    method: 'post',
62
+    data: {
63
+      name: query.name,
64
+      wechatRoom: data.id
65
+    }
66
+  })
67
+}

+ 50 - 3
src/views/room/wechatMember/index.vue

@@ -13,6 +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 17
         <el-button class="filter-item" type="danger" v-waves icon="el-icon-warning" @click="handlereset">歸零</el-button>
17 18
       </div>
18 19
       <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row
@@ -118,7 +119,17 @@
118 119
             <el-button type="primary" @click="updateData">確 定</el-button>
119 120
           </div>
120 121
       </el-dialog>
121
-
122
+      <el-dialog title="會員創建" :visible.sync="dialogCreateFormVisible" :before-close="handleDialogClose" center>
123
+        <el-form :rules="rules" :model="tempCreate" ref="createForm" label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
124
+          <el-form-item label="名稱" prop="id">
125
+            <el-input v-model="tempCreate.name"></el-input>
126
+          </el-form-item>
127
+        </el-form>          
128
+        <div slot="footer" class="dialog-footer">
129
+          <el-button @click="handleDialogClose">取 消</el-button>
130
+          <el-button type="primary" @click="createData">確 定</el-button>
131
+        </div>
132
+      </el-dialog>
122 133
     </div>
123 134
     <router-view></router-view>
124 135
   </div>
@@ -129,7 +140,7 @@
129 140
 import { mapGetters, mapActions } from 'vuex'
130 141
 // TODO 需更改抓取此房間人員
131 142
 import { fetchWeChatMemberList, chipsDeposit, chipsReward, createGambleMember, fetchAgentList, updateBelongAgent } from '@/api/gambleMember'
132
-import { resetWechatRoomMembersChips } from '@/api/room'
143
+import { resetWechatRoomMembersChips, createWechatMember } from '@/api/room'
133 144
 import waves from '@/directive/waves' // 水波纹指令
134 145
 import Multiselect from 'vue-multiselect'// 使用的一个多选框组件,element-ui的select不能满足所有需求
135 146
 import 'vue-multiselect/dist/vue-multiselect.min.css'// 多选框组件css
@@ -152,6 +163,10 @@ export default {
152 163
         chipsSort: '', 
153 164
         updatedSort: '' 
154 165
       }, 
166
+      tempCreate: {
167
+        name: '',
168
+      },
169
+      dialogCreateFormVisible: false,
155 170
       temp: {
156 171
         id: '',
157 172
         WeChatUser: {
@@ -181,6 +196,8 @@ export default {
181 196
     }
182 197
   },
183 198
   created() {
199
+        console.log('sssss', this.data.secondLayer)
200
+
184 201
     this.SetVisible(2)
185 202
     this.getList()
186 203
   },
@@ -382,7 +399,37 @@ export default {
382 399
     noAgent(GambleMember) {
383 400
       return GambleMember.GambleAgent?false:true;
384 401
       // console.log('GambleAgent', GambleMember)
385
-    }
402
+    },
403
+    handleCreate() {
404
+      this.dialogCreateFormVisible = true
405
+      this.$nextTick(() => {
406
+        this.$refs['createForm'].clearValidate()
407
+      })
408
+    },
409
+    createData() {
410
+     this.$refs['createForm'].validate((valid) => {
411
+        if (valid) {
412
+          const temp = Object.assign({}, this.tempCreate)
413
+          createWechatMember(this.data.secondLayer, temp).then(() => {
414
+            for (const v of this.list) {
415
+              if (v.id === this.tempCreate.id) {
416
+                const index = this.list.indexOf(v)
417
+                this.list.splice(index, 1, this.tempCreate)
418
+                break
419
+              }
420
+            }
421
+            this.dialogCreateFormVisible = false
422
+            this.$notify({
423
+              title: '成功',
424
+              message: '操作成功',
425
+              type: 'success',
426
+              duration: 2000
427
+            })
428
+            this.getList()
429
+          })
430
+        }
431
+      })
432
+    },
386 433
   },
387 434
   // watch: {
388 435
   //   activeName: (val) => {