sadjv3_admin/src/views/bl/commission/jjr/jjrApply.vue

1079 lines
25 KiB
Vue
Raw Normal View History

2024-08-05 10:22:21 +08:00
<template>
<div>
<!-- 列表 -->
<div style="display: inline-block">
<span>状态</span>
<el-select
clearable
v-model="status"
style="width: 150px;">
<el-option value="" label="全部"></el-option>
<el-option value="0" label="申请中"></el-option>
<el-option value="1" label="已授权"></el-option>
<el-option value="2" label="已驳回"></el-option>
</el-select>&nbsp;&nbsp;
</div>
<div style="margin-left:10px;display: inline-block">
<span>姓名</span>
<el-input
style="width: 200px"
placeholder="请输入姓名"
v-model="name">
</el-input>
</div>
<div style="margin-left:10px;display: inline-block">
<span>电话</span>
<el-input
style="width: 200px"
placeholder="请输入电话"
v-model="phone">
</el-input>
</div>
<div style="margin-left:10px;display: inline-block;">
<span>申请开始时间</span>
<el-date-picker style="width: 160px;" v-model="startTime" align="right"
type="datetime" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择开始时间">
</el-date-picker>&nbsp;&nbsp;&nbsp;
</div>
<div style="margin-left:10px;display: inline-block;">
<span>申请截止时间</span>
<el-date-picker style="width: 160px;" v-model="endTime" align="right" type="datetime"
format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择截止时间">
</el-date-picker>
</div>
<el-button
style="margin-left: 10px"
size="mini"
type="primary"
icon="document"
@click="handleSelect"
>查询
</el-button>
<el-button
style="margin-left: 10px"
size="mini"
type="primary"
icon="document"
@click="handleClear"
>重置
</el-button>
<el-button
style="margin-left: 10px"
size="mini"
type="primary"
icon="document"
@click="handleEdit(0)"
>添加
</el-button>
<el-table v-loading="tableDataLoading" :data="tableData.list">
<el-table-column
prop="id"
label="编号"
width="80"
fixed="left"
>
</el-table-column>
<el-table-column
prop="userId"
label="用户ID"
fixed="left"
width="150"
>
</el-table-column>
<el-table-column prop="avatar" label="头像" fixed="left">
<template slot-scope="scope">
<img
v-if="scope.row.avatar && scope.row.avatar != ''"
:src="scope.row.avatar"
width="40"
height="40"
/>
<span v-else>暂无图片</span>
</template>
</el-table-column>
<el-table-column
prop="userName"
label="昵称"
fixed="left"
width="150"
>
</el-table-column>
<el-table-column
prop="name"
label="姓名"
fixed="left"
width="150"
>
</el-table-column>
<el-table-column
prop="phone"
label="手机号"
fixed="left"
width="150"
>
</el-table-column>
<el-table-column
prop="remarks"
label="备注"
fixed="left"
width="150"
>
</el-table-column>
<el-table-column
prop="createTime"
label="申请时间"
fixed="left"
width="150"
>
</el-table-column>
<el-table-column label="状态" fixed="left" prop="status">
<template slot-scope="scope">
{{ showDictValue(scope.row.status, statusData) }}
</template>
</el-table-column>
<el-table-column label="操作" prop="id" width="360" fixed="right">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
style="margin: 5px"
@click="handleView(scope.row)"
>查看
</el-button>
<el-button v-if="scope.row.status == 0"
size="mini"
type="primary"
style="margin: 5px"
@click="handleEdit(scope.row)"
>修改
</el-button>
<el-button v-if="scope.row.status == 0"
size="mini"
type="primary"
style="margin: 5px"
@click="handleDelete(scope.row)"
>删除
</el-button>
<el-button v-if="scope.row.status != 1"
size="mini"
type="primary"
style="margin: 5px"
@click="handleApply(scope.row)"
>授权
</el-button>
<el-button v-if="scope.row.status == 1"
size="mini"
type="primary"
style="margin: 5px"
@click="handleCancelApply(scope.row)"
>取消授权
</el-button>
</template>
</el-table-column>
</el-table>
<div style="text-align: center; margin-top: 10px">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:page-sizes="[10, 20, 30, 40]"
:page-size="limit"
:current-page="page"
layout="total,sizes, prev, pager, next,jumper"
:total="tableData.totalCount"
>
</el-pagination>
</div>
<!-- 查看 -->
<el-dialog :title="titles" :visible.sync="dialogFormViewVisible" center @close="closeFxy">
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">用户ID</span>
<el-input
style="width: 50%"
v-model="userId"
type="text"
placeholder=""
:disabled="true"
>
</el-input>
</div>
<div style="margin-bottom: 10px; display: flex">
<span style="width: 200px; display: inline-block; text-align: right">头像</span>
<div
style="
width: 148px;
height: 148px;
border: 1px dashed #c0ccda;
border-radius: 6px;
text-align: center;
line-height: 148px;
"
>
<img
:src="avatar"
class="avatar"
style="border-radius: 6px; width: 148px; height: 148px"
/>
</div>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">昵称</span>
<el-input
style="width: 50%"
v-model="userName"
:disabled="true"
></el-input>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">姓名</span>
<el-input
style="width: 50%"
v-model="name"
:disabled="true"
></el-input>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">手机号</span>
<el-input
style="width: 50%"
v-model="phone"
:disabled="true"
></el-input>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right"
>备注</span
>
<el-input
style="width: 50%"
v-model="remarks"
type="textarea"
:rows="4"
:disabled="true"
>
</el-input>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">状态</span>
<el-radio-group v-model="status" :disabled="true">
<el-radio :label="1">授权</el-radio>
<el-radio :label="2">驳回</el-radio>
</el-radio-group>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">审批意见</span>
<el-input
style="width: 50%"
v-model="opinion"
type="textarea"
:rows="4"
:disabled="true"
>
</el-input>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormViewVisible = false"> </el-button>
</div>
</el-dialog>
<!-- 添加修改 -->
<el-dialog :title="titles" :visible.sync="dialogFormVisible" center @close="closeFxy">
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">用户ID</span>
<el-input
style="width: 50%"
v-model="userId"
type="text"
placeholder="请选择用户"
:disabled="true"
>
</el-input>
<el-button
style="margin: 10px"
size="mini"
type="primary"
icon="document"
@click="showUsersView()"
>用户列表
</el-button>
</div>
<div style="margin-bottom: 10px; display: flex">
<span style="width: 200px; display: inline-block; text-align: right">头像</span>
<div
style="
width: 148px;
height: 148px;
border: 1px dashed #c0ccda;
border-radius: 6px;
text-align: center;
line-height: 148px;
"
>
<img
:src="avatar"
class="avatar"
style="border-radius: 6px; width: 148px; height: 148px"
/>
</div>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">昵称</span>
<el-input
style="width: 50%"
v-model="userName"
:disabled="true"
></el-input>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">姓名</span>
<el-input
style="width: 50%"
v-model="name"
placeholder="请输入姓名"
></el-input>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">手机号</span>
<el-input
style="width: 50%"
v-model="phone"
placeholder="请输入手机号"
></el-input>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right"
>备注</span
>
<el-input
style="width: 50%"
v-model="remarks"
type="textarea"
:rows="4"
placeholder="请输入备注"
>
</el-input>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false"> </el-button>
<el-button type="primary" @click="handleSubmit()"> </el-button>
</div>
</el-dialog>
<!-- <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 用户列表弹框 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<-->
<el-dialog title="用户列表" :visible.sync="dialogUserListFormVisible" width="60%" center>
<div style="margin-left: 10px; display: inline-block;">
<span>昵称</span>
<el-input
style="width: 200px"
placeholder="请输入昵称"
v-model="userName"
></el-input>
</div>
<div style="margin-left: 10px; display: inline-block">
<span>手机号</span>
<el-input
style="width: 200px"
placeholder="请输入手机号"
v-model="phone"
></el-input>
</div>
<div style="margin-left: 10px; display: inline-block">
<span>邀请码</span>
<el-input
style="width: 200px"
placeholder="请输入邀请码"
v-model="invitationCode"
></el-input>
</div>
<el-button
style="margin-left: 10px;"
size="mini"
type="primary"
icon="document"
@click="handleSelectUsers">查询
</el-button>
<el-button
style="margin-left: 10px"
size="mini"
type="primary"
icon="document"
@click="handleClearUsers">重置
</el-button>
<el-table :data="userTableData.list" style="width: 100%">
<el-table-column prop="userId" label="用户ID"></el-table-column>
<el-table-column prop="avatar" label="头像">
<template slot-scope="scope">
<img
v-if="scope.row.avatar && scope.row.avatar != ''"
:src="scope.row.avatar"
width="40"
height="40"
/>
<span v-else>暂无图片</span>
</template>
</el-table-column>
<el-table-column prop="userName" label="昵称"></el-table-column>
<el-table-column prop="phone" label="手机号"></el-table-column>
<el-table-column prop="invitationCode" label="邀请码"></el-table-column>
<el-table-column label="操作" prop="id">
<template slot-scope="scope">
<el-button
style="margin: 10px 0"
size="mini"
type="primary"
icon="document"
@click="handleAddUser(scope.row)"
>添加
</el-button>
</template>
</el-table-column>
</el-table>
<div style="text-align: center; margin-top: 10px">
<el-pagination
@size-change="handleUserSizeChange"
@current-change="handleUserCurrentChange"
:page-size="userLimit"
:current-page="userPage"
layout="total, prev, pager, next,jumper"
:total="userTableData.totalCount"
></el-pagination>
</div>
</el-dialog>
<!-- <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<用户列表<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -->
<!-- 审批 -->
<el-dialog :title="titles" :visible.sync="dialogApproveFormVisible" center @close="closeFxy">
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">用户ID</span>
<el-input
style="width: 50%"
v-model="userId"
type="text"
placeholder="请选择用户"
:disabled="true"
>
</el-input>
</div>
<div style="margin-bottom: 10px; display: flex">
<span style="width: 200px; display: inline-block; text-align: right">头像</span>
<div
style="
width: 148px;
height: 148px;
border: 1px dashed #c0ccda;
border-radius: 6px;
text-align: center;
line-height: 148px;
"
>
<img
:src="avatar"
class="avatar"
style="border-radius: 6px; width: 148px; height: 148px"
/>
</div>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">昵称</span>
<el-input
style="width: 50%"
v-model="userName"
:disabled="true"
></el-input>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">姓名</span>
<el-input
style="width: 50%"
v-model="name"
placeholder="请输入姓名"
:disabled="true"
></el-input>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">手机号</span>
<el-input
style="width: 50%"
v-model="phone"
placeholder="请输入手机号"
:disabled="true"
></el-input>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right"
>备注</span
>
<el-input
style="width: 50%"
v-model="remarks"
type="textarea"
:rows="4"
:disabled="true"
>
</el-input>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">状态</span>
<el-radio-group v-model="status">
<el-radio :label="1">授权</el-radio>
<el-radio :label="2">驳回</el-radio>
</el-radio-group>
</div>
<div style="margin-bottom: 10px">
<span style="width: 200px; display: inline-block; text-align: right">审批意见</span>
<el-input
style="width: 50%"
v-model="opinion"
type="textarea"
:rows="4"
placeholder="请输入审批意见"
>
</el-input>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogApproveFormVisible = false"> </el-button>
<el-button type="primary" @click="handleApprove()"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
statusData:[{id:0,value:'待授权'},{id:1,value:'已授权'},{id:2,value:'已驳回'}],
apiUrl: "",
titles: "",
tableDataLoading: false,
tableData: {},
userId: "",
avatar: "",
userName: "",
name: "",
phone: "",
remarks: "",
status: "",
opinion: "",
startTime: "",
endTime: "",
page: 1,
limit: 10,
dialogFormVisible: false,
dialogFormViewVisible: false,
dialogApproveFormVisible: false,
dialogUserListFormVisible: false,
userTableDataLoading: false,
userPage: 1,
userLimit: 10,
userTableData:{},
invitationCode: "",
};
},
methods: {
showDictValue(data, datas){
const dictItem = datas.find(item => data === item.id);
return dictItem ? dictItem.value : '';
},
// 获取服务包列表数据
handleSelect() {
this.tableDataLoading = true;
this.$http({
url: this.$http.adornUrl("commission/jjrApply/findPage"),
method: "get",
params: this.$http.adornParams({
page: this.page,
limit: this.limit,
name: this.name,
phone: this.phone,
status: this.status,
startTime: this.startTime,
endTime: this.endTime,
}),
}).then(({data}) => {
if (data.code == 0) {
this.tableData = data.data;
console.log(this.tableData);
} else {
this.$notify({
title: "提示",
duration: 1800,
message: data.msg,
type: "warning",
});
}
this.tableDataLoading = false;
});
},
// 重置
handleClear() {
this.name = "";
this.phone ="";
this.status = "";
this.startTime = "";
this.endTime = "";
this.page = 1;
this.handleSelect();
},
//分页
handleSizeChange(val) {
this.limit = val;
this.handleSelect();
},
//翻页
handleCurrentChange(val) {
this.page = val;
this.handleSelect();
},
handleApply(row) {
this.titles = "审批";
this.id = row.id;
this.userId = row.userId;
this.name = row.name;
this.phone = row.phone;
this.avatar = row.avatar;
this.userName = row.userName;
this.remarks = row.remarks;
this.status = 1;
this.dialogApproveFormVisible = true;
},
handleView(row){
this.titles = "查看";
this.id = row.id;
this.userId = row.userId;
this.name = row.name;
this.phone = row.phone;
this.avatar = row.avatar;
this.userName = row.userName;
this.remarks = row.remarks;
this.status = row.status;
this.opinion = row.opinion;
this.dialogFormViewVisible = true;
},
// 添加服务包
handleEdit(row) {
if (row != 0) {
this.titles = "修改";
this.id = row.id;
this.userId = row.userId;
this.name = row.name;
this.phone = row.phone;
this.avatar = row.avatar;
this.userName = row.userName;
this.remarks = row.remarks;
this.status = row.status;
this.opinion = row.opinion;
} else {
this.titles = "添加";
this.id = "";
this.userId = "";
this.name = "";
this.phone = "";
this.avatar = "";
this.userName = "";
this.remarks = "";
this.status = 0;
this.opinion = "";
}
this.dialogFormVisible = true;
},
closeFxy(){
this.handleClear();
},
// 提交添加、修改
handleSubmit() {
if (this.name == "") {
this.$notify({
title: "提示",
duration: 1800,
message: "请输入姓名",
type: "warning",
});
return;
}
if (this.phone == "") {
this.$notify({
title: "提示",
duration: 1800,
message: "请输入电话",
type: "warning",
});
return;
}
if (this.userId == "") {
this.$notify({
title: "提示",
duration: 1800,
message: "请选择用户",
type: "warning",
});
return;
}
if (this.status === "") {
this.$notify({
title: "提示",
duration: 1800,
message: "请选择状态",
type: "warning",
});
return;
}
if (this.titles == "添加") {
this.apiUrl = "commission/jjrApply/add";
} else {
this.apiUrl = "commission/jjrApply/update";
}
this.$http({
url: this.$http.adornUrl(this.apiUrl),
method: "post",
params: this.$http.adornParams({
id: this.id,
userId: this.userId,
name: this.name,
phone: this.phone,
remarks: this.remarks,
}),
}).then(({data}) => {
if (data.code == 0) {
this.dialogFormVisible = false;
this.clearDatas();
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.handleSelect();
},
});
} else {
this.$message({
message: data.msg,
type: "warning",
duration: 1500,
onClose: () => {
},
});
}
});
},
handleDelete(row){
this.$confirm(`确定删除此条信息?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
let id = row.id;
this.$http({
url: this.$http.adornUrl("commission/jjrApply/delete"),
method: "post",
params: this.$http.adornParams({
id: id
}),
}).then(({data}) => {
if (data.code == 0) {
this.clearDatas();
this.$message({
message: "删除成功",
type: "success",
duration: 1500,
onClose: () => {
this.handleSelect();
},
});
} else {
this.$message({
message: data.msg,
type: "warning",
duration: 1500,
onClose: () => {
},
});
}
});
}).catch(() => {});
},
//授权
handleApprove() {
if (this.status == "") {
this.$notify({
title: "提示",
duration: 1800,
message: "请选择审批状态",
type: "warning",
});
return;
}
if (this.status == '2') {
if (this.opinion == "") {
this.$notify({
title: "提示",
duration: 1800,
message: "请输入审批意见",
type: "warning",
});
return;
}
}
this.$http({
url: this.$http.adornUrl("commission/jjrApply/approve"),
method: "post",
params: this.$http.adornParams({
id: this.id,
opinion: this.opinion,
2024-08-08 16:05:57 +08:00
status: 1,
userId: this.userId,
2024-08-05 10:22:21 +08:00
}),
}).then(({data}) => {
if (data.code == 0) {
this.dialogApproveFormVisible = false;
this.clearDatas();
this.$message({
message: "审核成功",
type: "success",
duration: 1500,
onClose: () => {
this.handleSelect();
},
});
} else {
this.$message({
message: data.msg,
type: "warning",
duration: 1500,
onClose: () => {
},
});
}
});
},
//取消授权
handleCancelApply(row){
let id = row.id;
this.$http({
url: this.$http.adornUrl("commission/jjrApply/approve"),
method: "post",
params: this.$http.adornParams({
id: id,
opinion: '系统取消授权',
status: 0,
2024-08-08 16:05:57 +08:00
userId: this.userId,
2024-08-05 10:22:21 +08:00
}),
}).then(({data}) => {
if (data.code == 0) {
this.clearDatas();
this.$message({
message: "取消成功",
type: "success",
duration: 1500,
onClose: () => {
this.handleSelect();
},
});
} else {
this.$message({
message: data.msg,
type: "warning",
duration: 1500,
onClose: () => {
},
});
}
});
},
clearDatas(){
this.apiUrl="";
this.tableDataLoading= false;
this.id= "";
this.name= "";
this.phone= "";
this.status= "";
this.startTime= "";
this.endTime= "";
this.page= 1;
this.limit= 10;
this.dialogFormVisible= false;
this.dialogApproveFormVisible= false;
},
closeDetail(){
this.handleSelect();
},
showUsersView(){
this.handleSelectUsers();
this.dialogUserListFormVisible = true;
},
handleSelectUsers(){
this.userTableDataLoading = true;
this.$http({
url: this.$http.adornUrl("commission/jjrApply/findUserPage"),
method: "get",
params: this.$http.adornParams({
userPage: this.userPage,
userLimit: this.userLimit,
2024-08-06 22:53:35 +08:00
userName: this.userName,
phone: this.phone,
invitationCode: this.invitationCode,
2024-08-05 10:22:21 +08:00
}),
}).then(({data}) => {
if (data.code == 0) {
this.userTableData = data.data;
} else {
this.$notify({
title: "提示",
duration: 1800,
message: data.msg,
type: "warning",
});
}
this.userTableDataLoading = false;
});
},
//分页
handleUserSizeChange(val) {
this.userLimit = val;
this.handleSelectUsers();
},
//翻页
handleUserCurrentChange(val) {
this.userPage = val;
this.handleSelectUsers();
},
// 重置
handleClearUsers() {
this.userName = "";
this.phone = "";
this.invitationCode = "";
this.userPage = 1;
this.userLimit = 10;
this.handleSelectUsers();
},
handleAddUser(row){
this.userId = row.userId;
this.avatar = row.avatar;
this.userName = row.userName;
this.dialogUserListFormVisible = false;
},
},
mounted() {
this.handleSelect();
},
};
</script>
<style>
.customWidth {
width: 80% !important;
}
.el-dialog--center {
text-align: center;
margin-top: 1vh !important;
}
.el-tooltip__popper {
width: 200px;
padding: 10px;
color: #000 !important;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.4);
background-color: #fff !important;
}
.adver_main.box a {
display: flex;
justify-content: center;
height: 150px;
line-height: 150px;
text-decoration: none;
}
.bannerManin span {
display: inline-block;
margin-left: 5px;
}
.bannerManin img {
width: 48px;
height: 48px;
border-radius: 50%;
}
.bannerbtn a {
flex: 1;
text-align: center;
color: #3e8ef7 !important;
text-decoration: none;
}
.imgs {
position: relative;
border-radius: 6px;
width: 148px;
height: 148px;
margin-right: 10px;
display: inline-block;
}
.dels {
position: absolute;
top: 0;
left: 0;
display: none;
}
.dels .el-icon-delete {
line-height: 148px;
padding-left: 58px;
font-size: 25px;
color: #fff;
}
.imgs:hover .dels {
width: 100%;
height: 100%;
background: #000;
display: block;
opacity: 0.5;
}
.bqList {
padding: 4px 14px;
margin: 4px;
border: 1px solid #efefef;
font-size: 12px;
color: #999;
border-radius: 4px;
margin-right: 15px;
}
.delss {
display: none;
position: relative;
}
.delss .el-icon-delete {
position: absolute;
top: 0;
}
.bqList:hover .delss {
display: initial;
opacity: 0.5;
}
.tj {
padding: 6px !important;
margin: 4px;
font-size: 12px;
border: 1px solid #ccc;
border-radius: 4px;
}
</style>