feedback-records.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. var docInfo,
  2. page1 = 0,
  3. pagesize = 10,
  4. page2 = 0;
  5. mui.init();
  6. mui.plusReady(function(){
  7. docInfo = plus.storage.getItem('docInfo');
  8. docInfo = JSON.parse(docInfo);
  9. getAccountBackData(true);
  10. getFeedbackData(true);
  11. initScroller();
  12. bindEvents();
  13. });
  14. //获取账号申诉列表
  15. function getAccountBackData(isInit){
  16. if(isInit){
  17. page1 = 0;
  18. }
  19. var url = "/doctorFeedback/feedback/findByIdcard",
  20. params = {
  21. idcard: docInfo.idcard,
  22. page: page1,
  23. pagesize: pagesize
  24. };
  25. plus.nativeUI.showWaiting();
  26. sendGet(url ,params, null, function(res){
  27. if(res.status == 200){
  28. if(res.list.length == 0){
  29. if(isInit){
  30. $("#no_result_wrap1").show();
  31. $("#result_wraper1").hide();
  32. }else{
  33. mui('#result_wraper1').pullRefresh().disablePullupToRefresh();
  34. }
  35. }else{
  36. $("#no_result_wrap1").hide();
  37. $("#result_wraper1").show();
  38. var html = template("list_tmp", {list: res.list, type: 1});
  39. if(isInit){
  40. $("#listPanel1").empty().append(html);
  41. }else{
  42. $("#listPanel1").append(html);
  43. }
  44. if(res.list.length < pagesize){
  45. mui('#result_wraper1').pullRefresh().disablePullupToRefresh();
  46. }else{
  47. page1 ++;
  48. mui('#result_wraper1').pullRefresh().enablePullupToRefresh();
  49. }
  50. }
  51. }else{
  52. mui.toast(res.msg);
  53. }
  54. plus.nativeUI.closeWaiting();
  55. }, true)
  56. }
  57. //获得意见反馈列表
  58. function getFeedbackData(isInit){
  59. if(isInit){
  60. page2 = 0;
  61. }
  62. var url = "/doctor/feedback/findByCreater",
  63. params = {
  64. page: page2,
  65. pagesize: pagesize
  66. };
  67. plus.nativeUI.showWaiting();
  68. sendGet(url, params, null, function(res){
  69. if(res.status == 200){
  70. if(res.list.length == 0){
  71. if(isInit){
  72. $("#no_result_wrap2").show();
  73. $("#result_wraper2").hide();
  74. }else{
  75. mui('#result_wraper2').pullRefresh().disablePullupToRefresh();
  76. }
  77. }else{
  78. $("#no_result_wrap2").hide();
  79. $("#result_wraper2").show();
  80. var html = template("list_tmp", {list: res.list, type: 2});
  81. if(isInit){
  82. $("#listPanel2").empty().append(html);
  83. }else{
  84. $("#listPanel2").append(html);
  85. }
  86. if(res.list.length < pagesize){
  87. mui('#result_wraper2').pullRefresh().disablePullupToRefresh();
  88. }else{
  89. page2 ++;
  90. mui('#result_wraper2').pullRefresh().enablePullupToRefresh();
  91. }
  92. }
  93. }else{
  94. mui.toast(res.msg);
  95. }
  96. plus.nativeUI.closeWaiting();
  97. }, true);
  98. }
  99. function initScroller(){
  100. //阻尼系数
  101. var deceleration = mui.os.ios?0.003:0.0009;
  102. mui('.mui-scroll-wrapper').scroll({
  103. bounce: false,
  104. indicators: true, //是否显示滚动条
  105. deceleration:deceleration
  106. });
  107. $.each(document.querySelectorAll('.mui-slider-group .mui-scroll-wrapper'), function(index, pullRefreshEl) {
  108. mui(pullRefreshEl).pullRefresh({
  109. down:{
  110. callback: function(){
  111. var self = this;
  112. setTimeout(function(){
  113. if(index == 0){
  114. getAccountBackData(true);
  115. }else{
  116. getFeedbackData(true);
  117. }
  118. self.endPulldownToRefresh();
  119. }, 1000)
  120. }
  121. },
  122. up: {
  123. callback: function() {
  124. var self = this;
  125. setTimeout(function() {
  126. if(index == 0){
  127. getAccountBackData(false);
  128. }else{
  129. getFeedbackData(false);
  130. }
  131. self.endPullupToRefresh();
  132. }, 1000);
  133. }
  134. }
  135. });
  136. });
  137. }
  138. function bindEvents(){
  139. $(".mui-control-item").on('tap', function(){
  140. var $this = $(this);
  141. if($this.hasClass("mui-active")){
  142. return false;
  143. }
  144. var index = $this.data("index");
  145. if(index == 1){
  146. getAccountBackData(true);
  147. }else{
  148. getFeedbackData(true);
  149. }
  150. });
  151. $(".mui-scroll-wrapper").on('tap', '.list-item', function(){
  152. var $this = $(this),
  153. type = $this.data('type'), // 1-账号申诉,2-意见反馈
  154. code = $this.data('code');
  155. openWebview("feedback-detail.html", {
  156. type: type,
  157. code: code
  158. });
  159. });
  160. template.helper('formatDate', function(time){
  161. if(time){
  162. return time.substr(0,16);
  163. }
  164. return "";
  165. });
  166. template.helper('getTypeValue', function(type, fkType){
  167. if(fkType == 1){
  168. switch(type){
  169. case 1:
  170. return "手机号变更";
  171. break;
  172. case 2:
  173. return "重置密码";
  174. break;
  175. case 3:
  176. return "其他";
  177. break;
  178. default:
  179. return "";
  180. break;
  181. }
  182. }else if(fkType == 2){
  183. switch(type){
  184. case 1:
  185. return "优化建议";
  186. break;
  187. case 2:
  188. return "提交bug";
  189. break;
  190. case 3:
  191. return "新功能建议";
  192. break;
  193. case 4:
  194. return "其他";
  195. break;
  196. default:
  197. return "";
  198. break;
  199. }
  200. }
  201. });
  202. template.helper("getStatus", function(status){
  203. switch(status){
  204. case 0:
  205. return "未读";
  206. break;
  207. case 1:
  208. return "待处理";
  209. break;
  210. case 2:
  211. return "已处理";
  212. break;
  213. }
  214. })
  215. }