This commit is contained in:
dute7liang
2024-01-02 23:36:50 +08:00
parent 7b98acc1ae
commit 810eec3d55
7 changed files with 206 additions and 37 deletions

View File

@@ -32,6 +32,27 @@ export function getFullUser(id) {
}) })
} }
export function listUserByUserCode(usercode) {
return request({
url: '/cai/user/listByUserCode',
method: 'get',
params:{
usercode: usercode,
limit: 40
}
})
}
export function getUserByUsercode(usercode) {
return request({
url: '/cai/user/getByUsercode',
method: 'get',
params:{
usercode: usercode
}
})
}
// 新增用户 // 新增用户
export function addUser(data) { export function addUser(data) {
return request({ return request({

View File

@@ -50,7 +50,7 @@
<el-table-column label="举报人" align="center"> <el-table-column label="举报人" align="center">
<el-table-column label="头像" align="center" prop="avatar"> <el-table-column label="头像" align="center" prop="avatar">
<template v-slot="scope"> <template v-slot="scope">
<image-preview :value="scope.row.avatar"/> <image-avatar :value="scope.row.avatar"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="蜜瓜号" align="center" prop="usercode"/> <el-table-column label="蜜瓜号" align="center" prop="usercode"/>
@@ -58,7 +58,7 @@
<el-table-column label="举报对象" align="center"> <el-table-column label="举报对象" align="center">
<el-table-column label="头像" align="center" prop="reportAvatar"> <el-table-column label="头像" align="center" prop="reportAvatar">
<template v-slot="scope"> <template v-slot="scope">
<image-preview :value="scope.row.reportAvatar"/> <image-avatar :value="scope.row.reportAvatar"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="昵称" align="center" prop="reportNickname"/> <el-table-column label="昵称" align="center" prop="reportNickname"/>

View File

@@ -148,7 +148,7 @@
</template> </template>
<script> <script>
import {delUser, listUser, resetUserPassword} from '@/api/cai/user' import {delUser, getFullUser, listUser, resetUserPassword} from '@/api/cai/user'
import {authList, genderList, userStatusList, isAnchorList, videoStatusList} from '@/constant/statusMap' import {authList, genderList, userStatusList, isAnchorList, videoStatusList} from '@/constant/statusMap'
import UserAddUpdateDialog from '@/views/cai/user/user-add-update-dialog.vue' import UserAddUpdateDialog from '@/views/cai/user/user-add-update-dialog.vue'
import UserInfoDialog from "@/views/cai/user/user-info-dialog"; import UserInfoDialog from "@/views/cai/user/user-info-dialog";
@@ -234,18 +234,38 @@ export default {
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; getFullUser(row.id).then(response => {
this.$modal.confirm('是否确认删除用户编号为"' + ids + '"的数据项?').then(() => { let user = response.data.user
this.loading = true; let account = response.data.account
return delUser(ids); let anchor = response.data.anchor
}).then(() => { let userCount = response.data.userCount
this.loading = false; if(user.isUnion === 1){
this.getList(); this.$modal.msgError("该用户检测为工会会长,请先解散工会后再删除用户")
this.$modal.msgSuccess("删除成功"); return;
}).catch(() => { }
}).finally(() => { let html = `<p>确认删除用户:<span style="color: red">` + user.nickname + `</span> 吗?</p>`
this.loading = false; + `<p>用户余额:<span style="color: red">` + account.incomeCoin + `</span></p>`
}); + `<p>用户收益:<span style="color: red">` + account.totalBuyMoney + `</span></p>`
+ `<p>粉丝数:<span style="color: red">` + userCount.fansCount + `</span></p>`
if(anchor){
html = html + `<p style="color: red"> 并且用户为主播,是否继续删除?</p>`
}
html = html + `<p style="color: red">删除后将无法撤回,请谨慎操作</p>`
this.$confirm(html, '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
dangerouslyUseHTMLString: true,
type: 'warning'
}).then(() => {
this.loading = true
return delUser(row.id)
}).then(() => {
this.loading = false
this.getList()
this.msgSuccess('删除成功')
}).catch(() => {
})
})
}, },
/** 重置密码按钮操作 */ /** 重置密码按钮操作 */
handleResetPwd(row) { handleResetPwd(row) {

View File

@@ -33,14 +33,14 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="工会名称" prop="unionName"> <!-- <el-form-item label="工会名称" prop="unionName">
<el-input <el-input
v-model="queryParams.unionName" v-model="queryParams.unionName"
placeholder="请输入邀请人手机号" placeholder="请输入邀请人手机号"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>-->
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -53,15 +53,19 @@
<el-table v-loading="loading" :data="userInviteList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="userInviteList" @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">
<el-table-column label="手机号" align="center" prop="mobile"/> <el-table-column label="蜜瓜号" align="center" prop="usercode"/>
<el-table-column label="所属工会" align="center" prop="unionName"/> <el-table-column label="手机号" align="center" prop="mobile"/>
<el-table-column label="邀请人蜜瓜号" align="center" prop="inviteUsercode"/> </el-table-column>
<el-table-column label="邀请人手机号" align="center" prop="inviteMobile"/> <!-- <el-table-column label="所属工会" align="center" prop="unionName"/>-->
<el-table-column label="邀请人为会长" align="center" prop="inviteIsUnion"> <el-table-column label="邀请人" align="center">
<template v-slot="scope"> <el-table-column label="蜜瓜号" align="center" prop="inviteUsercode"/>
<cai-dict-tag :options="isAnchorList" :value="scope.row.inviteIsUnion"/> <el-table-column label="手机号" align="center" prop="inviteMobile"/>
</template> <el-table-column label="是否为会长" align="center" prop="inviteIsUnion">
<template v-slot="scope">
<cai-dict-tag :options="isAnchorList" :value="scope.row.inviteIsUnion"/>
</template>
</el-table-column>
</el-table-column> </el-table-column>
<el-table-column label="好友守护分成" align="center" prop="guardIncomeRate" /> <el-table-column label="好友守护分成" align="center" prop="guardIncomeRate" />
<el-table-column label="好友礼物分成" align="center" prop="giftIncomeRate" /> <el-table-column label="好友礼物分成" align="center" prop="giftIncomeRate" />

View File

@@ -0,0 +1,96 @@
<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.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 {addUserUnion} from "@/api/cai/userUnion";
import {getUserByUsercode, listUserByUserCode} from "@/api/cai/user";
export default {
components: {
},
data () {
return {
open: false,
title: '',
form:{
id: undefined,
usercode: undefined,
},
info:{
},
// 表单校验
rules: {
usercode: [
{ required: true, message: "数据不能为空", trigger: "blur" }
],
},
buttonLoading: false,
}
},
created() {
},
methods: {
init () {
this.open = true;
this.title = "新增工会"
this.info = {};
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;
addUserUnion(this.form).then(data => {
this.$modal.msgSuccess("新增工会成功");
this.buttonLoading = false;
this.open = false
this.$emit('refreshDataList')
}).finally(() => {
this.buttonLoading = false;
});
}
})
},
}
}
</script>

View File

@@ -24,6 +24,16 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <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="['cai:userUnion:add']"
>新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
@@ -79,6 +89,7 @@
/> />
<union-update-dialog v-if="unionUpdateDialogVisible" ref="unionUpdateDialog" @refreshDataList="getList"/> <union-update-dialog v-if="unionUpdateDialogVisible" ref="unionUpdateDialog" @refreshDataList="getList"/>
<add-union-dialog v-if="addUnionDialogVisible" ref="addUnionDialog" @refreshDataList="getList" />
</div> </div>
</template> </template>
@@ -86,16 +97,18 @@
import {delUserUnion, listUserUnion} from '@/api/cai/userUnion' import {delUserUnion, listUserUnion} from '@/api/cai/userUnion'
import {booleanList, genderList, userStatusList} from '@/constant/statusMap' import {booleanList, genderList, userStatusList} from '@/constant/statusMap'
import UnionUpdateDialog from "@/views/cai/userUnion/union-update-dialog"; import UnionUpdateDialog from "@/views/cai/userUnion/union-update-dialog";
import AddUnionDialog from "@/views/cai/userUnion/add-union-dialog";
export default { export default {
name: 'UserUnion', name: 'UserUnion',
components: { components: {
UnionUpdateDialog UnionUpdateDialog,AddUnionDialog
}, },
data() { data() {
return { return {
genderList, booleanList, userStatusList, genderList, booleanList, userStatusList,
unionUpdateDialogVisible: false, unionUpdateDialogVisible: false,
addUnionDialogVisible: false,
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组 // 选中数组
@@ -155,20 +168,35 @@ export default {
this.$refs.unionUpdateDialog.init(row) this.$refs.unionUpdateDialog.init(row)
}) })
}, },
handleAdd(row){
this.addUnionDialogVisible = true
this.$nextTick(() => {
this.$refs.addUnionDialog.init(row)
})
},
handleDetail(row){ handleDetail(row){
const params = { unionId: row.id }; const params = { unionId: row.id };
this.$tab.openPage("["+row.name+"]工会详情", '/tool/union-user/index', params); this.$tab.openPage("["+row.name+"]工会详情", '/tool/union-user/index', params);
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids // '是否确认删除商家名称为"' + row.nickName + '"的数据项?删除后无法回归!'
this.$modal.confirm('是否确认删除工会列表编号为"' + ids + '"的数据项?').then(() => { const html = `<p>确认解散【<span style="color: red">` + row.name + `</span>】工会 吗?</p>`
+ `<p>该工会共有:<span style="color: red">` + row.allNum + `</span>人</p>`
+ `<p>工会解散后,会长的一级好友提成比例也会回归默认值</p>`
+ `<p style="color: red">删除后将无法撤回,请谨慎操作</p>`
this.$confirm(html, '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
dangerouslyUseHTMLString: true,
type: 'warning'
}).then(() => {
this.loading = true this.loading = true
return delUserUnion(ids) return delUserUnion(row.id)
}).then(() => { }).then(() => {
this.loading = false this.loading = false
this.getList() this.getList()
this.$modal.msgSuccess('删除成功') this.$modal.msgSuccess('解散成功')
}).catch(() => { }).catch(() => {
}).finally(() => { }).finally(() => {
this.loading = false this.loading = false

View File

@@ -16,9 +16,9 @@
<el-radio :label="false">关闭</el-radio> <el-radio :label="false">关闭</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="默认提成" prop="defaultIncomeRate"> <!-- <el-form-item label="默认提成" prop="defaultIncomeRate">
<el-input v-model="form.defaultIncomeRate" /> <el-input v-model="form.defaultIncomeRate" />
</el-form-item> </el-form-item>-->
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button> <el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
@@ -42,7 +42,7 @@ export default {
nickname: undefined, nickname: undefined,
mobile: undefined, mobile: undefined,
usercode: undefined, usercode: undefined,
defaultIncomeRate: undefined, // defaultIncomeRate: undefined,
enableRate: undefined, enableRate: undefined,
}, },
// 表单校验 // 表单校验
@@ -50,9 +50,9 @@ export default {
enableRate: [ enableRate: [
{ required: true, message: "数据不能为空", trigger: "blur" } { required: true, message: "数据不能为空", trigger: "blur" }
], ],
defaultIncomeRate: [ // defaultIncomeRate: [
{ required: true, message: "数据不能为空", trigger: "blur" } // { required: true, message: "数据不能为空", trigger: "blur" }
], // ],
}, },
buttonLoading: false, buttonLoading: false,
} }