(function (c) { config.init(); //是否可以预约 if (Fx.getUrlParam("appiontFlag") == "1") { console.log("2"); c('.fixedbox').html(''); } var selectedDate = window.Fx.getUrlParam('date'); var a = { hospitalId: Fx.getUrlParam("hospitalId"), deptId: Fx.getUrlParam("deptId"), doctorId: Fx.getUrlParam("doctorId") }; var b = { hospitalId: Fx.getUrlParam("hospitalId"), deptId: Fx.getUrlParam("deptId"), doctorId: Fx.getUrlParam("doctorId"), regDate: window.Fx.getUrlParam('date') || (new Date()).pattern('yyyy-MM-dd') } //界面显示日期 url参数 // c('#date').html(selectedDate); //获取医生诊疗费用 c.ajax({ type: "get", url: window.apiUrl + "index.php?c=Other&a=getDoctorBookingScheduleSyn", dataType: "jsonp", data: c.extend(window.hzAPI.getToken(), a), jsonp: "callback", async: false, crossDomain: true, success: function (data) { //显示金额 c('#money').html('¥' + data.dataInfo.data[0].treatFee / 100 + '.00'); }, error: function (error) { window.hzAPI.dialog(false, window.hzAPI.options.timeout, "网络链接失败"); }, timeout: 9000 }); //医生信息 hzAPI.getData(window.apiUrl + "?c=Index&a=doctorInfo", a, "#docinfo"); //hzAPI.getData(window.apiUrl + "?c=Index&a=doctorInfo", a, "#list1 ul", 1, null, null, null); var getTime = function () { var deferred = c.Deferred(); c.ajax({ type: "get", url: window.apiUrl + "index.php?c=ReqHis&a=getTimeRegInfo", dataType: "jsonp", data: c.extend(window.hzAPI.getToken(), b), jsonp: "callback", async: false, crossDomain: true, success: function (data) { deferred.resolve(data); }, error: function (error) { window.hzAPI.dialog(false, window.hzAPI.options.timeout, "服务器繁忙,请刷新重试"); }, timeout: 9000 }); return deferred.promise(); } var getDate = function () { var deferred = c.Deferred(); c.ajax({ type: "get", url: window.apiUrl + "index.php?c=Other&a=getDoctorBookingScheduleSyn", dataType: "jsonp", data: c.extend(window.hzAPI.getToken(), a), jsonp: "callback", async: false, crossDomain: true, success: function (data) { deferred.resolve(data); }, error: function (error) { window.hzAPI.dialog(false, window.hzAPI.options.timeout, "网络链接失败"); }, timeout: 9000 }); return deferred.promise(); } //就诊日期 获取参数生成链接 c.when(getTime(), getDate()).done(function (res1, res2) { //如果返回的结果是 false 说明医院的接口又拿不到数据啦~ if (!res1 || !res2) { window.hzAPI.dialog(fasle, window.hzAPI.options.timeout, "服务器繁忙,请刷新重试"); return false; } console.log(res1, res2); var list = res1.dataInfo.data; var dateList = res2.dataInfo.data; var timeFlag = ''; var regFee = ''; var treatFee = ''; var listStr = ''; //找出选择日期的参数的值 for (var i in dateList) { if (dateList[i].regDate == selectedDate) { timeFlag = dateList[i].timeFlag; regFee = dateList[i].regFee; treatFee = dateList[i].treatFee; } } $('.subscribeList li').eq(0).siblings().remove(); for (var i = 0; i < list.length; i++) { if (list[i].regLeaveCount > 0) { listStr += '
  • ' + '' + ' ' + '
    ' + list[i].startTime + '~' + list[i].endTime + '(总' + list[i].regTotalCount + '余' + list[i].regLeaveCount + ')号 ' + '可预约' + '
    ' + '
    ' + '
    ' + '
  • '; } else { listStr += '
  • ' + '' + ' ' + '
    ' + list[i].startTime + '~' + list[i].endTime + '(总' + list[i].regTotalCount + '余' + list[i].regLeaveCount + ')号 ' + '不可预约' + '
    ' + '
    ' + '
    ' + '
  • '; } '已约满' } $('.subscribeList ul').append(listStr); }) //旧接口 // hzAPI.getData(window.apiUrl + "?c=Other&a=getDoctorBookingScheduleSyn", a, "#list1 ul", 1, null, null, null, "该周暂无出诊安排"); c('#subscribe').click(function (e) { c('#d-title').html('
    ' + $('.doctor .name').html() + ' ' + $('.doctor .title').html() + '
    '); c('#d-img').attr('src', $('.doctor img').attr('src')); c('.lists').addClass('active'); }); c('.wrap').click(function (e) { c('.lists').removeClass('active'); // c('#list1 ul').html(''); }); c('body').on('click', '.close', function (e) { c('.lists').removeClass('active'); }) //添加关注 // c('#favorite').click(function (e) { // window.hzAPI.sendData(window.apiUrl+"?c=Index&a=favoriteDoctor",c.extend(a,{status: 1}),false, ["更新失败", "更新成功"], [0, c(this)]); // }) })(Zepto);