index.vue
29.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
<template>
<div id="app" class="app-container" style="margin: 10px;">
<el-form :inline="true" :model="parameter" class="demo-form-inline">
<el-form-item label="用户ID">
<el-input v-model="parameter.UserId" placeholder="用户ID"></el-input>
</el-form-item>
<el-form-item label="手机号">
<!-- <el-select v-model="formInline.region" placeholder="活动区域">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select> -->
<el-input v-model="parameter.Phone" placeholder="手机号"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="SubmitUser">查询</el-button>
</el-form-item>
</el-form>
<el-table style="margin-top: 5px;" v-loading="listLoading" :data="userlist" element-loading-text="Loading"
border fit highlight-current-row>
<el-table-column label="上线" align="center">
<template slot-scope="scope">
{{scope.row.ParentUserId}}
</template>
</el-table-column>
<el-table-column label="微信头像" width="120" align="center">
<template slot-scope="scope">
<img :src="scope.row.beijintupian" style="width: 50px;height: 50px;" />
</template>
</el-table-column>
<el-table-column label="用户ID" width="120" align="center">
<template slot-scope="scope">
{{scope.row.id}}
</template>
</el-table-column>
<el-table-column label="用户微信名" align="center">
<template slot-scope="scope">
<span>{{ scope.row.username }}</span>
</template>
</el-table-column>
<el-table-column label="称呼" align="center">
<template slot-scope="scope">
<span>{{ scope.row.full_name }}</span>
</template>
</el-table-column>
<el-table-column label="手机号码" align="center">
<template slot-scope="scope">
<span>{{ scope.row.phone }}</span>
</template>
</el-table-column>
<el-table-column label="备用手机" align="center">
<template slot-scope="scope">
<span>{{ scope.row.updphone }}</span>
</template>
</el-table-column>
<el-table-column label="地址" align="center">
<template slot-scope="scope">
<span>{{ scope.row.address }}</span>
</template>
</el-table-column>
<el-table-column label="车型" align="center">
<template slot-scope="scope">
<span>{{ scope.row.CarModel }}</span>
</template>
</el-table-column>
<el-table-column label="颜色" align="center">
<template slot-scope="scope">
<span>{{ scope.row.CarColour }}</span>
</template>
</el-table-column>
<el-table-column label="划痕" align="center">
<template slot-scope="scope">
<span>{{ scope.row.Scratch }}</span>
</template>
</el-table-column>
<el-table-column label="腐蚀" align="center">
<template slot-scope="scope">
<span>{{ scope.row.Corrosion}}</span>
</template>
</el-table-column>
<el-table-column label="破损" align="center">
<template slot-scope="scope">
<span>{{ scope.row.BeDamaged }}</span>
</template>
</el-table-column>
<el-table-column label="飞漆" align="center">
<template slot-scope="scope">
<span>{{ scope.row.FlyingPaint }}</span>
</template>
</el-table-column>
<el-table-column label="余额" align="center" v-if="false">
<template slot-scope="scope">
<span>¥{{ scope.row.balance/100 }}</span>
</template>
</el-table-column>
<el-table-column label="已完成单数" align="center" v-if="false">
<template slot-scope="scope">
<span>{{scope.row.nowNum }}</span>
</template>
</el-table-column>
<el-table-column label="性别" align="center" v-if="false">
<template slot-scope="scope">
<el-tag :type="scope.row.sex==0?'success':'warn'">
<span>{{ scope.row.sex==0?'男':'女'}}</span>
</el-tag>
</template>
</el-table-column>
<el-table-column label="生日" align="center" v-if="false">
<template slot-scope="scope">
<span>{{ scope.row.birthday }}</span>
</template>
</el-table-column>
<el-table-column label="注册时间" align="center" v-if="false">
<template slot-scope="scope">
{{ scope.row.add_time }}
</template>
</el-table-column>
<el-table-column label="用户角色" align="center">
<template slot-scope="scope">
<el-tag :key="scope.row.type" type="warning" effect="dark">
{{scope.row.type==0?'超级管理员':scope.row.type==1?'管理员':scope.row.type==2?'普通用户':scope.row.type==3?'推广专员':scope.row.type==4?'客户经理':'未知' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="用户状态" align="center">
<template slot-scope="scope">
<el-tag :key="scope.row.status" v-if="scope.row.status==='0'" type="success" effect="dark">
使用中
</el-tag>
<el-tag :key="scope.row.status" v-if="scope.row.status==='-99'" type="danger" effect="dark">
禁用中
</el-tag>
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="230">
<template slot-scope="scope">
<el-dropdown @command="(e)=>{handleCommand(e,scope.row.id,scope.row)}">
<span class="el-dropdown-link">
操作<el-icon class="el-icon--right">
<arrow-down />
</el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="h">查看客户
</el-dropdown-item>
<el-dropdown-item command="i">查看专员
</el-dropdown-item>
<el-dropdown-item command="a">升级成客户经理
</el-dropdown-item>
<el-dropdown-item command="e">升级成推广专员
</el-dropdown-item>
<el-dropdown-item command="b">删除</el-dropdown-item>
<el-dropdown-item command='c' v-if="false">编辑</el-dropdown-item>
<el-dropdown-item command='d' v-if="false">车辆信息</el-dropdown-item>
<el-dropdown-item command="f" v-if="scope.row.status==0">拉黑用户</el-dropdown-item>
<el-dropdown-item command="g" v-else>取消拉黑</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<el-pagination background layout="prev, pager, next" :total="parameter.TotalCount" @current-change="Pages"
style="text-align: right;margin-top: 10px;">
</el-pagination>
<el-dialog title="查看客户" :visible.sync="dialogVisibleSub" width="100%">
<el-table :data="SubList" element-loading-text="Loading" border fit highlight-current-row>
<el-table-column label="用户ID" width="120" align="center">
<template slot-scope="scope">
{{scope.row.id}}
</template>
</el-table-column>
<el-table-column label="用户微信名" align="center">
<template slot-scope="scope">
<span>{{ scope.row.username }}</span>
</template>
</el-table-column>
<el-table-column label="别名" align="center" v-if="false">
<template slot-scope="scope">
<span>{{ scope.row.full_name }}</span>
</template>
</el-table-column>
<el-table-column label="用户电话" align="center">
<template slot-scope="scope">
<span>{{ scope.row.phone }}</span>
</template>
</el-table-column>
<el-table-column label="备用电话" align="center">
<template slot-scope="scope">
<span>{{ scope.row.updphone }}</span>
</template>
</el-table-column>
<el-table-column label="地址" align="center">
<template slot-scope="scope">
<span>{{ scope.row.address }}</span>
</template>
</el-table-column>
<el-table-column label="余额" align="center">
<template slot-scope="scope">
<span>¥{{ scope.row.balance/100 }}</span>
</template>
</el-table-column>
<el-table-column label="已完成单数" align="center">
<template slot-scope="scope">
<span>{{scope.row.nowNum }}</span>
</template>
</el-table-column>
<el-table-column label="性别" align="center" v-if="false">
<template slot-scope="scope">
<el-tag :type="scope.row.sex==0?'success':'warn'">
<span>{{ scope.row.sex==0?'男':'女'}}</span>
</el-tag>
</template>
</el-table-column>
<el-table-column label="生日" align="center" v-if="false">
<template slot-scope="scope">
<span>{{ scope.row.birthday }}</span>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleSub = false">取 消</el-button>
<el-button type="primary" @click="dialogVisibleSub = false">确 定</el-button>
</span>
<el-pagination background layout="prev, pager, next" :total="SubModel.TotalCount" @current-change="PageSub"
style="text-align: center;margin-top: 10px;">
</el-pagination>
</el-dialog>
<el-dialog title="查看专员" :visible.sync="dialogVisibleCom" width="100%">
<el-table :data="CommiserList" element-loading-text="Loading" border fit highlight-current-row>
<el-table-column label="用户ID" width="120" align="center">
<template slot-scope="scope">
{{scope.row.id}}
</template>
</el-table-column>
<el-table-column label="用户微信名" align="center">
<template slot-scope="scope">
<span>{{ scope.row.username }}</span>
</template>
</el-table-column>
<el-table-column label="别名" align="center" v-if="false">
<template slot-scope="scope">
<span>{{ scope.row.full_name }}</span>
</template>
</el-table-column>
<el-table-column label="用户电话" align="center">
<template slot-scope="scope">
<span>{{ scope.row.phone }}</span>
</template>
</el-table-column>
<el-table-column label="备用电话" align="center">
<template slot-scope="scope">
<span>{{ scope.row.updphone }}</span>
</template>
</el-table-column>
<el-table-column label="地址" align="center">
<template slot-scope="scope">
<span>{{ scope.row.address }}</span>
</template>
</el-table-column>
<el-table-column label="余额" align="center" >
<template slot-scope="scope">
<span>¥{{ scope.row.balance/100 }}</span>
</template>
</el-table-column>
<el-table-column label="已完成单数" align="center" >
<template slot-scope="scope">
<span>{{scope.row.nowNum }}</span>
</template>
</el-table-column>
<el-table-column label="性别" align="center" v-if="false">
<template slot-scope="scope">
<el-tag :type="scope.row.sex==0?'success':'warn'">
<span>{{ scope.row.sex==0?'男':'女'}}</span>
</el-tag>
</template>
</el-table-column>
<el-table-column label="生日" align="center" v-if="false">
<template slot-scope="scope">
<span>{{ scope.row.birthday }}</span>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleCom = false">取 消</el-button>
<el-button type="primary" @click="dialogVisibleCom = false">确 定</el-button>
</span>
<el-pagination background layout="prev, pager, next" :total="ComTotalCount"
style="text-align: center;margin-top: 10px;">
</el-pagination>
</el-dialog>
<el-dialog title="编辑" :visible.sync="dialogVisible" width="50%">
<el-form ref="form" :model="form" label-width="80px" :rules="rules">
<el-form-item label="账户名" prop="username">
<el-input v-model="form.username"></el-input>
</el-form-item>
<el-form-item label="身份证号" prop="ID_card" v-if="false">
<el-input v-model="form.ID_card"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="phone">
<el-input v-model="form.phone"></el-input>
</el-form-item>
<el-form-item label="地址" prop="address">
<el-input v-model="form.address"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark"></el-input>
</el-form-item>
<el-form-item label="性别" prop="sex">
<!-- 0男 1-女 -->
<el-select v-model="form.sex" placeholder="请选择">
<el-option label="男" value="0"></el-option>
<el-option label="女" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="生日" prop="birthday">
<el-date-picker v-model="form.birthday" type="date" placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="UpdSubmit">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="车辆信息" :visible.sync="dialogVisibleCar" width="50%">
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="date" label="ID" width="180" v-if="false">
<template slot-scope="scope">
{{scope.row.id}}
</template>
</el-table-column>
<el-table-column prop="date" label="用户ID" width="180" v-if="false">
<template slot-scope="scope">
{{scope.row.id}}
</template>
</el-table-column>
<el-table-column prop="date" label="车型" width="180">
<template slot-scope="scope">
{{scope.row.CarModel}}
</template>
</el-table-column>
<el-table-column prop="Scratch" label="漆面划痕" width="180">
<template slot-scope="scope">
{{scope.row.Scratch}}
</template>
</el-table-column>
<el-table-column prop="Corrosion" label="漆面腐蚀" width="180">
<template slot-scope="scope">
{{scope.row.Corrosion}}
</template>
</el-table-column>
<el-table-column prop="BeDamaged" label="漆面破损" width="180">
<template slot-scope="scope">
{{scope.row.BeDamaged}}
</template>
</el-table-column>
<el-table-column prop="FlyingPaint" label="沥青飞漆" width="180">
<template slot-scope="scope">
{{scope.row.FlyingPaint}}
</template>
</el-table-column>
<el-table-column prop="CarDefault" label="默认车辆" width="180">
<template slot-scope="scope">
<el-tag :type="scope.row.CarDefault==true?'success':'warn'">
{{scope.row.CarDefault==true?'默认车辆':'非默认车辆'}}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="AddTime" label="添加时间" width="180">
<template slot-scope="scope">
{{scope.row.AddTime}}
</template>
</el-table-column>
<el-table-column prop="UpdateTime" label="修改时间" width="180">
<template slot-scope="scope">
{{scope.row.UpdateTime}}
</template>
</el-table-column>
<el-table-column prop="UpdateTime" label="设为默认" width="180">
<template slot-scope="scope">
<el-button type="success" @click="SetDefault(scope.row)">设为默认</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination background layout="prev, pager, next" :total="CarModel.TotalCount" @current-change="PagesCar"
style="text-align: right;margin-top: 10px;">
</el-pagination>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleCar = false">取 消</el-button>
<el-button type="primary" @click="dialogVisibleCar = false">确 定</el-button>
</span>
</el-dialog>
<el-dialog title="上级ID编号" :visible.sync="dialogVisibleT" width="90%">
<el-form :inline="true">
<el-form-item label="关键字">
<el-input v-model="ManagerModel.KeyWord" placeholder="关键字查询"></el-input>
</el-form-item>
<el-form-item>
<el-button type="success" @click="SubmitManager">提交</el-button>
</el-form-item>
</el-form>
<!-- <el-input v-model="updateType.ParentUserId" placeholder="请输入上级ID"></el-input> -->
<el-table :data="ManagerList" element-loading-text="Loading" border fit highlight-current-row
ref="multipleTable" @row-click="singleElection">
<el-table-column label="" width="65">
<template slot-scope="scope">
<el-radio class="radio" :label="scope.$index" v-model="radiodata"> </el-radio>
</template>
</el-table-column>
<el-table-column label="用户ID" width="120" align="center">
<template slot-scope="scope">
{{scope.row.id}}
</template>
</el-table-column>
<el-table-column label="用户微信名" align="center">
<template slot-scope="scope">
<span>{{ scope.row.username }}</span>
</template>
</el-table-column>
<el-table-column label="别名" align="center" v-if="false">
<template slot-scope="scope">
<span>{{ scope.row.full_name }}</span>
</template>
</el-table-column>
<el-table-column label="用户电话" align="center">
<template slot-scope="scope">
<span>{{ scope.row.phone }}</span>
</template>
</el-table-column>
<el-table-column label="备用电话" align="center">
<template slot-scope="scope">
<span>{{ scope.row.updphone }}</span>
</template>
</el-table-column>
<el-table-column label="地址" align="center">
<template slot-scope="scope">
<span>{{ scope.row.address }}</span>
</template>
</el-table-column>
<el-table-column label="余额" align="center">
<template slot-scope="scope">
<span>¥{{ scope.row.balance/100 }}</span>
</template>
</el-table-column>
<el-table-column label="已完成单数" align="center">
<template slot-scope="scope">
<span>{{scope.row.nowNum }}</span>
</template>
</el-table-column>
<el-table-column label="性别" align="center" v-if="false">
<template slot-scope="scope">
<el-tag :type="scope.row.sex==0?'success':'warn'">
<span>{{ scope.row.sex==0?'男':'女'}}</span>
</el-tag>
</template>
</el-table-column>
<el-table-column label="生日" align="center" v-if="false">
<template slot-scope="scope">
<span>{{ scope.row.birthday }}</span>
</template>
</el-table-column>
</el-table>
<el-pagination background layout="prev, pager, next" :total="ManagerModel.TotalCount"
@current-change="PagesManager" style="text-align: right;margin-top: 10px;">
</el-pagination>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleT = false">取 消</el-button>
<el-button type="primary" @click="UpdateUserType">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
GetUserByCar,
GetUserList,
UpdateUserType,
DeleteUser,
Save,
Blacklist,
NoBlacklist,
GetUserListByInviteeUserId,
GetCommissionerByManage,
GetUserListBytManager
} from '@/api/user'
import {
GetVehicleListByUser,
UpdateCarDefault,
} from '../../api/VehicleManagement.js'
import utils from '../../utils/utils.js'
export default {
data() {
return {
tableData: [],
radiodata: '',
dialogVisibleCom: false,
dialogVisibleSub: false,
dialogVisibleT: false,
dialogVisible: false,
dialogVisibleCar: false,
dialogVisiblecommissioner: false,
rules: {
username: [{
required: true,
message: '请输入账户名',
trigger: 'blur'
}],
ID_card: [{
required: true,
message: '请输入身份证号码',
trigger: 'blur'
}, {
min: 6,
max: 30,
message: '长度在 6 到 30 个字符'
}, {
pattern: /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/,
message: '请输入正确的身份证号码'
}],
phone: [{
required: true,
message: '请输入电话号码',
trigger: 'blur'
}, {
pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/,
message: '请输入正确的手机号格式'
}],
address: [{
required: true,
message: '请输入地址',
trigger: 'blur'
}],
sex: [{
required: true,
message: '请选择年龄',
trigger: 'blur'
}],
birthday: [{
required: true,
message: '请选择生日',
trigger: 'blur'
}],
},
//经理下面的专员
CommiserList: [],
// 条数
ComTotalCount: 0,
userlist: [],
// 该用户下级信息
SubList: [],
listLoading: true,
parameter: {
"UserId": 0,
"Phone": "",
"KeyWord": "",
"TotalCount": 0,
"PageIndex": 1,
"PageSize": 20,
"Sort": [{
"Field": "id",
"Type": 0
}]
},
// {
// pageIndex: 1,
// pageSize: 10,
// sort: "id",
// sortOrder: 2,
// keyword: "",
// status: 1
// },
total: 0,
updateType: {
UserId: 0,
UserType: 2,
ParentUserId: 0
},
form: {
"ParentUserId": 0,
"InviteeUserId": 0,
"beijintupian": "",
"birthday": "",
"ID_card": "",
"address": "",
"id": 0,
"username": "",
"password": "",
"author": "",
"status": "",
"type": 0,
"full_name": "",
"add_time": "2022-01-20T13:27:24.548Z",
"update_time": "2022-01-20T13:27:24.548Z",
"remark": "",
"avatar": "",
"phone": "",
"openid": "",
"sex": "",
"balance": 0
},
CarModel: {
"UserId": 0,
"KeyWord": "",
"TotalCount": 0,
"PageIndex": 1,
"PageSize": 10,
"Sort": [{
"Field": "id",
"Type": 0
}]
},
// 默认
CarDefaultModel: {
"id": 0,
"UserId": 0
},
SubModel: {
"ParentUserId": 0,
"KeyWord": "",
"TotalCount": 0,
"PageIndex": 1,
"PageSize": 10,
"Sort": [{
"Field": "",
"Type": 0
}]
},
ManagerModel: {
"KeyWord": "",
"TotalCount": 0,
"PageIndex": 1,
"PageSize": 10,
"Sort": [{
"Field": "id",
"Type": 0
}]
},
ManagerList: []
}
},
created() {},
mounted() {
this.GetUserListHeadler();
},
methods: {
PagesManager(e) {
this.ManagerModel.PageIndex = e
this.ShowManager()
},
Pages(e) {
this.parameter.pageIndex = e
this.GetUserListHeadler()
},
PageSub(e) {
this.SubModel.PageIndex = e
this.ShowSub()
},
PagesCar(e) {
this.CarModel.PageIndex = e
this.ShowCar()
},
GetUserListHeadler() {
GetUserByCar(this.parameter).then(res => {
res.data.data.rows.forEach((item, index) => {
item.birthday = utils.formatTime(item.birthday, "yyyy-MM-dd")
})
this.userlist = res.data.data.rows
this.parameter.TotalCount=res.data.data.total
console.log('经理', this.userlist)
this.listLoading = false;
});
},
// 提交查询
SubmitUser(){
this.GetUserListHeadler()
},
handleCommand(value, val, item) {
if (value == "a") {
this.UpdateUserTypeHeadler(val);
}
if (value == "b") {
this.DelUserHeadler(val)
}
if (value == "c") {
this.UpdateUserHeadler(item)
}
if (value == "d") {
this.ShowCar(val)
}
if (value == "e") {
this.ShowUpgrade(val)
// this.UpdateUserType(val)
// this.dialogVisibleT=true
}
if (value == 'f') {
// 拉黑
this.BlacklistSubmit(val)
}
if (value == 'g') {
// 取消拉黑
this.NoBlacklistSubmit(val)
}
if (value == 'h') {
// 显示下级信息
this.ShowSub(val)
}
if (value == 'i') {
// 显示经理下面的专员
this.ShowCommissioner(val)
}
},
// 显示经理下面的专员
ShowCommissioner(val) {
this.dialogVisibleCom = true
let json = {
UserId: val
}
GetCommissionerByManage(json).then(res => {
console.log('数据专员', res)
this.CommiserList = res.data.data
this.ComTotalCount = res.data.data.length
})
},
// 查询该用户下级数据
ShowSub(val) {
this.dialogVisibleSub = true
console.log('val数据', val)
this.SubModel.ParentUserId = val
GetUserListByInviteeUserId(this.SubModel).then(res => {
console.log('查询数据', res)
this.SubModel.TotalCount = res.data.data.total
this.SubList = res.data.data.rows
console.log('查询下级数据', this.SubList)
})
},
BlacklistSubmit(id) {
// 拉黑
Blacklist(id).then(res => {
if (res.data.code == 200) {
this.$message.success('拉黑成功')
this.GetUserListHeadler()
} else {
this.$message.error('拉黑失败')
}
})
},
NoBlacklistSubmit(id) {
// 取消拉黑
NoBlacklist(id).then(res => {
if (res.data.code == 200) {
this.$message.success('取消拉黑成功')
this.GetUserListHeadler()
} else {
this.$message.error('取消拉黑失败')
}
})
},
// 查询销售经理 (升级推广专员)
ShowManager() {
GetUserListBytManager(this.ManagerModel).then(res => {
console.log('销售经理', res)
this.ManagerModel.TotalCount = res.data.data.total
this.ManagerList = res.data.data.rows
})
},
SubmitManager() {
this.ShowManager()
},
// 选择推广经理
singleElection(row) {
console.log('数据啊啊啊row', row)
this.updateType.ParentUserId = row.id
},
// 升级推广专员打开页面传参
ShowUpgrade(val) {
this.dialogVisibleT = true
this.ShowManager()
// 升级成推广专员
this.updateType.UserId = val
this.updateType.UserType = 3
console.log('ID', this.updateType)
},
UpdateUserType() {
// 修改成推广专员
// this.updateType = {
// UserId: UserId,
// UserType: 3,
// ParentUserId: 0
// };
this.$confirm('确定把该用户升级成推广专员?', '消息', {
confirmButtonText: '确认',
cancelButtonText: '取消',
callback: (action) => {
if (action == "confirm") {
UpdateUserType(this.updateType).then(res => {
if (res.data.code == 200) {
this.$confirm('该用户已升级成推广专员', '消息', {
confirmButtonText: '确认',
cancelButtonText: '取消',
callback: (action) => {
this.GetUserListHeadler();
},
})
} else {
this.$confirm(res.data.message, '消息', {
confirmButtonText: '确认',
cancelButtonText: '取消'
})
}
});
}
},
})
},
// 设为默认车辆
SetDefault(item) {
console.log('数据', item)
if (item.CarDefault == true) {
this.$message.error('该车辆已是默认车辆')
} else {
this.CarDefaultModel.id = item.id
this.CarDefaultModel.UserId = this.CarModel.UserId
UpdateCarDefault(this.CarDefaultModel).then(res => {
console.log('默认', res)
if (res.data.code == 200) {
this.$message.success('修改默认车辆成功')
this.ShowCar()
} else {
this.$message.error(res.data.message)
}
})
}
},
// 查询车辆信息
ShowCar(id) {
console.log('车辆ID', id)
this.CarModel.UserId = id
this.dialogVisibleCar = true
GetVehicleListByUser(this.CarModel).then(res => {
console.log('车辆信息', res)
if (res.data.code == 200) {
res.data.data.rows.forEach((item, index) => {
item.add_time = utils.formatTime(item.add_time, "yyyy-MM-dd HH:mm:ss")
item.UpdateTime = utils.formatTime(item.UpdateTime, "yyyy-MM-dd HH:mm:ss")
})
this.tableData = res.data.data.rows
this.CarModel.TotalCount = res.data.data.total
}
})
},
UpdSubmit() {
// 修改提交信息
this.$refs.form.validate((valid) => {
if (valid) {
Save(this.form).then(res => {
console.log('提交', res)
if (res.data.code == 200) {
this.$message.success('修改成功')
this.dialogVisible = false
this.GetUserListHeadler()
} else {
this.$message.error('修改失败')
}
})
}
})
},
// 修改信息
UpdateUserHeadler(item) {
console.log('item', item)
this.dialogVisible = true
this.form.birthday = item.birthday
this.form.ID_card = item.ID_card
this.form.address = item.address
this.form.id = item.id
this.form.username = item.username
this.form.add_time = item.add_time
this.form.update_time = item.update_time
this.form.remark = item.remark
this.form.phone = item.phone
this.form.sex = item.sex
// -------------------
this.form.InviteeUserId = item.InviteeUserId
this.form.ParentUserId = item.ParentUserId
this.form.beijintupian = item.beijintupian
this.form.password = item.password
this.form.author = item.author
this.form.status = item.status
this.form.type = item.type
this.form.full_name = item.full_name
this.form.avatar = item.avatar
this.form.openid = item.openid
this.form.balance = item.balance
},
DelUserHeadler(Id) {
DeleteUser({
ids: Id
}).then(res => {
console.log('res', res)
if (res.data.code == 200) {
this.$message.success('删除成功')
this.GetUserListHeadler()
} else {
this.$message.error('删除失败')
}
})
},
UpdateUserTypeHeadler(UserId) {
this.updateType = {
UserId: UserId,
UserType: 4,
ParentUserId: 0
};
this.$confirm('确定把该用户升级成客户经理?', '消息', {
confirmButtonText: '确认',
cancelButtonText: '取消',
callback: (action) => {
if (action == "confirm") {
UpdateUserType(this.updateType).then(res => {
if (res.data.code == 200) {
this.$confirm('该用户已升级成客户经理', '消息', {
confirmButtonText: '确认',
cancelButtonText: '取消',
callback: (action) => {
this.GetUserListHeadler();
},
})
} else {
this.$confirm(res.data.message, '消息', {
confirmButtonText: '确认',
cancelButtonText: '取消'
})
}
});
}
},
})
}
}
}
</script>
<style>
</style>