sign_manage.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832
  1. var postUrl = "doctor/sign/sign_info";
  2. var docType;
  3. var curType;
  4. var curTypeGroup2 = 3; //记录当前续签管理下选中的tab值
  5. var yqy_iscroll, dqy_iscroll, djf_iscroll;
  6. var xq_dcl_iscroll, xq_djf_iscroll, xq_yxq_iscroll; //续签相关tab页面的iscroll
  7. var date = new Date(),
  8. dateStr = date.format("yyyy-MM-dd");
  9. mui.plusReady(function() {
  10. docType = plus.storage.getItem("docType");
  11. $('.qy-barner').removeClass('c-hide');
  12. var self = plus.webview.currentWebview();
  13. var type = curType || self.type || 0;
  14. $(".sign-comonhd").find(".sanp-flex").eq(self.type).click();
  15. // 初始化签约管理增加签约统计功能,分别统计待审核、待缴费、已签约数量。在三个页切按钮下方增加统计数字
  16. getSignCount(handleSucc9);
  17. yqy_iscroll = $('#yqy_list').lscroll({id: "yqy_iscroll", top: 67, pullUpAction: function(g){
  18. loadMore("#yqy_list", 3, g.options.page);
  19. }, pullDownAction: function(g){
  20. g.options.page = 1;
  21. getData(3, 0, handleSucc3);
  22. }});
  23. djf_iscroll = $('#djf_list').lscroll({id: "djf_iscroll", top: 67, pullUpAction: function(g){
  24. loadMore("#djf_list", 5, g.options.page);
  25. }, pullDownAction: function(g){
  26. g.options.page = 1;
  27. getData(5, 0, handleSucc5);
  28. }});
  29. dqy_iscroll = $('#dqy_list').lscroll({id: "dqy_iscroll", top: 67, pullUpAction: function(g){
  30. loadMore("#dqy_list", 1, g.options.page);
  31. }, pullDownAction: function(g){
  32. g.options.page = 1;
  33. getData(1, 0, handleSucc1);
  34. }});
  35. //初始化续签管理页面的iscroll
  36. xq_dcl_iscroll = $("#xq_dcl_list").lscroll({
  37. id: "xq_dcl_iscroll",
  38. top: 67,
  39. pullUpAction: function(g){
  40. loadMore("#xq_dcl_list", 6, g.options.page);
  41. },
  42. pullDownAction: function(g){
  43. g.options.page = 1;
  44. getXqData(1, handleSucc6);
  45. }
  46. });
  47. xq_djf_iscroll = $("#xq_djf_list").lscroll({
  48. id: "xq_djf_iscroll",
  49. top: 67,
  50. pullUpAction: function(g){
  51. loadMore("#xq_djf_list", 7, g.options.page);
  52. },
  53. pullDownAction: function(g){
  54. g.options.page = 1;
  55. getXqData(2, handleSucc7);
  56. }
  57. });
  58. xq_yxq_iscroll = $("#xq_yxq_list").lscroll({
  59. id: "xq_yxq_iscroll",
  60. top: 67,
  61. pullUpAction: function(g){
  62. loadMore("#xq_yxq_list", 8, g.options.page);
  63. },
  64. pullDownAction: function(g){
  65. g.options.page = 1;
  66. getXqData(3, handleSucc8);
  67. }
  68. });
  69. //添加初始化续签中待处理的数据,有数据时,续签管理添加小红点
  70. // getXqData(1, handleSucc6);
  71. back2home();
  72. });
  73. function getData(type, id, handelSucc, page) {
  74. sendPost(postUrl, {
  75. doctorType: docType,
  76. status: type,
  77. page: page || 1,
  78. pageSize: 10
  79. }, null, handelSucc);
  80. };
  81. function getXqData(status, handelSucc, page) {
  82. //status 1-待签约, 2-代缴费, 3-已签约
  83. var url = "/doctor/sign/sign_info_renew";
  84. sendPost(url, {
  85. status: status,
  86. page: page || 1,
  87. pageSize: 10
  88. }, null, handelSucc);
  89. };
  90. //签约管理增加签约统计功能,分别统计待审核、待缴费、已签约数量。在三个页切按钮下方增加统计数字
  91. function getSignCount(handelSucc) {
  92. var url = "/doctor/sign/sign_info_count";
  93. sendPost(url, {}, null, handelSucc);
  94. };
  95. /*
  96. * 待签约
  97. */
  98. var dqyObj;
  99. function handleSucc1(res) {
  100. plus.nativeUI.closeWaiting();
  101. if (res.status == 200) {
  102. if (res.data.list.length == 0) {
  103. $('#dqy_iscroll').hide().prev().show();
  104. return;
  105. }
  106. $('#dqy_iscroll').prev().hide();
  107. dqyObjList = _.map(res.data.list, function(o){
  108. o.jsonStr = JSON.stringify(o);
  109. return o;
  110. });
  111. dqyObj = {list: dqyObjList} ;
  112. dealTmpl(dqyObj, "dqy_tmpl", "dqy_list");
  113. $('#dqy_iscroll').show();
  114. isShowMore(res, dqy_iscroll);
  115. } else {
  116. mui.toast(res.msg);
  117. }
  118. }
  119. /*
  120. * 已签约
  121. */
  122. var yqyObj;
  123. function handleSucc3(res) {
  124. plus.nativeUI.closeWaiting();
  125. if (res.status == 200) {
  126. if (res.data.list.length == 0) {
  127. $('#yqy_iscroll').hide().prev().show();
  128. return;
  129. }
  130. $('#yqy_iscroll').prev().hide();
  131. res.docType = docType;
  132. yqyObj = res.data;
  133. dealTmpl(yqyObj, "yqy_tmpl", "yqy_list");
  134. $('#yqy_iscroll').show();
  135. isShowMore(res, yqy_iscroll);
  136. } else {
  137. mui.toast(res.msg);
  138. }
  139. }
  140. /*
  141. * 待缴费
  142. */
  143. var djfObj;
  144. function handleSucc5(res) {
  145. plus.nativeUI.closeWaiting();
  146. if (res.status == 200) {
  147. if (res.data.list.length == 0) {
  148. $('#djf_iscroll').hide().prev().show();
  149. return;
  150. }
  151. $('#djf_iscroll').prev().hide();
  152. res.docType = docType;
  153. djfObj = res.data;
  154. dealTmpl(djfObj, "djf_tmpl", "djf_list");
  155. $('#djf_iscroll').show();
  156. isShowMore(res, djf_iscroll);
  157. hasDtx();
  158. } else {
  159. mui.toast(res.msg);
  160. }
  161. }
  162. /*
  163. * 续签管理 - 待处理
  164. */
  165. var xq_dclObj;
  166. function handleSucc6(res){
  167. plus.nativeUI.closeWaiting();
  168. if (res.status == 200) {
  169. if (res.data.list.length == 0) {
  170. $('#xq_dcl_iscroll').hide().prev().show();
  171. return;
  172. }
  173. //给“续签管理”添加小红点
  174. $("#sign2").next().addClass("red-dot");
  175. $('#xq_dcl_iscroll').prev().hide();
  176. res.docType = docType;
  177. var xq_dclObjList = _.map(res.data.list,function(o){
  178. o.jsonStr = JSON.stringify(o);
  179. return o;
  180. });
  181. xq_dclObj = {list: xq_dclObjList};
  182. dealTmpl(xq_dclObj, "dqy_tmpl", "xq_dcl_list");
  183. $('#xq_dcl_iscroll').show();
  184. isShowMore(res, xq_dcl_iscroll);
  185. } else {
  186. mui.toast(res.msg);
  187. }
  188. }
  189. /*
  190. * 续签管理 - 待缴费
  191. */
  192. var xq_djfObj;
  193. function handleSucc7(res){
  194. plus.nativeUI.closeWaiting();
  195. if (res.status == 200) {
  196. if (res.data.list.length == 0) {
  197. $('#xq_djf_iscroll').hide().prev().show();
  198. return;
  199. }
  200. $('#xq_djf_iscroll').prev().hide();
  201. res.docType = docType;
  202. xq_djfObj = res.data;
  203. dealTmpl(xq_djfObj, "xq_yxq_tmpl", "xq_djf_list");
  204. $('#xq_djf_iscroll').show();
  205. isShowMore(res, xq_djf_iscroll);
  206. } else {
  207. mui.toast(res.msg);
  208. }
  209. }
  210. /*
  211. * 续签管理 - 待处理
  212. */
  213. var xq_yxqObj;
  214. function handleSucc8(res){
  215. plus.nativeUI.closeWaiting();
  216. if (res.status == 200) {
  217. if (res.data.list.length == 0) {
  218. $('#xq_yxq_iscroll').hide().prev().show();
  219. return;
  220. }
  221. $('#xq_yxq_iscroll').prev().hide();
  222. res.docType = docType;
  223. xq_yxqObj = res.data;
  224. dealTmpl(xq_yxqObj, "xq_yxq_tmpl", "xq_yxq_list");
  225. $('#xq_yxq_iscroll').show();
  226. isShowMore(res, xq_yxq_iscroll);
  227. } else {
  228. mui.toast(res.msg);
  229. }
  230. }
  231. //签约管理增加签约统计功能,分别统计待审核、待缴费、已签约数量。在三个页切按钮下方增加统计数字 (处理函数))
  232. function handleSucc9(res){
  233. plus.nativeUI.closeWaiting();
  234. if (res.status == 200) {
  235. var _signdata = res.data;
  236. $('#Pending_contract').html(_signdata.waitSignCount);
  237. $('#Pending_payment').html(_signdata.waitPayCount);
  238. $('#Signed').html(_signdata.signCount);
  239. }
  240. }
  241. function hasDtx(){
  242. sendPost("doctor/sign/is_remind_expenses_all", { }, null,
  243. function(res) {
  244. var $jfRemindAllBtn = $('#jf_all_tx');
  245. if (res.status == 200) {
  246. if(res.data == "1") { // 已经全部提醒缴费
  247. $jfRemindAllBtn.hide();
  248. } else {
  249. $jfRemindAllBtn.show();
  250. }
  251. } else {
  252. mui.toast(res.msg);
  253. }
  254. })
  255. }
  256. //判断要不要显示加载更多
  257. function isShowMore(res, curScroll){//res 数据moreObj 要显示或隐藏的加载更多按钮
  258. // var pageNow=res.data.page;//当前第几页
  259. // var pageAll=res.data.totalPage; //总共几页
  260. curScroll.refresh(res.data.list.length < 10);
  261. }
  262. /*
  263. * 拼接模板数据
  264. */
  265. function dealTmpl(res, tmplId, ulId) {
  266. document.getElementById(ulId).innerHTML = template(tmplId, res);
  267. }
  268. function isShowRemindAllBtn() {
  269. sendPost("doctor/sign/is_remind_focus_all", { }, null,
  270. function(res) {
  271. var $remindAllBtn = $('#weixin_all_tx');
  272. if (res.status == 200) {
  273. if(res.data == "1") { // 已经全部提醒关注
  274. $remindAllBtn.hide();
  275. } else {
  276. $remindAllBtn.show();
  277. }
  278. } else {
  279. mui.toast(res.msg);
  280. }
  281. })
  282. }
  283. $(function() {
  284. $(".sign-comonhd").find(".sanp-flex").click(function() {
  285. $(".sign-comonhd").find(".sanp-flex").removeClass("curr");
  286. $(this).addClass("curr");
  287. var type = $(this).index();
  288. if(type < 3){
  289. curType = type;
  290. }else{
  291. curTypeGroup2 = type;
  292. }
  293. plus.nativeUI.showWaiting("加载中,请稍候...");
  294. $(".posater-oper").hide().eq(type).show();
  295. switch (type) {
  296. case 0:
  297. if (dqyObj) {
  298. plus.nativeUI.closeWaiting();
  299. } else {
  300. getData(1, 0, handleSucc1);
  301. }
  302. break;
  303. case 1:
  304. if (djfObj) {
  305. plus.nativeUI.closeWaiting();
  306. } else {
  307. getData(5, 0, handleSucc5);
  308. }
  309. break;
  310. case 2:
  311. if (yqyObj) {
  312. plus.nativeUI.closeWaiting();
  313. } else {
  314. getData(3, 0, handleSucc3);
  315. isShowRemindAllBtn();
  316. }
  317. break;
  318. case 3:
  319. if (xq_dclObj){
  320. plus.nativeUI.closeWaiting();
  321. } else {
  322. getXqData(1, handleSucc6);
  323. }
  324. break;
  325. case 4:
  326. if (xq_djfObj){
  327. plus.nativeUI.closeWaiting();
  328. } else {
  329. getXqData(2, handleSucc7);
  330. }
  331. break;
  332. case 5:
  333. if (xq_yxqObj){
  334. plus.nativeUI.closeWaiting();
  335. }else{
  336. getXqData(3, handleSucc8);
  337. }
  338. break;
  339. }
  340. });
  341. });
  342. function toXiaoxiChuli(signStatus, jsonData){
  343. plus.nativeUI.showWaiting();
  344. var signStatus2 = 1;
  345. if(jsonData.renewFlag == "2"){
  346. signStatus2 = "9";
  347. }else if(jsonData.renewFlag == "1"){
  348. signStatus2 = "8";
  349. }
  350. sendPost("doctor/message/find", { sender: jsonData.patientCode, signStatus: signStatus2 }, null,
  351. function(res) {
  352. plus.nativeUI.closeWaiting();
  353. if (res.status == 200) {
  354. if (res.data) {
  355. if(jsonData.renewFlag){
  356. openWebview("xuqian_management.html", {
  357. patient: jsonData.patientCode,
  358. signCode: jsonData.code,
  359. renewFlag: jsonData.renewFlag,
  360. msgId: res.data.id,
  361. applyDate: jsonData.applyDate
  362. });
  363. return ;
  364. }
  365. if(docType==3){
  366. openWebviewExtras("xiaoxichuli_jg.html",
  367. { type: res.data.type,
  368. msgId: res.data.id,
  369. patiCode: res.data.sender,
  370. status: res.data.status,
  371. reason: res.data.reason,
  372. signStatus: res.data.signStatus,
  373. renewFlag: jsonData.renewFlag
  374. })
  375. }else{
  376. mui.openWindow('../html/xiaoxichuli.html', 'xiaoxichuli', {
  377. extras: {
  378. type: res.data.type,
  379. msgId: res.data.id,
  380. patiCode: res.data.sender,
  381. status: res.data.status,
  382. reason: res.data.reason,
  383. signStatus: res.data.signStatus,
  384. renewFlag: jsonData.renewFlag
  385. }
  386. });
  387. }
  388. } else {
  389. // mui.toast("未找到相关申请信息!");
  390. //屏蔽线上出现的消息已读的bug 17年6月和7月均出现过一次
  391. console.log("未找到相关的申请信息!");
  392. if(jsonData.renewFlag){
  393. openWebview("xuqian_management.html", {
  394. patient: jsonData.patientCode,
  395. signCode: jsonData.code,
  396. renewFlag: jsonData.renewFlag,
  397. msgId: '',
  398. applyDate: jsonData.applyDate
  399. });
  400. return ;
  401. }
  402. if(docType==3){
  403. openWebviewExtras("xiaoxichuli_jg.html",
  404. { type: '',
  405. msgId: '',
  406. patiCode: jsonData.patientCode,
  407. reason: '',
  408. signStatus: jsonData.status,
  409. renewFlag: jsonData.renewFlag
  410. })
  411. }else{
  412. mui.openWindow('../html/xiaoxichuli.html', 'xiaoxichuli', {
  413. extras: {
  414. type: '',
  415. msgId: '',
  416. patiCode: jsonData.patientCode,
  417. reason: '',
  418. signStatus: jsonData.status,
  419. renewFlag: jsonData.renewFlag
  420. }
  421. });
  422. }
  423. }
  424. } else {
  425. mui.toast(res.msg);
  426. }
  427. })
  428. }
  429. /*
  430. * 待缴费查看基本信息
  431. */
  432. mui("#djf_list").on("tap", ".c-list-info", function() {
  433. var patient = $(this).parent().attr("data-patient");
  434. plus.nativeUI.showWaiting();
  435. sendPost("/doctor/patient_label_info/patient", {patient: patient}, null, function(res){
  436. if(res.status==200){
  437. sendGet("/doctor/admin-teams/team/members/"+ patient, {}, null, function(res1){
  438. plus.nativeUI.closeWaiting();
  439. if(res1.status==200){
  440. openWebview("../../huanzhe/html/huanzhexinxi.html",{teamCode: res1.data.teamId, patiInfo: JSON.stringify(res.data), patiCode: res.data.code});
  441. } else
  442. mui.toast(res1.msg)
  443. })
  444. } else {
  445. plus.nativeUI.closeWaiting();
  446. mui.toast(res.msg);
  447. }
  448. })
  449. return false;
  450. });
  451. /*
  452. * 提醒
  453. */
  454. mui("#djf_list").on("tap", ".c-dtx-action", function() {
  455. var $li = $(this).parent();
  456. txjf($li.attr("data-patient"), $li.attr("data-name"), $(this));
  457. return false;
  458. });
  459. mui('#yqy_list').on("tap", ".c-to-remind-action", function() {
  460. var $li = $(this).parent();
  461. txWeixin($li.attr("data-patient"), $li.attr("data-name"), $(this));
  462. return false;
  463. });
  464. mui("#djf_list").on("tap", ".c-ytx-action", function() {
  465. return false;
  466. });
  467. /**
  468. * 全部提醒(缴费)
  469. */
  470. $('#jf_all_tx').on("tap", function(){
  471. mui.confirm("是否向所有未提醒过的未缴费居民发出缴费提醒?(如绑定手机号则短信提醒,如绑定微信则微信提醒)", "提示", ["立即提醒", "不了,谢谢"], function(e){
  472. if(e.index == 0){
  473. txjf("", "", "", 1);
  474. }
  475. })
  476. })
  477. $('#weixin_all_tx').on('tap',function() {
  478. mui.confirm("是否提醒所有未关注公众号的居民关注公众号?(居民如未绑定手机则无法提醒)", "提示", ["立即提醒", "不了,谢谢"], function(e){
  479. if(e.index == 0){
  480. txWeixin("", "", "", 1);
  481. }
  482. })
  483. })
  484. function txjf(patient, patientName, $dom, isAll){
  485. plus.nativeUI.showWaiting();
  486. sendPost("/doctor/family_contract/expenses_remind", {patient: patient || "", isAll: isAll || 0}, null, function(res){
  487. plus.nativeUI.closeWaiting();
  488. var $jfAllBtn = $('#jf_all_tx');
  489. if(res.status == 200){
  490. if(isAll==1){
  491. mui.toast("已向所有未缴费居民发出缴费提醒");
  492. $('.c-dtx-action').addClass("c-ytx-action").html("已提醒").removeClass("c-dtx-action");
  493. $jfAllBtn.hide();
  494. } else {
  495. $dom.removeClass("c-dtx-action").addClass("c-ytx-action");
  496. mui.toast(res.msg);
  497. }
  498. } else {
  499. mui.toast(res.msg);
  500. }
  501. })
  502. }
  503. function txWeixin(patient, patientName, $dom, isAll){
  504. plus.nativeUI.showWaiting();
  505. sendPost("doctor/family_contract/wechat_focus_remind", {patient: patient || "", isAll: isAll || 0}, null, function(res){
  506. plus.nativeUI.closeWaiting();
  507. var $wxAllBtn = $('#weixin_all_tx');
  508. if(res.status == 200){
  509. if(isAll==1){
  510. mui.toast("已向所有未关注公众号居民发出关注提醒");
  511. $('.c-to-remind-action').addClass("c-reminded-action").html("已提醒").removeClass("c-to-remind-action");
  512. $wxAllBtn.hide();
  513. } else {
  514. $dom.removeClass("c-to-remind-action").addClass("c-reminded-action");
  515. mui.toast(res.msg);
  516. isShowRemindAllBtn();
  517. }
  518. } else {
  519. $dom.removeClass("c-to-remind-action").addClass("c-reminded-action");
  520. mui.toast(res.msg);
  521. }
  522. })
  523. }
  524. ///doctor/family_contract/expenses_remind
  525. /*
  526. * 查看签约状态
  527. */
  528. mui("#yqy_list").on("tap", "li", function() {
  529. var patient = $(this).attr("data-patient");
  530. mui.openWindow({
  531. url: "patient-manage.html",
  532. id: "patient-manage.html",
  533. extras: {
  534. patientCode: patient,
  535. signStatus: "yqy"
  536. }
  537. })
  538. return false;
  539. });
  540. /*
  541. * 修改签约状态
  542. */
  543. mui("#dqy_list").on("tap", ".c-dqy-action", function() {
  544. var jsonStr = $(this).parent().attr("data-json");
  545. jsonStr = jsonStr && JSON.parse(jsonStr);
  546. toXiaoxiChuli(1, jsonStr);
  547. return false;
  548. });
  549. /*续签-待处理*/
  550. mui("#xq_dcl_list").on("tap", ".c-dqy-action", function(){
  551. var jsonStr = $(this).parent().attr("data-json");
  552. jsonStr = jsonStr && JSON.parse(jsonStr);
  553. var signStatus = (jsonStr.renewFlag == 1)?8:9;
  554. plus.nativeUI.showWaiting();
  555. sendPost("doctor/message/find", { sender: jsonStr.patientCode, signStatus: signStatus }, null,
  556. function(res){
  557. if(res.status == 200){
  558. if(res.data){
  559. openWebview("xuqian_management.html", {
  560. patient: jsonStr.patientCode,
  561. signCode: jsonStr.code,
  562. renewFlag: jsonStr.renewFlag,
  563. msgId: res.data.id,
  564. applyDate: jsonStr.applyDate
  565. });
  566. }else{
  567. mui.toast("未找到相关消息");
  568. }
  569. }else{
  570. mui.toast(res.msg);
  571. }
  572. plus.nativeUI.closeWaiting();
  573. });
  574. return false;
  575. });
  576. /*续签-待缴费*/
  577. mui("#xq_djf_list").on("tap", ".c-dqy-action", function(){
  578. var patient = $(this).parent().attr("data-patient");
  579. openWebview("../../huanzhe/html/huanzhexinxi.html", {patiCode: patient});
  580. return false;
  581. });
  582. /*续签-已续签*/
  583. mui("#xq_yxq_list").on("tap", ".c-dqy-action", function(){
  584. var patient = $(this).parent().attr("data-patient");
  585. openWebview("../../huanzhe/html/huanzhexinxi.html", {patiCode: patient});
  586. return false;
  587. });
  588. /*
  589. * 切换头部管理类型
  590. */
  591. /*关闭续签管理入口
  592. $(".header-select").on("tap", function(){
  593. $(".lin-mask").show();
  594. $(".lin-sel-group").show();
  595. });
  596. $(".lin-mask").on("click",function(){
  597. $(".lin-mask").hide();
  598. $(".lin-sel-group").hide();
  599. });
  600. */
  601. $(".icon-checkbox").on("change",function(e){
  602. e.preventDefault();
  603. var value = this.value;
  604. console.log(value);
  605. if(value == "2"){
  606. if(date.getFullYear() != 2017){
  607. $(".header-link").hide(); //2017年度后的提醒续签的按钮不显示
  608. }else{
  609. $(".header-link").show();
  610. }
  611. //添加小红点
  612. if($(this).next().hasClass("red-dot")){
  613. $(".header-select").find("span:eq(0)").addClass("red-dot");
  614. }
  615. $(".tab-group1").hide();
  616. $(".tab-group2").show();
  617. $(".sign-comonhd").find(".sanp-flex").eq(curTypeGroup2).click();
  618. }else{
  619. $(".header-link").hide();
  620. $(".tab-group2").hide();
  621. $(".tab-group1").show();
  622. $(".sign-comonhd").find(".sanp-flex").eq(curType).click();
  623. }
  624. $(".lin-mask").trigger("click");
  625. $("#Dtitle").html($(this).parent().find("label").html());
  626. //重新加载数据
  627. });
  628. /*提醒续签*/
  629. $(".header-link").on("tap", function(){
  630. var remindInfo = window.localStorage.getItem("remindXQ");
  631. //remindInfo = {date: '2017-05-07', remind: 1}
  632. var info = remindInfo && JSON.parse(remindInfo);
  633. if(remindInfo && (info.date == dateStr) && (info.remind == 1)){
  634. mui.toast("对不起,您今天已经全部提醒过,无法再次全部提醒");
  635. return;
  636. }
  637. var url = "/doctor/sign/sendRenewToPatients";
  638. dialog({
  639. content: "是否向所有未提醒过的待续签居民发出续签提醒?(如绑定手机号则短信提醒,如绑定微信则微信提醒)",
  640. okValue: "立即提醒",
  641. ok: function(){
  642. plus.nativeUI.showWaiting();
  643. sendPost(url, {}, null, function(res){
  644. if(res.status == 200){
  645. if(res.data == 0){
  646. mui.toast(res.msg);
  647. }else{
  648. mui.toast("已向所有待续签居民发出续签提醒");
  649. }
  650. var obj = {date: dateStr, remind: 1};
  651. localStorage.setItem("remindXQ", JSON.stringify(obj));
  652. // $(".header-link").hide();
  653. }else{
  654. mui.toast(res.msg);
  655. }
  656. plus.nativeUI.closeWaiting();
  657. }, "post", "", true);
  658. },
  659. cancelValue: "不了,谢谢",
  660. cancel: function(){}
  661. }).showModal();
  662. });
  663. /*
  664. * 加载更多
  665. */
  666. function loadMore(ulId, type, page) {
  667. plus.nativeUI.showWaiting("加载中,请稍候...");
  668. var id = $(ulId).children().last().attr("data-id");
  669. if(type == 1 || type == 3 || type == 5){
  670. getData(type, id, function(res) {
  671. if (res.status == 200) {
  672. var tmplId, domUl, curScroll;
  673. switch (type) {
  674. case 1:
  675. tmplId = "dqy_tmpl";
  676. domUl = $("#dqy_list");
  677. curScroll = dqy_iscroll;
  678. break;
  679. case 3:
  680. tmplId = "yqy_tmpl";
  681. domUl = $("#yqy_list");
  682. curScroll = yqy_iscroll;
  683. isShowRemindAllBtn();
  684. break;
  685. case 5:
  686. tmplId = "djf_tmpl";
  687. domUl = $("#djf_list");
  688. curScroll = djf_iscroll;
  689. break;
  690. }
  691. if (res.data.list.length == 0) {
  692. curScroll.refresh(true);
  693. plus.nativeUI.closeWaiting();
  694. return
  695. }
  696. if(type == 5){
  697. hasDtx();
  698. }
  699. var list = _.map(res.data.list, function(o){
  700. o.jsonStr = JSON.stringify(o);
  701. return o;
  702. })
  703. var obj = {list: list};
  704. domUl.append(template(tmplId, obj));
  705. isShowMore(res, curScroll);
  706. plus.nativeUI.closeWaiting();
  707. }
  708. }, page);
  709. }else{
  710. //续签的流程
  711. var tmplId, domUl, curScroll, status;
  712. switch (type) {
  713. case 6:
  714. tmplId = "dqy_tmpl";
  715. domUl = $("#xq_dcl_list");
  716. curScroll = xq_dcl_iscroll;
  717. status = 1;
  718. break;
  719. case 7:
  720. tmplId = "xq_yxq_tmpl";
  721. domUl = $("#xq_djf_list");
  722. curScroll = xq_djf_iscroll;
  723. isShowRemindAllBtn();
  724. status = 2;
  725. break;
  726. case 8:
  727. tmplId = "xq_yxq_tmpl";
  728. domUl = $("#xq_yxq_list");
  729. curScroll = xq_yxq_iscroll;
  730. status = 3;
  731. break;
  732. }
  733. getXqData(status, function(res){
  734. var list = _.map(res.data.list, function(o){
  735. o.jsonStr = JSON.stringify(o);
  736. return o;
  737. })
  738. var obj = {list: list};
  739. domUl.append(template(tmplId, obj));
  740. isShowMore(res, curScroll);
  741. plus.nativeUI.closeWaiting();
  742. }, page);
  743. }
  744. }
  745. window.addEventListener("updata", function() {
  746. plus.webview.currentWebview().reload(false);
  747. });
  748. window.addEventListener('reloadTab', function(e){
  749. var index = e.detail.tab;
  750. if(index > 2){
  751. curTypeGroup2 = index;
  752. xq_dclObj = null;
  753. xq_djfObj = null;
  754. }else{
  755. curType = index;
  756. }
  757. if(curType == 0 && dqyObj) {
  758. //需要重新刷新页面
  759. dqyObj = "";
  760. }else if(curType == 1 && djfObj){
  761. djfObj = "";
  762. }else if(curType == 2 && yqyObj){
  763. yqyObj = "";
  764. }
  765. $(".sign-comonhd").find(".sanp-flex:eq("+index+")").trigger("click")
  766. });
  767. template.helper("formatShowTime",function(str){
  768. if(str){
  769. return str.substr(0,16);
  770. }else{
  771. return "";
  772. }
  773. });
  774. template.helper("setPhoto", function(p) {
  775. return getImgUrl(p);
  776. });