var d = dialog({ contentType: 'load', skin: 'bk-popup' }); var payParams = JSON.parse(window.localStorage.getItem("payParams")); if(!payParams){ payParams = {}; } var expensesStatus = payParams.exstatus, code = payParams.code, teamCode = payParams.teamCode, type = payParams.type, doctorHealth = payParams.doctorHealth, status = payParams.status, renew = payParams.renew, showResult = payParams.showResult; //标记直接根据交易码获取缴费信息,区别在线支付回调 var request = GetRequest(); //获取支付成功后回调回来的参数 $(function(){ queryInit(); }); function queryInit(){ getInfo(); bindEvents(); } function getInfo(){ d.show(); if(showResult && expensesStatus == 1){ var url = "/patient/chargeQuery", params = {code: payParams.payCode}; sendPost(url, params, "json", "post", queryFailed, payokSuccess); }else{ //支付成功后回调处理 var url = "/patient/returnUrl", params = request; d.close(); //将支付成功回调返回的参数显示到页面中 params.userName = decodeURI(params.userName); params.responseContent = params.responseContent?JSON.parse(params.responseContent):'' var html = template("ok_tmp", {data: params}); $("#signList").append(html); sendPost(url, params, "json", "post", function(res){ //不处理 }, function(res){ console.log(res); }); } } 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 payokSuccess(res){ if(res.status == 200){ d.close(); res.data.responseContent = res.data.responseContent?JSON.parse(res.data.responseContent):'' var html = template("ok_tmp", {data:res.data}); $("#signList").append(html); }else{ payfailSuccess(res); } } function payfailSuccess(res){ d.close(); var html = template("fail_tmp", res); $("#signList").append(html); } function bindEvents(){ $('body').on('tap','.start-sever',function(){ if(showResult && (type != 1)){ //非三师签约的才能跳转(在signing_management.js页面也有这个判断) window.location.href ="sign_info.html?code="+code+"&teamCode="+teamCode+"&type="+type+"&doctor="+doctorHealth+"&status="+status+"&isRenew="+renew; }else{ window.location.href = "signing_management.html"; } }) } template.helper('formatDate', function(str){ if(str && str.length > 0){ return str.substr(0,4)+"-"+str.substr(4,2)+"-"+str.substr(6,2)+' '+str.substr(8, 2)+":"+str.substr(10, 2); }else{ return ''; } }); template.helper('formatMoney', function(str){ if(str && str.length > 0){ return (parseInt(str) / 100).toFixed(2); }else{ return '0.00'; } });