reconciliation.js 38.7 KB
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 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058
var payOrderType_Array ={"101":"临停支付","102":"停车预付","103":"停车补缴", "104":"共享车位支付","201":"余额充值","202":"押金充值","301":"会员卡购","302":"会员卡续费"};

var fun = {
    init:function () {
//      commSelect.area_Pl_LinkedSelect("#recon-parkArea","#recon-parkIds");
        fun.dateInit();
        fun.monthdateInit();
        fun.queryReconciliationTotal();
        fun.createTableData();
    },
    //时间初始化
    dateInit:function () {
        $('#recon-daterange-btnsta').val(moment().subtract('days', 1).format('YYYY-MM-DD'));
        $('#recon-daterange-btnend').val(moment().subtract('days', 1).format('YYYY-MM-DD'));
        //开始日期
        $("#recon-daterange-btnsta").datetimepicker({
            endDate: moment().subtract('days', 1).format('YYYY-MM-DD'),
            format: 'yyyy-mm-dd',
            autoclose: true,
            startView: 2,
            //maxDate:moment().subtract('months', 3),
            minView: 2,
            forceParse: false,
            locale: "zh-CN",
            language: 'zh-CN',
            pickerPosition: "bottom-right"
        })
        $("#recon-daterange-btnend").datetimepicker({
            endDate: moment().subtract('days', 1).format('YYYY-MM-DD'),
            //startDate:startVal,
            format: 'yyyy-mm-dd',
            weekStart: 1,
            autoclose: true,
            startView: 2,
            minView: 2,
            forceParse: false,
            locale: "zh-CN",
            language: 'zh-CN',
            pickerPosition: "bottom-right"
        })
    },
    monthdateInit:function () {
        /** 月 时间初始化 **/
        $('#recon-monthdaterange-btnsta').val(moment().subtract('months', 1).format('YYYY-MM'));
        $('#recon-monthdaterange-btnend').val(moment().subtract('months', 1).format('YYYY-MM'));
        //开始日期
        $("#recon-monthdaterange-btnsta").datetimepicker({
            endDate: moment().subtract('months', 1).format('YYYY-MM'),
            format: 'yyyy-mm',
            autoclose: true,
            startView: 3,
            //maxDate:moment().subtract('months', 3),
            minView: 3,
            forceParse: false,
            locale: "zh-CN",
            language: 'zh-CN',
            pickerPosition: "bottom-right"
        })
        //结束日期
        $("#recon-monthdaterange-btnend").datetimepicker({
            endDate: moment().subtract('months', 1).format('YYYY-MM'),
            //startDate:startVal,
            format: 'yyyy-mm',
            weekStart: 1,
            autoclose: true,
            startView: 3,
            minView: 3,
            forceParse: false,
            locale: "zh-CN",
            language: 'zh-CN',
            pickerPosition: "bottom-right"
        })
    },
    /*获取查询参数*/
    getQueryParam: function () {
        debugger;
        var dateType = $('#queryType').attr('data-value');
        var busType = $("#bus_type").val(); //交易类型
        var payType = $("#pay_type").val(); //支付类型

        if(busType=="ALL" || busType==null || busType=="" || busType==undefined ){
            busType = null;
        }
        if(payType=="ALL" || payType==null || payType=="" || payType==undefined ){
            payType = null;
        }
        var beginTime;
        var endTime;
        if(dateType==1){
            beginTime = $("#recon-daterange-btnsta").val();
            endTime = $("#recon-daterange-btnend").val();
        }else{
            beginTime = $("#recon-monthdaterange-btnsta").val()+"-01";
            endTime = $("#recon-monthdaterange-btnend").val()+"-01";
        }
        beginTime = new Date(beginTime.replace(new RegExp(/-/gm) ,"/"));
        endTime = new Date(endTime.replace(new RegExp(/-/gm) ,"/"));
//      var plNos = JSON.parse($("#recon-parkIds").val());
//      if (plNos.length < 1) {
//          plNos.push("-1X");
//      }

        var req = {
            sysCode: sysComm.sysCode,
//          plNos: plNos,
            orgId: fn.getOrgId(),
            busType:busType,
            payType:payType,
            beginTime:beginTime,
            endTime:endTime,
            dateType:dateType

        };

//      req.payFinishTimeStart = req.beginTime;
//      req.payFinishTimeEnd = req.endTime;
//      req.payTypes = [1,2,4,5];

        var index =  fun.getDiffIndex();
        // qeualType /**平账类型  -1:帐未平, 0:未开始平账 1:账已平*/
        //全部
        if(index == 0){
            req.qeualType = null;
        }

        //有差异
        if(index == 1){
            req.qeualType = -1
        }
        //无差异
        if(index == 2){
            req.qeualType = 1
        }

        return req;

    },
    //数据初始化
    initDatas:function(){
        // 把id为total_div 下 span 中id属性名 结尾为Fee  Count的 赋值
//   	$("#total_div span[id$='Fee']").text("0.00");
//   	$("#total_div span[id$='Feept']").text("0.00");
//  	$("#total_div span[id$='Count']").text(0);
        //$("#total_div span[id$='AndCount']").text('0.00元/0笔');
        $("[id$='Fee']").text("0.00");
        $("[id$='Feept']").text("0.00");
    },
    queryReconciliationTotal:function(){
        fun.initDatas();
        var req = fun.getQueryParam();
        var opt = {
            method: 'post',
            url: dataUrl.util.queryReconciliationTotal(),
            data: JSON.stringify(req),
            contentType: 'application/json; charset=utf-8',
            dataType: 'json',
            success: function (res) {
                //console.log(res);
                if (res.code == '8888' && res.data != null) {
                    var data = res.data;
                    $('#wxblncaceActualFee').text(fun.moneyFormatter(data.wxActFeeForThird));
                    $('#wxblncacetuiFee').text(fun.moneyFormatter(data.wxRefundFeeForThird));
                    $('#wxblncaceActualFeept').text(fun.moneyFormatter(data.wxActFeeForPlatform));
                    $('#wxblncacetuiFeept').text(fun.moneyFormatter(data.wxRefundFeeForPlatform));

                    $('#aliblncaceActualFee').text(fun.moneyFormatter(data.aliActFeeForThird));
                    $('#aliblncacetuiFee').text(fun.moneyFormatter(data.aliRefundFeeForThird));
                    $('#aliblncaceActualFeept').text(fun.moneyFormatter(data.aliActFeeForPlatform));
                    $('#aliblncacetuiFeept').text(fun.moneyFormatter(data.aliRefundFeeForPlatform));

                }
            }
        };
        sysAjax(opt);
    },
    //默认数据 table 全部
    createTableData: function () {
        $('#recordtable').bootstrapTable('destroy').bootstrapTable({
            striped: true, //表格显示条纹
            pagination: true, //启动分页
            pageNumber: 1, //当前第几页
            // showColumns: true,
            pageSize: 10, //每页显示的记录数
            pageList: [10, 15, 20], //记录数可选列表
            sidePagination: 'server', //表示服务端分页
            queryParamsType: 'limit',
            method: 'POST', //请求方法
            // fixedColumns: true,
            // fixedNumber: 1,
            // leftFixedColumns: true,
            // leftFixedNumber: 3,
            //rightFixedColumns: true,
            //rightFixedNumber: 1,
            // selectItemName: 'personCustName',
            paginationPreText: '<',
            paginationNextText: '>',
            ajax: tableLoadRequest, //自定义ajax加载数据
            uniqueId: 'id',
            columns: [
                [
                    {
                        field: '',
                        title: '第三方',
                        valign: "middle",
                        align: 'center',
                        colspan: 6,
                        rowspan: 1,
                    },
                    {
                        field: '',
                        title: '平台',
                        valign: "middle",
                        align: 'center',
                        colspan: 5,
                        rowspan: 1,
                    },
                    {
                        field: 'checkResultType',
                        title: '差异类型',
                        width: '10%',
                        align: 'center',
                        rowspan: 2,
                        valign: "middle",
                        formatter: function (value, row, index) {
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.checkResultTypeFomatter(value)+'</div>';
                        }
                    },
                    {
                        field: 'diffFee',
                        title: '差异金额',
                        width: '10%',
                        align: 'center',
                        rowspan: 2,
                        valign: "middle",
                        formatter: function (value, row, index) {
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.moneyFormatter(value)+'</div>'

                        }
                    },

                ],
                [

                    {
                        field: 'onlineTradeTime',
                        title: '交易时间',
                        width: '15%',
                        align: "left",
                        formatter: function (value, row, index) {
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+  commonObj.timeFormatter(value)+'</div>'
                        }
                    },
                    {
                        field: 'onlineTransactionId',
                        title: '交易凭证号',
                        width: '15%',
                        align: "left"
                    },
                    {
                        field: 'onlinePayOrderId',
                        title: '商户订单号',
                        width: '15%',
                        align: "left",
                        formatter: function (value, row, index) {

//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.busTypeFomatter(value)+"-"+payOrderType_Array[row.payOrderType]+'</div>';
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+commonObj.replacenull(value)+'</div>';
                        }
                    },
                    {
                        field: 'busType',
                        title: '交易类型',
                        width: '8%',
                        align: "left",
                        formatter: function (value, row, index) {
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.busTypeFomatter(value)+'</div>';
                        }
                    },
                    {
                        field: 'onlinePayType',
                        title: '支付方式',
                        width: '8%',
                        align: "left",
                        formatter: function (value, row, index) {
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.payTypeFomatter(value)+'</div>';
                        }
                    },
                    {
                        field: 'onlineActFee',
                        title: '订单金额',
                        width: '15%',
                        align: "left",
                        formatter: function (value, row, index) {
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+commonObj.moneyFormatter(value)+'</div>';
                        }
                    },
                    {
                        field: 'payOrderId',
                        title: '支付单号',
                        width: '15%',
                        align: "left",
                        formatter: function (value, row, index) {

                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+commonObj.replacenull(value)+'</div>';
                        }
                    },
                    {
                        field: 'payOrderType',
                        title: '交易场景',
                        width: '8%',
                        align: "left",
                        formatter: function (value, row, index) {
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.payOrderTypeFomatter(row,value)+'</div>';
                        }
                    },


                    {
                        field: 'actFee',
                        title: '交易金额(元)',
                        width: '15%',
                        align: "left",
                        formatter: function (value, row, index) {
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+commonObj.moneyFormatter(value)+'</div>'
                        }
                    },
                    {
                        field: 'payFinishTime',
                        title: '支付完成时间',
                        width: '15%',
                        align: "left",
                        formatter: function (value, row, index) {
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+commonObj.timeFormatter(value)+'</div>'
                        }
                    },
                    {
                    field: 'plName',
                    title: '停车场名称',
                    width: '15%',
                    align: "left",
                    formatter: function (value, row, index) {
                        if(value !=null && value !="" && value!=undefined){
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+value+'</div>';
                        }else{
                            return '<div class="ITD-common-fontsize12 ITD-common-color070" >-</div>';
                        }

                    }
                },



                ],

            ]
        });

    },
//  //数据 table 有差异
//  variantCreateTableData: function () {
//      $('#recordtable').bootstrapTable('destroy').bootstrapTable({
//          striped: true, //表格显示条纹
//          pagination: true, //启动分页
//          pageNumber: 1, //当前第几页
//          // showColumns: true,
//          pageSize: 10, //每页显示的记录数
//          pageList: [10, 15, 20], //记录数可选列表
//          sidePagination: 'server', //表示服务端分页
//          queryParamsType: 'limit',
//          method: 'POST', //请求方法
//          fixedColumns: true,
//          fixedNumber: 1,
//          leftFixedColumns: true,
//          leftFixedNumber: 3,
//          //rightFixedColumns: true,
//          //rightFixedNumber: 1,
//          // selectItemName: 'personCustName',
//          paginationPreText: '<',
//          paginationNextText: '>',
//          ajax: tableLoadRequest, //自定义ajax加载数据
//          uniqueId: 'id',
//          columns: [
//              {
//                  field: 'reportDate',
//                  title: '<span class="time-icon"></span>交易时间',
//                  width: '15%',
//                  visible: true,
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      // console.log(row.plNo)
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+value+'</div>'
//
//                  }
//              },
//              {
//                  field: 'payType',
//                  title: '<span class="moneydifference-icon"></span>交易类型',
//                  width: '10%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.payTypeFomatter(value)+'</div>';
//                  }
//              },
//              {
//                  field: 'payType',
//                  title: '<span class="moneydifference-icon"></span>支付方式',
//                  width: '10%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.payTypeFomatter(value)+'</div>';
//                  }
//              },
//              {
//                  field: 'payOrderId',
//                  title: '<span class="moneydifference-icon"></span>交易单号',
//                  width: '15%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+value+'</div>';
//                  }
//              },
//              {
//                  field: 'transactionId',
//                  title: '<span class="money-icon"></span>第三方交易流水',
//                  width: '15%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+value+'</div>'
//                  }
//              },
//              {
//                  field: 'orderActFee',
//                  title: '<span class="money-icon"></span>支付单金额',
//                  width: '10%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.moneyFormatter(value)+'</div>'
//                  }
//              },
//              {
//                  field: 'orderActFee',
//                  title: '<span class="money-icon"></span>第三方金额',
//                  width: '15%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      var actFee = (row.orderActFee == null?0:row.orderActFee);
//                      var diffFee = (row.diffFee == null?0:row.diffFee);
//
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.moneyFormatter(actFee + diffFee)+'</div>'
//                  }
//              },
//              {
//                  field: 'diffFee',
//                  title: '<span class="moneydifference-icon"></span>差异金额',
//                  width: '10%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.moneyFormatter(value)+'</div>'
//                  }
//              },
//
//          ]
//      });
//  },
//  //数据 table 无差异
//  normalCreateTableData: function () {
//      $('#recordtable').bootstrapTable('destroy').bootstrapTable({
//          striped: true, //表格显示条纹
//          pagination: true, //启动分页
//          pageNumber: 1, //当前第几页
//          // showColumns: true,
//          pageSize: 10, //每页显示的记录数
//          pageList: [10, 15, 20], //记录数可选列表
//          sidePagination: 'server', //表示服务端分页
//          queryParamsType: 'limit',
//          method: 'POST', //请求方法
//          fixedColumns: true,
//          fixedNumber: 1,
//          leftFixedColumns: true,
//          leftFixedNumber: 3,
//          //rightFixedColumns: true,
//          //rightFixedNumber: 1,
//          // selectItemName: 'personCustName',
//          paginationPreText: '<',
//          paginationNextText: '>',
//          ajax: tableLoadRequest, //自定义ajax加载数据
//          uniqueId: 'id',
//          columns: [
//              {
//                  field: 'reportDate',
//                  title: '<span class="time-icon"></span>交易时间',
//                  width: '15%',
//                  visible: true,
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      // console.log(row.plNo)
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+value+'</div>'
//
//                  }
//              },
//              {
//                  field: 'payType',
//                  title: '<span class="moneydifference-icon"></span>交易类型',
//                  width: '10%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.payTypeFomatter(value)+'</div>';
//                  }
//              },
//              {
//                  field: 'payType',
//                  title: '<span class="moneydifference-icon"></span>支付方式',
//                  width: '10%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.payTypeFomatter(value)+'</div>';
//                  }
//              },
//              {
//                  field: 'payOrderId',
//                  title: '<span class="moneydifference-icon"></span>交易单号',
//                  width: '15%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+value+'</div>';
//                  }
//              },
//              {
//                  field: 'diffFee',
//                  title: '<span class="money-icon"></span>第三方交易流',
//                  width: '15%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.moneyFormatter(value)+'</div>'
//                  }
//              },
//              {
//                  field: 'diffFee',
//                  title: '<span class="money-icon"></span>支付单金额',
//                  width: '10%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.moneyFormatter(value)+'</div>'
//                  }
//              },
//              {
//                  field: 'diffFee',
//                  title: '<span class="money-icon"></span>第三方金额',
//                  width: '15%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.moneyFormatter(value)+'</div>'
//                  }
//              },
//              {
//                  field: 'diffFee',
//                  title: '<span class="moneydifference-icon"></span>差异金额',
//                  width: '10%',
//                  align: "left",
//                  formatter: function (value, row, index) {
//                      return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.moneyFormatter(value)+'</div>'
//                  }
//              },
//
//          ]
//      });
//  },
    //数量处理
    numberFormatter: function (value) {
        if (value == 0 || value == undefined || value == null) {
            return 0;
        } else {
            return value;
        }
    },
    moneyFormatter:function(value){
        if(value==null|| value == 0){
            return "0.00";
        }
        else{
            return (value/100).toFixed(2);
        }
    },
    payTypeFomatter:function(value){
        if(value == 1){
            return '支付宝';
        }else if(value == 2 || value == 4){
            return '微信';
        }else if(value == 5){
            return '余额';
        }else if(value == 3){
            return '银联';
        }else if(value == 6){
            return '现金';
        }else if(value == 7){
            return 'IC卡';
        }
    },
//  busTypeFomatter:function(value){
//      //101:停车付款单,102:停车预付单,103:停车补缴单,104:共享车位;201:余额充值单,202:押金充值;301:会员卡购买单,302:会员卡续费
//      return '交易';
//
//		if(value == 1){
//  		return '交易';
//  	}else if(value == 2){
//  		return '退款';
//  	}else{
//  		return '未知';
//  	}
//	},
    busTypeFomatter:function(value){
        //业务类型: 1:收入 2:退款 3:支出
        if(value == 1){
            return '交易';
        }else if(value == 2){
            return '退款';
        }else if(value == 3){
            return '支出';
        }else{
            return '未知';
        }
    },
    payTypeFomatter:function(value){
        //业务类型: 1:收入 2:退款 3:支出
        if(value == 1){
            return '支付宝';
        }else if(value == 2){
            return '微信';
        }else if(value == 3){
            return '银联';
        }else if(value == 4){
            return '服务号';
        }else{
            return '未知';
        }
    },
    onlinePayTypeFomatter:function(value){
        //交易状态
        if(value == 1){
            return '成功';
        }else{
            return '失败';
        }
    },
    checkResultTypeFomatter:function(value){
        //1-长款 2-短款 3-平账*/
        if(value == 1){
            return '长款';
        }else if(value == 2){
            return '短款';
        }else{
            return '平账';
        }
    },
    payOrderTypeFomatter:function(row,value){
        //101:停车付款单,102:停车预付单,103:停车补缴单,104:共享车位;201:余额充值单,202:押金充值;301:会员卡购买单,302:会员卡续费
        if(value == 101){
            return '交易-临停支付';
        }else if(value == 102){
            return '交易-停车预付';
        }else if(value == 103){
            return '交易-停车补缴';
        }else if(value == 104){
            return '交易-共享车位预定';
        }else if(value == 201){
            if(row.terminalSource!='' ||row.terminalSource!=null ||row.terminalSource!=undefined||row.terminalSource!='null'){
                if(row.terminalSource == 1){
                    return '交易-余额充值';
                } else if(row.terminalSource == 2){
                    return '交易-收费员充值';
                }else {
                    return '交易-余额充值';
                }
            }
            else{
                return '交易-余额充值';
            }

        }else if(value == 202){
            return '交易-押金充值';
        }else if(value == 301){
            return '交易-会员卡购买';
        }else if(value == 302){
            return '交易-会员卡续费';
        }else{
            return '未知';
        }
    },
    strFomatter:function(value){
        if(value == undefined || value == null ){
            return '-';
        }
        return value;

    },
    dateTimeFormatter: function(value, row, index) {
        if(value == null) {
            return "";
        } else {
            return DateUtils.long2String(value, 7);
        }
    },
    //获取差异类型下标
    getDiffIndex:function(){
        return $('#tab-btn-wrap li.tabAction').index();
    },

    //弹窗 table数据
    createdetailTableData:function (id) {
        id.bootstrapTable('destroy').bootstrapTable({
            striped: true, //表格显示条纹
            pagination: true, //启动分页
            pageNumber: 1, //当前第几页
            // showColumns: true,
            pageSize: 10, //每页显示的记录数
            pageList: [10, 15, 20], //记录数可选列表
            sidePagination: 'server', //表示服务端分页
            queryParamsType: 'limit',
            method: 'POST', //请求方法
            fixedColumns: true,
            fixedNumber: 1,
            leftFixedColumns: true,
            leftFixedNumber: 3,
            //rightFixedColumns: true,
            //rightFixedNumber: 1,
            // selectItemName: 'personCustName',
            paginationPreText: '<',
            paginationNextText: '>',
            ajax: tableLoadDetailRequest, //自定义ajax加载数据
            uniqueId: 'id',
            columns: [
                {
                    field: 'payFinishTime',
                    title: '<span class="time-icon"></span>交易时间',
                    width: '10%',
                    align: "left",
                    formatter: function (value, row, index) {
                        // console.log(row.plNo)
                        return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.dateTimeFormatter(value)+'</div>'

                    }
                },
                {
                    field: 'busType',
                    title: '<span class="money-icon"></span>类型',
                    width: '10%',
                    align: "left",
                    formatter: function (value, row, index) {
                        return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.busTypeFomatter(value)+'</div>'

                    }
                },
                {
                    field: 'payOrderId',
                    title: '<span class="carflow-icon"></span>支付单号',
                    width: '10%',
                    align: "left",
                    formatter: function (value, row, index) {
                        return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.strFomatter(value)+'</div>'
                    }
                },
                {
                    field: 'transactionId',
                    title: '<span class="device-icon"></span>第三方交易流水号',
                    width: '10%',
                    align: "left",
                    formatter: function (value, row, index) {
                        return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.strFomatter(value)+'</div>'
                    }
                },
                {
                    field: 'actFee',
                    title: '<span class="person-icon"></span>支付单金额',
                    width: '10%',
                    align: "left",
                    formatter: function (value, row, index) {
                        return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.moneyFormatter(value)+'</div>'
                    }
                },
                {
                    field: 'blncaceActualFee',
                    title: '<span class="person-icon"></span>第三方金额',
                    width: '10%',
                    align: "left",
                    formatter: function (value, row, index) {
                        return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.moneyFormatter(value)+'</div>'
                    }
                },
                {
                    field: 'diffFee',
                    title: '<span class="person-icon"></span>差异金额',
                    width: '10%',
                    align: "left",
                    formatter: function (value, row, index) {
                        return '<div class="ITD-common-fontsize12 ITD-common-color070" >'+fun.moneyFormatter(value)+'</div>'
                    }
                },


            ]
        });

    },
};
fun.init();
//查询
documentBindFunc.on('click', '#recon-queryBtn', function () {
    fun.queryReconciliationTotal();
    fun.createTableData();
});
//切换  全部 有差异 无差异
$('#tab-btn-wrap li').on('click',function () {
    //因后面逻辑需要,一定要线切换 tabAction 样式, 然后在调用 对应的函数
    $(this).addClass('tabAction').siblings().removeClass('tabAction');
    fun.createTableData();
});



