Blame view

src/views/user/commissioner.vue 3.06 KB
2d21111e   wangming   项目初始化
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
  <template>
  	<!-- 专员 -->
  	<div class="container" style="margin:10px;">
  		<el-form :inline="true" :model="model" class="demo-form-inline">
  			<el-form-item label="推广专员ID">
  				<el-input v-model="model.UserId" placeholder="推广专员ID"></el-input>
  			</el-form-item>
  			<el-form-item>
  				<el-button type="primary" @click="onSubmit">查询</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="用户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">
  					<el-tag :key="scope.row.type" type="warning" effect="dark">
  						{{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">
  					<span>{{ scope.row.remark }}</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 fixed="right" label="操作" width="160">
  				<template slot-scope="scope">
  					<!-- <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button> -->
  					<el-button type="text" size="small" @click="showUpdate(scope.row.id)" v-show="false">编辑
  					</el-button>
  					<el-button type="text" size="small" @click="deleteInfo(scope.row.id)">删除
  					</el-button>
  				</template>
  			</el-table-column>
  		</el-table>
  	<!-- 	<el-pagination
  		  background
  		  layout="prev, pager, next"
  		  :total="total"  style="text-align: right;margin-top: 10px;">
  		</el-pagination> -->
  	</div>
  </template>
  
  <script>
  	import {
  		GetUserCustomerView,
  		DeleteUser,
  		Save,
  	} from '../../api/user.js'
  	export default {
  		data() {
  			return {
  				userlist: [],
  				listLoading: true,
  				model: {
  					UserId: 0
  				},
  			}
  		},
  		created() {
  			this.ShowCustomer()
  		},
  		methods: {
  		
  			ShowCustomer() {
  				GetUserCustomerView(this.model).then(res => {
  					console.log('数据', res)
  					if (res.code == 200) {
  						this.userlist = res.data
  						this.listLoading=false
  					}
  				})
  			},
  			onSubmit(){
  				if(this.model.UserId==0){
  					this.$message.error('请输入专员ID')
  				}else{
  					this.ShowCustomer()
  				}
  			},
  			deleteInfo(id){
  				DeleteUser({
  					ids:id
  				}).then(res=>{
  					console.log('res',res)
  					if(res.code==200){
  						this.$message.success('删除成功')
  						this.ShowCustomer()
  					}else{
  						this.$message.error('删除失败')
  					}
  				})
  			}
  		}
  
  	}
  </script>
  
  <style>
  </style>