|
|
@@ -0,0 +1,541 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <!-- Search Form -->
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="80px">
|
|
|
+ <el-form-item label="项目" prop="projectId">
|
|
|
+ <el-select v-model="queryParams.projectId" placeholder="请选择项目" clearable size="small" >
|
|
|
+ <el-option
|
|
|
+ v-for="item in projectOptions"
|
|
|
+ :key="item.dictValue"
|
|
|
+ :label="item.dictLabel"
|
|
|
+ :value="item.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="会员昵称" prop="nickname">
|
|
|
+ <el-input
|
|
|
+ style="width: 200px"
|
|
|
+ v-model="queryParams.nickname"
|
|
|
+ placeholder="请输入会员昵称"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="手机号码" prop="phone">
|
|
|
+ <el-input
|
|
|
+ style="width: 200px"
|
|
|
+ v-model="queryParams.phone"
|
|
|
+ placeholder="请输入手机号码"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="注册时间">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="dateRange"
|
|
|
+ size="small"
|
|
|
+ style="width: 240px"
|
|
|
+ type="daterange"
|
|
|
+ range-separator="-"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ end-placeholder="结束日期"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ ></el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <!-- Toolbar -->
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <!-- User Table -->
|
|
|
+ <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange" border>
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="ID" align="center" prop="userId" />
|
|
|
+ <el-table-column label="项目" align="center" prop="projectId">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag v-if="scope.row.projectId !== null">{{ getProjectLabel(scope.row.projectId) }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="昵称" align="center" prop="nickname" />
|
|
|
+ <el-table-column label="头像" align="center" width="80">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-popover
|
|
|
+ placement="right"
|
|
|
+ title=""
|
|
|
+ trigger="hover"
|
|
|
+ >
|
|
|
+ <img slot="reference" :src="scope.row.avatar" width="50">
|
|
|
+ <img :src="scope.row.avatar" style="max-width: 120px;">
|
|
|
+ </el-popover>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="手机号码" align="center" prop="phone" />
|
|
|
+ <el-table-column label="积分" align="center" prop="integral" v-if="false" />
|
|
|
+ <el-table-column label="状态" align="center">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag :type="scope.row.status === 1 ? 'success' : 'danger'">
|
|
|
+ {{ scope.row.status === 1 ? '正常' : '禁止' }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="标签" align="center" prop="tag" show-overflow-tooltip />
|
|
|
+ <el-table-column label="注册时间" align="center" prop="createTime" width="160" />
|
|
|
+ <el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
|
|
+ <el-table-column label="所属员工" align="center" prop="companyUserNickName" />
|
|
|
+ <el-table-column label="操作" align="center" width="120" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-check"
|
|
|
+ @click="handleAudit(scope.row)"
|
|
|
+ v-if="scope.row.isCurrentCompanyUser === 1 && scope.row.status === 0"
|
|
|
+ >审核会员</el-button>
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['qw:fsUserCompanyUserQw:myEdit']"
|
|
|
+ >修改</el-button>
|
|
|
+
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ @click="handledetails(scope.row)"
|
|
|
+ >详情</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- Edit User Dialog -->
|
|
|
+ <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
+ <el-form-item label="用户头像" prop="avatar">
|
|
|
+ <el-popover
|
|
|
+ placement="right"
|
|
|
+ title=""
|
|
|
+ trigger="hover"
|
|
|
+ >
|
|
|
+ <img slot="reference" :src="form.avatar" width="80">
|
|
|
+ <img :src="form.avatar" style="max-width: 120px;">
|
|
|
+ </el-popover>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="昵称" prop="nickname">
|
|
|
+ <el-input v-model="form.nickname" :disabled="true" placeholder="请输入昵称" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="手机号码" prop="phone">
|
|
|
+ <el-input v-model="form.phone" disabled placeholder="请输入手机号码" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="所属员工" prop="companyUserId">
|
|
|
+ <el-select v-model="form.companyUserId" disabled placeholder="请选择所属员工" clearable>
|
|
|
+ <el-option
|
|
|
+ v-for="item in companyUserList"
|
|
|
+ :key="item.userId"
|
|
|
+ :label="item.nickName"
|
|
|
+ :value="item.userId"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="用户备注" prop="remark">
|
|
|
+ <el-input v-model="form.remark" type="textarea" placeholder="请输入用户备注" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="状态">
|
|
|
+ <el-radio-group v-model="form.status">
|
|
|
+ <el-radio :label="1">正常</el-radio>
|
|
|
+ <el-radio :label="0">禁止</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-drawer
|
|
|
+ :with-header="false"
|
|
|
+ size="75%"
|
|
|
+ :title="show.title" :visible.sync="show.open">
|
|
|
+ <userDetails ref="userDetails" />
|
|
|
+ </el-drawer>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { myListUser, getUser, addUser, updateUser, delUser, exportUser } from "../../../api/user/fsUserByQw";
|
|
|
+import {transferUser} from "@/api/users/user";
|
|
|
+import {getUserList} from "@/api/company/companyUser";
|
|
|
+import userDetails from '@/views/store/components/userDetails.vue';
|
|
|
+export default {
|
|
|
+ name: "FsUser",
|
|
|
+ components: {userDetails},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+
|
|
|
+ show:{
|
|
|
+ title:"会员详情",
|
|
|
+ open:false,
|
|
|
+ },
|
|
|
+ cusTransfer: {
|
|
|
+ targetUserId: [{required: true, message: '请选择转移至销售', trigger: 'change'}],
|
|
|
+ content: [{required: true, message: '请选择转移至销售', trigger: 'change'}]
|
|
|
+ },
|
|
|
+ dialogVisible:false,
|
|
|
+ companyUserList: [],
|
|
|
+ openTransferDialog: false,
|
|
|
+ transferForm: {
|
|
|
+ targetUserId: null,
|
|
|
+ content: null
|
|
|
+ },
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ companyUserId:null,
|
|
|
+ companyId:null,
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 用户表格数据
|
|
|
+ userList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 日期范围
|
|
|
+ dateRange: [],
|
|
|
+ // 状态数据字典
|
|
|
+ statusOptions: [],
|
|
|
+ // 标签选项
|
|
|
+ tagOptions: [],
|
|
|
+ // 销售员工选项
|
|
|
+ salesOptions: [],
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ nickname: null,
|
|
|
+ phone: null,
|
|
|
+ // status: null,
|
|
|
+ tagIds: [],
|
|
|
+ tabValue: "0",
|
|
|
+ watchCourseType: "0",
|
|
|
+ missCourseStatus: "0",
|
|
|
+ continueMissCourseSort: "0",
|
|
|
+ registerStartTime: null,
|
|
|
+ registerEndTime: null,
|
|
|
+ projectId: null,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ // nickname: [
|
|
|
+ // { required: true, message: "昵称不能为空", trigger: "blur" }
|
|
|
+ // ],
|
|
|
+ // phone: [
|
|
|
+ // { required: true, message: "手机号码不能为空", trigger: "blur" },
|
|
|
+ // { pattern: /^1[3-9]\d{9}$/, message: "请输入正确的手机号码", trigger: "blur" }
|
|
|
+ // ],
|
|
|
+ status: [
|
|
|
+ { required: true, message: "状态不能为空", trigger: "change" }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ projectOptions: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ getUserList().then(res=>{
|
|
|
+ if(res.code === 200) {
|
|
|
+ this.companyUserList = res.data
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.getList();
|
|
|
+ this.getDicts("user_status").then(response => {
|
|
|
+ this.statusOptions = response.data;
|
|
|
+ });
|
|
|
+ this.getDicts("sys_course_project").then(response => {
|
|
|
+ this.projectOptions = response.data;
|
|
|
+ });
|
|
|
+ this.getTagOptions();
|
|
|
+ this.getSalesOptions();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handledetails(row){
|
|
|
+ this.show.open=true;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.userDetails.getDetails(row.userId);
|
|
|
+ }, 1);
|
|
|
+ },
|
|
|
+ /** 提交转移按钮 (如果使用对话框) */
|
|
|
+
|
|
|
+ submitTransfer() {
|
|
|
+ this.$refs["transferForm"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ transferUser({
|
|
|
+ userIds: this.ids,
|
|
|
+ targetCompanyUserId: this.transferForm.targetUserId,
|
|
|
+ content: this.transferForm.content
|
|
|
+ }).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.msgSuccess(response.msg);
|
|
|
+ this.openTransferDialog = false;
|
|
|
+ this.getList();
|
|
|
+ } else {
|
|
|
+ this.msgError(response.msg || "转移失败");
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.msgError("转移请求失败");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 转移按钮操作 */
|
|
|
+ handleTransfer(row) {
|
|
|
+ const userIds = row.userId ? [row.userId] : this.ids;
|
|
|
+ if (userIds.length === 0) {
|
|
|
+ this.$message.warning("请至少选择一个客户进行转移");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.resetTransferForm();
|
|
|
+ this.openTransferDialog = true;
|
|
|
+ },
|
|
|
+ // 重置表单
|
|
|
+ resetForm() {
|
|
|
+ this.linkForm={
|
|
|
+ days:null,
|
|
|
+ courseId:null,
|
|
|
+ videoId:null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ resetTransferForm() {
|
|
|
+ this.transferForm = {
|
|
|
+ targetUserId: null,
|
|
|
+ content: null
|
|
|
+ };
|
|
|
+ this.resetForm("transferForm"); // 假设 transferForm 是 el-form 的 ref
|
|
|
+ },
|
|
|
+ cancelTransfer() {
|
|
|
+ this.openTransferDialog = false;
|
|
|
+ this.resetTransferForm();
|
|
|
+ },
|
|
|
+ /** 查询用户列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+
|
|
|
+ // 处理日期范围
|
|
|
+ if (this.dateRange && this.dateRange.length > 0) {
|
|
|
+ this.queryParams.registerStartTime = this.dateRange[0];
|
|
|
+ this.queryParams.registerEndTime = this.dateRange[1];
|
|
|
+ } else {
|
|
|
+ this.queryParams.registerStartTime = null;
|
|
|
+ this.queryParams.registerEndTime = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ myListUser(this.queryParams).then(response => {
|
|
|
+ this.userList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 获取标签选项 */
|
|
|
+ getTagOptions() {
|
|
|
+ this.tagOptions = [
|
|
|
+ { tagId: "1", tagName: "VIP会员" },
|
|
|
+ { tagId: "2", tagName: "普通会员" },
|
|
|
+ { tagId: "3", tagName: "新用户" },
|
|
|
+ { tagId: "4", tagName: "高频用户" }
|
|
|
+ ];
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 获取销售员工选项 */
|
|
|
+ getSalesOptions() {
|
|
|
+ this.salesOptions = [
|
|
|
+ { userId: 1, nickName: "销售A" },
|
|
|
+ { userId: 2, nickName: "销售B" },
|
|
|
+ { userId: 3, nickName: "销售C" }
|
|
|
+ ];
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ userId: null,
|
|
|
+ nickname: null,
|
|
|
+ avatar: null,
|
|
|
+ phone: null,
|
|
|
+ status: 1,
|
|
|
+ tagIds: [],
|
|
|
+ companyUserId: null,
|
|
|
+ remark: null
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.dateRange = [];
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+
|
|
|
+ /** Tab切换操作 */
|
|
|
+ handleTabChange() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.userId);
|
|
|
+ this.single = selection.length !== 1;
|
|
|
+ this.multiple = !selection.length;
|
|
|
+ this.companyId = selection[0].companyId;
|
|
|
+ this.companyUserId = selection[0].companyUserId;
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "添加用户";
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const userId = row.userId || this.ids[0];
|
|
|
+ getUser(userId).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+
|
|
|
+ // 处理标签数据,将字符串转为数组
|
|
|
+ if (this.form.tagIds && typeof this.form.tagIds === 'string') {
|
|
|
+ this.form.tagIds = this.form.tagIds.split(',');
|
|
|
+ }
|
|
|
+
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改用户";
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ // 处理标签数据,将数组转为字符串
|
|
|
+ if (this.form.tagIds && Array.isArray(this.form.tagIds)) {
|
|
|
+ this.form.tagIds = this.form.tagIds.join(',');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.form.userId != null) {
|
|
|
+ updateUser(this.form).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.$message.success("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addUser(this.form).then(response => {
|
|
|
+ if (response.code === 200) {
|
|
|
+ this.$message.success("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const userIds = row.userId || this.ids;
|
|
|
+ this.$confirm('是否确认删除用户编号为"' + userIds + '"的数据项?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ return delUser(userIds);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$message.success("删除成功");
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ const queryParams = this.queryParams;
|
|
|
+ this.$confirm('是否确认导出所有用户数据项?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ return exportUser(queryParams);
|
|
|
+ }).then(response => {
|
|
|
+ this.download(response.msg);
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 获取项目对应名称 */
|
|
|
+ getProjectLabel(projectId) {
|
|
|
+ return this.projectOptions.find(item => parseInt(item.dictValue) === projectId)?.dictLabel;
|
|
|
+ },
|
|
|
+
|
|
|
+ batchSend(){
|
|
|
+ this.dialogVisible = true;
|
|
|
+ },
|
|
|
+ handleClose(){
|
|
|
+ this.dialogVisible = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.el-tag + .el-tag {
|
|
|
+ margin-left: 5px;
|
|
|
+}
|
|
|
+.mb8 {
|
|
|
+ margin-bottom: 8px;
|
|
|
+}
|
|
|
+</style>
|