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: '
\ 签约在线缴费需使用实名且与医保卡同名的微信公众号进行绑卡及缴费,如需为家人代理缴费,需先到市行政服务中心申请家庭共济关系后,才可以绑定家人的医保卡并缴费哟~\
\
\ \
\
', btn: ['
开始缴费
', '
暂不缴费
'], shadeClose: false, yes: function(index) { var checkedValue = $("#input_1").prop("checked"), val; if(checkedValue) { val = 0; } else { val = 1; } var url = "/patient/prescription/pay/savePopups", params = { type: 0, status: val }; sendPost(url, params, 'JSON', 'POST', queryFailed, function(res) { if(res.status == 200) { var jsonObj = $this.parent().parent().attr("data-json"); jsonObj && (jsonObj = JSON.parse(jsonObj)); checkBindCard(jsonObj); } else { queryFailed(res); } }); layer.close(index); }, no: function(index) { location.reload(); }, }); } else { var jsonObj = $this.parent().parent().attr("data-json"); jsonObj && (jsonObj = JSON.parse(jsonObj)); checkBindCard(jsonObj); } }) .on('tap', '.pay-record', function(e) { e.stopPropagation(); //判断是否可以在线支付 if(!canPayOnline) { dialog({ content: '服务维护中,暂时看不了线上的缴费记录', okValue: '知道了', ok: function() {} }).showModal(); return false; } var jsonObj = $(this).parent().parent().attr("data-json"); jsonObj && (jsonObj = JSON.parse(jsonObj)); var payParams = { code: jsonObj.code, teamCode: jsonObj.teamCode, type: jsonObj.type, doctorHealth: jsonObj.doctor, status: jsonObj.status, renew: jsonObj.isRenew, exstatus: jsonObj.expensesStatus, payCode: jsonObj.chargeCode, showResult: true //标记直接根据交易码获取缴费信息,区别在线支付回调 }; payParams = JSON.stringify(payParams); window.localStorage.setItem("payParams", payParams); window.location.href = "pay_result.html"; }); $("#require_sign").on('click', function() { // location.href = "select-doctor.html"; if(isOverdue) { location.href = "../../xuqian/html/information.html"; } else { location.href = "select-doctor.html"; } }); $('#sign_family_doctor_btn').click(function() { location.href = "select-doctor.html"; }); $("body").on("tap", ".unsign-info", function() { //审核中的信息跳转去医生主页 var doctor = $(this).attr("data-code"), isRenew = $(this).attr("data-renew"); location.href = "doctor-index.html?id=" + doctor + "&status=0&renew=" + isRenew; }); //勾选框 $('.piaochecked').click(function () { if ($(this).hasClass('on_check')) { $('.input_checked').prop("checked", false); $(this).removeClass('on_check'); } else { $('.input_checked').prop("checked", true); $(this).addClass('on_check'); } }) } function checkBindMobile(cb) { var url = "patient/prescription/pay/getPatientMobile" sendPost(url, {}, "json", "get", queryFailed, function(res) { if(res.status == 200) { if(res.data == 1) { cb && cb() } else { d.close(); dialog({ content: '您当前暂未绑定手机,无法在线缴费,请点击确认完成手机号码绑定', cancelValue: '取消', cancel: function() {}, okValue: '确认', ok: function() { window.location.href = "../../home/html/bind-mobile.html" } }).showModal(); } } else { queryFailed(res); } }) } function checkBindCard(jsonObj){ d.show(); var url = "patient/bindCard", params = {}; sendPost(url, params, "json", "post", queryFailed, function(res) { if(res.status == 200) { if(res.data.bindStatus == '000000') { checkBindMobile(function() { //已绑卡,跳转去缴费页面 charge(jsonObj); }) } else if(res.data.bindStatus == '030007') { d.close(); dialog({ content: '当前未绑定电子社保卡,无法进行线上缴费,是否立即绑定', cancelValue: '不了,谢谢', cancel: function() {}, okValue: '是', ok: function() { //需要将签约的code缓存起来用在绑卡成功后的回调页面中 var obj = { signCode: jsonObj.code }; window.localStorage.setItem('request_info', JSON.stringify(obj)) window.location.href = res.data.sicardUrl; } }).showModal(); } } else { queryFailed(res); } }); } //发起缴费申请 function charge(signInfo) { var url = "/patient/charge", params = { orgCode: signInfo.hospital, chargeType: 1, chargeRelation: signInfo.code, totalAmount: 12000 }; sendPost(url, params, 'json', 'post', queryFailed, function(res) { d.close(); if(res.status == 200) { //跳转去缴费页面 window.location.href = res.data; } else { queryFailed(res); } }); } template.helper("formatDate", function(str) { if(str) { return str.substr(0, 10); } else { return ""; } }); function goToWlc() { window.location.href = "signing-welcome.html?isOverdue=" + isOverdue; }