<template> <div class="app-container"> <!--工具栏--> <div class="head-container"> <!-- 搜索 --> <el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" /> <el-select v-model="query.key" clearable placeholder="类型" class="filter-item" style="width: 130px"> <el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" /> </el-select> <!-- <el-select v-model="userType" clearable placeholder="用户来源" class="filter-item" style="width: 130px"> <el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" /> </el-select> --> <el-select v-model="query.isRecharge" clearable placeholder="付款状态" class="filter-item" style="width: 130px"> <el-option v-for="item in recharges" :key="item.value" :label="item.label" :value="item.value" /> </el-select> <el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button> <!-- 新增 --> <el-button type="danger" class="filter-item" size="mini" icon="el-icon-refresh" @click="toQuery" >刷新</el-button> <el-button class="filter-item" size="mini" type="warning" @click="moveMember">会员转移</el-button> <el-button class="filter-item" size="mini" type="warning" icon="el-icon-download" @click="doExport" >导出</el-button> </div> <!--表单组件--> <eForm ref="form" :is-add="isAdd" /> <pForm ref="formp" :is-add="isAdd" /> <detail ref="formd" /> <!--表格渲染--> <el-table v-loading="loading" :data="data" size="small" style="width: 100%;" @selection-change="selectionChangeHandler"> <el-table-column type="selection" width="55" /> <el-table-column prop="nickname" label="用户昵称" /> <el-table-column prop="realName" label="真实姓名" /> <el-table-column ref="table" prop="avatar" label="用户头像"> <template slot-scope="scope"> <a :href="scope.row.avatar" style="color: #42b983" target="_blank"><img :src="scope.row.avatar" alt="点击打开" class="el-avatar"></a> </template> </el-table-column> <el-table-column prop="phone" label="手机号码" width="150" /> <el-table-column label="性别"> <template slot-scope="scope"> <span>{{scope.row.gender == 0 ? '女' : '男'}}</span> </template> </el-table-column> <el-table-column prop="idCard" label="身份证号码" width="200" /> <el-table-column prop="city" label="区域" width="150" /> <el-table-column prop="industry" label="所在行业" width="150" /> <el-table-column prop="position" label="所在职位" /> <el-table-column prop="createTime" label="授权时间" width="150" /> <el-table-column prop="isRecharge" label="是否缴费"> <template slot-scope="scope"> <span>{{scope.row.isRecharge == 0 ? '未缴费' : '已缴费'}}</span> </template> </el-table-column> <el-table-column prop="payTime" label="缴费时间" width="150" /> <el-table-column prop="inviterCount" label="缴费人数" /> <el-table-column prop="brokeragePrice" label="总收益" /> <!-- <el-table-column prop="city" label="是否体现" /> --> <!-- <el-table-column v-if="checkPermission(['admin','YXUSER_ALL','YXUSER_EDIT','YXUSER_DELETE'])" label="操作" width="215" align="center" fixed="right"> <template slot-scope="scope"> <el-button v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']" size="mini" type="danger" @click="editD(scope.row)" >查看下级</el-button> <el-button v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']" size="mini" type="primary" @click="edit(scope.row)" >修改用户</el-button> <el-button v-permission="['admin','YXUSER_ALL','YXUSER_EDIT']" size="mini" type="primary" @click="editP(scope.row)" >修改余额</el-button> </template> </el-table-column> --> </el-table> <el-dialog title="选择转移到的服务老师" :visible.sync="checkMasterDialog" width="500"> <el-select v-model="master" placeholder=""> <el-option v-for="item in masterList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> <div slot="footer"> <el-button @click="checkMasterDialog = false">取 消</el-button> <el-button type="primary" @click="checkMasterDialog = false">确 定</el-button> </div> </el-dialog> <!--分页组件--> <el-pagination :total="total" :current-page="page + 1" style="margin-top: 8px;" layout="total, prev, pager, next, sizes" @size-change="sizeChange" @current-change="pageChange" /> </div> </template> <script> import checkPermission from '@/utils/permission' import initData from '@/mixins/crud' import { del, onStatus } from '@/api/yxUser' import eForm from './form' import pForm from './formp' import detail from './detail' import { formatTime, downloadFile } from '@/utils/index' import request from '@/utils/request' import qs from 'qs' export default { components: { eForm, pForm, detail }, mixins: [initData], data() { return { delLoading: false, userType: '', queryTypeOptions: [ { key: 'nickName', display_name: '用户昵称' }, { key: 'phone', display_name: '手机号码' }, { key: 'city', display_name: '所在城市' } ], statusOptions: [ { value: 'routine', label: '小程序' }, { value: 'wechat', label: '公众号' }, { value: 'H5', label: 'H5' } ], recharges:[ { value: '0', label: '未付款' }, { value: '1', label: '已付款' }, ], checkMasterDialog: false, master:'', masterList: [] } }, created() { this.$nextTick(() => { this.init() }) }, methods: { doExport(){ let params = { page: this.page, size: this.size, sort: 'id,desc', isModel: ''} request({ url: 'api/member/download' + '?' + qs.stringify(params, { indices: false }), method: 'get', responseType: 'blob' }).then(result => { downloadFile(result, '会员充值数据', 'xlsx') }).catch(() => { }) }, selectionChangeHandler(val){ console.log(val) }, moveMember(){ }, formatTime, checkPermission, onStatus(id, status) { this.$confirm(`确定进行[${status ? '禁用' : '开启'}]操作?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' }) .then(() => { onStatus(id, { status: status }).then(({ data }) => { this.$message({ message: '操作成功', type: 'success', duration: 1000, onClose: () => { this.init() } }) }) }) .catch(() => { }) }, beforeInit() { this.url = 'api/member/listMembers' const sort = 'uid,desc' this.params = { page: this.page, size: this.size, sort: sort, userType: this.userType,isPromoter:0 } const query = this.query const type = query.type const value = query.value if (type && value) { this.params[type] = value } return true }, subDelete(uid) { this.delLoading = true del(uid).then(res => { this.delLoading = false this.$refs[uid].doClose() this.dleChangePage() this.init() this.$notify({ title: '删除成功', type: 'success', duration: 2500 }) }).catch(err => { this.delLoading = false this.$refs[uid].doClose() console.log(err.response.data.message) }) }, add() { this.isAdd = true this.$refs.form.dialog = true }, edit(data) { this.isAdd = false const _this = this.$refs.form _this.form = { uid: data.uid, account: data.account, pwd: data.pwd, realName: data.realName, birthday: data.birthday, cardId: data.cardId, mark: data.mark, partnerId: data.partnerId, groupId: data.groupId, nickname: data.nickname, avatar: data.avatar, phone: data.phone, addTime: data.addTime, addIp: data.addIp, lastTime: data.lastTime, lastIp: data.lastIp, nowMoney: data.nowMoney, brokeragePrice: data.brokeragePrice, integral: data.integral, signNum: data.signNum, status: data.status, level: data.level, spreadUid: data.spreadUid, spreadTime: data.spreadTime, userType: data.userType, isPromoter: data.isPromoter, payCount: data.payCount, spreadCount: data.spreadCount, cleanTime: data.cleanTime, addres: data.addres, adminid: data.adminid, loginType: data.loginType } _this.dialog = true }, editP(data) { this.isAdd = false const _this = this.$refs.formp _this.form = { uid: data.uid, nickname: data.nickname, ptype: 1, money: 0 } _this.dialog = true }, editD(data) { const _this = this.$refs.formd _this.form = { uid: data.uid, nickname: data.nickname } _this.dialog = true _this.spread(data.uid) } } } </script> <style scoped> </style>