|
|
@@ -3,135 +3,103 @@ define([ 'app/app' ], function(app) {
|
|
|
app.register.controller('LotteryUsersCtrl', ['$scope', 'ngTableParams', 'Lottery', 'BaseService', '$modal', function($scope, ngTableParams, Lottery, BaseService, $modal) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
|
|
|
- $scope.itemActive = 'all';
|
|
|
- $scope.roleActive = 'all';
|
|
|
+ $scope.itemActive = 'all';
|
|
|
+ $scope.roleActive = 'all';
|
|
|
$scope.keyword = '';
|
|
|
$scope.role = '';
|
|
|
$scope.status = 100;
|
|
|
|
|
|
// 设置等级
|
|
|
- $scope.setActive = function(state) {
|
|
|
- if($scope.itemActive != state) {
|
|
|
+ $scope.setActive = function (state) {
|
|
|
+ if ($scope.itemActive != state) {
|
|
|
$scope.itemActive = state;
|
|
|
- if($scope.usersTableParams.page() == 1)
|
|
|
+ if ($scope.usersTableParams.page() == 1)
|
|
|
$scope.usersTableParams.reload();
|
|
|
else
|
|
|
$scope.usersTableParams.page(1);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- var getState = function() {
|
|
|
- var state = '';
|
|
|
- switch($scope.itemActive) {
|
|
|
- case 'all' : //全部
|
|
|
- state = ''; break;
|
|
|
- case 'bronze' ://青铜
|
|
|
- state = '12wwwwwwww'; break;
|
|
|
- case 'gold' : //黄金
|
|
|
- state = '12wwwwwwwQ'; break;
|
|
|
- case 'diamond' : //钻石
|
|
|
- state = '12wwwwwwwZ'; break;
|
|
|
- case 'king' : //王者
|
|
|
- state = '12wwwwwwwX'; break;
|
|
|
- }
|
|
|
- return state;
|
|
|
- };
|
|
|
+ var getState = function () {
|
|
|
+ var state = '';
|
|
|
+ switch ($scope.itemActive) {
|
|
|
+ case 'all' : //全部
|
|
|
+ state = '';
|
|
|
+ break;
|
|
|
+ case 'bronze' ://青铜
|
|
|
+ state = '12wwwwwwww';
|
|
|
+ break;
|
|
|
+ case 'gold' : //黄金
|
|
|
+ state = '12wwwwwwwQ';
|
|
|
+ break;
|
|
|
+ case 'diamond' : //钻石
|
|
|
+ state = '12wwwwwwwZ';
|
|
|
+ break;
|
|
|
+ case 'king' : //王者
|
|
|
+ state = '12wwwwwwwX';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return state;
|
|
|
+ };
|
|
|
|
|
|
- // 设置角色
|
|
|
- $scope.setRole = function(state) {
|
|
|
- if($scope.roleActive != state) {
|
|
|
+ // 设置角色
|
|
|
+ $scope.setRole = function (state) {
|
|
|
+ if ($scope.roleActive != state) {
|
|
|
$scope.roleActive = state;
|
|
|
- if($scope.usersTableParams.page() == 1)
|
|
|
+ if ($scope.usersTableParams.page() == 1)
|
|
|
$scope.usersTableParams.reload();
|
|
|
else
|
|
|
$scope.usersTableParams.page(1);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- var getRole = function() {
|
|
|
+ var getRole = function () {
|
|
|
var state = '';
|
|
|
- switch($scope.roleActive) {
|
|
|
+ switch ($scope.roleActive) {
|
|
|
case '' : //全部
|
|
|
- state = ''; break;
|
|
|
+ state = '';
|
|
|
+ break;
|
|
|
case 'NORMAL' ://普通
|
|
|
- state = 'NORMAL'; break;
|
|
|
+ state = 'NORMAL';
|
|
|
+ break;
|
|
|
case 'CUSTOMER' : //买家
|
|
|
- state = 'CUSTOMER'; break;
|
|
|
+ state = 'CUSTOMER';
|
|
|
+ break;
|
|
|
case 'SELLER' : //卖家
|
|
|
- state = 'SELLER'; break;
|
|
|
+ state = 'SELLER';
|
|
|
+ break;
|
|
|
}
|
|
|
return state;
|
|
|
};
|
|
|
|
|
|
- var loadData = function() {
|
|
|
+ var loadData = function () {
|
|
|
$scope.usersTableParams = new ngTableParams({
|
|
|
- page : 1,
|
|
|
- count : 10,
|
|
|
+ page: 1,
|
|
|
+ count: 10,
|
|
|
}, {
|
|
|
- total : 0,
|
|
|
- getData : function($defer, params) {
|
|
|
+ total: 0,
|
|
|
+ getData: function ($defer, params) {
|
|
|
var param = BaseService.parseParams(params.url());
|
|
|
param.activityCode = '11wwwwwwww';
|
|
|
param.keyword = $scope.keyword;
|
|
|
param.role = getRole();
|
|
|
param.itemCode = getState();
|
|
|
param.status = $scope.status;
|
|
|
- Lottery.getAllUsers(param, function(page) {
|
|
|
+ Lottery.getAllUsers(param, function (page) {
|
|
|
if (page) {
|
|
|
params.total(page.totalElements);
|
|
|
$defer.resolve(page.content);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
- loadData();
|
|
|
-
|
|
|
- //根据订单号搜索
|
|
|
- $scope.onSearch = function() {
|
|
|
- $scope.usersTableParams.reload();
|
|
|
- };
|
|
|
-
|
|
|
- // 填写兑奖信息
|
|
|
- $scope.openRedempte = function(id) {
|
|
|
- var modalInstance = $modal.open({
|
|
|
- templateUrl : 'static/view/admin/ads/redempte_modal.html',
|
|
|
- controller : 'RedempteModalCtrl',
|
|
|
- size : 'md',
|
|
|
- resolve: {
|
|
|
- winningHistoryId: function() {
|
|
|
- return id;
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- modalInstance.opened.then(function(){
|
|
|
-
|
|
|
- });
|
|
|
- modalInstance.result.then(function(brand){
|
|
|
- $scope.usersTableParams.reload();
|
|
|
- }, function(reason){
|
|
|
-
|
|
|
});
|
|
|
};
|
|
|
- }]);
|
|
|
|
|
|
- //兑奖信息模态框的controller
|
|
|
- app.register.controller('RedempteModalCtrl', ['$scope', '$modalInstance', 'Lottery', 'toaster', 'winningHistoryId', function($scope, $modalInstance, Lottery, toaster, winningHistoryId) {
|
|
|
+ loadData();
|
|
|
|
|
|
- $scope.cancel = function() {
|
|
|
- $modalInstance.dismiss();
|
|
|
- };
|
|
|
-
|
|
|
- $scope.confirm = function() {
|
|
|
- Lottery.redempte({id: winningHistoryId, userTel: $scope.userTel, code: $scope.code}, {}, function (data) {
|
|
|
- if (data.code == 200) {
|
|
|
- toaster.pop('info', '兑奖成功!');
|
|
|
- $modalInstance.close();
|
|
|
- } else {
|
|
|
- toaster.pop('error', '兑奖失败:' + data.message);
|
|
|
- }
|
|
|
- });
|
|
|
+ //根据用户名称、企业名称搜索
|
|
|
+ $scope.onSearch = function () {
|
|
|
+ $scope.usersTableParams.reload();
|
|
|
};
|
|
|
}]);
|
|
|
});
|