//导出
var InterValObj; //timer变量,控制时间
var count = 8; //间隔函数,1秒执行
var curCount;//当前剩余秒数

function sendMessage() {
    curCount = count;
    //设置button效果,开始计时
    $("#caryardReport").attr("disabled", "true");
    $(".ITD-export-btn").css("width", "138px");
    $("#caryardReport").val(curCount + "秒后可再次导出");
    InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器,1秒执行一次
}

//timer处理函数
function SetRemainTime() {
    if (curCount == 0) {
        window.clearInterval(InterValObj);//停止计时器
        $("#caryardReport").removeAttr("disabled");//启用按钮
        $(".ITD-export-btn").css("width", "72px");
        $("#caryardReport").val("导出");
    }
    else {
        curCount--;
        $("#caryardReport").val(curCount + "秒后可再次导出");
    }
}
//导出excle
documentBindFunc.on('click','#caryardReport',function (){
    //获取table所有行数据
    var parkLot = $("#recordtable").bootstrapTable('getData');
    //获取table总条数
    var numTotal = $("#recordtable").bootstrapTable('getOptions').totalRows;
    //提示 无数据不导出
    if(parkLot.length<1){
        $('.ITD-alertmodel-contentmsg').text('无数据可导出!');
        $('#ITD-tipsmodel').modal('show');
        setTimeout(function () {
            $('.ITD-alertmodel-contentmsg').text('');
            $('#ITD-tipsmodel').modal('hide');
        },3000);
        return false;
    }
    //超1万条 缩短查询范围
    if(numTotal>10000){
        $('.ITD-alertmodel-contentmsg').text('数据量过大,请缩小查询范围!');
        $('#ITD-tipsmodel').modal('show');
        setTimeout(function () {
            $('.ITD-alertmodel-contentmsg').text('');
            $('#ITD-tipsmodel').modal('hide');
        },3000);
        return false;
    }

    //执行倒计时函数
    sendMessage();

    var req = fun.getQueryParam();
    var url = dataUrl.util.exportReconciliationForPage();
    var forms = exportDetailForm(url, req.beginTime, req.endTime,req.dateType,req.qeualType,req.orgId,req.busType,req.payType);
    forms.submit();
});
function exportDetailForm(url, beginTime, endTime, dateType,qeualType,orgId,busType,payType) {

    var form = document.createElement("form");
    form.style.display = 'none';
    form.action = url;
    form.method = "post";
    document.body.appendChild(form);

    var input = document.createElement("input");
    input.name = "beginTime";
    input.value = beginTime;
    form.appendChild(input);

    var input2 = document.createElement("input");
    input2.name = "endTime";
    input2.value = endTime;
    form.appendChild(input2);

    var input3 = document.createElement("input");
    input3.name = "orgId";
    input3.value = orgId;
    form.appendChild(input3);

    var input4 = document.createElement("input");
    input4.name = "dateType";
    input4.value = dateType;
    form.appendChild(input4);

    var input6 = document.createElement("input");
    input6.name = "sysCode";
    input6.value = sysComm.sysCode;
    form.appendChild(input6);

    var input7 = document.createElement("input");
    input7.name = "qeualType";
    input7.value = qeualType;
    form.appendChild(input7);

    var input8 = document.createElement("input");
    input8.name = "busType";
    input8.value = busType;
    form.appendChild(input8);

    var input9 = document.createElement("input");
    input9.name = "payType";
    input9.value = payType;
    form.appendChild(input9);




    return form;
}

