xufangxiangqing2.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. ///管理端调用
  2. mui.plusReady(function(){
  3. var self = plus.webview.currentWebview(),
  4. prescriptionCode = self.prescriptionCode;
  5. var $patiInfo = $('#patient-info');
  6. var strOriginalData;
  7. queryData();
  8. bindEvent();
  9. function queryData(){
  10. plus.nativeUI.showWaiting();
  11. var params ={
  12. code:prescriptionCode,
  13. type: 0 //非团队长权限查看信息
  14. }
  15. sendPost("doctor/prescriptionInfo/getContinuedPrescriptionAsDoctor",params, function(){
  16. plus.nativeUI.closeWaiting();
  17. mui.toast("请求失败");
  18. }, function(res){
  19. plus.nativeUI.closeWaiting();
  20. if(res.status == 200){
  21. strOriginalData = res.data;
  22. var html = template('pati_tmp',{data:res.data,isLeader:0})
  23. $patiInfo.html(html);
  24. }else{
  25. mui.toast("获取数据失败");
  26. }
  27. },'get')
  28. }
  29. function bindEvent(){
  30. $patiInfo.on('click','#old-data',function(){
  31. mui.openWindow({
  32. id: "chufangxiangqing",
  33. url: "chufangxiangqing.html",
  34. extras: {
  35. code:strOriginalData.prescription.jwCode,
  36. patient:strOriginalData.prescription.patient
  37. }
  38. })
  39. })
  40. }
  41. template.helper('setStatus',function(o){
  42. if(o == -5){return '<span style="color: #999">线下取消</span>'}
  43. if(o == -4){return '<span style="color: #999">线下退费</span>'}
  44. if(o == -3){ return '<span style="color:#999">续方取消(24小时未支付)</span>' }
  45. if(o == -2){ return '<span style="color:#999">续方取消(居民主动取消)</span>' }
  46. if(o == -1){ return '<span style="color:#ff4c4c">审核未通过</span>' }
  47. if(o == 0 || o == 10){ return '<span style="color:#ffa54b">审核中</span>' }
  48. if(o == 2){ return '<span style="color:#ffa54b">调整中</span>' }
  49. if(o == 3){ return '<span style="color:#ffa54b">调整成功/待ca认证</span>' }
  50. if(o == 4){ return '<span style="color:#ffa54b">调整失败</span>' }
  51. if(o == 20){ return '<span style="color:#ffa54b">药师审核中</span>' }
  52. if(o == 21){ return '<span style="color:#ff4c4c">药师审核失败</span>' }
  53. if(o == 30){ return '<span style="color:#ffa54b">开方中</span>' }
  54. if(o == 31){ return '<span style="color:#ff4c4c">开方失败</span>' }
  55. if(o == 40 || o == 41){ return '<span style="color:#db6bbd">待支付</span>' }
  56. if(o == 50){ return '<span style="color:#ffa54b">配药中</span>' }
  57. if(o == 60){ return '<span style="color:#db6bbd">等待领药</span>' }
  58. if(o == 61 || o == 62 || o == 65 || o == 69){ return '<span style="color:#06bf04">配送中</span>' }
  59. if(o == 100){ return '<span style="color:#17b3ec">已完成</span>' }
  60. })
  61. template.helper('setReview',function(o){
  62. if(o == 0){ return '<span style="color:#ffa54b">审核中</span>' }
  63. if(o == 1){ return '<span style="color:#17b3ec">审核通过</span>' }
  64. if(o == -1){ return '<span style="color:#ff4c4c">审核未通过</span>' }
  65. if(o == -2){ return '<span style="color:#ff4c4c">审核无效</span>' }
  66. })
  67. template.helper('setPrescription',function(array){
  68. var arr=[];
  69. $.map(array,function(item,index){
  70. arr.push(item.name)
  71. })
  72. return arr.join(',')
  73. })
  74. template.helper('setRestTime',function(minDate,sDate){
  75. var now = getNowDate();
  76. var createDate = sDate.split(' ');
  77. var diff = getDays(createDate[0],now);
  78. if(diff<minDate){
  79. return '<span style="color:#17b3ec">'+(minDate-diff)+'天</span>'
  80. }else{
  81. return '<span style="color:#ff4c4c">已用完</span>'
  82. }
  83. })
  84. //相隔几天
  85. function getDays(sDate,eDate){
  86. var oDate1;
  87. var oDate2;
  88. var iDays;
  89. oDate1= sDate.split("-");
  90. oDate2= eDate.split("-");
  91. var strDateS = new Date(oDate1[0], oDate1[1]-1, oDate1[2]);
  92. var strDateE = new Date(oDate2[0], oDate2[1]-1, oDate2[2]);
  93. iDays = parseInt(Math.abs(strDateE - strDateS ) / 1000 / 60 / 60 /24)
  94. return iDays ;
  95. }
  96. //现在时间
  97. function getNowDate() {
  98. var date = new Date();
  99. var year = date.getFullYear();
  100. var month = date.getMonth() + 1;
  101. var day = date.getDate();
  102. var hour = date.getHours();
  103. var minute = date.getMinutes();
  104. var second = date.getSeconds();
  105. return year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day);
  106. }
  107. function reloadPageData(){
  108. queryData()
  109. }
  110. window.addEventListener("refreshXufang", function(){
  111. reloadPageData()
  112. })
  113. })