This commit is contained in:
张良(004796)
2024-03-13 16:59:17 +08:00
parent 55c04e1d1b
commit 8f40a0c7dd
8 changed files with 588 additions and 72 deletions

View File

@@ -0,0 +1,101 @@
<template>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="用户编号" prop="usercode">
<el-autocomplete
class="inline-input"
v-model="form.usercode"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
@select="handleSelect"
></el-autocomplete>
</el-form-item>
<el-form-item label="昵称" v-if="info.nickname">
{{ info.nickname }} {{ info.usercode }}
</el-form-item>
<el-form-item label="性别" v-if="info.gender">
<cai-dict-tag :options="genderList" :value="info.gender" />
</el-form-item>
<el-form-item label="头像" v-if="info.avatar">
<image-avatar :src="info.avatar"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="open = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import ImageUpload from '@/components/ImageUpload/index'
import { getUserByUsercode, listUserByUserCode, userBindInvite } from '@/api/xq/user'
import { genderList } from '@/constant/statusMap'
export default {
components: {
ImageUpload,
},
data () {
return {
genderList,
open: false,
title: '',
form:{
id: undefined,
usercode: undefined,
},
info:{},
// 表单校验
rules: {
usercode: [
{ required: true, message: "数据不能为空", trigger: "blur" }
]
},
buttonLoading: false,
}
},
created() {
},
methods: {
init (id) {
this.open = true;
this.title = "设置用户邀请人"
this.info = {};
this.form.id = id
this.form.usercode = undefined
},
querySearch(querySearch,cb){
listUserByUserCode(querySearch).then(res => {
cb(res.data.map((terminal) => {
return {
value: terminal,
name: terminal,
};
}))
})
},
handleSelect(item){
getUserByUsercode(item.value).then(res => {
this.info = res.data
})
},
// 表单提交
submitForm () {
this.$refs['form'].validate((valid) => {
if (valid) {
this.buttonLoading = true;
userBindInvite(this.form.id,this.form.usercode).then(data => {
this.$modal.msgSuccess("绑定成功");
this.buttonLoading = false;
this.open = false
this.$emit('refreshDataList')
}).finally(() => {
this.buttonLoading = false;
});
}
})
},
}
}
</script>

View File

