diff --git a/src/views/Customer/AgentManagement.vue b/src/views/Customer/AgentManagement.vue index 4c0fd79..6e28f4e 100644 --- a/src/views/Customer/AgentManagement.vue +++ b/src/views/Customer/AgentManagement.vue @@ -1,26 +1,32 @@ @@ -412,8 +553,7 @@ import { mapGetters } from "vuex"; import { getAreaList } from "@/api/modules/api"; export default { data() { - - var validatePass1 = (rule, value, callback) => { + var validatePass1 = (rule, value, callback) => { if (value === "") { // callback(new Error("请输入手机号")); callback(); @@ -427,69 +567,69 @@ export default { callback(); } }; - var validatePass = (rule, value, callback) => { + var validatePass = (rule, value, callback) => { if (value === "") { callback(new Error("请输入管理员账号")); } else { if (value) { - this.passFlag=false + this.passFlag = false; if (!/^1[3456789]\d{9}$/.test(value)) { // alert("手机号码不合法,请重新输入"); callback(new Error("手机号格式错误,请重新输入")); - }else{ - // 验证电话号码 - this.$api.api.verPhone(value).then((res) => { - // console.log(res); - // 判断数据是否已经有了 - if (res.data) { - // 由用户 - this.$api.api.userVerify({ - // orgType:localStorage.getItem('orgType'), - orgType:1, - accountId:res.data.sysUser.accountId, - username:res.data.sysUser.username, - agentId:localStorage.getItem('agentId'), - orgCode:localStorage.getItem('orgCode'), - }) - .then(res1=>{ - - this.resetFlag=true - this.passFlag=true - if(this.dialogVisible3){ - this.replaceagentobj.managerPassword=res.data.sysUser.resultPwd - }else{ - this.addagentobj.managerPassword=res.data.sysUser.resultPwd + } else { + // 验证电话号码 + this.$api.api.verPhone(value).then((res) => { + // console.log(res); + // 判断数据是否已经有了 + if (res.data) { + // 由用户 + this.$api.api + .userVerify({ + // orgType:localStorage.getItem('orgType'), + orgType: 1, + accountId: res.data.sysUser.accountId, + username: res.data.sysUser.username, + agentId: localStorage.getItem("agentId"), + orgCode: localStorage.getItem("orgCode"), + }) + .then((res1) => { + this.resetFlag = true; + this.passFlag = true; + if (this.dialogVisible3) { + this.replaceagentobj.managerPassword = + res.data.sysUser.resultPwd; + } else { + this.addagentobj.managerPassword = + res.data.sysUser.resultPwd; + } + callback(); + }) + .catch((err) => { + console.log(err); + this.resetFlag = false; + callback(new Error(err)); + }); + } else { + // 没有用户 + // console.log("没有用户"); + // callback(new Error("没有管理员账号")); + if (this.dialogVisible3) { + this.replaceagentobj.managerPassword = ""; + } else { + this.addagentobj.managerPassword = ""; } + this.resetFlag = true; + this.passFlag = false; callback(); - }) - .catch(err=>{ - console.log(err) - this.resetFlag=false - callback(new Error(err)); - }) - } else { - // 没有用户 - // console.log("没有用户"); - // callback(new Error("没有管理员账号")); - if(this.dialogVisible3){ - this.replaceagentobj.managerPassword='' - }else{ - this.addagentobj.managerPassword='' - } - this.resetFlag=true - this.passFlag=false - callback(); - - } - }); + } + }); } - } callback(); } }; return { - props: { + props: { lazy: true, async lazyLoad(node, resolve) { console.log(node, 123); @@ -521,7 +661,7 @@ export default { props1: { lazy: true, checkStrictly: true, - expandTrigger:'hover', + expandTrigger: "hover", async lazyLoad(node, resolve) { // console.log(node, 123); const { level } = node; @@ -546,12 +686,12 @@ export default { }; }); resolve(nodes); - }else{ - resolve() + } else { + resolve(); } }, }, - area:[], + area: [], options: [ { value: "0", @@ -562,153 +702,157 @@ export default { label: "已过期", }, ], - passFlag:false, - dialogVisible:false, - dialogVisible2:false, - resetFlag:false, - dialogVisible3:false, - operaVisible:false, - loadingFlag:false, - provinceId:'', - cityId:'', - areaList:[], - operaList:[], - operationalId:'', - timelist:'', + passFlag: false, + dialogVisible: false, + dialogVisible2: false, + resetFlag: false, + dialogVisible3: false, + operaVisible: false, + loadingFlag: false, + provinceId: "", + cityId: "", + areaList: [], + operaList: [], + operationalId: "", + timelist: "", tableData: [], - addressOptions: [], - currentPage4:1, - total:0,//总条数 - pageNum:1, - pageSize:10, - contractStartDate:'',//开始时间 - contractEndDate:'',//结束时间 - serviceStatus:'',//状态 - agentName:'',//代理商名称 - operationalName:'',//运营人员姓名 - addagentobj:{ - agentName:'',// 代理商名称 - contractStartDate:'',// 合同开始时间 - contractEndDate:'',// 合同结束时间 - linkman:'',// 联系人 - provinceId:'',// 省id - area:[], - cityId:'',// 市id - address:'',// 详细地址 + addressOptions: [], + currentPage4: 1, + total: 0, //总条数 + pageNum: 1, + pageSize: 10, + contractStartDate: "", //开始时间 + contractEndDate: "", //结束时间 + serviceStatus: "", //状态 + agentName: "", //代理商名称 + operationalName: "", //运营人员姓名 + addagentobj: { + agentName: "", // 代理商名称 + contractStartDate: "", // 合同开始时间 + contractEndDate: "", // 合同结束时间 + linkman: "", // 联系人 + provinceId: "", // 省id + area: [], + cityId: "", // 市id + address: "", // 详细地址 // operationalPeople:'',// 运营人员id - managerPhone:'',// 管理员账号 - managerPassword:'',// 管理员账号密码 - linkmanPhone:'',// 联系人手机号 - rulestimelist:[] + managerPhone: "", // 管理员账号 + managerPassword: "", // 管理员账号密码 + linkmanPhone: "", // 联系人手机号 + rulestimelist: [], }, - editoragentobj:{ - id:'', - agentName:'',// 代理商名称 - contractStartDate:'',// 合同开始时间 - contractEndDate:'',// 合同结束时间 - linkman:'',// 联系人 - provinceId:'',// 省id - cityId:'',// 市id - address:'',// 详细地址 + editoragentobj: { + id: "", + agentName: "", // 代理商名称 + contractStartDate: "", // 合同开始时间 + contractEndDate: "", // 合同结束时间 + linkman: "", // 联系人 + provinceId: "", // 省id + cityId: "", // 市id + address: "", // 详细地址 // operationalPeople:'',// 运营人员id - linkmanPhone:'',// 联系人手机号 - rulestimelist:[], - + linkmanPhone: "", // 联系人手机号 + rulestimelist: [], }, - rules:{ - agentName: [ - { required: true, message: '请输入代理商名称', trigger: 'blur' }, - ], + rules: { + agentName: [ + { required: true, message: "请输入代理商名称", trigger: "blur" }, + ], rulestimelist: [ - { required: true, message: '请选择时间', trigger: 'blur' }, - ], - linkman: [ - // { required: true, message: '请输入联系人名称', trigger: 'blur' }, - ], - provinceId: [ - { required: false, message: '请输入选择省', trigger: 'blur' }, - ], - cityId: [ - { required: false, message: '请输入选择市', trigger: 'blur' }, - ], - address: [ - // { required: true, message: '请输入详细地址', trigger: 'blur' }, - ], - // operationalPeople: [ - // { required: true, message: '请选择运营人员', trigger: 'blur' }, - // ], - managerPhone: [ - { required: true, message: '请输入管理员账号', trigger: 'blur' }, - { validator: validatePass, trigger: "blur" }, - ], - managerPassword: [ - { required: true, message: "请填写密码", trigger: "blur" }, - { min: 6, max: 18, message: '请输入6~18位,数字或字母组合的密码', trigger: 'blur' } - ], - linkmanPhone: [ - // { required: true, message: '请输入联系人手机号', trigger: 'blur' }, - // { min: 11, max: 11, message: '请输入手机号', trigger: 'blur' } - { validator: validatePass1, trigger: "blur" } - ], + { required: true, message: "请选择时间", trigger: "blur" }, + ], + linkman: [ + // { required: true, message: '请输入联系人名称', trigger: 'blur' }, + ], + provinceId: [ + { required: false, message: "请输入选择省", trigger: "blur" }, + ], + cityId: [{ required: false, message: "请输入选择市", trigger: "blur" }], + address: [ + // { required: true, message: '请输入详细地址', trigger: 'blur' }, + ], + // operationalPeople: [ + // { required: true, message: '请选择运营人员', trigger: 'blur' }, + // ], + managerPhone: [ + { required: true, message: "请输入管理员账号", trigger: "blur" }, + { validator: validatePass, trigger: "blur" }, + ], + managerPassword: [ + { required: true, message: "请填写密码", trigger: "blur" }, + { + min: 6, + max: 18, + message: "请输入6~18位,数字或字母组合的密码", + trigger: "blur", + }, + ], + linkmanPhone: [ + // { required: true, message: '请输入联系人手机号', trigger: 'blur' }, + // { min: 11, max: 11, message: '请输入手机号', trigger: 'blur' } + { validator: validatePass1, trigger: "blur" }, + ], }, - editorrules:{ - agentName: [ - { required: true, message: '请输入代理商名称', trigger: 'blur' }, - ], + editorrules: { + agentName: [ + { required: true, message: "请输入代理商名称", trigger: "blur" }, + ], rulestimelist: [ - { required: true, message: '请选择时间', trigger: 'blur' }, - ], - linkman: [ - // { required: true, message: '请输入联系人名称', trigger: 'blur' }, - ], - provinceId: [ - { required: false, message: '请输入选择省', trigger: 'blur' }, - ], - cityId: [ - { required: false, message: '请输入选择市', trigger: 'blur' }, - ], - address: [ - { required: false, message: '请输入详细地址', trigger: 'blur' }, - ], - // operationalPeople: [ - // { required: true, message: '请选择运营人员', trigger: 'blur' }, - // ], - linkmanPhone: [ - // { required: true, message: '请输入联系人手机号', trigger: 'blur' }, - // { min: 11, max: 11, message: '请输入手机号', trigger: 'blur' } - { validator: validatePass1, trigger: "blur" } - ], + { required: true, message: "请选择时间", trigger: "blur" }, + ], + linkman: [ + // { required: true, message: '请输入联系人名称', trigger: 'blur' }, + ], + provinceId: [ + { required: false, message: "请输入选择省", trigger: "blur" }, + ], + cityId: [{ required: false, message: "请输入选择市", trigger: "blur" }], + address: [ + { required: false, message: "请输入详细地址", trigger: "blur" }, + ], + // operationalPeople: [ + // { required: true, message: '请选择运营人员', trigger: 'blur' }, + // ], + linkmanPhone: [ + // { required: true, message: '请输入联系人手机号', trigger: 'blur' }, + // { min: 11, max: 11, message: '请输入手机号', trigger: 'blur' } + { validator: validatePass1, trigger: "blur" }, + ], }, - operaForm:{ - operationalPeople:'' + operaForm: { + operationalPeople: "", }, - operaRules:{ - operationalPeople: [ - { required: false, message: '请选择运营人员', trigger: 'blur' }, - ], + operaRules: { + operationalPeople: [ + { required: false, message: "请选择运营人员", trigger: "blur" }, + ], }, - optionsparentId:[],//省份列表 - optionscityId:[],//市列表 - optionsoperationalPeople:[],//运营人员列表 - replaceagentobj:{ - id:'', - managerPhone:'', - managerPassword:'' + optionsparentId: [], //省份列表 + optionscityId: [], //市列表 + optionsoperationalPeople: [], //运营人员列表 + replaceagentobj: { + id: "", + managerPhone: "", + managerPassword: "", }, - ruleser:{ - managerPhone: [ - { required: true, message: '请输入管理员账号', trigger: 'blur' }, - { validator: validatePass, trigger: "blur" }, - ], + ruleser: { + managerPhone: [ + { required: true, message: "请输入管理员账号", trigger: "blur" }, + { validator: validatePass, trigger: "blur" }, + ], managerPassword: [ { required: true, message: "请填写密码", trigger: "change" }, - { min: 6, max: 18, message: '请输入6~18位,数字或字母组合的密码', trigger: 'blur' } + { + min: 6, + max: 18, + message: "请输入6~18位,数字或字母组合的密码", + trigger: "blur", + }, ], }, - }; }, - computed: { + computed: { ...mapGetters(["permissions"]), }, created() { @@ -720,24 +864,24 @@ export default { this.cus_ag_open = this.permissions["cus_ag_open"]; }, mounted() { - if(this.$route.query.serviceStatus){ - this.timelist=this.$route.query.residueTime; - this.contractStartDate=this.timelist[0]; - this.contractEndDate=this.timelist[1]; - this.serviceStatus=this.$route.query.serviceStatus; - } - // 获取运营人员 - this.getOperaList() - // 获取地区列表 + if (this.$route.query.serviceStatus) { + this.timelist = this.$route.query.residueTime; + this.contractStartDate = this.timelist[0]; + this.contractEndDate = this.timelist[1]; + this.serviceStatus = this.$route.query.serviceStatus; + } + // 获取运营人员 + this.getOperaList(); + // 获取地区列表 // this.getCityList() - this.getAgentList() + this.getAgentList(); }, methods: { - getOperaList(){ + getOperaList() { if (this.orgType == 1) { this.$api.http .getAllOperationsStaffByAgent({ - agentId: localStorage.getItem('agentId'), + agentId: localStorage.getItem("agentId"), }) .then((res) => { // console.log(1); @@ -752,381 +896,425 @@ export default { }); } }, - getCityList(){ - this.$api.api.getAreaList({parentId:0}) - .then(res=>{ + getCityList() { + this.$api.api.getAreaList({ parentId: 0 }).then((res) => { // console.log(res,'地区列表'); - this.areaList=res.data - }) + this.areaList = res.data; + }); }, - saveOpera(){ - this.$refs.operaForm.validate(valid=>{ - if(valid){ + saveOpera() { + this.$refs.operaForm.validate((valid) => { + if (valid) { // console.log(valid,this.operaForm); - this.loadingFlag=true - this.$api.api.zkoperationrecord({ - orgType:1, - accountIds:this.operaForm.operationalPeople.join(','), - orgId: this.operaForm.orgId, - operationType:1 - }) - .then(res=>{ - console.log(res); + this.loadingFlag = true; + this.$api.api + .zkoperationrecord({ + orgType: 1, + accountIds: this.operaForm.operationalPeople.join(","), + orgId: this.operaForm.orgId, + operationType: 1, + }) + .then((res) => { + console.log(res); setTimeout(() => { - this.loadingFlag=false - console.log('防重') - }, 1); - this.$message.success('操作成功') - this.getAgentList() - this.operaVisible=false - }) + this.loadingFlag = false; + console.log("防重"); + }, 1); + this.$message.success("操作成功"); + this.getAgentList(); + this.operaVisible = false; + }) + .catch((err) => { + this.loadingFlag = false; + }); } - }) + }); }, - editOpera(row){ + editOpera(row) { console.log(row); // 获取运营人员列表 - this.operaForm.orgId=row.id - this.getAllOperationsStaff() + this.operaForm.orgId = row.id; + this.getAllOperationsStaff(); - this.zkoperationrecordFindByOrg(row.id) + this.zkoperationrecordFindByOrg(row.id); }, - zkoperationrecordFindByOrg(orgId){ - this.$api.api.zkoperationrecordFindByOrg({ - orgType:'1', - orgId, - operationType:1 - }) - .then(res=>{ - // console.log(res); - if(res.data.length==0){ - // 没有运营人员 - this.operaForm.operationalPeople=[] - }else{ - let arr=[] - // 有运营 - res.data.map(item=>{ - arr.push(item.accountId) - }) - this.operaForm.operationalPeople=arr - } - this.operaVisible=true - }) + zkoperationrecordFindByOrg(orgId) { + this.$api.api + .zkoperationrecordFindByOrg({ + orgType: "1", + orgId, + operationType: 1, + }) + .then((res) => { + // console.log(res); + if (res.data.length == 0) { + // 没有运营人员 + this.operaForm.operationalPeople = []; + } else { + let arr = []; + // 有运营 + res.data.map((item) => { + arr.push(item.accountId); + }); + this.operaForm.operationalPeople = arr; + } + this.operaVisible = true; + }); }, - confirmtime3(){ - this.editoragentobj.contractStartDate=this.editoragentobj.rulestimelist[0]; - this.editoragentobj.contractEndDate=this.editoragentobj.rulestimelist[1]; + confirmtime3() { + this.editoragentobj.contractStartDate = + this.editoragentobj.rulestimelist[0]; + this.editoragentobj.contractEndDate = + this.editoragentobj.rulestimelist[1]; }, //编辑 - infoeditor(row){ - this.resetFlag=true - this.getparentIdList() - this.clickprovinceId2(row.provinceId) - this.getAllOperationsStaff() + infoeditor(row) { + this.resetFlag = true; + this.getparentIdList(); + this.clickprovinceId2(row.provinceId); + this.getAllOperationsStaff(); - this.editoragentobj.agentName=row.agentName;// 代理商名称 - this.editoragentobj.contractStartDate=row.contractStartDate;// 合同开始时间 - this.editoragentobj.contractEndDate=row.contractEndDate;// 合同结束时间 - this.editoragentobj. linkman=row.linkman;// 联系人 - this.editoragentobj. provinceId=row.provinceId;// 省id - this.editoragentobj.cityId=row.cityId;// 市id - this.editoragentobj.address=row.address;// 详细地址 - // this.editoragentobj. operationalPeople=row.operationalPeople;// 运营人员id - this.editoragentobj.linkmanPhone=row.linkmanPhone;// 联系人手机号 - this.editoragentobj.rulestimelist=[row.contractStartDate,row.contractEndDate]; - this.editoragentobj.id=row.id; - this.editoragentobj.area = [this.editoragentobj.provinceId, this.editoragentobj.cityId]; - this.dialogVisible2=true; + this.editoragentobj.agentName = row.agentName; // 代理商名称 + this.editoragentobj.contractStartDate = row.contractStartDate; // 合同开始时间 + this.editoragentobj.contractEndDate = row.contractEndDate; // 合同结束时间 + this.editoragentobj.linkman = row.linkman; // 联系人 + this.editoragentobj.provinceId = row.provinceId; // 省id + this.editoragentobj.cityId = row.cityId; // 市id + this.editoragentobj.address = row.address; // 详细地址 + // this.editoragentobj. operationalPeople=row.operationalPeople;// 运营人员id + this.editoragentobj.linkmanPhone = row.linkmanPhone; // 联系人手机号 + this.editoragentobj.rulestimelist = [ + row.contractStartDate, + row.contractEndDate, + ]; + this.editoragentobj.id = row.id; + this.editoragentobj.area = [ + this.editoragentobj.provinceId, + this.editoragentobj.cityId, + ]; + this.dialogVisible2 = true; }, - //获取市 - clickprovinceId2(item){ - this.$api.http.getparentIdList({ - parentId: item - }).then((res) => { - this.optionscityId= res.data + //获取市 + clickprovinceId2(item) { + this.$api.http + .getparentIdList({ + parentId: item, + }) + .then((res) => { + this.optionscityId = res.data; }); }, - //选择省的时候请求市并清空市 - clickprovinceId3(){ - this.optionscityId=[]; - this.editoragentobj.cityId=''; - this.$api.http.getparentIdList({ - parentId: this.editoragentobj.provinceId - }).then((res) => { - this.optionscityId= res.data + //选择省的时候请求市并清空市 + clickprovinceId3() { + this.optionscityId = []; + this.editoragentobj.cityId = ""; + this.$api.http + .getparentIdList({ + parentId: this.editoragentobj.provinceId, + }) + .then((res) => { + this.optionscityId = res.data; }); }, - reset1(){ + reset1() { this.$refs.addagentobj.resetFields(); - this.editoragentobj.area=[] + this.editoragentobj.area = []; }, - reset2(){ + reset2() { this.$refs.editoragentobj.resetFields(); - this.editoragentobj.area=[] + this.editoragentobj.area = []; }, //确认编辑 - editor(){ - // if(!this.resetFlag){ - // this.$message.error('平台用户与楼盘用户不能重复添加!') - // return - // } - this.$refs.editoragentobj.validate((valid) => { - if (valid) { - if(!this.resetFlag){ - return + editor() { + // if(!this.resetFlag){ + // this.$message.error('平台用户与楼盘用户不能重复添加!') + // return + // } + this.$refs.editoragentobj.validate((valid) => { + if (valid) { + if (!this.resetFlag) { + return; } - this.loadingFlag=true - this.$api.http.editorAgent(this.editoragentobj).then((res) => { - if(res.code==0){ - this.dialogVisible2=false; - setTimeout(() => { - this.loadingFlag=false - console.log('防重') + this.loadingFlag = true; + this.$api.http + .editorAgent(this.editoragentobj) + .then((res) => { + if (res.code == 0) { + this.dialogVisible2 = false; + setTimeout(() => { + this.loadingFlag = false; + console.log("防重"); }, 1); - this.editoragentobj.contractStartDate=''; - this.editoragentobj.contractEndDate=''; - this.editoragentobj.id=''; - this.$refs.editoragentobj.resetFields(); - this.Screeningofempty() - this.getAgentList() - }else{ - this.$message.error(res.message); - } - }); - } else { - return false; - } - }); + this.editoragentobj.contractStartDate = ""; + this.editoragentobj.contractEndDate = ""; + this.editoragentobj.id = ""; + this.$refs.editoragentobj.resetFields(); + this.Screeningofempty(); + this.getAgentList(); + } else { + this.$message.error(res.message); + } + }) + .catch((err) => { + this.loadingFlag = false; + }); + } else { + return false; + } + }); }, - //获取系统运营人员 - getAllOperationsStaff(){ - this.optionsoperationalPeople=[]; - this.$api.http.getAllOperationsStaff().then((res) => { - this.optionsoperationalPeople= res.data - }); + //获取系统运营人员 + getAllOperationsStaff() { + this.optionsoperationalPeople = []; + this.$api.http.getAllOperationsStaff().then((res) => { + this.optionsoperationalPeople = res.data; + }); }, //选择省的时候请求市并清空市 - clickprovinceId(){ - this.optionscityId=[]; - this.addagentobj.cityId=''; - this.$api.http.getparentIdList({ - parentId: this.addagentobj.provinceId - }).then((res) => { - this.optionscityId= res.data + clickprovinceId() { + this.optionscityId = []; + this.addagentobj.cityId = ""; + this.$api.http + .getparentIdList({ + parentId: this.addagentobj.provinceId, + }) + .then((res) => { + this.optionscityId = res.data; }); }, //获取省 - getparentIdList(){ - this.optionsparentId=[]; - this.$api.http.getparentIdList({ - parentId: 0 - }).then((res) => { - this.optionsparentId= res.data + getparentIdList() { + this.optionsparentId = []; + this.$api.http + .getparentIdList({ + parentId: 0, + }) + .then((res) => { + this.optionsparentId = res.data; }); }, - - //更换 - inforeplace(row){ - this.replaceagentobj.id=row.id; - this.dialogVisible3=true; - this.passFlag=false + inforeplace(row) { + this.replaceagentobj.id = row.id; + this.dialogVisible3 = true; + this.passFlag = false; }, - replaceClose(){ - this.replaceagentobj.managerPhone='' - this.replaceagentobj.managerPassword='' - this.$refs.replaceagentobj.resetFields(); + replaceClose() { + this.replaceagentobj.managerPhone = ""; + this.replaceagentobj.managerPassword = ""; + this.$refs.replaceagentobj.resetFields(); }, //确认更换 - replace(){ - if(!this.resetFlag){ - this.$message.error('平台用户与楼盘用户不能重复添加!') - return + replace() { + if (!this.resetFlag) { + this.$message.error("平台用户与楼盘用户不能重复添加!"); + return; + } + this.$refs.replaceagentobj.validate((valid) => { + if (valid) { + this.loadingFlag = true; + this.$api.http + .updateManagerPhone(this.replaceagentobj) + .then((res) => { + if (res.code == 0) { + this.dialogVisible3 = false; + setTimeout(() => { + this.loadingFlag = false; + console.log("防重"); + }, 1); + this.$refs.replaceagentobj.resetFields(); + this.Screeningofempty(); + this.getAgentList(); + } else { + this.$message.error(res.message); + } + }) + .catch((err) => { + this.loadingFlag = false; + }); + } else { + return false; } - this.$refs.replaceagentobj.validate((valid) => { - if (valid) { - this.loadingFlag=true - this.$api.http.updateManagerPhone(this.replaceagentobj).then((res) => { - if(res.code==0){ - this.dialogVisible3=false; - setTimeout(() => { - this.loadingFlag=false - console.log('防重') - }, 1); - this.$refs.replaceagentobj.resetFields(); - this.Screeningofempty() - this.getAgentList() - }else{ - this.$message.error(res.message); - } - }); - } else { - return false; - } - }); + }); }, - //新增 - infoadd(){ - this.dialogVisible=true; - this.passFlag=false - this.getparentIdList() - this.getAllOperationsStaff() + //新增 + infoadd() { + this.dialogVisible = true; + this.passFlag = false; + this.getparentIdList(); + this.getAllOperationsStaff(); }, //新增时间选择 - confirmtime2(){ - this.addagentobj.contractStartDate=this.addagentobj.rulestimelist[0]; - this.addagentobj.contractEndDate=this.addagentobj.rulestimelist[1]; + confirmtime2() { + this.addagentobj.contractStartDate = this.addagentobj.rulestimelist[0]; + this.addagentobj.contractEndDate = this.addagentobj.rulestimelist[1]; }, //确认新增 - add(){ - // if(!this.resetFlag){ - // this.$message.error('平台用户与楼盘用户不能重复添加!') - // return - // } - this.$refs.addagentobj.validate((valid) => { - if (valid) { - if(!this.resetFlag){ - return + add() { + // if(!this.resetFlag){ + // this.$message.error('平台用户与楼盘用户不能重复添加!') + // return + // } + this.$refs.addagentobj.validate((valid) => { + if (valid) { + if (!this.resetFlag) { + return; } - this.loadingFlag=true - this.$api.http.AddAgent(this.addagentobj).then((res) => { - if(res.code==0){ - this.dialogVisible=false; - setTimeout(() => { - this.loadingFlag=false - console.log('防重') + this.loadingFlag = true; + this.$api.http + .AddAgent(this.addagentobj) + .then((res) => { + if (res.code == 0) { + this.dialogVisible = false; + setTimeout(() => { + this.loadingFlag = false; + console.log("防重"); }, 1); - this.addagentobj.contractStartDate=''; - this.addagentobj.contractEndDate=''; - this.$refs.addagentobj.resetFields(); - this.Screeningofempty() - this.getAgentList() - }else{ - this.$message.error(res.message); - } - }); - } else { - return false; - } - }); - }, - //删除 - toinifodelete(item){ - this.$confirm('此操作将永久删除, 是否继续?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { - this.$api.http.delAgent({id:item.row.id}).then((res) => { - if(res.code==0){ - this.$message({ - type: 'success', - message: '删除成功!' - }); - this.Screeningofempty() - this.getAgentList() - }else{ - this.$message.error(res.message); - } + this.addagentobj.contractStartDate = ""; + this.addagentobj.contractEndDate = ""; + this.$refs.addagentobj.resetFields(); + this.Screeningofempty(); + this.getAgentList(); + } else { + this.$message.error(res.message); + } }) + .catch((err) => { + this.loadingFlag = false; + }); + } else { + return false; + } + }); + }, + //删除 + toinifodelete(item) { + this.$confirm("此操作将永久删除, 是否继续?", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + this.$api.http.delAgent({ id: item.row.id }).then((res) => { + if (res.code == 0) { + this.$message({ + type: "success", + message: "删除成功!", + }); + this.Screeningofempty(); + this.getAgentList(); + } else { + this.$message.error(res.message); + } + }); }) - .catch(err=>{ - console.log('关闭'); - }) + .catch((err) => { + console.log("关闭"); + }); }, - toDisable(row){ - this.$confirm(`确定${row.lockFlag==0?'禁用':'启用'}此代理商么?`, '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning' - }).then(() => { + toDisable(row) { + this.$confirm( + `确定${row.lockFlag == 0 ? "禁用" : "启用"}此代理商么?`, + "提示", + { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + } + ) + .then(() => { // return // console.log(123); - this.$api.http.editorAgent({id:row.id,lockFlag:row.lockFlag==0?'1':'0'}).then((res) => { - if(res.code==0){ - this.$message({ - type: 'success', - message: '操作成功!' - }); - this.Screeningofempty() - this.getAgentList() - }else{ - this.$message.error(res.message); - } + this.$api.http + .editorAgent({ + id: row.id, + lockFlag: row.lockFlag == 0 ? "1" : "0", }) + .then((res) => { + if (res.code == 0) { + this.$message({ + type: "success", + message: "操作成功!", + }); + this.Screeningofempty(); + this.getAgentList(); + } else { + this.$message.error(res.message); + } + }); }) - .catch(err=>{ + .catch((err) => { // console.log('关闭'); // console.log(err); - }) + }); }, - //时间选择 - confirmtime(e){ - // console.log(this.timelist) - console.log(e); - if(e){ - this.contractStartDate=e[0]; - this.contractEndDate=e[1]; - }else{ - this.contractStartDate=''; - this.contractEndDate=''; - } - + //时间选择 + confirmtime(e) { + // console.log(this.timelist) + console.log(e); + if (e) { + this.contractStartDate = e[0]; + this.contractEndDate = e[1]; + } else { + this.contractStartDate = ""; + this.contractEndDate = ""; + } }, //清空筛选 - Screeningofempty(){ - this.timelist=[]; - this.contractStartDate=''; - this.contractEndDate=''; - this.serviceStatus=''; - this.agentName=''; - this.operationalName=''; - this.provinceId='' - this.cityId='' - this.operationalId='' - this.pageNum=1 - this.area=[] - this.getAgentList() + Screeningofempty() { + this.timelist = []; + this.contractStartDate = ""; + this.contractEndDate = ""; + this.serviceStatus = ""; + this.agentName = ""; + this.operationalName = ""; + this.provinceId = ""; + this.cityId = ""; + this.operationalId = ""; + this.pageNum = 1; + this.area = []; + this.getAgentList(); }, //筛选 - Screening(){ - this.getAgentList() + Screening() { + this.getAgentList(); }, - // 获取代理商 + // 获取代理商 getAgentList() { - this.tableData=[]; - this.$api.http.getAgentList({ + this.tableData = []; + this.$api.http + .getAgentList({ current: this.pageNum, size: this.pageSize, - contractStartDate:this.contractStartDate, - contractEndDate:this.contractEndDate, - serviceStatus:this.serviceStatus, - agentName:this.agentName, - operationStaffId:this.operationalId, - provinceId:this.provinceId, - cityId:this.cityId, - operationalName:this.operationalName, - - }).then((res) => { - this.tableData=res.data.records; - this.total=res.data.total + contractStartDate: this.contractStartDate, + contractEndDate: this.contractEndDate, + serviceStatus: this.serviceStatus, + agentName: this.agentName, + operationStaffId: this.operationalId, + provinceId: this.provinceId, + cityId: this.cityId, + operationalName: this.operationalName, + }) + .then((res) => { + this.tableData = res.data.records; + this.total = res.data.total; }); }, - handleSizeChange(val) { - this.pageSize=val; - this.getAgentList() - }, + handleSizeChange(val) { + this.pageSize = val; + this.getAgentList(); + }, locationsChange(e) { console.log(e); if (!e) return; - if(this.dialogVisible){ - this.addagentobj.provinceId = e[0]; - this.addagentobj.cityId = e[1]; - }else{ - this.editoragentobj.provinceId = e[0]; - this.editoragentobj.cityId = e[1]; + if (this.dialogVisible) { + this.addagentobj.provinceId = e[0]; + this.addagentobj.cityId = e[1]; + } else { + this.editoragentobj.provinceId = e[0]; + this.editoragentobj.cityId = e[1]; } }, locationsChange1(e) { @@ -1135,10 +1323,10 @@ export default { this.provinceId = e[0]; this.cityId = e[1]; }, - handleCurrentChange(val) { - this.pageNum=val; - this.getAgentList() - } + handleCurrentChange(val) { + this.pageNum = val; + this.getAgentList(); + }, }, }; @@ -1150,10 +1338,10 @@ export default { min-width: 1000px; padding-bottom: 100px; } -.cen-tab{ +.cen-tab { width: 100%; padding: 15px; - background: #FFFFFF; + background: #ffffff; margin-top: 15px; } .tophove { @@ -1201,7 +1389,6 @@ export default { .div-lab { display: flex; margin: 5px; - } .div-inp { width: 250px; diff --git a/src/views/Customer/CompanyRecord.vue b/src/views/Customer/CompanyRecord.vue index c729e01..f9ca14e 100644 --- a/src/views/Customer/CompanyRecord.vue +++ b/src/views/Customer/CompanyRecord.vue @@ -3,9 +3,9 @@
-
代理商名称:
+
代理商名称:
- +
公司名称:
@@ -19,8 +19,8 @@ v-model="operationStaffName" >
--> -
运营人员:
-
+
运营人员:
+
--> - +
@@ -96,12 +96,8 @@ align="center" > - - + + - +