var d = dialog({ contentType: 'load', skin: 'bk-popup' }); var pagetype = 31; var isOverdue = false; //判断是否有已经生效的过期的记录 var popoverData; $(function() { checkUserAgent(); }); var scroller = new IScrollPullUpDown('wrapper5', { probeType: 2, bounceTime: 250, bounceEasing: 'quadratic', mouseWheel: false, scrollbars: true, click: true, fadeScrollbars: true, interactiveScrollbars: false }, null, null); function queryInit() { appendFamilyMember($('#memberContainer'), function() { $("#signList").empty(); $("#wrapper5").show(); $("#other_view").hide(); $('#require_sign').hide(); getInfo(); }, function() { //判断有授权家人,修改样式 if($('#memberContainer').is(':hidden')) { $('#wrapper5').css('top', 80); $('#other_view').css('padding-top', '150px'); } else { $('#wrapper5').css('top', $('.mui-content').height() + 90); $('#other_view').css('padding-top', '90px'); $('#memberContainer').css({ 'margin-top': $('.mui-content').height(), 'height': '90px', 'position': 'relative' }); } }); getInfo(); bindEvents(); popover() } function popover() { var url = "/patient/prescription/pay/getPopups", params = { type: 0 }; sendPost(url, params, 'JSON', 'GET', queryFailed, function(res) { if(res.status == 200) { popoverData = res.data; } else { queryFailed(res); } }) } function getInfo() { d.show(); var url = "/patient/sign/signs", params = {}; sendPost(url, params, "json", "post", queryFailed, querySuccess); } function queryFailed(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 querySuccess(res) { d.close(); if(res.status == 200) { if(res.data.length == 0) { // $("body").removeClass("bgc-f3f3f3").addClass("bgc-9beaf6"); $("#wrapper5").hide(); $("#other_view").show(); } else { // $("body").addClass("bgc-f3f3f3").removeClass("bgc-9beaf6"); $("#wrapper5").show(); $("#other_view").hide(); var slider = mui("#slider"); slider.slider({ interval: 2000 }); if($('#memberContainer').is(':hidden')) { $('#wrapper5').css('top', $('.mui-content').height()); } else { $('#wrapper5').css('top', $('.mui-content').height() + 90); } //签约状态(-1患者已取消,-2已拒绝,-3已解约,-4已到期,0待签约,1已签约,2患者申请取消签约,3医生申请取消签约 var addNew = true; var userAgent = JSON.parse(window.localStorage.getItem(agentName)); var isMe = false; if(userAgent.represented == userAgent.uid || userAgent.represented == undefined) { isMe = true; } for(i = 0; i < res.data.length; i++) { var status = res.data[i].status, type = res.data[i].type; //type : 1-三师签约,2-家庭签约 if(type == 2 && (status == "0" || status == "1")) { addNew = false; } //判断签约年限 var signYear = parseInt(res.data[i].end.substr(0, 4)) - 1; //当前年度 var now = new Date(), nowSignYear; if(now > new Date(now.getFullYear(), 06, 01)) { //大于6月30号为新年度 nowSignYear = now.getFullYear(); } else { nowSignYear = now.getFullYear() - 1; } if(type == 2 && (status == "-4") && (res.data[i].expensesStatus == "1") && signYear == (nowSignYear - 1)) { isOverdue = true; } } addNew && $("#require_sign").show(); var list = _.map(res.data, function(o) { var consultDoctor = o.doctorHealth ? o.doctorHealth : o.doctor; o.consultDoctor = consultDoctor; o.jsonStr = JSON.stringify(o); o.isMe = isMe; return o; }); var html = template("list_tmp", { list: list }); $("#signList").append(html); scroller.myScroll.refresh(); } } else { dialog({ contentType: 'tipsbox', skin: 'bk-popup', content: res.msg }).show(); } } function bindEvents() { $("body").on('tap', ".view-agreement", function(event) { event.stopPropagation(); window.location.href = "agreement.html?readonly=1"; }) .on('tap', ".sign-info", function() { var jsonObj = $(this).attr("data-json"); jsonObj && (jsonObj = JSON.parse(jsonObj)); var code = jsonObj.code, teamCode = jsonObj.teamCode, type = jsonObj.type, doctorHealth = jsonObj.consultDoctor, status = jsonObj.status, renew = jsonObj.isRenew; if(type == 1) { //三师签约不跳转 } else { window.location.href = "sign_info.html?code=" + code + "&teamCode=" + teamCode + "&type=" + type + "&doctor=" + doctorHealth + "&status=" + status + "&isRenew=" + renew; } }) .on('tap', '.to-pay', function(e) { var $this = $(this) e.stopPropagation(); //判断是否可以在线支付 if(!canPayOnline) { dialog({ content: '缴费功能即将开放,请耐心等待~如需线下缴费,可前往社区卫生服务中心缴费', okValue: '知道了', ok: function() {} }).showModal(); return false; } if(popoverData == 1) { //询问框 layer.open({ area:['auto'], title: ['温馨提示', 'font-weight:700;font-size:16px;height:40px;line-height:40px;'], content: '