//查看明细 弹窗
documentBindFunc.on('click', '#recon-detailIfo', function () {
    fun.createdetailTableData($("#detailtable"));
    $('#recon_detailmodel').modal('show');
});
/**
 *弹窗切换
 **/
$('#ITD-alert-tab-wrap li').on('click', function () {
    var _index = $(this).index();
    var _id = $("#detailtable");
    if (0 == _index) {
        _id = $("#detailtable");
    } else if (1 == _index) {
        _id = $("#alipaytable");
    } else {
        console.log(33333);
        _id = $("#resitable");
    }
    $('#ITD-alert-tab-wrap>li').eq(_index).addClass('ITD-alert-tab-active').siblings().removeClass('ITD-alert-tab-active');
    $('#ITD-alertcon-tab-wrap>li').eq(_index).removeClass('display-none').siblings().addClass('display-none');
    fun.createdetailTableData(_id);
});
/**
 * 自定义table AJAX请求
 * @param {Object} params
 */
function tableLoadRequest(params) {
    var req = fun.getQueryParam();
    //设置请求参数
    var pageNum = (params.data.offset / params.data.limit) + 1;

    //条件查询
    req.baseRequest = {
        pageNum: pageNum,
        pageSize: params.data.limit
    };

    var opt = {
        method: 'post',
        url: dataUrl.util.queryReconciliationForPage(),
        data: JSON.stringify(req),
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function (res) {
            //console.log(res);
            if (res.code == '8888') {
                params.success(res.data);
            }
        }
    };
    sysAjax(opt);
}
/**
 * 自定义table AJAX请求
 * @param {Object} params
 */
