浏览代码

完成 经纪人

魏熙美 6 年前
父节点
当前提交
66c57c02ed
共有 4 个文件被更改,包括 157 次插入5 次删除
  1. 15
    1
      src/config/api.js
  2. 31
    1
      src/store/modules/followup.js
  3. 109
    1
      src/views/followup/list.vue
  4. 2
    2
      src/views/sysuser/role/add/add.vue

+ 15
- 1
src/config/api.js 查看文件

@@ -425,7 +425,21 @@ const apis = {
425 425
         method: 'delete',
426 426
         url: `${commPrefix}/taGoods/delete/:id`
427 427
       },
428
-    }
428
+    },
429
+  },
430
+  agent: {
431
+    save: {
432
+      method: 'post',
433
+      url: `${commPrefix}/taCustomerTransfer/add`
434
+    },
435
+    update: {
436
+      method: 'put',
437
+      url: `${commPrefix}/taCustomerTransfer/update`
438
+    },
439
+    delete: {
440
+      method: 'delete',
441
+      url: `${commPrefix}/taCustomerTransfer/delete/:id`
442
+    },
429 443
   }
430 444
 
431 445
 }

+ 31
- 1
src/store/modules/followup.js 查看文件

@@ -1,5 +1,5 @@
1 1
 import lodash from 'lodash'
2
-import { interact } from '../../utils'
2
+import {interact, replaceApiParams} from '../../utils'
3 3
 import apis from '../../config/api'
4 4
 
5 5
 export default {
@@ -20,6 +20,36 @@ export default {
20 20
       interact(api, payload).then((data) => {
21 21
         commit('updateFollowup', data)
22 22
       })
23
+    },
24
+    addAgent(_, payload){ // 保存经纪人
25
+      const api = lodash.get(apis, 'agent.save')
26
+      return new Promise((resolve, reject) => {
27
+        interact(api, JSON.stringify(payload)).then((data) => {
28
+          resolve(data)
29
+        }).catch(() => {
30
+          reject()
31
+        })
32
+      })
33
+    },
34
+    updateAgent(_, payload){ // 修改经纪人
35
+      const api = lodash.get(apis, 'agent.update')
36
+      return new Promise((resolve, reject) => {
37
+        interact(api, JSON.stringify(payload)).then((data) => {
38
+          resolve(data)
39
+        }).catch(() => {
40
+          reject()
41
+        })
42
+      })
43
+    },
44
+    deleteAgent(_, payload) { // 删除经纪人
45
+      return new Promise((resolve, reject) => {
46
+        const api = replaceApiParams(lodash.get(apis, 'agent.delete'), payload)
47
+        interact(api).then((data) => {
48
+          resolve(data)
49
+        }).catch(() => {
50
+          reject()
51
+        })
52
+      })
23 53
     }
24 54
   }
25 55
 }

+ 109
- 1
src/views/followup/list.vue 查看文件

@@ -10,6 +10,11 @@
10 10
       <el-form-item label="客户车牌号">
11 11
         <el-input v-model="formInline.platNumber" placeholder="车牌号"></el-input>
12 12
       </el-form-item>
13
+      <el-form-item label="经纪人">
14
+        <el-select v-model="formInline.agentUserId" placeholder="请选择经纪人">
15
+          <el-option v-for="item in SysUserList.records" :label="item.username" :value="item.userId" :key="item.userId"/>
16
+        </el-select>
17
+      </el-form-item>
13 18
       <el-form-item>
14 19
         <el-button type="primary" @click="onSubmit">查询</el-button>
15 20
         <el-button type="info" @click="clear">重置</el-button>
@@ -108,10 +113,22 @@
108 113
       prop="status"
109 114
       label="状态">
110 115
     </el-table-column> -->
116
+      <el-table-column
117
+      prop="agentUserName"
118
+      label="经纪人"
119
+      >
120
+      </el-table-column>
111 121
     <el-table-column
112 122
       prop="createDate"
113 123
       label="创建时间">
114 124
     </el-table-column>
125
+    <el-table-column
126
+       prop="customerId"
127
+       label="操作">
128
+      <template slot-scope="scope">
129
+        <el-button type="text" @click="showAgent(scope.row)" size="small">调整经纪人</el-button>
130
+      </template>
131
+    </el-table-column>
115 132
     <!-- <el-table-column
116 133
       prop="consultantId"
117 134
       label="置业ID">
@@ -131,11 +148,29 @@
131 148
             layout="total, sizes, prev, pager, next, jumper"
132 149
             :total="FollowupList.total || 0">
133 150
     </el-pagination>
151
+
152
+  <!-- 经济人弹框 -->
153
+    <el-dialog
154
+            title="选择经纪人"
155
+            :visible.sync="agentDialogVisible"
156
+            width="25%"
157
+            :before-close="handleClose">
158
+
159
+        <el-select v-model="agent.toUserId" placeholder="请选择经纪人">
160
+          <el-option v-for="item in SysUserList.records" :label="item.username" :value="item.userId" :key="item.userId"/>
161
+        </el-select>
162
+      <div style="display: flex; justify-content: flex-end;">
163
+        <el-button @click="agentDialogVisible = false">取 消</el-button>
164
+        <el-button type="primary" @click="agentSubmit(true)" v-if="agent.transferId === ''">确 定</el-button>
165
+        <el-button type="primary" @click="agentSubmit(false)" v-else>确 定</el-button>
166
+      </div>
167
+    </el-dialog>
134 168
   </div>
