SharingRewardsController.js 5.2 KB
"use strict";
var sharingRewardsController = angular.module('sharingRewardsController',[]);

/**
 * 分享奖励订单
 */
sharingRewardsController.controller('shareRewardOrderController', [
    '$rootScope',
    '$scope',
    'SharingRewardsService',
    function($rootScope, $scope, SharingRewardsService) {
        $scope.currentPage = 1;
        $scope.numPages = 1;
        $scope.pageSize = 20;
        $scope.totalRecord = 0;
        $scope.shareOrders=[];
        $scope.shareOrderQuery={
            shareUserPhone:'',
            orderCode:'',
            startOrderDt:'',
            endOrderDt:'',
            startReceiveDt:'',
            endReceiveDt:'',
            pageNow:1,
            pageSize:20
        };
        SharingRewardsService.shareRewardOrderPager($scope.shareOrderQuery);
        $scope.$on('shareOrder.list', function() {
            $scope.shareOrders = SharingRewardsService.shareOrders.datas;
            $scope.numPages = SharingRewardsService.shareOrders.totalPage;
            $scope.totalRecord = SharingRewardsService.shareOrders.totalRecord;
        });

        $scope.onSelectPage = function(page) {
            $scope.shareOrderQuery.pageNow=page;
            SharingRewardsService.shareRewardOrderPager($scope.shareOrderQuery);
        };

        $scope.searchShareOrder=function() {
            $scope.shareOrderQuery.pageNow = 1;
            $scope.shareOrderQuery.startOrderDt = $('#startOrderDt').val();
            $scope.shareOrderQuery.endOrderDt   = $('#endOrderDt').val();
            $scope.shareOrderQuery.startReceiveDt = $('#startReceiveDt').val();
            $scope.shareOrderQuery.endReceiveDt   = $('#endReceiveDt').val();
            SharingRewardsService.shareRewardOrderPager($scope.shareOrderQuery);
        };

    }]
);

/**
 * 提现记录
 */
sharingRewardsController.controller('presentRecordListController', [
    '$rootScope',
    '$scope',
    'SharingRewardsService',
    function($rootScope, $scope, SharingRewardsService) {
        $scope.currentPage = 1;
        $scope.numPages = 1;
        $scope.pageSize = 20;
        $scope.totalRecord = 0;
        $scope.withdrawRecordList=[];
        $scope.withDrawRecordQuery={
            phone:'',
            nickName:'',
            idCard:'',
            startDt:'',
            endDt:'',
            pageNow:1,
            pageSize:20
        };
        SharingRewardsService.withDrawRecordPager($scope.withDrawRecordQuery);
        $scope.$on('withdraw.list', function() {
            $scope.withdrawRecordList = SharingRewardsService.withDrawList.datas;
            $scope.numPages = SharingRewardsService.withDrawList.totalPage;
            $scope.totalRecord = SharingRewardsService.withDrawList.totalRecord;
        });

        $scope.onSelectPage = function(page) {
            $scope.withDrawRecordQuery.pageNow=page;
            SharingRewardsService.withDrawRecordPager($scope.withDrawRecordQuery);
        };

        $scope.search=function() {
            $scope.withDrawRecordQuery.pageNow = 1;
            $scope.withDrawRecordQuery.startDt = $('#startDt').val();
            $scope.withDrawRecordQuery.endDt   = $('#endDt').val();
            SharingRewardsService.withDrawRecordPager($scope.withDrawRecordQuery);
        };
    }]
);

/**
 * 分享奖励报表统计
 */
sharingRewardsController.controller('sharingRewardStatementStatisticsController', [
    '$rootScope',
    '$scope',
    'SharingRewardsService',
    function($rootScope, $scope, SharingRewardsService) {
        $scope.withDraws = [];
        SharingRewardsService.selectTotalWithDrawalsAmount();
        $scope.$on('withDraw.list', function() {
            $scope.withDraws = SharingRewardsService.withDraws;
        });

    }]
);
/**
 *   分享奖励排名
 */
sharingRewardsController.controller('sharingRewardRankingsController', [
    '$rootScope',
    '$scope',
    'SharingRewardsService',
    function($rootScope, $scope, SharingRewardsService) {
        $scope.currentPage = 1;
        $scope.numPages = 1;
        $scope.pageSize = 20;
        $scope.totalRecord = 0;
        $scope.shareWithDrawRecords=[];
        $scope.sharingRewardRankingQuery={
            phone:'',
            nikeName:'',
            idCard:'',
            pageNow:1,
            pageSize:20
        };
        SharingRewardsService.sharingRewardRankings($scope.sharingRewardRankingQuery);
        $scope.$on('shareWithDrawRecord.list', function() {
            $scope.shareWithDrawRecords = SharingRewardsService.shareWithDrawRecords.datas;
            $scope.numPages = SharingRewardsService.shareWithDrawRecords.totalPage;
            $scope.totalRecord = SharingRewardsService.shareWithDrawRecords.totalRecord;
        });

        $scope.onSelectPage = function(page) {
            $scope.sharingRewardRankingQuery.pageNow=page;
            SharingRewardsService.sharingRewardRankings($scope.sharingRewardRankingQuery);
        };

        $scope.search=function() {
            $scope.sharingRewardRankingQuery.pageNow = 1;
            $scope.sharingRewardRankingQuery.startDt = $('#startDt').val();
            $scope.sharingRewardRankingQuery.endDt   = $('#endDt').val();
            SharingRewardsService.sharingRewardRankings($scope.sharingRewardRankingQuery);
        };

    }]
);