chufangmuban.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. mui.plusReady(function(){
  2. var $no_result_wrap = $('#no_result_wrap'),
  3. $list = $('#medi_list');
  4. plus.nativeUI.showWaiting();
  5. sendPost("doctor/prescriptionInfo/getPrescriptionTemp",{}, function(){
  6. plus.nativeUI.closeWaiting();
  7. mui.toast("获取数据失败")
  8. }, function(res){
  9. plus.nativeUI.closeWaiting();
  10. if(res.status == 200){
  11. if(res.data.length>0){
  12. var html = template('template_tmp',{data:$.map(res.data,function(o,index){
  13. o.jsonStr = JSON.stringify(o);
  14. return o })
  15. })
  16. $list.html(html);
  17. $('.mui-scroll-wrapper').show();
  18. }else{
  19. $no_result_wrap.show()
  20. }
  21. }else{
  22. mui.toast("获取数据失败")
  23. }
  24. },'get')
  25. mui.init({
  26. pullRefresh : {
  27. container:'.mui-scroll-wrapper',
  28. up : {
  29. height:50,
  30. contentrefresh : "正在加载...",
  31. contentnomore:'没有更多数据了',
  32. callback: function() {
  33. this.endPullupToRefresh(false)
  34. }
  35. }
  36. }
  37. })
  38. //点击显示详情
  39. $list.on('tap','.j-li-detail',function(){
  40. var $this = $(this);
  41. mui.openWindow({
  42. id: "mubanxiangqing",
  43. url: "mubanxiangqing.html",
  44. extras: {
  45. prescriptionInfo:$this.attr('data-json')
  46. }
  47. })
  48. })
  49. //跳转搜索
  50. $('.search-input').on('tap',function(){
  51. mui.openWindow({
  52. id: "mubansousuo",
  53. url: "mubansousuo.html",
  54. extras: {
  55. }
  56. })
  57. })
  58. //点击选择
  59. $list.on('tap','.j-choose-btn',function(event){
  60. var $this = $(this);
  61. plus.storage.setItem("chooseTemplate",$this.closest('.j-li-detail').attr('data-json'))
  62. var page = plus.webview.getWebviewById("change-chufang2");
  63. if(page){
  64. mui.fire(page, "chooseTemplate");
  65. }
  66. backIndex()
  67. event.stopPropagation();
  68. })
  69. function backIndex(){
  70. //删掉搜索页面
  71. var last = plus.webview.getWebviewById("chufangmuban");
  72. if(last){
  73. last.close();
  74. }
  75. var last1 = plus.webview.getWebviewById("mubansousuo");
  76. if(last1){
  77. last1.close();
  78. }
  79. var last2 = plus.webview.getWebviewById("mubanxiangqing");
  80. if(last2){
  81. last2.close();
  82. }
  83. }
  84. })