function tableLoadDetailRequest(params) {
    var req = fun.getQueryParam();
    var _index = $("#ITD-alert-tab-wrap .ITD-alert-tab-active").index();
    var payTypes=[];
    if(_index == 0){
        payTypes=[2,4];
    }else if(_index == 1){
        payTypes=[1];
    }else if(_index == 2){
        payTypes=[5];
    } else if(_index == 0){
        payTypes=[1,2,3,4,5,6,7];
    }
    //设置请求参数
    var pageNum = (params.data.offset / params.data.limit) + 1;

    //条件查询
    req.baseRequest = {
        pageNum: pageNum,
        pageSize: params.data.limit
    };
    req.sysCode = sysComm.sysCode;
    req.payTypes = payTypes;
    var opt = {
        method: 'post',
        url: dataUrl.util.queryReconciliationBillDetailForPage(),
        data: JSON.stringify(req),
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function (res) {
            //console.log(res);
            if (res.code == '8888') {
                params.success(res.data);
            }
        }
    };
    sysAjax(opt);
}

//切换 搜索部分 是否生效
documentBindFunc.on('click', "#recon-toptab div.ITD-graynav-topbar", function () {
    var index = $(this).index();
    $(this).addClass('ITD-graynav-topbaractive').siblings('div').removeClass('ITD-graynav-topbaractive');
    //console.log(index);


});
//日月切换 点击事件
//日 点击
documentBindFunc.on('click', '#recondayType', function () {
    $('.recon-choosedateday').removeClass('display-none');
    $('.recon-choosedatemonth').addClass('display-none');
    $('#queryType').attr('data-value', '1');
    //切换完后,调用查询表格
    fun.queryReconciliationTotal();
    fun.createTableData();
});
//月 点击
documentBindFunc.on('click', '#reconmonthType', function () {
    $('.recon-choosedatemonth').removeClass('display-none');
    $('.recon-choosedateday').addClass('display-none');
    $('#queryType').attr('data-value', '2');
    //切换完后,调用查询表格
    fun.queryReconciliationTotal();
    fun.createTableData();
});