var d = dialog({ contentType: 'load', skin: 'bk-popup' }); var expensesStatus; // expensesStatus '扣费状态 【""没有签约信息 "0"未扣费 "1"已扣费 "2"已退费】' var leaderCode = ""; var fuwutuanduiObj; var fuwutuandui = { getInfo: function(){ var url="/patient/sign/consult_sign_doctor_info", params = {team:request.teamCode,code: request.code, consult: request.consult,status:request.status}; d.show(); sendPost(url, params, "json", "post", this.queryFailed, this.querySuccess); }, queryFailed : function(res){ d.close(); if(res && res.msg) { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: res.msg }).show(); } else { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: '加载失败' }).show(); } }, querySuccess: function(res){ d.close(); fuwutuandui.fillRespData(res); }, fillRespData: function(res){ var data = res.data; expensesStatus = res.data.expensesStatus fuwutuanduiObj = res.data; //填充团队长信息 leaderCode = data.leader.code; //填充服务医生的数据 var docList = []; //如果全科医生和健康管理医生是同一个人 if(data.doctor && data.doctorHealth && (data.doctor.code == data.doctorHealth.code)){ var doctor = data.doctor; doctor.relation = "健康管理师&全科医生"; docList.push(data.doctor); }else{ if(data.doctor){ data.doctor.relation = "全科医生"; docList.push(data.doctor); } if(data.doctorHealth){ data.doctorHealth.relation = "健康管理师"; docList.push(data.doctorHealth); } } $.extend(true, data, {list: docList}); var html = template('item1_tmp', data); $("#item1").find(".mui-scroll").empty().append(html); }, bindEvents: function(){ $("body").on('tap',".doc-info", function(){ window.location.href = "doctor-index.html?id="+leaderCode; }); $("body").on("tap", ".li-doc-info", function(){ var code = $(this).attr("data-code"); window.location.href = "doctor-index.html?id="+code; }); $("body").on("tap", "#cancel", function(){ overSign(); }); } }; function overSign() { $("#txtInfo").hide(); dialog({ title: '申请解约', skin: "ui-dialog ax-popup pror reqest-unsign-pop", content: $("#xf-artd").get(0), ok: function() { var data = {}; data.doctor = fuwutuanduiObj.doctor.code; data.doctorName = fuwutuanduiObj.doctor.name; data.reason = $("#textReason").val(); if(data.reason == "" || data.reason == null) { $("#txtInfo").show(); return false; } else { $("#txtInfo").hide(); d.showModal(); sendPost('patient/family_contract/surrender', data, 'json', 'post', overSignSubmitFailed, overSignSubmitSuccess); $("body,html").css("overflow-y","initial"); return; } }, cancel: function() { $("body,html").css("overflow-y","initial"); return; } }).showModal(); } function overSignSubmitFailed(res) { d.close(); if(res && res.msg) { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: res.msg }).show(); } else { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: '操作失败' }).show(); } } function overSignSubmitSuccess(res) { if(res.status == 200) { $("#cancel").hide(); d.close(); dialog({ content: '已成功取消了签约关系', okValue:'我知道了', ok: function() { wx.closeWindow(); } }).showModal(); } else { submitFailed(res); } }