|
@@ -0,0 +1,191 @@
|
|
1
|
+<!-- TODO select -->
|
|
2
|
+<template>
|
|
3
|
+<div class="app-container calendar-list-container">
|
|
4
|
+ <div v-show="visible.secondLayer">
|
|
5
|
+ <div class="app-container">
|
|
6
|
+ <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="名稱" v-model="listQuery.name">
|
|
7
|
+ </el-input>
|
|
8
|
+ <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜尋</el-button>
|
|
9
|
+ <el-button class="filter-item" @click="handleCreate" type="primary" icon="el-icon-edit">創建</el-button>
|
|
10
|
+ </div>
|
|
11
|
+ <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row
|
|
12
|
+ style="width: 100%">
|
|
13
|
+ <el-table-column align="center" label='ID' >
|
|
14
|
+ <template slot-scope="scope">
|
|
15
|
+ {{scope.row.WeChatUser.id}}
|
|
16
|
+ </template>
|
|
17
|
+ </el-table-column>
|
|
18
|
+ <el-table-column label="名稱" align="center">
|
|
19
|
+ <template slot-scope="scope">
|
|
20
|
+ {{scope.row.WeChatUser.name}}
|
|
21
|
+ </template>
|
|
22
|
+ </el-table-column>
|
|
23
|
+ <!-- <el-table-column label="操作者" align="center">
|
|
24
|
+ <template slot-scope="scope">
|
|
25
|
+ <span>{{moment(scope.row.createdAt)}}</span>
|
|
26
|
+ </template>
|
|
27
|
+ </el-table-column> -->
|
|
28
|
+ <el-table-column align="center" label="操作" width="350">
|
|
29
|
+ <template slot-scope="scope">
|
|
30
|
+ <!-- <router-link to="/room/index/wechatMember/index">
|
|
31
|
+ <el-button type="primary" size="mini" icon="el-icon-tickets" @click="handlePage(scope.row)">會員管理</el-button>
|
|
32
|
+ </router-link> -->
|
|
33
|
+ </template>
|
|
34
|
+ </el-table-column>
|
|
35
|
+ </el-table>
|
|
36
|
+
|
|
37
|
+ <div v-show="!listLoading" class="pagination-container">
|
|
38
|
+ <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.page"
|
|
39
|
+ :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
|
40
|
+ </el-pagination>
|
|
41
|
+ </div>
|
|
42
|
+
|
|
43
|
+ <el-dialog title="客服創建" :visible.sync="dialogCreateFormVisible" :before-close="handleDialogClose" center>
|
|
44
|
+ <el-form :rules="rules" :model="temp" ref="createForm" label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
|
|
45
|
+ <el-form-item label="代理商" >
|
|
46
|
+ <multiselect v-model="createFormData" :options="agentLIstOptions" @search-change="getRemoteWeChatMemberList" placeholder="代理商搜尋" selectLabel="選擇"
|
|
47
|
+ deselectLabel="删除" track-by="key" :internalSearch="false" label="key">
|
|
48
|
+ <span slot='noResult'>無結果</span>
|
|
49
|
+ </multiselect>
|
|
50
|
+ </el-form-item>
|
|
51
|
+ </el-form>
|
|
52
|
+ <div slot="footer" class="dialog-footer">
|
|
53
|
+ <el-button @click="handleDialogClose">取 消</el-button>
|
|
54
|
+ <el-button type="primary" @click="createData">確 定</el-button>
|
|
55
|
+ </div>
|
|
56
|
+ </el-dialog>
|
|
57
|
+
|
|
58
|
+ </div>
|
|
59
|
+ </div>
|
|
60
|
+</template>
|
|
61
|
+
|
|
62
|
+<script>
|
|
63
|
+
|
|
64
|
+import { mapGetters, mapActions } from 'vuex'
|
|
65
|
+import { fetchWechatGameMaster, createWechatGameMaster } from '@/api/room'
|
|
66
|
+import { fetchWeChatMemberList } from '@/api/gambleMember'
|
|
67
|
+import waves from '@/directive/waves' // 水波纹指令
|
|
68
|
+import moment from 'moment-timezone'
|
|
69
|
+import Multiselect from 'vue-multiselect'// 使用的一个多选框组件,element-ui的select不能满足所有需求
|
|
70
|
+import 'vue-multiselect/dist/vue-multiselect.min.css'// 多选框组件css
|
|
71
|
+
|
|
72
|
+export default {
|
|
73
|
+ name: 'gambleMemberTable',
|
|
74
|
+ components: { Multiselect },
|
|
75
|
+ directives: {
|
|
76
|
+ waves
|
|
77
|
+ },
|
|
78
|
+ data() {
|
|
79
|
+ return {
|
|
80
|
+ list: null,
|
|
81
|
+ total: null,
|
|
82
|
+ listLoading: true,
|
|
83
|
+ listQuery: {
|
|
84
|
+ page: 1,
|
|
85
|
+ limit: 20,
|
|
86
|
+ name: ''
|
|
87
|
+ },
|
|
88
|
+ temp: {
|
|
89
|
+ name: '',
|
|
90
|
+ },
|
|
91
|
+ rules: {
|
|
92
|
+ name: [{ type: 'string', required: true, message: '必填', trigger: 'change' }]
|
|
93
|
+ },
|
|
94
|
+ dialogCreateFormVisible: false,
|
|
95
|
+ agentLIstOptions: [],
|
|
96
|
+ createFormData: null
|
|
97
|
+ }
|
|
98
|
+ },
|
|
99
|
+ props: ['room'],
|
|
100
|
+ created() {
|
|
101
|
+ this.SetVisible(2)
|
|
102
|
+ this.getList()
|
|
103
|
+ },
|
|
104
|
+ destroyed() {
|
|
105
|
+ this.SetVisible(1)
|
|
106
|
+ },
|
|
107
|
+ computed: {
|
|
108
|
+ ...mapGetters([
|
|
109
|
+ 'visible'
|
|
110
|
+ ])
|
|
111
|
+ },
|
|
112
|
+ methods: {
|
|
113
|
+ ...mapActions([
|
|
114
|
+ 'SetVisible'
|
|
115
|
+ ]),
|
|
116
|
+ getList() {
|
|
117
|
+ this.listLoading = true
|
|
118
|
+ fetchWechatGameMaster(this.room, this.listQuery).then(response => {
|
|
119
|
+ this.list = response.data.rows
|
|
120
|
+ this.total = response.data.count
|
|
121
|
+ this.listLoading = false
|
|
122
|
+ })
|
|
123
|
+ },
|
|
124
|
+ handleCreate() {
|
|
125
|
+ this.dialogCreateFormVisible = true
|
|
126
|
+ this.$nextTick(() => {
|
|
127
|
+ this.$refs['createForm'].clearValidate()
|
|
128
|
+ })
|
|
129
|
+ },
|
|
130
|
+ createData() {
|
|
131
|
+ this.$refs['createForm'].validate((valid) => {
|
|
132
|
+ if (valid) {
|
|
133
|
+ const room = Object.assign({}, this.room)
|
|
134
|
+ const createFormData = Object.assign({}, this.createFormData.value)
|
|
135
|
+ console.log('eqwewq', createFormData)
|
|
136
|
+ createWechatGameMaster(room, createFormData).then(() => {
|
|
137
|
+ for (const v of this.list) {
|
|
138
|
+ if (v.id === this.temp.id) {
|
|
139
|
+ const index = this.list.indexOf(v)
|
|
140
|
+ this.list.splice(index, 1, this.temp)
|
|
141
|
+ break
|
|
142
|
+ }
|
|
143
|
+ }
|
|
144
|
+ this.dialogCreateFormVisible = false
|
|
145
|
+ this.$notify({
|
|
146
|
+ title: '成功',
|
|
147
|
+ message: '操作成功',
|
|
148
|
+ type: 'success',
|
|
149
|
+ duration: 2000
|
|
150
|
+ })
|
|
151
|
+ this.getList()
|
|
152
|
+ })
|
|
153
|
+ }
|
|
154
|
+ })
|
|
155
|
+ },
|
|
156
|
+ handleFilter() {
|
|
157
|
+ this.listQuery.page = 1
|
|
158
|
+ this.getList()
|
|
159
|
+ },
|
|
160
|
+ handleSizeChange(val) {
|
|
161
|
+ this.listQuery.limit = val
|
|
162
|
+ this.getList()
|
|
163
|
+ },
|
|
164
|
+ handleCurrentChange(val) {
|
|
165
|
+ this.listQuery.page = val
|
|
166
|
+ this.getList()
|
|
167
|
+ },
|
|
168
|
+ handleDialogClose() {
|
|
169
|
+ this.dialogCreateFormVisible = false;
|
|
170
|
+ this.temp = {name: ''};
|
|
171
|
+ },
|
|
172
|
+ moment(time) {
|
|
173
|
+ return moment(time).tz('Asia/Taipei').format('YYYY-MM-DD HH:mm:ss')
|
|
174
|
+ },
|
|
175
|
+ getRemoteWeChatMemberList(query) {
|
|
176
|
+ let temp = {
|
|
177
|
+ limit: 20,
|
|
178
|
+ page: 1,
|
|
179
|
+ name: query,
|
|
180
|
+ }
|
|
181
|
+ fetchWeChatMemberList(this.room, temp).then(response => {
|
|
182
|
+ if (!response.data.rows) return
|
|
183
|
+ this.agentLIstOptions = response.data.rows.map(v => ({
|
|
184
|
+ key: v.WeChatUser.name,
|
|
185
|
+ value: v.WeChatUser
|
|
186
|
+ }))
|
|
187
|
+ })
|
|
188
|
+ }
|
|
189
|
+ }
|
|
190
|
+}
|
|
191
|
+</script>
|