updateService.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>选择您的服务类型</title>
  6. <meta name="author" content="yihu.com" />
  7. <meta name="format-detection" content="telephone=no" />
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  9. <meta name="apple-mobile-web-app-capable" content="yes" />
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  11. <link rel="stylesheet" href="../../../css/cross.css">
  12. <link rel="stylesheet" href="../../../css/cross.ui.css">
  13. <link rel="stylesheet" href="../../../css/mui.min.css">
  14. <link rel="stylesheet" href="../css/updateService.css" type="text/css" />
  15. </head>
  16. <body style="background: #f3f3f3;">
  17. <div class="mt5">
  18. <ul class="w3-row w3-row-padding mb10 clearfix" id="_service">
  19. </ul>
  20. </div>
  21. <div class="plr15 submitbtn">
  22. <a onclick="submit()" class="c-btn c-btn-full c-btn-4dcd70 border-radius-pill c-f17 pt10" style="height: 45px;">保&nbsp;存</a>
  23. </div>
  24. <script type="text/html" id="service_tmp">
  25. {{each list as it}}
  26. <li class="w3-col s4" data-code="{{it.labelCode}}" data-name="{{it.labelName0}}" >
  27. <div class="outdiv">
  28. <div class="labelIcon {{it.labelIcon}}">
  29. <div class="labelIcon1 {{it.labelIcon}}">
  30. <div class="pt10 pl10 c-f16 c-333">{{it.labelName0}}</div>
  31. <div class="pt5 pl10 c-f14 c-909090">{{it.labelName1}}</div>
  32. </div>
  33. </div>
  34. </div>
  35. </li>
  36. {{/each}}
  37. </script>
  38. <script src="../../../js/jquery/2.1.3/jquery.js"></script>
  39. <script type="text/javascript" src="../../../js/mui.min.js"></script>
  40. <script type="text/javascript" src="../../../js/app.js"></script>
  41. <script type="text/javascript" src="../../../js/weixin_common.js"></script>
  42. <script type="text/javascript" src="../../../js/underscore.js"></script>
  43. <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
  44. <script src="../../../js/template.js" type="text/javascript" charset="utf-8"></script>
  45. <script src="../../../js/common_http.js" type="text/javascript" charset="utf-8"></script>
  46. <script src="../../../js/security.js" type="text/javascript" charset="utf-8"></script>
  47. <link rel="stylesheet" type="text/css" href="../../../widget/artDialog/6.0.5/css/ui-dialog.min.css">
  48. <script src="../../../widget/artDialog/6.0.5/js/dialog-plus.min.js"></script>
  49. <script>
  50. var dd = dialog({
  51. contentType: 'load',
  52. skin: 'bk-popup',
  53. content: '保存中...'
  54. });
  55. var d = dialog({
  56. contentType: 'load',
  57. skin: 'bk-popup'
  58. });
  59. var Request = new Object();
  60. Request = GetRequest();
  61. var openid = Request["openid"];
  62. var type = Number(Request["type"]);
  63. var service = "";
  64. var doctor = Request["doctor"];
  65. var userAgent = window.localStorage.getItem(agentName);
  66. $(function() {
  67. var paramAgent = $.parseJSON(window.localStorage.getItem("paramAgent", paramAgent))
  68. checkUserAgent();
  69. getBaseInfo();
  70. })
  71. function getBaseInfo(){
  72. sendPost("/patient/baseinfo", {}, 'JSON', 'post', queryFailed, function(res) {
  73. service = res.data.label;
  74. if(!service){service=1}
  75. getServices();
  76. })
  77. }
  78. function getServices() {
  79. d.show();
  80. var url = "/patient/serviceType",
  81. params = {
  82. };
  83. sendPost(url, params, 'JSON', 'GET', queryFailed, function(res) {
  84. d.close();
  85. if(res.status == 200) {
  86. var list = _.map(res.list, function(item, index) {
  87. item.labelIcon = "labelIcon_" + item.labelCode;
  88. if(item.labelName.indexOf("老年人") > -1) {
  89. item.labelName0 = "老年人";
  90. item.labelName1 = "60岁以上";
  91. } else if(item.labelName.indexOf("儿童") > -1) {
  92. item.labelName0 = "儿童";
  93. item.labelName1 = "0-6岁";
  94. }else if(item.labelName.indexOf("精神疾病") > -1) {
  95. item.labelName0 = "精神疾病";
  96. item.labelName1 = "重度";
  97. } else {
  98. item.labelName0 = item.labelName;
  99. item.labelName1 = "";
  100. }
  101. return item;
  102. });
  103. var html = template("service_tmp", {
  104. list: list
  105. });
  106. $("#_service").empty().append(html);
  107. bindEvents();
  108. autodivheight();
  109. } else {
  110. queryFailed(res);
  111. }
  112. })
  113. }
  114. //请求失败处理事件
  115. function queryFailed(res, message) {
  116. d.close();
  117. if(message) {
  118. dialog({
  119. contentType: 'tipsbox',
  120. bottom: true,
  121. skin: 'bk-popup',
  122. content: message
  123. }).show();
  124. } else {
  125. if(res && res.msg) {
  126. dialog({
  127. contentType: 'tipsbox',
  128. bottom: true,
  129. skin: 'bk-popup',
  130. content: res.msg
  131. }).show();
  132. } else {
  133. dialog({
  134. contentType: 'tipsbox',
  135. bottom: true,
  136. skin: 'bk-popup',
  137. content: '加载失败'
  138. }).show();
  139. }
  140. }
  141. }
  142. function bindEvents() {
  143. //单个服务点击
  144. $("#_service").on("tap", "li", function() {
  145. $("#_service li[data-code='" + service + "']").removeClass("active");
  146. service = $(this).attr("data-code")
  147. $(this).addClass("active");
  148. })
  149. if(service) {
  150. $("#_service li[data-code='" + service + "']").addClass("active");
  151. }
  152. }
  153. function submit() {
  154. dd.showModal();
  155. var _active = $("#_service li.active");
  156. var params = {
  157. patient: JSON.parse(window.localStorage.getItem(agentName)).represented || JSON.parse(window.localStorage.getItem(agentName)).uid,
  158. name: window.localStorage.getItem("firstName"),
  159. label: _active.attr("data-code"),
  160. labelName: _active.attr("data-name"),
  161. };
  162. sendPost('patient/saveServiceType', params, 'json', 'post', operateFailed, operateSuccesss);
  163. }
  164. //失败
  165. function operateFailed(res) {
  166. dd.close();
  167. if(res && res.msg) {
  168. dialog({
  169. contentType: 'tipsbox',
  170. bottom: true,
  171. skin: 'bk-popup',
  172. content: res.msg
  173. }).show();
  174. } else {
  175. dialog({
  176. contentType: 'tipsbox',
  177. bottom: true,
  178. skin: 'bk-popup',
  179. content: '保存失败'
  180. }).show();
  181. }
  182. }
  183. //成功调用登录接口
  184. function operateSuccesss(res) {
  185. if(res.status == 200) {
  186. dd.close();
  187. dialog({
  188. content: '保存成功',
  189. okValue: '确定',
  190. ok: function() {
  191. if(type == 4) {
  192. window.location.href = "my-detail.html?type=" + type + "&openid=" + openid;
  193. } else {
  194. if(doctor) {
  195. checkDocInWork(doctor)
  196. }
  197. }
  198. }
  199. }).showModal();
  200. } else {
  201. //非200则为失败
  202. operateFailed(res);
  203. }
  204. }
  205. //获取签约医生的工作时间
  206. function checkDocInWork(doctor) {
  207. var url = 'patient/consult/isDoctorWorkWhenconsult',
  208. params = {
  209. doctor: doctor
  210. };
  211. sendPost(url, params, 'json', 'post', queryFailed, function(res) {
  212. $("#isFocus").removeClass("disabled");
  213. if(res.status == 200) {
  214. d.close();
  215. // data:0-医生不接受咨询/1-医生当前接受咨询/2-全科医生和健管师当前都不在工作时间/3-全科医生当前不在工作时间/4-健管师当前不在工作时间 健管师当前不在工作时间
  216. if(!(res.data == "1")) {
  217. dialog({
  218. content: '您好,由于您关注的医生工作繁忙,设置了每日回复咨询的时间段,所以,在该时间段外的时间,您的咨询将不会马上获得医生的回复。',
  219. okValue: '查看医生工作时间',
  220. ok: function() {
  221. window.location.href = "../../yszx/html/doctor-work-hours.html?doctor=" + doctor;
  222. },
  223. cancelValue: '继续新增咨询',
  224. cancel: function() {
  225. window.location.href = "../../yszx/html/add-consult.html?doctorCode=" + doctor;
  226. }
  227. }).showModal();
  228. } else {
  229. //跳转到新增咨询页面
  230. window.location.href = "../../yszx/html/add-consult.html?doctorCode=" + doctor;
  231. }
  232. } else {
  233. queryFailed(res);
  234. }
  235. });
  236. }
  237. function autodivheight() { //函数:获取尺寸
  238. //获取浏览器窗口高度
  239. var divWidth = $("#_service li").width();
  240. $("#_service li").each(function() {
  241. $(this).find(".outdiv").css('height', divWidth *1.28 + 'px');
  242. })
  243. }
  244. window.onresize = autodivheight; //浏览器窗口发生变化时同时变化DIV高度
  245. </script>
  246. </body>
  247. </html>