This commit is contained in:
wangjinlei
2024-11-04 18:07:04 +08:00

View File

@@ -1,20 +1,41 @@
<template>
<div class="mod-config">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item >
<el-form
:inline="true"
:model="dataForm"
@keyup.enter.native="getDataList()"
>
<el-form-item>
<el-input v-model="dataForm.key" placeholder="参数名" clearable>
</el-input>
</el-form-item>
<el-form-item>
<el-button @click="pageIndex = 1;getDataList()">查询</el-button>
<el-button v-if="isAuth('book:user:save')" type="primary" @click="addOrUpdateHandle()">新增</el-button>
<el-button type="primary" @click="addOrUpdateHandle()">合并账号</el-button>
<el-button
@click="
pageIndex = 1;
getDataList();
"
>查询</el-button
>
<el-button
v-if="isAuth('book:user:save')"
type="primary"
@click="addOrUpdateHandle()"
>新增</el-button
>
<el-button type="primary" @click="addOrUpdateHandle()"
>合并账号</el-button
>
<!-- <el-button v-if="isAuth('book:user:delete')" type="danger" @click="deleteHandle()"
:disabled="dataListSelections.length <= 0">批量删除</el-button> -->
</el-form-item>
</el-form>
<el-table :data="dataList" border v-loading="dataListLoading"
style="width: 100%;">
<el-table
:data="dataList"
border
v-loading="dataListLoading"
style="width: 100%;"
>
<!-- <el-table-column type="selection" header-align="center" align="center" width="50">
</el-table-column> -->
<!-- <el-table-column label="序号" width="70" align="center">
@@ -26,11 +47,20 @@
prop="id"
header-align="center"
align="center"
label="用户ID">
label="用户ID"
>
</el-table-column>
<el-table-column prop="nickname" header-align="center" align="center" label="姓名">
<el-table-column
prop="nickname"
header-align="center"
align="center"
label="姓名"
>
<template slot-scope="scope">
<span>{{scope.row.nickname ? scope.row.nickname : '暂无用户名'}}</span>-
<span>{{
scope.row.nickname ? scope.row.nickname : "暂无用户名"
}}</span
>-
<span v-if="scope.row.vip == 0">普通用户</span>
<span v-else-if="scope.row.vip == 2">吴门医述VIP</span>
<span v-else-if="scope.row.vip == 1">超级VIP</span>
@@ -44,18 +74,49 @@
<span v-if="scope.row.sex == 0">女</span><span v-if="scope.row.sex == 1">男</span><span v-if="scope.row.sex == 2">保密</span>
</template>
</el-table-column> -->
<el-table-column prop="avatar" header-align="center" align="center" label="头像">
<el-table-column
prop="avatar"
header-align="center"
align="center"
label="头像"
>
<template slot-scope="scope">
<img v-if="scope.row.avatar && scope.row.avatar != ''" :src="scope.row.avatar" width="50" height="50" class="tableImg" />
<img v-else src="../../../../static/img/morenAvavter.png" width="50" height="50" class="tableImg">
<img
v-if="scope.row.avatar && scope.row.avatar != ''"
:src="scope.row.avatar"
width="50"
height="50"
class="tableImg"
/>
<img
v-else
src="../../../../static/img/morenAvavter.png"
width="50"
height="50"
class="tableImg"
/>
</template>
</el-table-column>
<el-table-column prop="nickname" header-align="center" align="center" label="昵称">
<el-table-column
prop="nickname"
header-align="center"
align="center"
label="昵称"
>
</el-table-column>
<el-table-column prop="tel" header-align="center" align="center" label="电话">
<el-table-column
prop="tel"
header-align="center"
align="center"
label="电话"
>
</el-table-column>
<el-table-column prop="email" header-align="center" align="center" label="邮箱">
<el-table-column
prop="email"
header-align="center"
align="center"
label="邮箱"
>
</el-table-column>
<!-- <el-table-column
prop="password"
@@ -75,7 +136,41 @@
align="center"
label="vip 有效期">
</el-table-column> -->
<el-table-column prop="peanutCoin" header-align="center" align="center" label="天医币">
<el-table-column
prop="peanutCoin"
header-align="center"
align="center"
label="天医币"
>
</el-table-column>
<el-table-column
prop="peanutCoin"
header-align="center"
align="center"
label="VIP 办理"
>
<template slot-scope="scope">
<el-popover
placement="right"
width="300"
trigger="click"
@show="getVipMoney(scope.row)"
>
<el-table :data="vipList">
<el-table-column
width="150"
property="title"
label="VIP名称"
></el-table-column>
<el-table-column
width="100"
property="lastFee"
label="开通金额"
></el-table-column>
</el-table>
<el-button slot="reference" size="small">办理金额</el-button>
</el-popover>
</template>
</el-table-column>
<!-- <el-table-column
prop="readTime"
@@ -95,25 +190,78 @@
align="center"
label="删除标记">
</el-table-column> -->
<el-table-column fixed="right" header-align="center" align="center" width="150" label="操作">
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作"
>
<template slot-scope="scope">
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
<el-button
type="text"
size="small"
@click="addOrUpdateHandle(scope.row.id)"
>修改</el-button
>
<el-button
type="text"
size="small"
@click="deleteHandle(scope.row.id)"
>删除</el-button
>
<el-dropdown>
<span class="el-dropdown-link" style="font-size:12px; color:#17B3A3; cursor: pointer;">
<span
class="el-dropdown-link"
style="font-size:12px; color:#17B3A3; cursor: pointer;"
>
更多操作<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item><el-button type="text" size="small" @click="ck(scope.row)">/扣天医币</el-button></el-dropdown-item>
<el-dropdown-item
><el-button type="text" size="small" @click="ck(scope.row)"
>/扣天医币</el-button
></el-dropdown-item
>
<el-dropdown-item>
<router-link :to="{ path: 'user-point-memery', query: {'tel':scope.row.tel, 'id':scope.row.id, 'userName':scope.row.nickname} }">
<el-button type="text" size="small">/扣天医币记录</el-button>
<router-link
:to="{
path: 'user-point-memery',
query: {
tel: scope.row.tel,
id: scope.row.id,
userName: scope.row.nickname
}
}"
>
<el-button type="text" size="small"
>/扣天医币记录</el-button
>
</router-link>
</el-dropdown-item>
<el-dropdown-item><el-button type="text" size="small" @click=" thisUserID = scope.row.id; youVisible = true">优惠券管理</el-button></el-dropdown-item>
<el-dropdown-item><el-button type="text" size="small" @click="resetPassword(scope.row)">修改密码</el-button></el-dropdown-item>
<el-dropdown-item
><el-button
type="text"
size="small"
@click="
thisUserID = scope.row.id;
youVisible = true;
"
>优惠券管理</el-button
></el-dropdown-item
>
<el-dropdown-item
><el-button
type="text"
size="small"
@click="resetPassword(scope.row)"
>修改密码</el-button
></el-dropdown-item
>
<el-dropdown-item>
<router-link :to="{ path: '/userCourse', query: {id:scope.row.id} }">
<router-link
:to="{ path: '/userCourse', query: { id: scope.row.id } }"
>
<el-button type="text" size="small">
用户课程管理
</el-button>
@@ -125,18 +273,45 @@
</template>
</el-table-column>
</el-table>
<el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="total"
layout="total, sizes, prev, pager, next, jumper">
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
>
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<el-dialog title="充/扣天医币" :close-on-click-modal="false" :visible.sync="adc" append-to-body width="30%" :before-close="closeDia">
<el-form :model="pointForm" label-width="100px" :rules="pointFormRules" ref="pointForm">
<add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList"
></add-or-update>
<el-dialog
title="充/扣天医币"
:close-on-click-modal="false"
:visible.sync="adc"
append-to-body
width="30%"
:before-close="closeDia"
>
<el-form
:model="pointForm"
label-width="100px"
:rules="pointFormRules"
ref="pointForm"
>
<el-form-item label="用户">
{{pointForm.tel}} <span v-if="pointForm.name!=''">({{pointForm.name}})</span>
<span>账户余额<em style="font-style: normal; font-size: 16px; color: #17B3A3;">{{pointForm.peanutCoin}}</em></span>
{{ pointForm.tel }}
<span v-if="pointForm.name != ''">({{ pointForm.name }})</span>
<span
>账户余额<em
style="font-style: normal; font-size: 16px; color: #17B3A3;"
>{{ pointForm.peanutCoin }}</em
></span
>
</el-form-item>
<!-- <el-form-item label="充/扣主题">
<el-input v-model="pointForm.title"></el-input>
@@ -145,147 +320,205 @@
<!-- <el-input v-model="pointForm.pointType" placeholder="0-普通 1-vip"></el-input>
-->
<el-select v-model="pointForm.pointType" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="金额" prop="pointAmount">
<el-input-number v-model="pointForm.pointAmount" :placeholder="pointForm.peanutCoin+'可用'">
<el-input-number
v-model="pointForm.pointAmount"
:placeholder="pointForm.peanutCoin + '可用'"
>
</el-input-number>
</el-form-item>
<el-form-item label="充扣明细">
<el-input type="textarea" rows="5" v-model="pointForm.remark" placeholder="操作说明">
<el-input
type="textarea"
rows="5"
v-model="pointForm.remark"
placeholder="操作说明"
>
</el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDia">取消</el-button>
<el-button type="primary" @click="huaSheng(pointForm.peanutCoin)">确定</el-button>
<el-button type="primary" @click="huaSheng(pointForm.peanutCoin)"
>确定</el-button
>
</span>
</el-dialog>
<userCouponList v-if="youVisible" ref="userCouponList" :userId='thisUserID' @close="closeCoupon"></userCouponList>
<userCouponList
v-if="youVisible"
ref="userCouponList"
:userId="thisUserID"
@close="closeCoupon"
></userCouponList>
</div>
</template>
<script>
import userCouponList from '../coupon/userCouponList'
import AddOrUpdate from './user-add-or-update'
export default {
import userCouponList from "../coupon/userCouponList";
import AddOrUpdate from "./user-add-or-update";
export default {
data() {
return {
dataForm: {
key: ''
key: ""
},
pointFormRules:{
pointAmount:[
{ required: true, message: '请输入金额', trigger: 'blur' },
pointFormRules: {
pointAmount: [
{ required: true, message: "请输入金额", trigger: "blur" }
],
pointType:{ required: true, message: '请选择操作类型', trigger: 'blur' }
pointType: {
required: true,
message: "请选择操作类型",
trigger: "blur"
}
},
options: [{
vipList: [],
options: [
{
value: 0,
label: '充天医币'
}, {
label: "充天医币"
},
{
value: 1,
label: '扣天医币'
}],
label: "扣天医币"
}
],
adc: false,
pointForm: {
pointType: 0,
remark:'',
remark: "",
// title:'',
pointAmount:0
pointAmount: 0
},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
total:0,
total: 0,
dataListLoading: false,
dataListSelections: [],
addOrUpdateVisible: false,
youVisible: false,
youForm: {},
courperList: [],
courperHistList: [],
}
courperHistList: []
};
},
components: {
AddOrUpdate,
userCouponList
},
activated() {
this.getDataList()
this.getDataList();
},
methods: {
closeCoupon(val){
this.youVisible = false
},
// 用户课程
userCourse(val){
getVipMoney(data) {
console.log("data at line 420:", data.id);
},
// 获取数据列表
getDataList() {
this.dataListLoading = true
this.$http({
// url: this.$http.adornUrl('/book/user/list'),
url: this.$http.adornUrl('/book/user/getUserList'),
method: 'post',
url: this.$http.adornUrl("/master/userVip/getVipProductForUser"),
method: "post",
data: this.$http.adornData({
'page': this.pageIndex,
'limit': this.pageSize,
'key': this.dataForm.key
}),
uid: data.id
})
// params: this.$http.adornParams({
// 'page': 1,
// 'limit': this.pageSize,
// 'key': this.dataForm.key
// })
}).then(({
data
}) => {
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.user.records
this.totalPage = data.user.pages
this.total = data.user.total
this.dataListLoading = false
var list=[]
console.log("data at line 436:", data.list);
for(let i in data.list){
if (data.list[i].length > 0) {
list.push([...data.list[i]]);
}
}
this.vipList=list.flat(Infinity)
console.log("this.vipList at line 440:", this.vipList);
}else{
this.$message.error(data.msg);
this.vipList=[]
}
});
},
closeCoupon(val) {
this.youVisible = false;
},
// 用户课程
userCourse(val) {},
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.$http({
// url: this.$http.adornUrl('/book/user/list'),
url: this.$http.adornUrl("/book/user/getUserList"),
method: "post",
data: this.$http.adornData({
page: this.pageIndex,
limit: this.pageSize,
key: this.dataForm.key
})
// params: this.$http.adornParams({
// 'page': 1,
// 'limit': this.pageSize,
// 'key': this.dataForm.key
// })
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.user.records;
this.totalPage = data.user.pages;
this.total = data.user.total;
this.dataListLoading = false;
}
});
},
// 重置密码
resetPassword(row){
console.log(row,'row')
this.$prompt('请输入新密码', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
resetPassword(row) {
console.log(row, "row");
this.$prompt("请输入新密码", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消"
// inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
// inputErrorMessage: '邮箱格式不正确'
}).then(({ value }) => {
this.$http({
url: this.$http.adornUrl('/book/user/updateUserPassword'),
method: 'post',
data: this.$http.adornData({
'id':row.id,
'password': value
}),
}).then(({data}) => {
if (data && data.code === 0) {
this.$message.success('修改密码成功')
}
}).catch(({e}) => {
console.log(e,'e')
})
.then(({ value }) => {
this.$http({
url: this.$http.adornUrl("/book/user/updateUserPassword"),
method: "post",
data: this.$http.adornData({
id: row.id,
password: value
})
})
.then(({ data }) => {
if (data && data.code === 0) {
this.$message.success("修改密码成功");
}
})
.catch(({ e }) => {
console.log(e, "e");
});
// this.$message({
// type: 'success',
// message: '你的邮箱是: ' + value
// });
}).catch(() => {
})
.catch(() => {
// this.$message({
// type: 'info',
// message: '取消输入'
@@ -295,88 +528,92 @@ import userCouponList from '../coupon/userCouponList'
// 每页数
sizeChangeHandle(val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.pageIndex = val
this.getDataList()
this.pageIndex = val;
this.getDataList();
},
// 多选
selectionChangeHandle(val) {
this.dataListSelections = val
this.dataListSelections = val;
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id)
})
this.$refs.addOrUpdate.init(id);
});
},
closeDia(){
this.adc = false
closeDia() {
this.adc = false;
this.$refs.pointForm.resetFields();
// this.pointForm.pointType == 0
},
// 删除
deleteHandle(id) {
var ids = id ? [id] : this.dataListSelections.map(item => {
return item.id
})
this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
var ids = id
? [id]
: this.dataListSelections.map(item => {
return item.id;
});
this.$confirm(
`确定对[id=${ids.join(",")}]进行[${id ? "删除" : "批量删除"}]操作?`,
"提示",
{
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}
).then(() => {
this.$http({
url: this.$http.adornUrl('/book/user/delete'),
method: 'post',
url: this.$http.adornUrl("/book/user/delete"),
method: "post",
data: this.$http.adornData(ids, false)
}).then(({
data
}) => {
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList()
this.getDataList();
}
})
});
} else {
this.$message.error(data.msg)
this.$message.error(data.msg);
}
})
})
});
});
},
// 充值扣款天医币
ck(e) {
this.pointForm=e
this.adc = true
this.pointForm = e;
this.adc = true;
},
huaSheng(point){
huaSheng(point) {
// console.log(this.pointForm.pointAmount, point)
if(this.pointForm.pointAmount > point && this.pointForm.pointType == 1){
return this.$message.error('扣除金额不能大于总金额')
if (this.pointForm.pointAmount > point && this.pointForm.pointType == 1) {
return this.$message.error("扣除金额不能大于总金额");
}
this.$refs['pointForm'].validate((valid) => {
this.$refs["pointForm"].validate(valid => {
this.$http({
url: this.$http.adornUrl(`/book/user/pointChange?pointType=${this.pointForm.pointType}&note=${this.pointForm.remark}&pointAmount=${this.pointForm.pointAmount}&id=${this.pointForm.id}`),
method: 'get',
url: this.$http.adornUrl(
`/book/user/pointChange?pointType=${this.pointForm.pointType}&note=${this.pointForm.remark}&pointAmount=${this.pointForm.pointAmount}&id=${this.pointForm.id}`
),
method: "get",
params: this.$http.adornParams()
}).then(({
data
}) => {
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message.success('操作成功')
this.getDataList()
this.adc = false
this.$message.success("操作成功");
this.getDataList();
this.adc = false;
}
})
})
});
});
},
// async getUserCouponList(userId) {
// var obj = undefined
@@ -422,26 +659,24 @@ import userCouponList from '../coupon/userCouponList'
// 删除优惠券
courDelete(e) {
let arrList = []
arrList.push(e.id)
let arrList = [];
arrList.push(e.id);
this.$http({
url: this.$http.adornUrl('/book/couponhistory/delete'),
method: 'post',
url: this.$http.adornUrl("/book/couponhistory/delete"),
method: "post",
data: this.$http.adornData(arrList, false)
}).then(({
data
}) => {
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '删除成功',
type: 'success',
duration: 1500,
})
this.youhui(this.youForm)
this.youVisible = true
}
})
message: "删除成功",
type: "success",
duration: 1500
});
this.youhui(this.youForm);
this.youVisible = true;
}
});
}
}
};
</script>