index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px" @submit.native.prevent>
  4. <el-form-item label="关键词" prop="keyword">
  5. <el-input
  6. style="width:220px"
  7. v-model="queryParams.keyword"
  8. placeholder="请输入微信名称/手机号"
  9. clearable
  10. size="small"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  16. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  17. </el-form-item>
  18. </el-form>
  19. <el-row :gutter="10" class="mb8">
  20. <el-button
  21. size="mini"
  22. type="primary"
  23. style="margin-left: 5px"
  24. :disabled="ids.length === 0"
  25. @click="handleUpdateBatch"
  26. v-hasPermi="['his:user:enabledUsers']"
  27. >批量启用</el-button>
  28. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  29. </el-row>
  30. <el-table height="500" border v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
  31. <el-table-column type="selection" width="55" align="center" />
  32. <el-table-column label="用户id" align="center" prop="userId" />
  33. <el-table-column label="用户昵称" align="center" prop="nickname" />
  34. <el-table-column label="用户头像" align="center" prop="avatar">
  35. <template slot-scope="scope">
  36. <el-popover trigger="hover" placement="top">
  37. <el-image :src="scope.row.avatar" style="width: 200px;height: 200px"/>
  38. <div slot="reference" class="name-wrapper">
  39. <el-avatar shape="square" size="large" :src="scope.row.avatar"/>
  40. </div>
  41. </el-popover>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="注册时间" align="center" prop="createTime" width="160px"/>
  45. <el-table-column label="看课数量" align="center" prop="watchCourseCount" />
  46. <el-table-column label="缺课数量" align="center" prop="missCourseCount" />
  47. <el-table-column label="缺课状态" align="center" prop="missCourseStatus">
  48. <template slot-scope="scope">
  49. <el-tag effect="dark" type="danger" v-if="scope.row.missCourseStatus === 1">已缺课</el-tag>
  50. <el-tag effect="dark" type="success" v-else>未缺课</el-tag>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="参与营期数量" align="center" prop="partCourseCount" width="100px"/>
  54. <el-table-column label="最后一次看课时间" align="center" prop="lastWatchDate" width="160px"/>
  55. <el-table-column label="用户状态" align="center" prop="courseCountStatus">
  56. <template slot-scope="scope">
  57. <el-tag effect="dark" type="success" v-if="scope.row.courseCountStatus === 1">正常</el-tag>
  58. <el-tag effect="dark" type="info" v-else-if="scope.row.courseCountStatus === 2">停止</el-tag>
  59. <el-tag effect="dark" type="danger" v-else>未看</el-tag>
  60. </template>
  61. </el-table-column>
  62. <el-table-column label="停课天数" align="center" prop="stopWatchDays" />
  63. <el-table-column label="完播时间" align="center" prop="completeWatchDate" width="160px"/>
  64. <el-table-column label="标签名称" align="center" prop="tag" />
  65. <el-table-column label="所属销售名称" align="center" prop="companyUserNickName" width="120px"/>
  66. <el-table-column label="备注" align="center" prop="remark" />
  67. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  68. <template slot-scope="scope">
  69. <el-button
  70. size="mini"
  71. type="text"
  72. @click="handleUpdate(scope.row)"
  73. v-hasPermi="['his:user:darkRoomList']"
  74. >启用</el-button>
  75. </template>
  76. </el-table-column>
  77. </el-table>
  78. <pagination
  79. v-show="total>0"
  80. :total="total"
  81. :page.sync="queryParams.pageNum"
  82. :limit.sync="queryParams.pageSize"
  83. @pagination="getList"
  84. />
  85. </div>
  86. </template>
  87. <script>
  88. import { darkRoomList,enabledUsers } from "@/api/his/user";
  89. export default {
  90. name: "darkRoom",
  91. data() {
  92. return {
  93. // 遮罩层
  94. loading: true,
  95. // 选中数组
  96. ids: [],
  97. // 非单个禁用
  98. single: true,
  99. // 非多个禁用
  100. multiple: true,
  101. // 显示搜索条件
  102. showSearch: true,
  103. // 总条数
  104. total: 0,
  105. // 用户列表数据
  106. userList: [],
  107. // 查询参数
  108. queryParams: {
  109. pageNum: 1,
  110. pageSize: 10,
  111. keyword: null,
  112. isBlack: true
  113. },
  114. };
  115. },
  116. created() {
  117. this.getList();
  118. },
  119. methods: {
  120. /** 查询客户列表 */
  121. getList() {
  122. this.loading = true;
  123. darkRoomList(this.queryParams).then(response => {
  124. this.userList = response.rows;
  125. this.total = response.total;
  126. this.loading = false;
  127. });
  128. },
  129. /** 搜索按钮操作 */
  130. handleQuery() {
  131. this.queryParams.pageNum = 1;
  132. this.getList();
  133. },
  134. /** 重置按钮操作 */
  135. resetQuery() {
  136. this.resetForm("queryForm");
  137. this.handleQuery();
  138. },
  139. // 多选框选中数据
  140. handleSelectionChange(selection) {
  141. this.ids = selection.map(item => item.userId)
  142. this.single = selection.length!==1
  143. this.multiple = !selection.length
  144. },
  145. // 启用
  146. handleUpdate(row) {
  147. enabledUsers([row.userId]).then(response => {
  148. if (response.code === 200) {
  149. this.msgSuccess("取消禁用成功");
  150. this.getList();
  151. } else {
  152. this.msgError(response.msg);
  153. }
  154. });
  155. },
  156. // 启用
  157. handleUpdateBatch() {
  158. enabledUsers(this.ids).then(response => {
  159. if (response.code === 200) {
  160. this.msgSuccess("取消禁用成功");
  161. this.getList();
  162. } else {
  163. this.msgError(response.msg);
  164. }
  165. });
  166. }
  167. }
  168. };
  169. </script>
  170. <style scoped>
  171. .app-container {
  172. height: 87.5vh;
  173. }
  174. </style>