xietongfuwu-detail.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. var xtCode,
  2. dealState,// 处理结果
  3. xtType; //记录是哪种协同服务
  4. var $text = $('#show_content');
  5. mui.plusReady(function(){
  6. var self = plus.webview.currentWebview();
  7. xtCode = self.code;
  8. xtType = self.type;
  9. queryData()
  10. })
  11. function queryData(){
  12. plus.nativeUI.showWaiting();
  13. sendGet("doctor/pcCustomer/getCallServiceInfo",{code:xtCode}, function(){
  14. plus.nativeUI.closeWaiting();
  15. mui.toast("请求失败");
  16. }, function(res){
  17. plus.nativeUI.closeWaiting();
  18. if(res.status == 200){
  19. var html = template('text_tmp',{data:res.data})
  20. dealState = res.data.callService.dealState
  21. $text.html(html)
  22. bindEvents();
  23. }else{
  24. mui.toast("获取数据失败");
  25. }
  26. })
  27. }
  28. function bindEvents(){
  29. $('.call-btn').on('click',function(){
  30. var moblie = $(this).attr("data-tel");
  31. //观察者模式下,不可以拨打被观察者患者的电话
  32. var userAgent = plus.navigator.getUserAgent(),
  33. index = userAgent.indexOf("}"),
  34. s = userAgent.substr(0, index+1),
  35. item = JSON.parse(s);
  36. if(item.observer){
  37. mui.toast("观察者模式无法拨打患者电话");
  38. }else{
  39. if(moblie){
  40. dialog({
  41. content: moblie,
  42. okValue:'立即拨号',
  43. ok: function (){
  44. window.location.href = "tel:"+moblie;
  45. },
  46. cancelValue: '不了,谢谢',
  47. cancel: function () {
  48. return;
  49. }
  50. }).showModal();
  51. }
  52. }
  53. })
  54. $('#handle').on('click',function(){
  55. var $this = $(this)
  56. if($this.attr('data-type')==1){
  57. mui.openWindow({
  58. id: "appointment-register",
  59. url: "../../wdyy/html/appointment-register.html",
  60. extras: {
  61. patient:$this.attr('data-patient'),
  62. xtCode:xtCode
  63. }
  64. })
  65. }else{
  66. mui.openWindow({
  67. id: "xietongfuwu-deal",
  68. url: "xietongfuwu-deal.html",
  69. extras: {
  70. type:$this.attr('data-type'),
  71. code:xtCode
  72. }
  73. })
  74. }
  75. })
  76. }
  77. template.helper('setDealState',function(item){
  78. if(item == 1){return '完成'}
  79. if(item == 2){return '无法联系'}
  80. })
  81. template.helper('setDealType',function(item){
  82. if(item == 1){return '电话回复'}
  83. if(item == 2){return '客服回复'}
  84. })
  85. template.helper('setDealState2',function(item){
  86. return '无法预约'
  87. })
  88. template.helper('setDealReason',function(item){
  89. if(item == 1){return '没有号源'}
  90. if(item == 2){return '病人取消'}
  91. })