123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- 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: '<div id="content_div" class="content_bg c-t-left">\
- 签约在线缴费需使用实名且与医保卡同名的微信公众号进行绑卡及缴费,如需为家人代理缴费,需先到市行政服务中心申请家庭共济关系后,才可以绑定家人的医保卡并缴费哟~\
- </br>\
- <div class="c-t-center mtb10">\
- <label class="input-group-checkbox" style="color: #40AFFE">\
- <div class="input-group-pack">\
- <input id="input_1" type="checkbox">\
- <span class="tick"></span>\
- </div>\
- 下次不再提醒\
- </label>\
- </div>\
- </div>',
- btn: ['<div id="jiaofei">开始缴费</div>', '<div id="bujiaofei">暂不缴费</div>'],
- 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;
- }
|