You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

354 lines
9.7 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div style="padding:30px;">
  3. <!-- 搜索栏 -->
  4. <div class="search">
  5. <el-form :inline="true">
  6. <el-form-item label="用户昵称:" style="margin-right:50px;">
  7. <el-input
  8. v-model="queryParams.query.nickName"
  9. clearable
  10. placeholder="请输入用户昵称"
  11. />
  12. </el-form-item>
  13. <el-form-item label="用户编号:" style="margin-right:50px;">
  14. <el-input
  15. v-model="queryParams.query.code"
  16. clearable
  17. placeholder="请输入用户编号"
  18. />
  19. </el-form-item>
  20. <el-form-item label="联系电话:" style="margin-right:50px;">
  21. <el-input
  22. v-model="queryParams.query.phonenumber"
  23. clearable
  24. placeholder="请输入联系电话"
  25. />
  26. </el-form-item>
  27. <el-form-item label="注册时间:" style="margin-right:50px;">
  28. <el-date-picker
  29. v-model="time"
  30. type="daterange"
  31. range-separator="至"
  32. start-placeholder="开始日期"
  33. end-placeholder="结束日期"
  34. format="yyyy-MM-dd"
  35. value-format="yyyy-MM-dd"
  36. />
  37. </el-form-item>
  38. </el-form>
  39. <div class="search-button">
  40. <el-button
  41. size="medium"
  42. type="primary"
  43. style="height:36px;width:100px;"
  44. @click="search"
  45. >搜索</el-button
  46. >
  47. <el-button
  48. @click="refresh"
  49. size="medium"
  50. style="margin-left:20px;height:36px;width:100px;"
  51. >重置</el-button
  52. >
  53. </div>
  54. </div>
  55. <!-- 列表 -->
  56. <div class="content">
  57. <el-table
  58. v-loading="loading"
  59. ref="singleTable"
  60. :data="tableData"
  61. border
  62. style="width: 100%"
  63. >
  64. <el-table-column align="center" type="index" label="序号" width="50" />
  65. <el-table-column align="center" property="avatar" label="头像">
  66. <template slot-scope="scope">
  67. <div>
  68. <img style="width: 50px;height: 50px;" :src="scope.row.avatar" alt="" />
  69. </div>
  70. </template>
  71. </el-table-column>
  72. <el-table-column align="center" property="nickName" label="昵称" />
  73. <el-table-column align="center" property="code" label="编号">
  74. <template slot-scope="scope">
  75. <div>
  76. <span>{{ scope.row.code }}</span>
  77. <i
  78. style="float: right;font-size:14px;"
  79. @click="handleEditCode(scope.row)"
  80. class="el-icon-edit-outline"
  81. ></i>
  82. </div>
  83. </template>
  84. </el-table-column>
  85. <el-table-column
  86. align="center"
  87. property="phonenumber"
  88. label="联系电话"
  89. />
  90. <el-table-column
  91. align="center"
  92. property="createTime"
  93. label="注册时间"
  94. />
  95. <el-table-column align="center" property="level" label="用户等级">
  96. <template slot-scope="scope">
  97. {{ levelormat(scope.row) }}
  98. </template>
  99. </el-table-column>
  100. <el-table-column align="center" property="remark" label="备注">
  101. <template slot-scope="scope">
  102. <div>
  103. <span>{{ scope.row.remark }}</span>
  104. <i
  105. style="float: right;font-size:14px;"
  106. @click="handleEditRemark(scope.row)"
  107. class="el-icon-edit-outline"
  108. ></i>
  109. </div>
  110. </template>
  111. </el-table-column>
  112. <el-table-column align="center" label="操作">
  113. <template slot-scope="scope">
  114. <el-button type="text" size="mini" @click="handleEdit(scope.row)"
  115. >修改等级</el-button
  116. >
  117. </template>
  118. </el-table-column>
  119. </el-table>
  120. <pagination
  121. v-show="total > 0"
  122. :total="total"
  123. :page.sync="queryParams.pageNum"
  124. :limit.sync="queryParams.pageSize"
  125. @pagination="queryUserInfo"
  126. />
  127. </div>
  128. <!-- 修改表单 -->
  129. <el-dialog
  130. :title="dialog.title"
  131. :visible.sync="dialog.Visible"
  132. center
  133. width="350px"
  134. >
  135. <el-form :model="form" :inline="true">
  136. <div v-if="type == 'level'">
  137. <el-form-item label="客户昵称:" style="width:100%">
  138. <span>{{ data.nickName }}</span>
  139. </el-form-item>
  140. <el-form-item label="客户等级:" style="width:100%">
  141. <span>{{ levelormat(data) }}</span>
  142. </el-form-item>
  143. <el-form-item label="修改为:" style="width:100%">
  144. <el-select v-model="form.level" placeholder="请选择客户等级">
  145. <el-option
  146. v-for="(item,index) in level"
  147. :key="index"
  148. :label="item.dictLabel"
  149. :value="item.dictValue"
  150. />
  151. </el-select>
  152. </el-form-item>
  153. </div>
  154. <div v-if="type == 'code'">
  155. <el-form-item label="客户编号">
  156. <el-input v-model="form.code" clearable placeholder="请输入客户编号" />
  157. </el-form-item>
  158. </div>
  159. <div v-if="type == 'remark'">
  160. <el-form-item label="备注">
  161. <el-input
  162. style="width:100%"
  163. type="textarea"
  164. :rows="5"
  165. v-model="form.remark"
  166. placeholder="请输入备注"
  167. />
  168. </el-form-item>
  169. </div>
  170. </el-form>
  171. <div slot="footer" class="dialog-footer">
  172. <el-button @click="dialog.Visible = false"> </el-button>
  173. <el-button type="primary" @click="subMit"> </el-button>
  174. </div>
  175. </el-dialog>
  176. </div>
  177. </template>
  178. <script>
  179. import { queryUserInfo, updateUserInfo } from "@/api/user/user.js";
  180. export default {
  181. data() {
  182. return {
  183. loading: true,
  184. queryParams: {
  185. pageNum: 1,
  186. pageSize: 10,
  187. query: {
  188. nickName: undefined,
  189. code: undefined,
  190. phonenumber: undefined,
  191. userType: '01',
  192. params: {
  193. beginTime: undefined,
  194. endTime: undefined
  195. }
  196. },
  197. },
  198. time: [],
  199. total: 0,
  200. tableData: [],
  201. form: {
  202. userId: ""
  203. },
  204. dialog: {
  205. Visible: false,
  206. title: ""
  207. },
  208. level: [],
  209. data: {},
  210. type: "level"
  211. };
  212. },
  213. created() {
  214. this.getDicts("jbs_wj_user_level").then(res => {
  215. this.level = res.data;
  216. });
  217. },
  218. mounted() {
  219. this.queryUserInfo();
  220. },
  221. methods: {
  222. //获取用户
  223. async queryUserInfo() {
  224. this.loading = true;
  225. try {
  226. let res = await queryUserInfo(this.queryParams);
  227. if (res.code == 200) {
  228. this.loading = false;
  229. this.tableData = res.rows;
  230. this.total = res.total;
  231. }
  232. } catch (err) {
  233. }
  234. },
  235. //搜索
  236. search() {
  237. if (this.time != null) {
  238. if (this.time.length > 0) {
  239. this.queryParams.query.params.beginTime = this.time[0];
  240. this.queryParams.query.params.endTime = this.time[1];
  241. }
  242. } else {
  243. this.time = [];
  244. this.queryParams.query.params.beginTime = undefined;
  245. this.queryParams.query.params.endTime = undefined;
  246. }
  247. this.queryUserInfo()
  248. },
  249. //重置
  250. refresh() {
  251. this.time = []
  252. this.queryParams = {
  253. pageNum: 1,
  254. pageSize: 10,
  255. query: {
  256. nickName: undefined,
  257. code: undefined,
  258. phonenumber: undefined,
  259. userType: '01',
  260. },
  261. params: {
  262. beginTime: undefined,
  263. endTime: undefined
  264. }
  265. }
  266. this.queryUserInfo()
  267. },
  268. // 任务组名字典翻译
  269. levelormat(row, column) {
  270. return this.selectDictLabel(this.level, row.level);
  271. },
  272. // 编辑用户等级
  273. handleEdit(row) {
  274. this.form = {}
  275. this.dialog.Visible = true;
  276. this.dialog.title = "修改用户等级";
  277. this.type = "level";
  278. this.form.userId = row.userId;
  279. this.data = row;
  280. },
  281. //编辑用户编号
  282. handleEditCode(row) {
  283. this.form = {}
  284. this.dialog.Visible = true;
  285. this.dialog.title = "修改用户编号";
  286. this.form.userId = row.userId;
  287. this.type = "code";
  288. this.data = row;
  289. },
  290. //编辑客户备注
  291. handleEditRemark(row) {
  292. this.form = {}
  293. this.dialog.Visible = true;
  294. this.dialog.title = "修改用户备注";
  295. this.form.userId = row.userId;
  296. this.type = "remark";
  297. this.data = row;
  298. },
  299. //提交表单
  300. async subMit() {
  301. if(this.type == "level"){
  302. if(this.form.level == undefined || this.form.level == ''){
  303. this.$message({
  304. message: '请选择用户等级',
  305. type: "error"
  306. });
  307. return false;
  308. }
  309. }
  310. if(this.type == "code"){
  311. if(this.form.code == undefined || this.form.code == ''){
  312. this.$message({
  313. message: '请输入用户编号',
  314. type: "error"
  315. });
  316. return false;
  317. }
  318. }
  319. if(this.type == "remark"){
  320. if(this.form.remark == undefined || this.form.remark == ''){
  321. this.$message({
  322. message: '请输入用户备注',
  323. type: "error"
  324. });
  325. return false;
  326. }
  327. }
  328. try {
  329. let res = await updateUserInfo(this.form);
  330. if (res.code == 200) {
  331. this.$message.success("修改成功");
  332. this.dialog.Visible = false;
  333. this.queryUserInfo();
  334. }
  335. } catch (err) {
  336. }
  337. }
  338. }
  339. };
  340. </script>
  341. <style scoped>
  342. .content {
  343. background: #fff;
  344. margin-top: 15px;
  345. }
  346. .add-button {
  347. margin-top: 15px;
  348. }
  349. .search-button {
  350. display: flex;
  351. }
  352. </style>