You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dandelionPlatformToB-uni-v3/root/merchantManagement/addOrUpdataMember.vue

315 lines
7.2 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<div class="team-manage-container g_bg_page">
<div class="g_h_10"></div>
<g-panel-form-slot
:deptList="deptList"
:list="[
{
icon: '',
label: '姓名',
result: '',
value: memberInfo.aliasName,
path: '',
placeholder: '请输入成员姓名',
tip: 'slot-name',
type: 'slot',
pColumn: 8,
require: true,
},
{
icon: '',
label: '手机号',
result: '',
value: memberInfo.tel,
path: '',
tip: 'slot-mobile',
placeholder: '请输入成员手机号',
type: 'slot',
pColumn: 8,
require: true,
disabled: memberInfo.agencyRoleName && memberInfo.agencyRoleName.indexOf('创建人') > -1,
},
{
icon: '',
label: '角色',
result: '',
value: memberInfo.agencyRoleName,
roleIds: memberInfo.agencyRoleIdList,
roleNames: memberInfo.agencyRoleNameList,
path: '',
placeholder: '请选择角色',
tip: 'slot-agencyRole',
type: 'slot',
pColumn: 15,
require: true,
},
{
icon: '',
label: '部门',
result: '',
value: memberInfo.agencyTeamName,
deptIds: memberInfo.agencyTeamIdList,
deptNames: memberInfo.agencyTeamNameList,
path: '',
placeholder: '请选择部门',
tip: 'slot-agencyTeam',
type: 'slot',
pColumn: 15,
require: false,
},
{
icon: '',
label: '职位',
result: '',
value: memberInfo.title,
path: '',
placeholder: '请输入职位',
tip: 'slot-title',
type: 'slot',
pColumn: 8,
require: false,
},
]"
:roleList="roleList"
@changeName="changeName"
@changeMobile="changeMobile"
@changeTitle="changeTitle"
@changeAgencyTeam="changeAgencyTeam"
@changeAgencyRole="changeAgencyRole"
></g-panel-form-slot>
<div class="g_text_c g_mt_90">
<rh-button btnText="确定" type="primary" class="" @clickBtn="subMemberInfo"></rh-button>
<div class="g_c_sub g_mt_16" v-if="memberInfo.agencyRoleName && memberInfo.agencyRoleName.indexOf('创建人') == -1" @click="delMember">删除成员</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
memberInfo: {},
deptList: [],
roleList: [],
};
},
onShow() {},
onLoad(options) {
console.log("this.memberInfo", this.memberInfo);
console.log("this.memberInfo", options);
if (options.info) {
console.log("options.info", options.info);
this.memberInfo = JSON.parse(options.info);
this.initMemberDept();
uni.setNavigationBarTitle({
title: "修改成员信息",
});
} else {
uni.setNavigationBarTitle({
title: "添加成员",
});
}
this.getDeptList();
this.getRoleList();
},
created() {
console.log(123123);
},
methods: {
getDeptList() {
let that = this;
this.G.Post('/yishoudan/agency/team/list', {}, (res) => {
that.deptList = res.list || [];
});
},
initMemberDept() {
let info = this.memberInfo;
if (info.agencyTeamIds) {
info.agencyTeamIdList = info.agencyTeamIds.split(",").map((id) => Number(id));
} else {
info.agencyTeamIdList = [];
}
if (info.agencyTeamName) {
info.agencyTeamNameList = info.agencyTeamName.split("");
} else {
info.agencyTeamNameList = [];
}
if (info.agencyRoleIds) {
info.agencyRoleIdList = info.agencyRoleIds.split(",").map((id) => Number(id));
} else {
info.agencyRoleIdList = [];
}
if (info.agencyRoleName) {
info.agencyRoleNameList = info.agencyRoleName.split("");
} else {
info.agencyRoleNameList = [];
}
},
getRoleList() {
let that = this;
this.G.Get('/yishoudan/agency/role/list', {}, (res) => {
that.roleList = res.list || [];
});
},
getMemberList() {
let that = this;
this.G.Get(this.api.order_peopleList, {}, (res) => {
console.log("报名人列表:", res);
that.memberList = res.recordList;
});
},
addMember() {
this.addMemberShow = true;
},
subMemberInfo() {
let that = this;
if (this.memberInfo.aliasName == "") {
uni.showToast({
title: "请输入成员姓名",
icon: "none",
});
return false;
}
if (this.memberInfo.tel == "") {
uni.showToast({
title: "请输入成员手机号",
icon: "none",
});
return false;
}
let exp = /^1[3-9]\d{9}$/;
console.log("that.memberInfo. tel", that.memberInfo.tel);
console.log("exp.test(that.memberInfo.tel)", exp.test(that.memberInfo.tel));
if (!exp.test(that.memberInfo.tel)) {
uni.showToast({
title: "请输入正确的手机号",
icon: "none",
});
return false;
}
if (!this.memberInfo.agencyRoleIds) {
uni.showToast({
title: "请选择角色",
icon: "none",
});
return false;
}
let url = "order_addMember";
if (this.memberInfo.id) {
// 判断是否是编辑成员
url = "order_updateMember";
}
this.G.Post(this.api[url], this.memberInfo, (res) => {
console.log("resresresres", res);
uni.showToast({
title: "提交成功",
});
setTimeout(() => {
uni.navigateBack({
detail: 1,
});
}, 1500);
});
},
delMember() {
let that = this;
this.G.handleConfirm({
title: "删除",
content: "确定要删除该成员吗?",
success: (res) => {
if (res.confirm) {
that.G.Post(that.api.order_checkMemberDel, { id: that.memberInfo.id }, (checkRes) => {
console.log('checkRes1', checkRes);
if (checkRes) {
console.log('checkRes2', checkRes);
uni.showModal({
title: "确认删除吗?",
content: checkRes,
success: (res1) => {
if (res1.confirm) {
that.subDel();
}
},
});
} else {
console.log('checkRes3', checkRes);
that.subDel();
}
}, (err) => {
console.log('err2', err);
});
}
},
});
},
subDel() {
let that = this;
that.G.Post(that.api.order_delMember, { id: that.memberInfo.id }, (res) => {
console.log(res);
uni.showToast({
title: "删除成功",
});
setTimeout(() => {
uni.navigateBack({
detail: 1,
});
}, 1500);
}, (err) => {
console.log('err', err);
});
},
changeName(e) {
console.log("e", e);
this.memberInfo.aliasName = e;
},
changeMobile(e) {
console.log("e", e);
this.memberInfo.tel = e;
},
changeTitle(e) {
console.log("e", e);
this.memberInfo.title = e;
},
changeAgencyTeam(res) {
console.log("res", res);
this.memberInfo.agencyTeamIds = res.ids;
this.memberInfo.agencyTeamName = res.names;
this.memberInfo.agencyTeamIdList = res.idList;
this.memberInfo.agencyTeamNameList = res.nameList;
},
changeAgencyRole(res) {
console.log("roleRes", res);
this.memberInfo.agencyRoleIds = res.ids;
this.memberInfo.agencyRoleName = res.names;
this.memberInfo.agencyRoleIdList = res.idList;
this.memberInfo.agencyRoleNameList = res.nameList;
},
},
};
</script>
<style lang="scss">
.creator {
color: #46c7bb;
border: 1px solid #46c7bb;
background-color: #46c7ba3d;
}
.member {
color: #f9676e;
border: 1px solid #f9676e;
background-color: #f9676e3d;
}
.manager {
color: #0066d6;
border: 1px solid #0066d6;
background-color: #0066d63d;
}
.sticky {
position: sticky;
bottom: 0;
left: 0;
z-index: 999;
}
</style>