import request from '../../../util/http' import apiUrl from '../../../util/apiUrl' var app = getApp(); Page({ data: { listShow:false, noServantList:false, unSetModal:false,//未设置服务者提醒 unSetBtn: [ { text: '设置', extClass: 'buttonBold' }, { text: '暂不' }, ], buttonFooter:[ { text: '取消' }, { text: '确定', extClass: 'buttonBold' }, ], servantList:[] }, onLoad() { // this.initServantList(); }, onShow(){ this.initServantList(); }, initServantList(){ let params={ "employerId":app.globalData.userInfo.id, "pageNo": 1, "pageSize": 100, } request.httpServicePost(apiUrl.findByEmployerIdListPath,params).then(data=>{ console.log(data); if(data.dataList.length==0){ this.setData({ listShow:false, noServantList:true, unSetModal:true, }); }else{ this.setData({ listShow:true, noServantList:false, unSetModal:false, servantList:data.dataList }); } }).catch(e=>{ console.log(e); }) }, editServant(e){ console.log(e); app.globalData.relationInfo=e.target.dataset.relationInfo; my.navigateTo({ url: '../editServant/editServant' }); }, addServant(){ my.navigateTo({ url: '../createServant/createServant' }); }, enterCustomerCenter(e){ let emReNo=e.target.dataset.emReNo; my.navigateTo({ url: '../customerCenter/customerCenter?emReNo='+emReNo }); }, // 点击设置按钮 onSetButtonClick(e){ console.log(e.target); if(e.target.dataset.index==0){ this.setData({ unSetModal: false, }); my.navigateTo({ url: '../createServant/createServant' }); }else{ this.setData({ unSetModal: false, }); } }, // 切换角色 switchRole(){ my.navigateTo({ url: '../../common/selectRole/selectRole' }); }, copyCode(e){ let code=e.target.dataset.code; console.log(code); my.setClipboard({ text: code, success:()=>{ my.showToast({ content: '复制成功', }); }, fail:()=>{ my.showToast({ content: '复制失败', }); } }); }, });