瀏覽代碼

add directory

ethan 6 年之前
父節點
當前提交
a7bfe82467
共有 4 個文件被更改,包括 244 次插入13 次删除
  1. 25 0
      src/api/directory.js
  2. 41 11
      src/router/index.js
  3. 2 2
      src/utils/point.js
  4. 176 0
      src/views/directory/index.vue

+ 25 - 0
src/api/directory.js

@@ -0,0 +1,25 @@
1
+import request from '@/utils/request'
2
+
3
+export function createDirectory(data) {
4
+  return request({
5
+    url: '/weChatDirectories',
6
+    method: 'post',
7
+    data: {
8
+      name: data.name,
9
+      wechatId: data.wechatId,
10
+      phone: data.phone
11
+    }
12
+  })
13
+}
14
+
15
+export function fetchDirectory(query) {
16
+  return request({
17
+    url: `/weChatDirectories`,
18
+    method: 'get',
19
+    params: {
20
+      name: query.name,
21
+      limit: query.limit,
22
+      offset: (query.page - 1) * query.limit
23
+    }
24
+  })
25
+}

+ 41 - 11
src/router/index.js

@@ -57,7 +57,8 @@ export const constantRouterMap = [
57 57
         // redirect: '/round/index/gambleMember/index',
58 58
         meta: {
59 59
           title: '房間管理',
60
-          icon: 'form'
60
+          icon: 'form',
61
+          noCache: true
61 62
           // role: ['dd']
62 63
         },
63 64
         children: [
@@ -67,7 +68,8 @@ export const constantRouterMap = [
67 68
             component: _import('room/wechatMember/index'),
68 69
             hidden: true,
69 70
             meta: {
70
-              title: '微信會員'
71
+              title: '微信會員',
72
+              noCache: true
71 73
               // role: ['dd']
72 74
             },
73 75
             children: [
@@ -77,7 +79,8 @@ export const constantRouterMap = [
77 79
                 component: _import('room/gameHistory/index'),
78 80
                 hidden: true,
79 81
                 meta: {
80
-                  title: '歷史紀錄'
82
+                  title: '歷史紀錄',
83
+                  noCache: true
81 84
                   // role: ['dd']
82 85
                 },
83 86
                 children: [
@@ -87,7 +90,8 @@ export const constantRouterMap = [
87 90
                     component: _import('room/detail/index'),
88 91
                     hidden: true,
89 92
                     meta: {
90
-                      title: '詳細記錄'
93
+                      title: '詳細記錄',
94
+                      noCache: true
91 95
                       // role: ['dd']
92 96
                     }
93 97
                   }
@@ -99,7 +103,8 @@ export const constantRouterMap = [
99 103
                 component: _import('room/chipsHistory/index'),
100 104
                 hidden: true,
101 105
                 meta: {
102
-                  title: '上下分紀錄'
106
+                  title: '上下分紀錄',
107
+                  noCache: true
103 108
                   // role: ['dd']
104 109
                 }
105 110
               }
@@ -110,7 +115,8 @@ export const constantRouterMap = [
110 115
             component: _import('room/wechatGameMaster/index'),
111 116
             hidden: true,
112 117
             meta: {
113
-              title: '微信客服'
118
+              title: '微信客服',
119
+              noCache: true
114 120
               // role: ['dd']
115 121
             }
116 122
           }
@@ -129,7 +135,8 @@ export const constantRouterMap = [
129 135
         component: _import('gambleGameBucket/index'),
130 136
         meta: {
131 137
           title: '每場紀錄',
132
-          icon: 'table'
138
+          icon: 'table',
139
+          noCache: true
133 140
           // role: ['dd']
134 141
         },
135 142
         children: [
@@ -139,7 +146,8 @@ export const constantRouterMap = [
139 146
             component: _import('gambleGameBucket/detail/index'),
140 147
             hidden: true,
141 148
             meta: {
142
-              title: '詳細紀錄'
149
+              title: '詳細紀錄',
150
+              noCache: true
143 151
               // role: ['dd']
144 152
             }
145 153
           }
@@ -158,7 +166,8 @@ export const constantRouterMap = [
158 166
         component: _import('agnetManagement/index'),
159 167
         meta: {
160 168
           title: '代理商管理',
161
-          icon: 'table'
169
+          icon: 'table',
170
+          noCache: true
162 171
           // role: ['dd']
163 172
         },
164 173
         children: [
@@ -168,7 +177,8 @@ export const constantRouterMap = [
168 177
             component: _import('agnetManagement/gambleMemberManagement/index'),
169 178
             hidden: true,
170 179
             meta: {
171
-              title: '會員管理'
180
+              title: '會員管理',
181
+              noCache: true
172 182
               // role: ['dd']
173 183
             },
174 184
             children: [
@@ -178,7 +188,8 @@ export const constantRouterMap = [
178 188
                 component: _import('room/gameHistory/index'),
179 189
                 hidden: true,
180 190
                 meta: {
181
-                  title: '歷史紀錄'
191
+                  title: '歷史紀錄',
192
+                  noCache: true
182 193
                   // role: ['dd']
183 194
                 }
184 195
               }
@@ -207,6 +218,25 @@ export const constantRouterMap = [
207 218
       }
208 219
     ]
209 220
   },
221
+  {
222
+    path: '/directory',
223
+    component: Layout,
224
+    redirect: 'directory',
225
+    name: 'Directory',
226
+    children: [
227
+      {
228
+        path: 'directory',
229
+        name: 'directory',
230
+        component: _import('directory/index'),
231
+        meta: {
232
+          title: '通訊錄',
233
+          icon: 'table',
234
+          noCache: true
235
+          // role: ['dd']
236
+        }
237
+      }
238
+    ]
239
+  },
210 240
   // {
211 241
   //   path: '/example',
212 242
   //   component: Layout,

+ 2 - 2
src/utils/point.js

@@ -7,14 +7,14 @@ export function ponitTransform(dealingRecord) {
7 7
   totalPoints = Number(totalPoints)
8 8
   if (point1 === 0 && point2 === 0) {
9 9
     return `白板對`
10
+  } else if (point1 === -1 || point2 === -1) {
11
+    return `莊家通賠`
10 12
   } else if (point1 === point2) {
11 13
     return `對子`
12 14
   } else if (point1 + point2 === 10) {
13 15
     return `尻`
14 16
   } else if (point1 === 0 || point2 === 0) {
15 17
     return `${point1 === 0 ? nzhhk.encodeS(`${point2}`) : nzhhk.encodeS(`${point1}`)}點半`
16
-  } else if (point1 === -1 || point2 === -1) {
17
-    return `莊家通賠`
18 18
   } else {
19 19
     return `${nzhhk.encodeS(`${totalPoints}`)}點`
20 20
   }

+ 176 - 0
src/views/directory/index.vue

@@ -0,0 +1,176 @@
1
+<template>
2
+  <div class="app-container calendar-list-container">
3
+    <div  v-show="visible.firstLayer">
4
+      <div class="app-container">
5
+        <el-input @keyup.enter.native="handleFilter" style="width: 200px;" class="filter-item" placeholder="名稱" v-model="listQuery.name">
6
+        </el-input>
7
+        <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">搜尋</el-button>
8
+        <el-button class="filter-item" @click="handleCreate" type="primary" icon="el-icon-edit">創建聯絡人</el-button>
9
+      </div>
10
+      <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row
11
+        style="width: 100%">
12
+        <!-- <el-table-column align="center" label='ID' >
13
+          <template slot-scope="scope">
14
+            {{scope.row.GambleMember.id}}
15
+          </template>
16
+        </el-table-column> -->
17
+        <el-table-column label="名稱" align="center">
18
+          <template slot-scope="scope">
19
+            {{scope.row.name}}
20
+          </template>
21
+        </el-table-column>
22
+        <el-table-column label="微信ID" align="center">
23
+          <template slot-scope="scope">
24
+            {{scope.row.wechatId}}
25
+          </template>
26
+        </el-table-column>
27
+          <el-table-column label="電話" align="center">
28
+            <template slot-scope="scope">
29
+              <span>{{scope.row.phone}}</span>
30
+            </template>
31
+        </el-table-column>
32
+        <el-table-column align="center" label="操作" width="450">
33
+        </el-table-column>
34
+      </el-table>
35
+
36
+      <div v-show="!listLoading" class="pagination-container">
37
+        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page.sync="listQuery.page"
38
+          :page-sizes="[10,20,30, 50]" :page-size="listQuery.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
39
+        </el-pagination>
40
+      </div>
41
+
42
+      <el-dialog title="創建聯絡人" :visible.sync="dialogCreateFormVisible" :before-close="handleDialogClose" center>
43
+        <el-form :rules="rules" ref="createForm" :model="createFormData" label-position="left" label-width="100px" style='width: 400px; margin-left:50px;'>
44
+          <el-form-item label="名稱" prop="name">
45
+            <el-input v-model="createFormData.name"></el-input>
46
+          </el-form-item>
47
+          <el-form-item label="微信 ID">
48
+            <el-input v-model="createFormData.wechatId"></el-input>
49
+          </el-form-item>
50
+            <el-form-item label="電話">
51
+            <el-input v-model="createFormData.phone"></el-input>
52
+          </el-form-item>
53
+        </el-form>          
54
+        <div slot="footer" class="dialog-footer">
55
+          <el-button @click="handleDialogClose">取 消</el-button>
56
+          <el-button type="primary" @click="createData">確 定</el-button>
57
+        </div>
58
+      </el-dialog>
59
+    </div>
60
+    <router-view></router-view>
61
+  </div>
62
+</template>
63
+
64
+<script>
65
+
66
+import { mapGetters, mapActions } from 'vuex'
67
+import { createDirectory, fetchDirectory } from '@/api/directory'
68
+import waves from '@/directive/waves' // 水波纹指令
69
+import moment from 'moment-timezone'
70
+import _ from 'lodash'
71
+import { Decimal } from 'decimal.js';
72
+
73
+export default {
74
+  directives: {
75
+    waves
76
+  },
77
+  data() {
78
+    return {
79
+      list: [],
80
+      total: null,
81
+      listLoading: true,
82
+      listQuery: {
83
+        page: 1,
84
+        limit: 20,
85
+        name: '',
86
+      },
87
+      dialogCreateFormVisible: false,
88
+      dialogStatus: '',
89
+      // agent: {},
90
+      rules: {
91
+        // rewardChips: [{ pattern: /^-?\d+$/, required: true, message: '請輸入整數', trigger: 'change' }],        
92
+        // depositChips: [{ pattern: /^-?\d+$/, required: true, message: '請輸入整數', trigger: 'change' }],                
93
+        // chips: [{ pattern: /^(0|[1-9][0-9]*)$/, required: true, message: '請輸入整數', trigger: 'change' }],
94
+        // name: [{ type: 'string', required: true, message: '必填', trigger: 'change' }]
95
+      },
96
+      createFormData: {
97
+        name: '',
98
+        wechatId: '',
99
+        phone: ''
100
+      }
101
+    }
102
+  },
103
+  created() {
104
+    this.SetVisible(1)
105
+    this.getList()
106
+  },
107
+  computed: {
108
+    ...mapGetters([
109
+      'visible',
110
+      'data',
111
+    ])
112
+  },
113
+  methods: {
114
+    ...mapActions([
115
+      'SetVisible',
116
+      'SetData',
117
+    ]),
118
+    getList() {
119
+      this.listLoading = true
120
+      fetchDirectory(this.listQuery).then(response => {
121
+        this.list = response.data.rows
122
+        this.total = response.data.count
123
+        console.log('res', response)
124
+      })
125
+      this.listLoading = false
126
+    },
127
+    resetCreateData() {
128
+      this.createFormData = {
129
+        id: undefined,
130
+        name: '',
131
+        wechatId: '',
132
+        phone: ''
133
+      }
134
+    },
135
+    handleCreate() {
136
+      this.resetCreateData()
137
+      this.dialogCreateFormVisible = true
138
+      this.$nextTick(() => {
139
+        this.$refs['createForm'].clearValidate()
140
+      })
141
+    },
142
+    createData() {
143
+      this.$refs['createForm'].validate((valid) => {
144
+        if (valid) {
145
+          createDirectory(this.createFormData).then((response) => {
146
+            let user = response.data
147
+            this.list.unshift(user)
148
+            this.dialogCreateFormVisible = false         
149
+            this.$notify({
150
+              title: '成功',
151
+              message: '創建成功',
152
+              type: 'success',
153
+              duration: 2000
154
+            })
155
+          })
156
+        }
157
+      })
158
+    },
159
+    handleFilter() {
160
+      this.listQuery.page = 1
161
+      this.getList()
162
+    },
163
+    handleSizeChange(val) {
164
+      this.listQuery.limit = val
165
+      this.getList()
166
+    },
167
+    handleCurrentChange(val) {
168
+      this.listQuery.page = val
169
+      this.getList()
170
+    },
171
+    handleDialogClose() {
172
+      this.dialogCreateFormVisible = false;
173
+    },
174
+  },
175
+}
176
+</script>