xietongfuwu-deal.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. var isGet,//0不需要请求
  2. code,
  3. type;
  4. var typeArr=[{'code':1,'name':'电话回复'},{'code':2,'name':'客服回复'}]
  5. var stateArr=[{'code':1,'name':'完成'},{'code':2,'name':'无法联系'}]
  6. var reasonArr=[{'code':1,'name':'预约成功'},{'code':2,'name':'预约失败'}]
  7. var yuyueArr=[{'code':1,'name':'没有号源'},{'code':2,'name':'病人取消'}]
  8. mui.plusReady(function(){
  9. var self = plus.webview.currentWebview();
  10. type = self.type;
  11. code = self.code;
  12. var html = template('text_tmp',{data:{time:getNowDate()},type:type})
  13. $('#show_content').html(html)
  14. bindEvents();
  15. })
  16. function bindEvents(){
  17. initMobiscroll(typeArr,$("#handle_type"),'')
  18. initMobiscroll(stateArr,$("#handle_result"),'')
  19. initMobiscroll(yuyueArr,$("#handle_cause"),'')
  20. $("#submitBtn").on('click', function(){
  21. if(type == 0){
  22. var dealType = $('#handle_type').attr('data-id');
  23. var dealState = $('#handle_result').attr('data-id');
  24. if(!dealType){
  25. mui.toast('请选择处理方式')
  26. return
  27. }
  28. if(!dealState){
  29. mui.toast('请选择处理结果')
  30. return
  31. }
  32. var params = {
  33. code:code,
  34. dealType:dealType,
  35. dealState:dealState,
  36. dealContent:$('#handle_text').val().trim()
  37. }
  38. plus.nativeUI.showWaiting();
  39. sendPost("doctor/pcCustomer/dealConsultCallService",params, function(){
  40. plus.nativeUI.closeWaiting();
  41. mui.toast("请求失败");
  42. }, function(res){
  43. plus.nativeUI.closeWaiting();
  44. if(res.status == 200){
  45. mui.toast('保存成功')
  46. refreshHz()
  47. closePage()
  48. }else{
  49. mui.toast('保存失败')
  50. }
  51. })
  52. }
  53. if(type == 1){
  54. var dealCause = $('#handle_cause').attr('data-id');
  55. if(!dealCause){
  56. mui.toast('请选择原因')
  57. return
  58. }
  59. var params = {
  60. code:code,
  61. type:2,//预约失败
  62. dealReason:dealCause,
  63. dealContent:$('#handle_yytext').val().trim()
  64. }
  65. plus.nativeUI.showWaiting();
  66. sendPost("doctor/pcCustomer/dealAppointCallService",params, function(){
  67. plus.nativeUI.closeWaiting();
  68. mui.toast("请求失败");
  69. }, function(res){
  70. plus.nativeUI.closeWaiting();
  71. if(res.status == 200){
  72. mui.toast('保存成功')
  73. refreshHz()
  74. closePage()
  75. }else{
  76. mui.toast('保存失败')
  77. }
  78. })
  79. }
  80. })
  81. }
  82. function initMobiscroll(data,$id,curid){
  83. var html = '<option disabled selected></option>';
  84. $.map(data,function(item,index){
  85. if(item.code == curid){
  86. html += '<option selected value="'+item.code+'">'+item.name+'</option>';
  87. }else{
  88. html += '<option value="'+item.code+'">'+item.name+'</option>';
  89. }
  90. })
  91. $id.html(html);
  92. $id.mobiscroll().select({
  93. theme: 'ios',
  94. lang: 'zh',
  95. display: 'bottom',
  96. placeholder:'请选择',
  97. rows:4,
  98. onSelect: function ( valueText, inst) {
  99. $id.attr('data-id',inst._tempValue)
  100. }
  101. })
  102. }
  103. //刷新事件
  104. function refreshHz(){
  105. var page = plus.webview.getWebviewById("xietongfuwu-management");
  106. if(page){ mui.fire(page, "refreshXietong") }
  107. var page1 = plus.webview.getWebviewById("xietongfuwu-message");
  108. if(page1){ mui.fire(page1, "refreshXTmsg") }
  109. }
  110. //关闭页面
  111. function closePage(){
  112. var page = plus.webview.getWebviewById("xietongfuwu-detail");
  113. if(page){ page.close('none') }
  114. var page1 = plus.webview.getWebviewById("appointment-register");
  115. if(page1){ page1.close('none') }
  116. var page2 = plus.webview.getWebviewById("hospital-dept");
  117. if(page2){ page2.close('none') }
  118. var page3 = plus.webview.getWebviewById("xietongfuwu-yy");
  119. if(page3){ page3.close('none') }
  120. var page4 = plus.webview.getWebviewById("select-doctor");
  121. if(page4){ page4.close('none') }
  122. var page5 = plus.webview.getWebviewById("doctor-detail");
  123. if(page5){ page5.close('none') }
  124. var page6 = plus.webview.getWebviewById("info-confirm");
  125. if(page6){ page6.close('none') }
  126. var page7 = plus.webview.getWebviewById("detail-appointment");
  127. if(page7){ page7.close('none') }
  128. setTimeout(function(){ mui.back() },1000)
  129. }
  130. //现在时间
  131. function getNowDate() {
  132. var date = new Date();
  133. var year = date.getFullYear();
  134. var month = date.getMonth() + 1;
  135. var day = date.getDate();
  136. var hour = date.getHours();
  137. var minute = date.getMinutes();
  138. var second = date.getSeconds();
  139. return year+'-'+(month<10?'0'+month:month)+'-'+(day<10?'0'+day:day)+' '+(hour<10?'0'+hour:hour)+':'+(minute<10?'0'+minute:minute)+':'+(second<10?'0'+second:second);
  140. }