darkRoom.vue 7.9 KB

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