@@ -149,19 +149,23 @@
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<bind-invite-dialog v-if="bindInviteDialogVisible" ref="bindInviteDialog" @refreshDataList="getList" />
</div>
</template>
<script>
import { listUser, getUser, delUser, addUser, updateUser } from "@/api/xq/user";
import { listUser, resetUserMobile, delUser, resetUserPassword, userUnBindInvite, getUser, userResetAvatar, userResetNickname } from "@/api/xq/user";
import { genderList, userStatusList } from '@/constant/statusMap'
import { resetUserMobile, resetUserPassword } from '@/api/cai/user'
import BindInviteDialog from '@/views/xq/user/bind-invite-dialog.vue'
export default {
name: "User",
components: {BindInviteDialog},
data() {
return {
userStatusList,genderList,
bindInviteDialogVisible: false,
// 遮罩层
loading: true,
// 选中数组
@@ -222,6 +226,32 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
},
handleUserResetAvatar(row){
this.$modal.confirm('是否确认重置用户"' + row.nickname + '"的头像?').then(() => {
this.loading = true;
return userResetAvatar(row.id);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("重置成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
handleUserResetNickname(row){
this.$modal.confirm('是否确认重置用户"' + row.nickname + '"的昵称?').then(() => {
this.loading = true;
return userResetNickname(row.id);
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("重置成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 重置密码按钮操作 */
handleResetPwd(row) {
this.$prompt('请输入"' + row.usercode + '"的新密码', "提示", {
@@ -256,6 +286,40 @@ export default {
});
}).catch(() => {});
},
handleUserBindInvite(row){
this.bindInviteDialogVisible = true
this.$nextTick(() => {
this.$refs.bindInviteDialog.init(row.id)
})
},
handleUserUnBindInvite(row){
getUser(row.inviteId).then(response => {
let inviteUser = response.data;
if(!inviteUser){
this.$modal.msgError("该用户不存在推荐人,无需解除")
return;
}
let html = `<p>确认解除用户:<span style="color: cadetblue">` + row.nickname + `</span> 的推荐人?</p>`
+ `<p>推荐人用户编号:<span style="color: red">` + inviteUser.usercode + `</span></p>`
+ `<p>推荐人昵称:<span style="color: red">` + inviteUser.nickname + `</span></p>`
this.$confirm(html, '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
dangerouslyUseHTMLString: true,
type: 'warning'
}).then(() => {
this.loading = true
return userUnBindInvite(row.id)
}).then(() => {
this.$modal.msgSuccess("解除成功");
this.loading = false
this.getList()
}).catch(() => {
}).finally(()=>{
this.loading = false
})
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;

View File

@@ -0,0 +1,113 @@
<template>
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="调整收益" prop="rechargeCoin">
<el-input v-model="form.rechargeCoin" placeholder="请输入" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入" />
</el-form-item>
<el-form-item label="用户编号" prop="usercode">
<el-autocomplete
class="inline-input"
v-model="form.usercode"
:fetch-suggestions="querySearch"
placeholder="请输入内容"
@select="handleSelect"
></el-autocomplete>
</el-form-item>
<el-form-item label="昵称" v-if="info.nickname">
{{ info.nickname }} {{ info.usercode }}
</el-form-item>
<el-form-item label="头像" v-if="info.avatar">
<image-avatar :src="info.avatar"/>
</el-form-item>
<el-form-item>
注意调整金额为负减余额正则加余额 请保证余额不能减为负数
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="open = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { getUserByUsercode, listUserByUserCode } from '@/api/xq/user'
import { updateIncomeCoin } from '@/api/xq/userExtend'
export default {
components: {
},
data () {
return {
open: false,
title: '',
form:{
usercode: undefined,
rechargeCoin: undefined,
remark: undefined
},
info:{
},
// 表单校验
rules: {
usercode: [
{ required: true, message: "数据不能为空", trigger: "blur" }
],
rechargeCoin: [
{ required: true, message: "数据不能为空", trigger: "blur" }
],
remark: [
{ required: true, message: "数据不能为空", trigger: "blur" }
],
},
buttonLoading: false,
}
},
created() {
},
methods: {
init () {
this.open = true;
this.title = "调整用户账号"
this.info = {};
this.form.usercode = undefined
this.form.rechargeCoin = undefined
this.form.remark = undefined
},
querySearch(querySearch,cb){
listUserByUserCode(querySearch).then(res => {
cb(res.data.map((terminal) => {
return {
value: terminal,
name: terminal,
};
}))
})
},
handleSelect(item){
getUserByUsercode(item.value).then(res => {
this.info = res.data
})
},
// 表单提交
submitForm () {
this.$refs['form'].validate((valid) => {
if (valid) {
this.buttonLoading = true;
updateIncomeCoin(this.form).then(data => {
this.$modal.msgSuccess("操作成功");
this.buttonLoading = false;
this.open = false
this.$emit('refreshDataList')
}).finally(() => {
this.buttonLoading = false;
});
}
})
},
}
}
</script>

View File

@@ -32,11 +32,22 @@
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['xq:userExtend:add']"
>收益调整
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="userExtendList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="用户编号" align="center" prop="usercode"/>
<el-table-column label="昵称" align="center" prop="nickname" show-overflow-tooltip/>
<el-table-column label="手机号" align="center" prop="mobile" width="100"/>
@@ -45,53 +56,33 @@
<image-avatar :src="scope.row.avatar"/>
</template>
</el-table-column>
<el-table-column label="收益" align="center" prop="incomeCoin" />
<el-table-column label="邀请人" align="center" prop="inviteId">
<template v-slot="scope">
<span v-if="!scope.row.inviteId">-</span>
<span v-if="scope.row.inviteId">{{scope.row.inviteNickname}}({{scope.row.inviteUsercode}})</span>
</template>
</el-table-column>
<el-table-column label="消费统计" align="center" prop="consumeTotal" />
<el-table-column label="提现统计" align="center" prop="withdrawTotal" />
<el-table-column label="给上级的提成" align="center" prop="cashbackTotal" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template v-slot="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['xq:userExtend:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['xq:userExtend:remove']"
>删除</el-button>
</template>
</el-table-column>
<el-table-column label="收益" align="center" prop="incomeCoin"/>
<el-table-column label="消费统计" align="center" prop="consumeTotal"/>
<el-table-column label="提现统计" align="center" prop="withdrawTotal"/>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<add-account-dialog v-if="addAccountDialogVisible" ref="addAccountDialog" @refreshDataList="getList"/>
</div>
</template>
<script>
import { listUserExtend } from '@/api/xq/userExtend'
import AddAccountDialog from '@/views/xq/userExtend/add-account-dialog.vue'
export default {
name: "UserExtend",
name: 'UserExtend',
components: { AddAccountDialog },
data() {
return {
addAccountDialogVisible: false,
// 遮罩层
loading: true,
// 选中数组
@@ -112,39 +103,45 @@ export default {
pageSize: 10,
nickname: undefined,
usercode: undefined,
mobile: undefined,
},
};
mobile: undefined
}
}
},
created() {
this.getList();
this.getList()
},
methods: {
handleAdd(row) {
this.addAccountDialogVisible = true
this.$nextTick(() => {
this.$refs.addAccountDialog.init(row?.usercode)
})
},
/** 查询用户邀请列表 */
getList() {
this.loading = true;
this.loading = true
listUserExtend(this.queryParams).then(response => {
this.userExtendList = response.rows;
this.total = response.total;
this.loading = false;
});
this.userExtendList = response.rows
this.total = response.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
}
}
};
}
</script>

View File

@@ -0,0 +1,161 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="上级编号" prop="inviteCode">
<el-input
v-model="queryParams.inviteCode"
placeholder="请输入上级编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="上级昵称" prop="inviteNickname">
<el-input
v-model="queryParams.inviteNickname"
placeholder="请输入上级昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="上级手机" prop="inviteMobile">
<el-input
v-model="queryParams.inviteMobile"
placeholder="请输入上级手机"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户编号" prop="usercode">
<el-input
v-model="queryParams.usercode"
placeholder="请输入用户编号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户昵称" prop="nickname">
<el-input
v-model="queryParams.nickname"
placeholder="请输入用户昵称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户手机" prop="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入用户手机"
clearable
@keyup.enter.native="handleQuery"
/>
</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>
<el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="userInviteList" @selection-change="handleSelectionChange">
<el-table-column label="上级用户" align="center" >
<el-table-column label="上级编号" align="center" prop="inviteCode" />
<el-table-column label="上级昵称" align="center" prop="inviteNickname" />
<el-table-column label="上级手机" align="center" prop="inviteMobile" />
<el-table-column label="上级头像" align="center" prop="inviteAvatar" >
<template v-slot="scope">
<image-avatar :src="scope.row.inviteAvatar"/>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="下级用户" align="center" >
<el-table-column label="用户编号" align="center" prop="usercode" />
<el-table-column label="用户手机" align="center" prop="nickname" />
<el-table-column label="用户昵称" align="center" prop="mobile" />
<el-table-column label="用户头像" align="center" prop="avatar" >
<template v-slot="scope">
<image-avatar :src="scope.row.avatar"/>
</template>
</el-table-column>
<el-table-column label="给上家的返现提成" align="center" prop="cashbackTotal" />
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
<script>
import { listUserInvite } from '@/api/xq/userInvite'
export default {
name: "UserInvite",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 用户邀请表格数据
userInviteList: [],
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
inviteCode: undefined,
inviteMobile: undefined,
inviteNickname: undefined,
usercode: undefined,
nickname: undefined,
mobile: undefined,
},
};
},
created() {
this.getList();
},
methods: {
/** 查询用户邀请列表 */
getList() {
this.loading = true;
listUserInvite(this.queryParams).then(response => {
this.userInviteList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
}
};
</script>