analysis2.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802
  1. (function(doc, win) {
  2. var docEl = doc.documentElement,
  3. resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
  4. recalc = function() {
  5. var clientWidth = docEl.clientWidth;
  6. if(!clientWidth) return;
  7. docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
  8. };
  9. if(!doc.addEventListener) return;
  10. win.addEventListener(resizeEvt, recalc, false);
  11. doc.addEventListener('DOMContentLoaded', recalc, false);
  12. })(document, window);
  13. function initScroller(){
  14. scroller1 = $("#wrapper1").initScroll(
  15. {
  16. pullDownAction: function(){
  17. plus.nativeUI.showWaiting();
  18. page.init();
  19. },pullUpAction: function() {
  20. $(".pullUp").hide();
  21. return false;
  22. }
  23. }
  24. );
  25. }
  26. var mb;
  27. var docType, page, area, level, index,title,initArea,initLevel;
  28. var startDate, endDate, checked;
  29. //定义年份
  30. var chooseYear;
  31. var now = new Date();
  32. if(now.getMonth() >= 6){
  33. chooseYear = now.getFullYear();
  34. }else{
  35. chooseYear = now.getFullYear() - 1;
  36. }
  37. mui.plusReady(function() {
  38. //plusReady调用完成后才可以调用plus的api
  39. window.addEventListener("loadData", function(e) {
  40. location.reload();
  41. });
  42. //下拉刷新初始化
  43. initScroller();
  44. plus.nativeUI.showWaiting();
  45. /*管理员信息*/
  46. var sDocInfo = plus.storage.getItem("docInfo");
  47. var docInfo = JSON.parse(sDocInfo);
  48. var docSex = docInfo.sex;
  49. var docPhoto = docInfo.photo;
  50. /*传参接收*/
  51. var self = plus.webview.currentWebview();
  52. startDate = self.startDate;//开始时间
  53. endDate = self.endDate;//结束时间
  54. checked = self.checked;//时间控件选择值
  55. area = self.area;//区域或机构代码
  56. level = self.level;//级别(4:市 3:区 2:社区医院 1:团队)
  57. index = self.index;//查询指标代码 格式:(指标代码,指标代码,指标代码)
  58. title = self.title;
  59. initArea = self.area;
  60. initLevel = self.level;
  61. if(level==4){
  62. title = title.substring(0,3);
  63. }
  64. $("#title").html(title);
  65. //显示年份
  66. $(".choose-label").text(chooseYear+"年");
  67. if(chooseYear == '2016'){
  68. $("#onlineInfo").hide();
  69. }else{
  70. $("#onlineInfo").show();
  71. }
  72. // //请求获取线上缴费数据
  73. // getOnlineInfo();
  74. //
  75. //设置时间选择器默认值
  76. // var p = {from: startDate, to: endDate};
  77. // if(checked!=-1)
  78. // p = {from: checked}
  79. // dataPicker.setValue(p.from, p.to);
  80. function tab(date1,date2){
  81. var oDate1 = new Date(date1);
  82. var oDate2 = new Date(date2);
  83. var isYse=false
  84. if(oDate1.getTime() > oDate2.getTime()){
  85. isYse=false
  86. } else {
  87. isYse=true
  88. }
  89. return isYse
  90. }
  91. function today(){
  92. var c = new Date();
  93. c.setDate(c.getDate() - 1);
  94. return formatDate(c);
  95. }//昨天
  96. function getPreDate(pre){
  97. var c = new Date();
  98. c.setDate(c.getDate() - pre);
  99. return formatDate(c);
  100. }//前几天
  101. function formatDate(d){
  102. return d.getFullYear() + "-" + getMonth(d.getMonth()) + "-" + d.getDate();
  103. }
  104. function getMonth(m){
  105. m++;
  106. if(m<10)
  107. return "0" + m.toString();
  108. return m.toString();
  109. }
  110. function getEndDate() {
  111. chooseYear = parseInt(chooseYear);
  112. var endDate = new Date((chooseYear+1) + '-06-30'),
  113. now = new Date();
  114. if(now <= endDate){
  115. var month = now.getMonth()+1,
  116. date1 = now.getDate();
  117. if(month < 10){
  118. month = "0"+month;
  119. }
  120. if(date1 < 10){
  121. date1 = "0"+date1;
  122. }
  123. return now.getFullYear()+"-"+month+"-"+date1;
  124. }else{
  125. return (chooseYear+1) + '-06-30';
  126. }
  127. }
  128. page={
  129. $juZheng:$(".juzheng"),//年龄分布
  130. init:function(){
  131. this.initJs();
  132. this.initData();
  133. //console.log(startDate+" "+endDate+" "+area+" "+level+" "+index)
  134. scroller1.refresh();
  135. },
  136. initData:function(){
  137. var m=this;
  138. m.shujujiezhi(),
  139. m.jiaofeiList(startDate,endDate,area,level)
  140. m.healthList(startDate,endDate,area,level)
  141. m.groupList(startDate,endDate,area,level)
  142. m.sexList(startDate,endDate,area,level)
  143. m.agoList(startDate,endDate,area,level)
  144. //请求获取线上缴费数据
  145. if(chooseYear == '2016'){
  146. $("#onlineInfo").hide();
  147. }else{
  148. $("#onlineInfo").show();
  149. getOnlineInfo();
  150. }
  151. },//数据初始化
  152. initJs:function(){
  153. var m=this;
  154. },
  155. shujujiezhi:function(){
  156. var m=this;
  157. sendPost("/statistics/time",null,function(res){
  158. },function(res){
  159. if(res.status=="200"){
  160. var date = (res.data && res.data.substring(11,16)) || "";
  161. $(".jiezhi-time").html(date)
  162. }
  163. })
  164. },//数据截止
  165. jiaofeiList:function(startDate,endDate,area,level,index){
  166. var m=this;
  167. sendGet("/statistics/leveltwo_increment",{
  168. startDate:startDate,
  169. endDate:getEndDate(), //截止时间
  170. area:area,//
  171. level:level,
  172. index:16
  173. },function(res){
  174. },function(res){
  175. if(res.status=="200"){
  176. var data=res.data.index_16;
  177. var arry=[];
  178. // console.log("16:"+JSON.stringify(data))
  179. if(data && data.length==1 && data[0].code==0){//未缴费率为100%的情况,后台没有返回已缴费的数据
  180. $(".div-yijiaofei .y-amount").html("0");
  181. $(".div-yijiaofei .y-rate").html("0.00%");
  182. }
  183. $.each(data,function(i,v){
  184. if(v.code == 0 || v.code == 1){
  185. v.rate = parseFloat(v.rate).toFixed(2);
  186. if(v.code==1){
  187. $(".div-yijiaofei .y-amount").html(v.amount);
  188. $(".div-yijiaofei .y-rate").html(v.rate+"%");
  189. }else{
  190. $(".div-weijiaofei .y-amount").html(v.amount);
  191. $(".div-weijiaofei .y-rate").html(v.rate+"%");
  192. }
  193. arry.push({"value":v.rate, "name":v.name+" \n "+v.rate+"%"})
  194. }
  195. })
  196. m.echartsJFQKFun(arry) ;
  197. }
  198. })
  199. },
  200. //健康分布
  201. healthList:function(startDate,endDate,area,level,index){
  202. var m=this;
  203. var url = startDate==''? '/statistics/lowlevel_total' : "/statistics/leveltwo_increment";
  204. sendGet("/statistics/leveltwo_increment",{
  205. startDate:startDate,
  206. endDate:getEndDate(), //截止时间
  207. area:area,//
  208. level:level,
  209. index:15
  210. },function(res){
  211. },function(res){
  212. if(res.status=="200"){
  213. var data=res.data.index_15;
  214. // console.log("15:"+JSON.stringify(data))
  215. var arry=[];
  216. $.each(data,function(i,v){
  217. v.rate = parseFloat(v.rate).toFixed(2);
  218. arry.push({"value":v.rate, "name":v.name});
  219. });
  220. var colors = "#42C7FF,#FFC84C,#FB5DAB,#CD67FD,#795548,#607d8b,#ff5722,#cddc39,#9e9e9e,#3f51b5,#f44336,#9c27b0".split(',');
  221. var html = template('li_tmpl',{list: _.map(arry,function(v,i) {
  222. v.color = colors[i];
  223. return v;
  224. })});
  225. $('#jkCatalogs').html(html);
  226. m.echartsJKFBFun(arry,colors.slice(0,arry.length)) ;
  227. }
  228. })
  229. },
  230. //服务分布
  231. groupList:function(startDate,endDate,area,level,index){
  232. var m=this;
  233. var url = startDate==''? '/statistics/lowlevel_total' : "/statistics/leveltwo_increment";
  234. var index = ((chooseYear==2016)?7:36);
  235. sendPost("/statistics/leveltwo_increment",{
  236. startDate:startDate,
  237. endDate:getEndDate(), //截止时间
  238. area:area,
  239. level:level,
  240. index:index
  241. },function(res){
  242. },function(res){
  243. if(res.status=="200"){
  244. var data=res.data["index_"+index];
  245. // console.log("777:"+JSON.stringify(data))
  246. var total = 0;
  247. mb= {};
  248. var arry=[];
  249. if(chooseYear==2016) {
  250. $.each(data,function(i,v){
  251. if(v.code == 1 || v.code == 2 || v.code == 3 || v.code == 7){
  252. v.rate = parseFloat(v.rate).toFixed(2);
  253. arry.push({"value":v.rate, "name":v.name});
  254. if(v.code=="1"){//普通人群 #42C7FF
  255. $(".div-ptrq").html(v.rate+"%");
  256. }else if(v.code=="2"){//慢病人群65岁以下 #FFC84C
  257. $(".div-65xmbrq").html(v.rate+"%");
  258. }else if(v.code=="3"){//65岁以上人群 #FB5DAB
  259. $(".div-65srq").html(v.rate+"%");
  260. }else if(v.code=="7"){//慢病人群65岁以上 #CD67FD
  261. $(".div-65smbrq").html(v.rate+"%");
  262. }
  263. }
  264. else{
  265. mb[(v.code==100? "gat" : v.code==4? "gxy" : "tnb")] = v;
  266. total += v.amount;
  267. }
  268. })
  269. var colors = "#42C7FF,#FFC84C,#FB5DAB,#CD67FD,#795548,#607d8b,#ff5722,#cddc39,#9e9e9e,#3f51b5,#f44336,#9c27b0".split(',');
  270. var html = template('li_tmpl',{list: _.map(arry,function(v,i) {
  271. v.color = colors[i];
  272. return v;
  273. })});
  274. $('#fwCatalogs').html(html);
  275. mb["total"] = total;
  276. jbfb();
  277. m.echartsFun(arry,colors.slice(0,arry.length))
  278. $('#ser2016').show();
  279. $('#ser2017').hide();
  280. }else{
  281. $('#ser2017').show();
  282. $('#ser2016').hide();
  283. arry = _.chain(data).filter(function(v) {
  284. return !_.contains(["0","2","13"],v.code)
  285. }).map(function(v) {
  286. v.rate = parseFloat(v.rate).toFixed(2);
  287. return {"value":v.rate, "name":v.name}
  288. }).value();
  289. plus.nativeUI.closeWaiting();
  290. m.echartsFun2(arry)
  291. }
  292. }
  293. })
  294. },//分组情况
  295. sexList:function(startDate,endDate,area,level){
  296. var m=this;
  297. var url = startDate==''? '/statistics/lowlevel_total' : "/statistics/leveltwo_increment";
  298. sendGet("/statistics/leveltwo_increment",{
  299. startDate:startDate,
  300. endDate:getEndDate(), //截止时间
  301. area:area,
  302. level:level,
  303. index:6
  304. },null,function(res){
  305. if(res.status=="200"){
  306. var data=res.data.index_6;
  307. var no = {"c-1": 1, "c-2": 2, "c-3": 3};
  308. $.each(data, function(i,v){
  309. delete no["c-"+ v.code];
  310. m.rotateCyc($(".fzabout cite.a"+parseInt(v.code)), parseFloat(v.rate).toFixed(2), v.amount);
  311. })
  312. for(var k in no){
  313. m.rotateCyc($(".fzabout cite.a"+parseInt(no[k])), 0, 0);
  314. }
  315. }
  316. })
  317. },//性别情况
  318. agoList:function(startDate,endDate,area,level){
  319. var m=this;
  320. var url = startDate==''? '/statistics/lowlevel_total' : "/statistics/leveltwo_increment";
  321. var parmas={
  322. startDate:startDate,
  323. endDate:getEndDate(), //截止时间
  324. area:area,//
  325. level:level,
  326. index:8
  327. }
  328. sendGet("/statistics/leveltwo_increment",parmas,function(res){
  329. //console.log("1"+JSON.stringify(res))
  330. },function(res){
  331. //console.log("2"+JSON.stringify(res))
  332. if(res.status=="200"){
  333. var data=res.data.index_8;
  334. m.txingInit(data);
  335. }
  336. })
  337. },
  338. //健康分布
  339. echartsJKFBFun:function(arry,colors){
  340. var m=this;
  341. var myChart = echarts.init(document.getElementById('jkfb-main'));
  342. var option = {
  343. tooltip: {
  344. trigger: 'item',
  345. formatter: "{a} <br/>{b}: {c} ({d}%)"
  346. },
  347. // textStyle: {
  348. // color: '#fff',
  349. // fontStyle: 'normal',
  350. // fontSize: 16,
  351. // },
  352. color:colors,
  353. series: [
  354. {
  355. name:'访问来源',
  356. type:'pie',
  357. // center: ['50%', '50%'],
  358. radius : '65%',
  359. center:[70,'50%'],
  360. // selectedMode: 'single',
  361. // radius: [0, '100%'],
  362. // legendHoverLink:false,
  363. // hoverAnimation:false,
  364. // selectedOffset:0,
  365. label: {
  366. normal: {
  367. show: false,
  368. textStyle: {
  369. color: "#000"
  370. }
  371. // position: 'inner'
  372. }
  373. },
  374. labelLine: {
  375. normal: {
  376. show: false
  377. }
  378. },
  379. data:arry
  380. },
  381. ]
  382. };
  383. myChart.setOption(option);
  384. },
  385. //健康分布扇形统计图
  386. echartsJFQKFun:function(arry){
  387. var m=this;
  388. var myChart = echarts.init(document.getElementById('jfqk-main'));
  389. var option = {
  390. tooltip: {
  391. trigger: 'item',
  392. formatter: "{a} <br/>{b}: {c} ({d}%)"
  393. },
  394. // textStyle: {
  395. // color: '#fff',
  396. // fontStyle: 'normal',
  397. // fontSize: 16,
  398. // },
  399. color:['#909090', '#29C681'],
  400. series: [
  401. {
  402. type:'pie',
  403. radius : ['70%', '90%'],
  404. // center:[70,55],
  405. itemStyle : {
  406. normal : {
  407. label : {
  408. show : false
  409. },
  410. labelLine : {
  411. show : false
  412. }
  413. },
  414. },
  415. // selectedMode: 'single',
  416. // radius: [0, '100%'],
  417. // legendHoverLink:false,
  418. // hoverAnimation:false,
  419. // selectedOffset:0,
  420. // label: {
  421. // normal: {
  422. // textStyle: {
  423. // color: "#000"
  424. // }
  425. //// position: 'inner'
  426. // }
  427. // },
  428. labelLine: {
  429. normal: {
  430. // show: false
  431. }
  432. },
  433. data:arry
  434. },
  435. ]
  436. };
  437. myChart.setOption(option);
  438. },
  439. //服务分布2017
  440. echartsFun2:function(arry){
  441. console.log("xx:"+JSON.stringify(arry))
  442. var m=this;
  443. var myChart = echarts.init(document.getElementById('main2'));
  444. var name=[];
  445. var rate =[];
  446. $.map(arry,function(item,index){
  447. name.push(item.name)
  448. rate.push(item.value)
  449. })
  450. var option = {
  451. grid: {y: 25, y2:30, x:10, x2:10,width:$("#main2").width(),borderColor:'#ffffff'},
  452. xAxis : [
  453. {
  454. type : 'category',
  455. axisLine: {show:true,lineStyle:{color:'#dcdcdc',width:1}},
  456. axisTick: {show:false},
  457. axisLabel: {
  458. show:true,
  459. interval:0,
  460. textStyle: {
  461. color:'#333',
  462. fontSize: 14,
  463. },
  464. formatter:function(val){
  465. if(val.length>4){
  466. return val.substring(0,4)+'…'
  467. }else{
  468. return val
  469. }
  470. },
  471. },
  472. splitArea: {show:false},
  473. splitLine: {show:false},
  474. data : name
  475. }
  476. ],
  477. yAxis : [
  478. {
  479. type : 'value',
  480. show:false,
  481. axisLine: {show:true,lineStyle:{color:'#dcdcdc',width:1}},
  482. axisTick: {show:false},
  483. axisLabel: {show:false},
  484. splitArea: {show:false},
  485. splitLine: {show:false},
  486. axisLabel:{show:false}
  487. }
  488. ],
  489. dataZoom: [
  490. {
  491. type: 'inside',
  492. orient:'horizontal',
  493. filterMode:'none',
  494. zoomLock:true,
  495. zoomOnMouseWheel:false,
  496. preventDefaultMouseMove:false,
  497. xAxisIndex:0,
  498. start: 0,
  499. end: 40
  500. }
  501. ],
  502. series : [
  503. {
  504. name:'',
  505. type:'bar',
  506. barWidth:20,
  507. barMinHeight:1,
  508. label:{
  509. normal:{
  510. show:true,
  511. position:'top',
  512. formatter: '{c}%',
  513. textStyle: {
  514. color: '#333',
  515. fontSize: 14,
  516. },
  517. }
  518. },
  519. itemStyle: {normal: {color:'#17B3EC'}},
  520. data:rate
  521. }
  522. ]
  523. }
  524. myChart.setOption(option);
  525. },
  526. //服务分布2016
  527. echartsFun:function(arry,colors){
  528. console.log("xx:"+JSON.stringify(arry))
  529. var m=this;
  530. var myChart = echarts.init(document.getElementById('main'));
  531. var option = {
  532. tooltip: {
  533. trigger: 'item',
  534. formatter: "{a} <br/>{b}: {c} ({d}%)"
  535. },
  536. // textStyle: {
  537. // color: '#fff',
  538. // fontStyle: 'normal',
  539. // fontSize: 16,
  540. // },
  541. color:colors,
  542. calculable : true,
  543. series: [
  544. {
  545. name:'访问来源',
  546. type:'pie',
  547. // center: ['50%', '50%'],
  548. radius : '65%',
  549. center:[70,'50%'],
  550. // name:'访问来源',
  551. // type:'pie',
  552. // center: ['50%', '50%'],
  553. // radius : '65%',
  554. // roseType : 'radius',
  555. // radius : [20, 80],
  556. // center:[100,'50%'],
  557. // selectedMode: 'single',
  558. // radius: [0, '100%'],
  559. // legendHoverLink:false,
  560. // hoverAnimation:false,
  561. // selectedOffset:0,
  562. label: {
  563. normal: {
  564. show: false,
  565. textStyle: {
  566. color: "#000"
  567. }
  568. // position: 'inner'
  569. }
  570. },
  571. labelLine: {
  572. normal: {
  573. show: false
  574. }
  575. },
  576. data:arry
  577. },
  578. ]
  579. };
  580. myChart.setOption(option);
  581. },//服务分布扇形统计图
  582. rotateCyc:function(obj,deg,size){
  583. var deg1=360*(deg/100)
  584. if(deg<51){
  585. obj.html('<div class="fontdiv"><font>'+deg+'%</font><span>'+size+'</span></div><i class="rotate1" style="transform: rotate('+deg1+'deg);-webkit-transform: rotate('+deg1+'deg);"></i><i class="rotate2" ></i><i class="bg"></i>')
  586. }else{
  587. obj.html('<div class="fontdiv"><font>'+deg+'%</font><span>'+size+'</span></div><i class="rotate3"></i><i class="rotate4" style="transform: rotate('+deg1+'deg);-webkit-transform: rotate('+deg1+'deg);"></i><i class="bg"></i>')
  588. }
  589. },//分组情况
  590. txingInit:function(data){
  591. var m=this;
  592. var data=data;
  593. // console.log(JSON.stringify(data))
  594. /*条形图 变量*/
  595. var dataLength=data.length;
  596. var dataWidth=20
  597. if(dataLength!=0){
  598. dataWidth=100/dataLength
  599. }
  600. var html="";
  601. // var data=[{"amount":0,"code":"1","name":"0~6"},{"amount":0,"code":"2","name":"7~18"},{"amount":0,"code":"3","name":"18~30"},{"amount":0,"code":"4","name":"30~50"},{"amount":0,"code":"5","name":"50~65"},{"amount":0,"code":"1","name":">65"}]
  602. var count=0;
  603. $.each(data,function(i,v){
  604. count+=parseInt(v.amount)
  605. html+='<li style="width:'+dataWidth+'%" data-value="'+v.amount+'">'+
  606. '<h3>'+v.amount+'</h3>'+
  607. '<cite>'+
  608. '<i style="height:0%;"></i>'+
  609. '</cite>'+
  610. '<em>'+v.name+'</em>'+
  611. '</li>'
  612. })
  613. m.$juZheng.html(html)
  614. if(count!=0){//如果有数据
  615. m.$juZheng.find("li").each(function(i,v){
  616. var val=$(v).attr("data-value");
  617. $(v).find("i").css("height",(parseInt(val)/count)*100+"%")
  618. })
  619. }
  620. }
  621. }
  622. page.init()
  623. });
  624. function asse(a, t){
  625. return (a/t).toFixed(2) * 100;
  626. }
  627. function jbfb(){
  628. var parmas={
  629. startDate:startDate,
  630. endDate:endDate, //截止时间
  631. area:area,//
  632. level:level,
  633. index:8
  634. }
  635. sendPost("/statistics/sixfive_statistics", parmas, null, function(res){
  636. if(res.status==200){
  637. var total = 0;
  638. function setGlrq(t){
  639. if(t != 0){
  640. $.each(res.data, function(i, v) {
  641. if(v.amount != 0 ){
  642. if(v.code==1)
  643. $('#glrq div.gxy').css('width', asse(v.amount, t) +'%').html(v.amount);
  644. else if(v.code==2)
  645. $('#glrq div.tnb').css('width', asse(v.amount, t) +'%').html(v.amount);
  646. else if(v.code==3)
  647. $('#glrq div.gat').css('width', asse(v.amount, t) +'%').html(v.amount);
  648. else if(v.code==4)
  649. $('#glrq div.jk').css('width', asse(v.amount, t) +'%').html(v.amount);
  650. }
  651. });
  652. for(var k in mb){
  653. if(mb[k].amount != 0 )
  654. $('#mbrq div.'+ k).css('width', asse(mb[k].amount, t) +'%').html(mb[k].amount);
  655. }
  656. }
  657. }
  658. $.each(res.data, function(i, v) {
  659. if(v.code != 0){
  660. total += v.amount;
  661. }
  662. });
  663. if(total > mb.total){
  664. setGlrq(total);
  665. } else{
  666. setGlrq(mb.total);
  667. }
  668. } else
  669. mui.toast(res.msg);
  670. plus.nativeUI.closeWaiting();
  671. // console.log("65sui"+ JSON.stringify(res))
  672. })
  673. }
  674. //获取线上缴费情况信息
  675. function getOnlineInfo(){
  676. var url = "/statistics/signPayOnline",
  677. params = {
  678. level:level,
  679. area:area,
  680. year: chooseYear
  681. };
  682. sendGet(url, params, null, function(res){
  683. if(res.status == 200){
  684. $("#onlineV1").text(res.data.signPayOnlineNum);
  685. var total = parseInt(res.data.signPayOnlineNum) + parseInt(res.data.signPayUnderNum);
  686. $("#onlineV2").text(" / "+ total);
  687. }else{
  688. mui.toast(res.msg);
  689. }
  690. }, true);
  691. }
  692. var dataPicker;
  693. $(function(){
  694. dataPicker = $('#datePickDIV').lpicker({onCheck: function(){
  695. var parent = plus.webview.getWebviewById("analysis1");
  696. mui.fire(parent, "setDateVal", this.getValue());
  697. var val = this.getValue();
  698. page.groupList(val.from, val.to, area, level)
  699. page.sexList(val.from, val.to,area, level)
  700. page.agoList(val.from, val.to,area, level)
  701. }});
  702. window.addEventListener("showMask", function() {
  703. dataPicker.toggle();
  704. });
  705. //添加信息删除按钮的点击事件
  706. $("#closeBtn").on("tap", function(){
  707. $(".information").hide();
  708. scroller1.refresh();
  709. });
  710. //点击缴费情况跳转缴费情况详情页面
  711. $("#onlineInfo").on("tap", function(){
  712. if(chooseYear == '2016'){
  713. return false;
  714. }
  715. mui.openWindow({
  716. url:"pay-online-analysis.html",
  717. id: "pay-online-analysis",
  718. extras:{
  719. level: level,
  720. code: area,
  721. title: $("#title").html(),
  722. year: chooseYear
  723. }
  724. })
  725. });
  726. window.addEventListener("showInformation", function(){
  727. $(".information").show();
  728. scroller1.refresh();
  729. });
  730. })
  731. window.addEventListener("refresh", function(e) {
  732. area = e.detail.area || initArea;
  733. level = e.detail.level || initLevel;
  734. name = e.detail.name;
  735. chooseYear = e.detail.year;
  736. // console.log("area:"+area+" level:"+level+" name:"+name)
  737. $("#title").html(name);
  738. $(".choose-label").text(chooseYear+"年");
  739. if(chooseYear == '2016'){
  740. $("#onlineInfo").hide();
  741. }else{
  742. $("#onlineInfo").show();
  743. }
  744. page.init();
  745. });
  746. document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);