Blame view

assets/pages/scripts/home/incomeprofile.js 29.6 KB
10646c94   Andy   add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
  /**
   * Created by mac on 18/4/10.
   */
  //时间初始化
  /*进场时间筛选框*/
  $('#incomeprofile-dateTime input').val(moment().subtract('days', 0).format('YYYY-MM-DD') + '  -  ' + moment().subtract('days', 0).format('YYYY-MM-DD'));
  $('#incomeprofile-dateTime').daterangepicker({
          // timePicker: true,
          // timePickerIncrement: 20,
          // minDate: moment().subtract('months', 2),
          startDate: moment().subtract('days', 0),
          endDate: moment().subtract('days', 0),
          opens: 'left', //日期选择框的弹出位置
          // dateLimit : {
          //     days : 6
          // },
          locale: {
              applyLabel: '确定',
              cancelLabel: '取消',
              customRangeLabel: '自定义',
              daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
              monthNames: ['一月', '二月', '三月', '四月', '五月', '六月',
                  '七月', '八月', '九月', '十月', '十一月', '十二月'],
              // format: 'MM/DD/YYYY HH:mm:ss'
          },
  
          ranges: {
              '今天': [moment().subtract('days', 0), moment().subtract('days', 0)],
              '昨天': [moment().subtract('days', 1), moment().subtract('days', 1)],
              '最近一周': [moment().subtract('days', 7), moment().subtract('days', 1)],
              // '最近一个月': [moment().subtract('months', 1), moment().subtract('days', 1)],
              // '最近三个月': [moment().subtract('months', 2), moment().subtract('days', 1)],
          },
          maxDate: moment().subtract('days', 0), //最大时间
  
      },
      function (start, end) {
          $('#incomeprofile-dateTime input').val(start.format('YYYY-MM-DD') + '  -  ' + end.format('YYYY-MM-DD'));
  
          //选择日期触发查询
          fun.queryIncomeStatisticForPayType(plNos);
          fun.queryIncomeStatistic(plNos);
      }
  );
  //地图 部分
  var map; //Map实例
  var clear_flag = false;
  //收益-按收益程度计数
  var incomeArray = [0, 0, 0, 0, 0];
  //数据
  mapData = [];
  var mapFun = {
      init: function () {
          map = new BMap.Map("allmap", {enableMapClick: false});
          //设置地图中心点,当前城市
          var point = new BMap.Point(mapData[0].lat, mapData[0].lot);
          //初始化地图,设置中心点坐标和地图级别。
          map.centerAndZoom(point, 13);
          //启用滚轮放大缩小
          map.enableScrollWheelZoom(true);
          //检测浏览器兼容
          if (typeof(Worker) === "undefined") {
              if (navigator.userAgent.indexOf("MSIE 9.0") <= 0) {
                  alert("定制个性地图示例:IE9以下不兼容,推荐使用百度浏览器、chrome、firefox、safari、IE10");
              }
          }
  
  
          mapFun.drawMarker(mapData);
          incomeStatic();
      },
      //
      drawMarker: function (mapData) {
          //清除以前的点位
          map.clearOverlays();
          //第7步:绘制点
          var marker = [];
          var poilat = null;//坐标
          var poilot = null;
          var parkNo = null;//编号
          var popAllnum = null;//总计
          var popltnum = null;//临停
          var popvipnum = null;//会员卡
          var popbjnum = null;//补缴
          var popalinum = null;//支付宝
          var popwxnum = null;//微信
          var popxjnum = null;//现金
          var popyynum = null;//余额
          var plname = null;//停车场名称
          incomeArray = [0, 0, 0, 0, 0];
          for (var i = 0; i < mapData.length; i++) {
              console.log(mapData)
              poilat = mapData[i].lat;
              poilot = mapData[i].lot;
              parkNo = mapData[i].parkNo;
              popAllnum = (mapData[i].allnum == undefined || mapData[i].allnum == null)?0:mapData[i].allnum;
              popltnum = mapData[i].ltnum;
              popvipnum = mapData[i].vipnum;
              popbjnum = mapData[i].bjnum;
              popalinum = mapData[i].alinum;
              popwxnum = mapData[i].wxnum;
              popxjnum = mapData[i].xjnum;
              popyynum = mapData[i].yynum;
              plname = mapData[i].plname;
              var point = new BMap.Point(poilat, poilot);
              incomeArray[4]++;
              if (popAllnum > 1000) {
                  incomeArray[3]++;
                  var myIcon = new BMap.Icon("../../assets/pages/img/mmap/its-park1.png", new BMap.Size(30, 40), {
                      offset: new BMap.Size(10, 40),
                      textColor: '#fff'
                  });
                  marker[i] = new BMap.Marker(point, {icon: myIcon});
                  map.addOverlay(marker[i]);
              } else if (popAllnum > 500 && popAllnum <= 1000) {
                  incomeArray[2]++;
                  var myIcon2 = new BMap.Icon("../../assets/pages/img/mmap/its-park2.png", new BMap.Size(30, 40), {
                      offset: new BMap.Size(10, 40),
                      textColor: '#fff'
                  });
                  marker[i] = new BMap.Marker(point, {icon: myIcon2});
                  map.addOverlay(marker[i]);
  
              } else if (popAllnum > 100 && popAllnum <= 500) {
                  incomeArray[1]++;
                  var myIcon3 = new BMap.Icon("../../assets/pages/img/mmap/its-park3.png", new BMap.Size(30, 40), {
                      offset: new BMap.Size(10, 40),
                      textColor: '#fff'
                  });
                  marker[i] = new BMap.Marker(point, {icon: myIcon3});
                  map.addOverlay(marker[i]);
  
              } else if (popAllnum <= 100 || popAllnum == undefined || popAllnum == "" || popAllnum == null) {
                  incomeArray[0]++;
                  var myIcon4 = new BMap.Icon("../../assets/pages/img/mmap/its-park4.png", new BMap.Size(30, 40), {
                      offset: new BMap.Size(10, 40),
                      textColor: '#fff'
                  });
                  marker[i] = new BMap.Marker(point, {icon: myIcon4});
                  map.addOverlay(marker[i]);
  
              }
              //debugger;
              marker[i].poilat = mapData[i].lat;
              marker[i].poilot = mapData[i].lot;
              marker[i].parkNo = mapData[i].parkNo;
              marker[i].popAllnum = mapData[i].allnum;
              marker[i].popltnum = mapData[i].ltnum;
              marker[i].popvipnum = mapData[i].vipnum;
              marker[i].popbjnum = mapData[i].bjnum;
              marker[i].popalinum = mapData[i].alinum;
              marker[i].popwxnum = mapData[i].wxnum;
              marker[i].popxjnum = mapData[i].xjnum;
              marker[i].popyynum = mapData[i].yynum;
              marker[i].plname = mapData[i].plname;
  
              marker[i].addEventListener("mouseover", function (n) {
  
                  var poilat = n.target.poilat;
                  var parkNo = n.target.parkNo;
                  var plname = n.target.plname;
                  var poilot = n.target.poilot;
                  var popAllnum = Number(n.target.popAllnum);
                  var popltnum = Number(n.target.popltnum);
                  var popvipnum = Number(n.target.popvipnum);
                  var popbjnum = Number(n.target.popbjnum);
                  var popalinum = Number(n.target.popalinum);
                  var popwxnum = Number(n.target.popwxnum);
                  var popxjnum = Number(n.target.popxjnum);
                  var popyynum = Number(n.target.popyynum);
  
                  addInfoWindow(poilat, parkNo, plname, poilot, popAllnum, popltnum, popvipnum, popbjnum,popalinum,popwxnum,popxjnum,popyynum);
              });
              marker[i].addEventListener("mouseout", function () {
                  closeInfoWindow();
              })
          }
          removeCluster(marker);
      }
  
  
  };
  
  //mapFun.init();
  //占用率统计条
  function incomeStatic() {
      var t1 = (incomeArray[0] * 100 / incomeArray[4]).toFixed(2);
      var t2 = (incomeArray[1] * 100 / incomeArray[4]).toFixed(2);
      var t3 = (incomeArray[2] * 100 / incomeArray[4]).toFixed(2);
  //	var t4=(incomeArray[3]*100/incomeArray[4]).toFixed(2);
      var t4 = (100 - t1 - t2 - t3).toFixed(2);
      $(".incomeprofile-per-main").find('li').eq(0).css("width", t1 + '%');
      $(".incomeprofile-per-main").find('li').eq(1).css("width", t2 + '%');
      $(".incomeprofile-per-main").find('li').eq(2).css("width", t3 + '%');
      $(".incomeprofile-per-main").find('li').eq(3).css("width", t4 + '%');
      $(".incomeprofile-per-area").find('span').eq(1).html(t1 + '%');
      $(".incomeprofile-per-area").find('span').eq(3).html(t2 + '%');
      $(".incomeprofile-per-area").find('span').eq(5).html(t3 + '%');
      $(".incomeprofile-per-area").find('span').eq(7).html(t4 + '%');
  };
  
  function removeCluster(marker) {
      if (clear_flag) {
          markerClusterer.clearMarkers();         //此步骤需要
      }
      markerClusterer = new BMapLib.MarkerClusterer(map,
          {
              markers: marker,
              styles: [{
                  url: '../../assets/pages/img/mmap/parkicon_culter.png',
                  size: new BMap.Size(53, 52),
                  zIndex: 0
              }],
          });
      markerClusterer.setMaxZoom(13);
      clear_flag = true;
  }
  //close pop弹窗
  function closeInfoWindow() {
      $(".pop_models").css('display', 'none');
  }
  //停车场信息弹窗
  function addInfoWindow(poilat, parkNo, plname, poilot, popAllnum, popltnum, popvipnum, popbjnum,popalinum,popwxnum,popxjnum,popyynum) {
  
      $('.BMapLabel').empty();
      var parkNo = parkNo;
      var poilat = poilat;
      var poilot = poilot;
      var plname = plname;
      var popAllnum = popAllnum;
      var popltnum = popltnum;
      var popvipnum = popvipnum;
      var popbjnum = popbjnum;
      var popalinum = popalinum;
      var popwxnum = popwxnum;
      var popxjnum = popxjnum;
      var popyynum = popyynum;
      var point = new BMap.Point(poilat, poilot);
      var myLabel = new BMap.Label('<div class="pop_models">' +
          '<div class="pop_toptitle ITD-common-color045">' + plname + '</div>' +
          '<div class="pop_msg"><span class="pop_bluebg"></span><span class="pop_nummsg ITD-common-color065">总计:' + popAllnum + '</span></div>' +
          '<div class="pop_msg"><span class="pop_greenbg"></span><span class="pop_nummsg ITD-common-color065">临停:' + popltnum + '</span></div>' +
          '<div class="pop_msg"><span class="pop_greenbg"></span><span class="pop_nummsg ITD-common-color065">会员卡:' + popvipnum + '</span></div>' +
          '<div class="pop_msg"><span class="pop_greenbg"></span><span class="pop_nummsg ITD-common-color065">补缴:' + popbjnum + '</span></div>' +
          '<div class="pop_toptitle ITD-common-color045">支付方式:</div>' +
          '<div class="pop_msg"><span class="pop_greenbg"></span><span class="pop_nummsg ITD-common-color065">支付宝:' + popalinum + '</span></div>' +
          '<div class="pop_msg"><span class="pop_greenbg"></span><span class="pop_nummsg ITD-common-color065">微信:' + popwxnum + '</span></div>' +
          '<div class="pop_msg"><span class="pop_greenbg"></span><span class="pop_nummsg ITD-common-color065">现金:' + popxjnum + '</span></div>' +
          '<div class="pop_msg"><span class="pop_greenbg"></span><span class="pop_nummsg ITD-common-color065">余额:' + popyynum + '</span></div>' +
          '</div>', {
          offset: new BMap.Size(30, -85),                  //label的偏移量,为了让label的中心显示在点上
          position: point
      });
  
      myLabel.setStyle({
              color: "#F0F0F0",
              fontSize: "12px",
              padding: "5px",
              whiteSpace: "normal",
              backgroundColor: "rgba(0, 0, 0, 0)",
              border: "0px",
              zIndex: "1000"
          }
      );
      map.addOverlay(myLabel);
      $('.pop_models').parent().parent().css('z-index', 99999999)
  }
  
  
  function drawPie(id, color, subtext, text, seriesData, seriesName) {
      var chart = echarts.init(document.getElementById(id));
      chart.setOption(
          {
              color: [color, '#D7D7D7'],
              title: {
                  subtext: text,
                  text: subtext,
                  textStyle: {
                      color: 'rgba(0,0,0,0.5)',
                      fontSize: '12',
                      align: 'middle',
                      verticalAlign: 'middle',
                  },
                  subtextStyle: {
                      color: '#000',
                      fontSize: '18',
                      align: 'middle',
                      verticalAlign: 'middle',
                  },
                  left: 'center',
                  top: '50',
  
              },
              tooltip: {
                  trigger: 'item',
                  show: false,
                  formatter: "{a} <br/>{b}: {c} ({d}%)"
              },
  
              series: [
                  {
                      name: seriesName,
                      hoverAnimation: false,
                      legendHoverLink: false,
                      type: 'pie',
                      hoverOffset: 5,
                      selectedOffset: 3,
                      radius: ['78%', '88%'],
                      avoidLabelOverlap: false,
                      label: {
                          normal: {
                              show: false,
                              position: 'center'
                          },
                          emphasis: {
                              show: false,
                              textStyle: {
                                  fontSize: '30',
                                  fontWeight: 'bold'
                              }
                          }
                      },
                      labelLine: {
                          normal: {
                              show: false
                          }
                      },
                      data: seriesData
                  }
              ]
          }
      );
  };
  
  
  //停车场实时收入
  function queryParkRealTimeListByPlNos(plNos) {
      var result = [];
      var req = {
          sysCode: sysComm.sysCode,
          plNos: plNos,
      };
      var realTimeAjax = {
          method: "post",
          url: dataUrl.util.queryParkRealTimeListByPlNos(),
          data: JSON.stringify(req),
          contentType: 'application/json; charset=utf-8',
          dataType: 'json',
          async: false,
          success: function (res) {
  
              if (res.code == '8888') {
                  var data = res.data;
  
                  result = data;
  
  
              } else {
                  console.log(res);
              }
          }
      };
      sysAjax(realTimeAjax);
      return result;
  };
  
  //停车场实时收入
  function queryParkRealTimeDatasByPlNos(plNos) {
      var result = [];
      var req = {
          sysCode: sysComm.sysCode,
          plNos: plNos,
      };
      var realTimeAjax = {
          method: "post",
          url: dataUrl.util.queryParkRealTimeDatasByPlNos(),
          data: JSON.stringify(req),
          contentType: 'application/json; charset=utf-8',
          dataType: 'json',
          async: false,
          success: function (res) {
  
              if (res.code == '8888') {
                  var data = res.data;
  
                  result = data;
  
  
              } else {
                  console.log(res);
              }
          }
      };
      sysAjax(realTimeAjax);
      return result;
  };
  
  
  //得到map
  function queryPlMap() {
      var map = {};
      var data = fn.getParkLot();
      $.each(data, function (index, item) {
  
          map[item.code]= item.name;
      });
  
      return map;
  }
  
  
  var chart = echarts.init(document.getElementById('tytj-echarts'));
  var option = {
      series: [{
          type: 'liquidFill',
          color: ['#63BBFF'],
          radius: '60%',
          data: [0.4],
          outline: {
              show: true,
              borderDistance: 5,
              itemStyle: {
                  color: 'none',
                  borderColor: '#38A2FF',
                  borderWidth: 5,
                  shadowBlur: 0,
                  shadowColor: 'rgba(255, 255, 255, 0)'
              }
          },
          backgroundStyle: {
              color: '#fff'
          },
          label: {
              normal: {
                  formatter: '',
                  textStyle: {
                      fontSize: 98
                  }
              }
          }
          // label: {
          //
          //     normal: {
          //         // formatter: '{a}\n{b}\nValue: {c}',
          //         textStyle: {
          //             color: 'red',
          //             insideColor: 'yellow',
          //             fontSize: 50
          //         }
          //     }
          // },
  
      }]
  };
  var plNos = [];
  chart.setOption(option);
  var fun = {
      //时间处理
      datetimeFormatter: function (value, row, index) {
          if (value == null) {
              return "";
          } else {
              return DateUtils.long2String(value, 7);
          }
      },
      getQueryParams: function () {
          var times = ($('#incomeprofile-dateTime input').val()).split("  -  ");
          var beginTime = times[0] + " 00:00:00";
          var endTime = times[1] + " 23:59:59";
          beginTime = new Date(beginTime.replace(new RegExp(/-/gm), "/"));
          endTime = new Date(endTime.replace(new RegExp(/-/gm), "/"));
          var req = {
              baseRequest: {
                  pageNum: 1,
                  pageSize: 0
              },
              plNos: plNos,
              beginTime: beginTime,
              endTime: endTime,
              sysCode: sysComm.sysCode
          };
          return req;
      },
      initPark: function () {
  
          var data = fn.getParkLot();
          mapData = [];
          for (var i = 0; i < data.length; i++) {
              plNos.push(data[i].code);
              //填充mapData
              var mapItem = {
                  parkNo: "",
                  plname: "",
                  lat: "0",
                  lot: "0",
                  allnum: "0",
                  ltnum: "0",
                  vipnum: "0",
                  bjnum: "0"
              };
              mapItem.parkNo = data[i].code;
              mapItem.plname = data[i].name;
              mapItem.lat = data[i].lonId;
              mapItem.lot = data[i].latId;
              mapData.push(mapItem);
          }
      },
      drawParkIncomeDatas: function (data) {
  
          var allIncomeFee = 0;
          var vipIncomeFee = 0;
          var backIncomeFee = 0;
          var tempIncomeFee = 0;
          if (data.length > 0) {
              $.each(data, function (index, item) {
                  allIncomeFee += item.allIncomeFee;
                  vipIncomeFee += item.vipIncomeFee;
                  backIncomeFee += item.backIncomeFee;
              });
          }
          tempIncomeFee = allIncomeFee - vipIncomeFee - backIncomeFee;
          $("#allIncome").html(fun.moneyFomatter(allIncomeFee));
          $("#tempIncome").html(fun.moneyFomatter(tempIncomeFee));
          $("#vipIncome").html(fun.moneyFomatter(vipIncomeFee));
          $("#backIncome").html(fun.moneyFomatter(backIncomeFee));
  
      },
      drawParkIncomeList: function (data) {
          //debugger;
          var html = '';
          var i = 1;
          if (data.length > 0) {
              //收入相同的情况下,按中文排序
              data.sort(function (a, b) {
                  if (b.allIncomeFee == a.allIncomeFee) {
                      return (a.plName).localeCompare(b.plName, 'zh');
                  } else {
                      return b.allIncomeFee - a.allIncomeFee;
                  }
              });
  
              $.each(data, function (index, item) {
                  html += '<li class="ITD-common-color000" ><span>' + (index + 1) + '</span><span class="ITD-cursor-pointer" title="' + item.plName + '"  value="' + item.plNo + '">' + item.plName + '</span><span>' + fun.moneyFomatter(item.allIncomeFee) + '</span></li>';
              });
          }
          else {
              //按中文排序
              mapData.sort(function (a, b) {
                  return (a.plname).localeCompare(b.plname, 'zh');
              });
              $.each(mapData, function (index, item) {
                  if (index < 10) {
                      html += '<li class="ITD-common-color000 ITD-cursor-pointer"><span>' + (index + 1) + '</span><span value="' + item.plNo + '">' + item.plname + '</span><span>' + fun.moneyFomatter(0) + '</span></li>';
                  }
              });
          }
          $(".incomeprofile-ranking").html(html);
      },
      drawParkIncomeMap: function (data) {
          //mapData初始化
          $.each(mapData, function (_index, _item) {
              //开始填充mapData
              _item.allnum = fun.moneyFomatter(0);
              _item.ltnum = fun.moneyFomatter(0);
              _item.vipnum = fun.moneyFomatter(0);
              _item.bjnum = fun.moneyFomatter(0);
              _item.alinum = fun.moneyFomatter(0);
              _item.wxnum = fun.moneyFomatter(0);
              _item.xjnum = fun.moneyFomatter(0);
              _item.yynum = fun.moneyFomatter(0);
          });
          if (data != null && data.length > 0) {
              $.each(data, function (index, item) {
                  $.each(mapData, function (_index, _item) {
                      //开始填充mapData
                      if (item.plNo == _item.parkNo) {
                          _item.allnum = fun.moneyFomatter(item.allIncomeFee);
                          _item.ltnum = fun.moneyFomatter(item.allIncomeFee - item.vipIncomeFee - item.backIncomeFee);
                          _item.vipnum = fun.moneyFomatter(item.vipIncomeFee);
                          _item.bjnum = fun.moneyFomatter(item.backIncomeFee);
                          _item.alinum = fun.moneyFomatter(item.aliFee);
                          _item.wxnum = fun.moneyFomatter(item.wxFee);
                          _item.xjnum = fun.moneyFomatter(item.cashFee);
                          _item.yynum = fun.moneyFomatter(item.balanceFee);
                      }
                  });
              });
              currentLon = mapData[0].lot;
              currentLat = mapData[0].lat;
  
          }
          //加载地图
          mapFun.init();
      },
      queryIncomeStatistic: function (plNos) {
          var req = fun.getQueryParams();
  
          var endTime = moment().format('YYYY-MM-DD');
          var reqEndTime = moment(req.endTime.getTime()).format('YYYY-MM-DD');
          var reqStartTime = moment(req.beginTime.getTime()).format('YYYY-MM-DD');
          if (reqStartTime==endTime &&  reqEndTime == endTime){
              var map = queryPlMap();
              var data = queryParkRealTimeListByPlNos(plNos)
  
              var transDatas = [];
              //debugger;
              $.each(data, function (index, item) {
  
                  var transData = {
  
                      /**停车场编号*/
                      plNo: item.plNo,
  
                      /**停车场名称*/
                      plName: map[item.plNo],
  
                      /**订单应收金额 单位:分*/
                      totalFee: item.parkIncome,
  
                      /**订单实收金额 单位:分*/
                      actFee: item.parkIncome,
  
                      /**欠费金额 单位:分*/
                      arrearageFee: item.escapeFee,
  
                      /**支付宝费用*/
                      aliFee: item.allAliIncome,
  
                      /**微信费用*/
                      wxFee: item.allWxIncome,
  
                      /**现金费用*/
                      cashFee: item.allCashIncome,
  
                      /**余额费用*/
                      balanceFee: item.allBalanceIncome,
  
                      /**停车收入 **/
                      parkIncomeFee: item.parkIncome,
  
                      /**会员卡收入 **/
                      vipIncomeFee: item.vipCardIncome,
  
                      /**补缴收入 **/
                      backIncomeFee: item.backIncome,
  
                      /**总的收入 **/
                      allIncomeFee: item.allIncome
  
                  };
  
  
                  transDatas.push(transData);
              })
  
              //停车收入概况
              fun.drawParkIncomeDatas(transDatas);
              //停车排行榜
              fun.drawParkIncomeList(transDatas);
              //停车收入地图数据
              fun.drawParkIncomeMap(transDatas);
  
              return;
  
          }
  
          var commonAjax = {
              method: "post",
              url: dataUrl.util.queryIncomeStatistic(),
              async: false,
              data: JSON.stringify(req),
              contentType: 'application/json; charset=utf-8',
              dataType: 'json',
              success: function (res) {
                  console.log(res);
                  if (res.code == '8888') {
                      if (res.data != null) {
                          var data = res.data;
                          //停车收入概况
                          fun.drawParkIncomeDatas(data);
                          //停车排行榜
                          fun.drawParkIncomeList(data);
                          //停车收入地图数据
                          fun.drawParkIncomeMap(data);
                      }
  
                  }
                  else {
                      console.log(res);
                  }
              }
          };
          sysAjax(commonAjax);
      },
      drawIncomeStatisticForPayType: function (data) {
          var wxFee = data.wxFee;
          var cashFee = data.cashFee;
          var aliFee = data.aliFee;
          var actFee = data.actFee;
          var arrearageFee = data.arrearageFee;
          var aliRate = ((aliFee * 100) / (actFee < 1 ? 1 : actFee)).toFixed(0);
          var wxRate = ((wxFee * 100) / (actFee < 1 ? 1 : actFee)).toFixed(0);
          var cashRate = ((cashFee * 100) / (actFee < 1 ? 1 : actFee)).toFixed(0);
          var otherRate = 100 - aliRate - wxRate - cashRate;
          if (actFee < 1 || otherRate < 0) {
              otherRate = (0).toFixed(0);
          }
          var totalFee = arrearageFee + actFee;
          var arrearageRate = ((arrearageFee == null ? 0 : arrearageFee) / (totalFee < 1 ? 1 : totalFee)).toFixed(4);
          var zfbData = [
              {value: Number(aliRate), name: '支付宝', selected: true},
              {value: Number(100 - aliRate), name: '总计'},
          ];
          var zfbName = '支付宝';
          drawPie('zfbMoney', '#1890FF', '支付宝', aliRate + '%', zfbData, zfbName);
  
          var wxData = [
              {value: Number(wxRate), name: '微信', selected: true},
              {value: Number(100 - wxRate), name: '总计'},
          ];
          var wxName = '微信';
          drawPie('wxMoney', '#5fe98f', '微信', wxRate + '%', wxData, wxName);
  
          var xjData = [
              {value: Number(cashRate), name: '现金', selected: true},
              {value: Number(100 - cashRate), name: '总计'},
          ];
  
          var xjName = '现金';
          drawPie('xjMoney', '#FACC14', '现金', cashRate + '%', xjData, xjName);
  
          var qtData = [
              {value: Number(otherRate), name: '其他', selected: true},
              {value: Number(100 - otherRate), name: '总计',},
          ];
          var qtName = '其他';
          drawPie('qtMoney', '#37CBCB', '其他', otherRate + '%', qtData, qtName);
  
          //逃逸金额
          $("#arrearageRate").html((arrearageRate * 100).toFixed(2) + '%');
          option.series[0].data[0] = arrearageRate;
          chart.setOption(option);
  
      },
      queryIncomeStatisticForPayType: function (plNos) {
          
          var req = fun.getQueryParams();
          var endTime = moment().format('YYYY-MM-DD');
          var reqEndTime = moment(req.endTime.getTime()).format('YYYY-MM-DD');
          var reqStartTime = moment(req.beginTime.getTime()).format('YYYY-MM-DD')
          if (reqStartTime==endTime &&  reqEndTime == endTime) {
              var map = queryPlMap();
              var item = queryParkRealTimeDatasByPlNos(plNos)
              console.log('item:');
              console.log(JSON.stringify(item));
              var transData = {
  
                  /**停车场编号*/
                  plNo: item.plNo,
  
                  /**停车场名称*/
                  plName: map[item.plNo],
  
                  /**订单应收金额 单位:分*/
                  totalFee: item.allIncome + item.escapeFee,
  
                  /**订单实收金额 单位:分*/
                  actFee: item.allIncome,
  
                  /**欠费金额 单位:分*/
                  arrearageFee: item.escapeFee,
  
                  /**支付宝费用*/
                  aliFee: item.allAliIncome,
  
                  /**微信费用*/
                  wxFee: item.allWxIncome,
  
                  /**现金费用*/
                  cashFee: item.allCashIncome,
  
                  /**余额费用*/
                  balanceFee: item.allBalanceIncome,
  
                  /**停车收入 **/
                  parkIncomeFee: item.parkIncome,
  
                  /**会员卡收入 **/
                  vipIncomeFee: item.vipCardIncome,
  
                  /**补缴收入 **/
                  backIncomeFee: item.backIncome,
  
                  /**总的收入 **/
                  allIncomeFee: item.allIncome
  
              };
  
              console.log('transData:');
              console.log(JSON.stringify(transData));
              //收入占比、逃逸统计
              fun.drawIncomeStatisticForPayType(transData);
  
              return;
  
          }
  
  
          var commonAjax = {
              method: "post",
              url: dataUrl.util.queryIncomeStatisticForPayType(),
              async: false,
              data: JSON.stringify(req),
              contentType: 'application/json; charset=utf-8',
              dataType: 'json',
              success: function (res) {
                  console.log(res);
                  if (res.code == '8888') {
                      if (res.data != null) {
                          var data = res.data;
                          //收入占比、逃逸统计
                          fun.drawIncomeStatisticForPayType(data);
                      }
  
                  }
                  else {
                      console.log(res);
                  }
              }
          };
          sysAjax(commonAjax);
      },
      moneyFomatter: function (value) {
          if (value == null) {
              return "0.00";
          }
          else {
              return (value / 100).toFixed(2);
          }
      },
  };
  fun.initPark();
  fun.queryIncomeStatisticForPayType(plNos);
  fun.queryIncomeStatistic(plNos);
  
  //定位停车场位置
  documentBindFunc.on('click','.incomeprofile-ranking li',function(){
     // debugger
     var plNo = $(this).find(".ITD-cursor-pointer").attr("value");
  
     var lot = "";
     var lat="";
     $.each(mapData,function(index,rows){
         if(rows.parkNo == plNo){
             lat = rows.lat;
             lot = rows.lot;
             return ;
         }
  
     });
      var point = new BMap.Point(lat, lot);
      map.setCenter(point);
      map.centerAndZoom(point, 20);
  });