135 169
 </template>
136 170
 <script>
137 171
 import { createNamespacedHelpers } from 'vuex'
138 172
 const {mapState: mapFollowupState, mapActions: mapFollowupActions } = createNamespacedHelpers('followup')
173
+const {mapState: mapUserState, mapActions: mapUserActions} = createNamespacedHelpers('sysuser')
139 174
 
140 175
 export default {
141 176
   name: 'followup-index',
@@ -146,26 +181,64 @@ export default {
146 181
         personName: '',
147 182
         phone: '',
148 183
         platNumber: '',
184
+        agentUserId: '',
149 185
         pageNum: 1,
150 186
         pageSize: 10
187
+      },
188
+      listQuery: {
189
+        name: '',
190
+        phone: '',
191
+        identity: undefined,
192
+      },
193
+      pageNavi: {
194
+        page: 1,
195
+        size: 1000,
196
+        total: 0,
197
+      },
198
+      agentDialogVisible: false,
199
+      tempToUserId: '', // 经纪人ID,零时存储
200
+      agent: {
201
+        customerId: '', // 客户ID
202
+        toUserId: '', // 经纪人ID
203
+        transferId: ''
151 204
       }
152 205
     }
153 206
   },
154 207
   computed: {
155 208
     ...mapFollowupState({
156 209
     FollowupList: x => x.followup
210
+    }),
211
+    ...mapUserState({
212
+      SysUserList: x => x.list
157 213
     })
158 214
   },
159 215
   created() {
160 216
     this.getPage()
217
+    this.getUserList()
161 218
   },
162 219
   methods: {
163 220
     ...mapFollowupActions([
164
-      'getFollowup'
221
+      'getFollowup',
222
+      'addAgent',
223
+      'updateAgent'
224
+    ]),
225
+    ...mapUserActions([
226
+      'getSysUserList'
165 227
     ]),
166 228
     onSubmit() {
167 229
       this.getPage()
168 230
     },
231
+    getUserList () {
232
+      this.getSysUserList({
233
+        pageNum: this.pageNavi.page || 1,
234
+        pageSize: this.pageNavi.size,
235
+        identity: this.listQuery.identity === '%' ? undefined : this.listQuery.identity,
236
+        ...this.listQuery,
237
+      }).then((data) => {
238
+        const { current: page, size, total } = data
239
+        this.pageNavi = { page, size, total }
240
+      })
241
+    },
169 242
     getPage() {
170 243
       this.getFollowup(this.formInline)
171 244
       // window.console.log(this.$store)
@@ -208,7 +281,42 @@ export default {
208 281
       this.formInline.platNumber = ''
209 282
       this.formInline.pageNum = 1
210 283
       this.formInline.pageSize = 10
284
+      this.formInline.agentUserId = ''
211 285
       this.getPage()
286
+    },
287
+    showAgent(row) {
288
+      this.agentDialogVisible = true
289
+
290
+      // 关联 ta_customer_transfer 主键ID
291
+      // 主键存在表示修改,不存在就是添加
292
+      this.agent.transferId = row.transferId
293
+      if (row.transferId === null) {
294
+        this.agent.transferId = ''
295
+      }
296
+
297
+      this.agent.toUserId = row.agentUserId
298
+      if (row.agentUserId === null) {
299
+        this.agent.toUserId = ''
300
+      }
301
+
302
+      this.agent.customerId = row.customerId
303
+    },
304
+    handleClose(done) { // 关闭经纪人弹框
305
+      done();
306
+    },
307
+    agentSubmit(obj) {
308
+      if (obj) {
309
+        this.agent.transferId = ''
310
+        this.addAgent(this.agent).then(() => {
311
+          this.getPage()
312
+        })
313
+      } else {
314
+        this.updateAgent(this.agent).then(() => {
315
+          this.getPage()
316
+        })
317
+      }
318
+
319
+      this.agentDialogVisible = false
212 320
     }
213 321
    
214 322
   }

+ 2
- 2
src/views/sysuser/role/add/add.vue 查看文件

@@ -52,7 +52,7 @@ export default {
52 52
   methods: {
53 53
     ...mapSysRoleActions([
54 54
         'getMenus',
55
-        'AddRole'
55
+        'addRole'
56 56
     ]),
57 57
     getCheckedNodes() {
58 58
       let idSet = new Set();
@@ -67,7 +67,7 @@ export default {
67 67
     },
68 68
     onSubmit() {
69 69
         this.getCheckedNodes()
70
-        this.AddRole(this.form)
70
+        this.addRole(this.form)
71 71
         this.$router.go(-1)
72 72
     }
73 73
   },