fuwutuandui.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. var d = dialog({
  2. contentType: 'load',
  3. skin: 'bk-popup'
  4. });
  5. var expensesStatus; // expensesStatus '扣费状态 【""没有签约信息 "0"未扣费 "1"已扣费 "2"已退费】'
  6. var leaderCode = "";
  7. var fuwutuanduiObj;
  8. var fuwutuandui = {
  9. getInfo: function(){
  10. var url="/patient/sign/consult_sign_doctor_info",
  11. params = {team:request.teamCode,code: request.code, consult: request.consult,status:request.status};
  12. d.show();
  13. sendPost(url, params, "json", "post", this.queryFailed, this.querySuccess);
  14. },
  15. queryFailed : function(res){
  16. d.close();
  17. if(res && res.msg) {
  18. dialog({
  19. contentType: 'tipsbox',
  20. skin: 'bk-popup',
  21. content: res.msg
  22. }).show();
  23. } else {
  24. dialog({
  25. contentType: 'tipsbox',
  26. skin: 'bk-popup',
  27. content: '加载失败'
  28. }).show();
  29. }
  30. },
  31. querySuccess: function(res){
  32. d.close();
  33. fuwutuandui.fillRespData(res);
  34. },
  35. fillRespData: function(res){
  36. var data = res.data;
  37. expensesStatus = res.data.expensesStatus
  38. fuwutuanduiObj = res.data;
  39. //填充团队长信息
  40. leaderCode = data.leader.code;
  41. //填充服务医生的数据
  42. var docList = [];
  43. //如果全科医生和健康管理医生是同一个人
  44. if(data.doctor && data.doctorHealth && (data.doctor.code == data.doctorHealth.code)){
  45. var doctor = data.doctor;
  46. doctor.relation = "健康管理师&全科医生";
  47. docList.push(data.doctor);
  48. }else{
  49. if(data.doctor){
  50. data.doctor.relation = "全科医生";
  51. docList.push(data.doctor);
  52. }
  53. if(data.doctorHealth){
  54. data.doctorHealth.relation = "健康管理师";
  55. docList.push(data.doctorHealth);
  56. }
  57. }
  58. $.extend(true, data, {list: docList});
  59. var html = template('item1_tmp', data);
  60. $("#item1").find(".mui-scroll").empty().append(html);
  61. },
  62. bindEvents: function(){
  63. $("body").on('tap',".doc-info", function(){
  64. window.location.href = "doctor-index.html?id="+leaderCode;
  65. });
  66. $("body").on("tap", ".li-doc-info", function(){
  67. var code = $(this).attr("data-code");
  68. window.location.href = "doctor-index.html?id="+code;
  69. });
  70. $("body").on("tap", "#cancel", function(){
  71. overSign();
  72. });
  73. }
  74. };
  75. function overSign() {
  76. $("#txtInfo").hide();
  77. dialog({
  78. title: '申请解约',
  79. skin: "ui-dialog ax-popup pror reqest-unsign-pop",
  80. content: $("#xf-artd").get(0),
  81. ok: function() {
  82. var data = {};
  83. data.doctor = fuwutuanduiObj.doctor.code;
  84. data.doctorName = fuwutuanduiObj.doctor.name;
  85. data.reason = $("#textReason").val();
  86. if(data.reason == "" || data.reason == null) {
  87. $("#txtInfo").show();
  88. return false;
  89. } else {
  90. $("#txtInfo").hide();
  91. d.showModal();
  92. sendPost('patient/family_contract/surrender', data, 'json', 'post', overSignSubmitFailed, overSignSubmitSuccess);
  93. $("body,html").css("overflow-y","initial");
  94. return;
  95. }
  96. },
  97. cancel: function() {
  98. $("body,html").css("overflow-y","initial");
  99. return;
  100. }
  101. }).showModal();
  102. }
  103. function overSignSubmitFailed(res) {
  104. d.close();
  105. if(res && res.msg) {
  106. dialog({
  107. contentType: 'tipsbox',
  108. skin: 'bk-popup',
  109. content: res.msg
  110. }).show();
  111. } else {
  112. dialog({
  113. contentType: 'tipsbox',
  114. skin: 'bk-popup',
  115. content: '操作失败'
  116. }).show();
  117. }
  118. }
  119. function overSignSubmitSuccess(res) {
  120. if(res.status == 200) {
  121. $("#cancel").hide();
  122. d.close();
  123. dialog({
  124. content: '已成功取消了签约关系',
  125. okValue:'我知道了',
  126. ok: function() {
  127. wx.closeWindow();
  128. }
  129. }).showModal();
  130. } else {
  131. submitFailed(res);
  132. }
  133. }