소스 검색

完成 经纪人

魏熙美 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
         method: 'delete',
425
         method: 'delete',
426
         url: `${commPrefix}/taGoods/delete/:id`
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
 import lodash from 'lodash'
1
 import lodash from 'lodash'
2
-import { interact } from '../../utils'
2
+import {interact, replaceApiParams} from '../../utils'
3
 import apis from '../../config/api'
3
 import apis from '../../config/api'
4
 
4
 
5
 export default {
5
 export default {
20
       interact(api, payload).then((data) => {
20
       interact(api, payload).then((data) => {
21
         commit('updateFollowup', data)
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
       <el-form-item label="客户车牌号">
10
       <el-form-item label="客户车牌号">
11
         <el-input v-model="formInline.platNumber" placeholder="车牌号"></el-input>
11
         <el-input v-model="formInline.platNumber" placeholder="车牌号"></el-input>
12
       </el-form-item>
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
       <el-form-item>
18
       <el-form-item>
14
         <el-button type="primary" @click="onSubmit">查询</el-button>
19
         <el-button type="primary" @click="onSubmit">查询</el-button>
15
         <el-button type="info" @click="clear">重置</el-button>
20
         <el-button type="info" @click="clear">重置</el-button>
108
       prop="status"
113
       prop="status"
109
       label="状态">
114
       label="状态">
110
     </el-table-column> -->
115
     </el-table-column> -->
116
+      <el-table-column
117
+      prop="agentUserName"
118
+      label="经纪人"
119
+      >
120
+      </el-table-column>
111
     <el-table-column
121
     <el-table-column
112
       prop="createDate"
122
       prop="createDate"
113
       label="创建时间">
123
       label="创建时间">
114
     </el-table-column>
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
     <!-- <el-table-column
132
     <!-- <el-table-column
116
       prop="consultantId"
133
       prop="consultantId"
117
       label="置业ID">
134
       label="置业ID">
131
             layout="total, sizes, prev, pager, next, jumper"
148
             layout="total, sizes, prev, pager, next, jumper"
132
             :total="FollowupList.total || 0">
149
             :total="FollowupList.total || 0">
133
     </el-pagination>
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
   </div>
168
   </div>
135
 </template>
169
 </template>
136
 <script>
170
 <script>
137
 import { createNamespacedHelpers } from 'vuex'
171
 import { createNamespacedHelpers } from 'vuex'
138
 const {mapState: mapFollowupState, mapActions: mapFollowupActions } = createNamespacedHelpers('followup')
172
 const {mapState: mapFollowupState, mapActions: mapFollowupActions } = createNamespacedHelpers('followup')
173
+const {mapState: mapUserState, mapActions: mapUserActions} = createNamespacedHelpers('sysuser')
139
 
174
 
140
 export default {
175
 export default {
141
   name: 'followup-index',
176
   name: 'followup-index',
146
         personName: '',
181
         personName: '',
147
         phone: '',
182
         phone: '',
148
         platNumber: '',
183
         platNumber: '',
184
+        agentUserId: '',
149
         pageNum: 1,
185
         pageNum: 1,
150
         pageSize: 10
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
   computed: {
207
   computed: {
155
     ...mapFollowupState({
208
     ...mapFollowupState({
156
     FollowupList: x => x.followup
209
     FollowupList: x => x.followup
210
+    }),
211
+    ...mapUserState({
212
+      SysUserList: x => x.list
157
     })
213
     })
158
   },
214
   },
159
   created() {
215
   created() {
160
     this.getPage()
216
     this.getPage()
217
+    this.getUserList()
161
   },
218
   },
162
   methods: {
219
   methods: {
163
     ...mapFollowupActions([
220
     ...mapFollowupActions([
164
-      'getFollowup'
221
+      'getFollowup',
222
+      'addAgent',
223
+      'updateAgent'
224
+    ]),
225
+    ...mapUserActions([
226
+      'getSysUserList'
165
     ]),
227
     ]),
166
     onSubmit() {
228
     onSubmit() {
167
       this.getPage()
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
     getPage() {
242
     getPage() {
170
       this.getFollowup(this.formInline)
243
       this.getFollowup(this.formInline)
171
       // window.console.log(this.$store)
244
       // window.console.log(this.$store)
208
       this.formInline.platNumber = ''
281
       this.formInline.platNumber = ''
209
       this.formInline.pageNum = 1
282
       this.formInline.pageNum = 1
210
       this.formInline.pageSize = 10
283
       this.formInline.pageSize = 10
284
+      this.formInline.agentUserId = ''
211
       this.getPage()
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
   methods: {
52
   methods: {
53
     ...mapSysRoleActions([
53
     ...mapSysRoleActions([
54
         'getMenus',
54
         'getMenus',
55
-        'AddRole'
55
+        'addRole'
56
     ]),
56
     ]),
57
     getCheckedNodes() {
57
     getCheckedNodes() {
58
       let idSet = new Set();
58
       let idSet = new Set();
67
     },
67
     },
68
     onSubmit() {
68
     onSubmit() {
69
         this.getCheckedNodes()
69
         this.getCheckedNodes()
70
-        this.AddRole(this.form)
70
+        this.addRole(this.form)
71
         this.$router.go(-1)
71
         this.$router.go(-1)
72
     }
72
     }
73
   },
73
   },