Browse Source

feat(lottery):新增奖品信息及维护

wangyc 7 years ago
parent
commit
819807d9ce

+ 33 - 0
src/main/java/com/uas/platform/b2c/common/lottery/controller/LotteryController.java

@@ -135,4 +135,37 @@ public class LotteryController {
     public JSONObject getUserInfos(String activityCode, com.uas.platform.core.model.PageParams pageParams, String keyword, String itemCode, String role, Integer status) {
         return userInfoService.findUserInfos(activityCode, pageParams, keyword, itemCode, role, status);
     }
+
+    /**
+     * 分页获取全部用户信息
+     * @param pageParams 分页参数
+     * @param itemCode 等级编号
+     * @return
+     */
+    @RequestMapping(value = "/user/prizes/page", method = RequestMethod.GET, produces = "application/json")
+    public JSONObject getPrizes(com.uas.platform.core.model.PageParams pageParams, String itemCode) {
+        return prizeService.getPrizes(pageParams, itemCode);
+    }
+
+    /**
+     * 更新权重
+     * @param code 中奖码
+     * @param weight 权重
+     * @return
+     */
+    @RequestMapping(value = "/updateweight", method = RequestMethod.PUT, produces = "application/json")
+    public ResultMap updateWeight(String code, Double weight) {
+        return prizeService.updateWeight(code, weight);
+    }
+
+    /**
+     * 更新奖品剩余数量
+     * @param code 中奖码
+     * @param amount 剩余数量
+     * @return
+     */
+    @RequestMapping(value = "/updateamount", method = RequestMethod.PUT, produces = "application/json")
+    public ResultMap updateAmount(String code, Integer amount) {
+        return prizeService.updateAmount(code, amount);
+    }
 }

+ 26 - 0
src/main/java/com/uas/platform/b2c/common/lottery/service/PrizeService.java

@@ -1,6 +1,8 @@
 package com.uas.platform.b2c.common.lottery.service;
 
+import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.model.PageParams;
 
 /**
  * Created by wangyc on 2018/9/12.
@@ -16,4 +18,28 @@ public interface PrizeService {
      * @return
      */
     ResultMap getPrizesByUser(String activityCode, String itemCode);
+
+    /**
+     * 分页获取奖品信息
+     * @param pageParams 分页参数
+     * @param itemCode 等级编号
+     * @return
+     */
+    JSONObject getPrizes(PageParams pageParams, String itemCode);
+
+    /**
+     * 更新权重
+     * @param code 中奖码
+     * @param weight 权重
+     * @return
+     */
+    ResultMap updateWeight(String code, Double weight);
+
+    /**
+     * 更新奖品剩余数量
+     * @param code 中奖码
+     * @param amount 剩余数量
+     * @return
+     */
+    ResultMap updateAmount(String code, Integer amount);
 }

+ 55 - 0
src/main/java/com/uas/platform/b2c/common/lottery/service/impl/PrizeServiceImpl.java

@@ -1,13 +1,16 @@
 package com.uas.platform.b2c.common.lottery.service.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2c.common.lottery.service.PrizeService;
 import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.trade.support.CodeType;
 import com.uas.platform.b2c.trade.support.ResultMap;
+import com.uas.platform.core.model.PageParams;
 import com.uas.platform.core.util.HttpUtil;
 import com.uas.platform.core.util.HttpUtil.Response;
+import com.uas.ps.core.page.exception.IllegalOperatorException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
@@ -28,6 +31,15 @@ public class PrizeServiceImpl implements PrizeService {
     // 获取当前等级奖品路径
     private static final String GET_PRIZES_USER_URL = "/prizes/user";
 
+    // 获取当前等级奖品路径
+    private static final String GET_PRIZES_PAGE_URL = "/prizes/page";
+
+    // 更新奖品权重
+    private static final String UPDATE_WEIGHT_URL = "/prizes/updateweight";
+
+    // 更新奖品剩余数量
+    private static final String UPDATE_AMOUNT_URL = "/prizes/updateamount";
+
     @Autowired
     public PrizeServiceImpl(SysConf sysConf) {
         this.sysConf = sysConf;
@@ -52,4 +64,47 @@ public class PrizeServiceImpl implements PrizeService {
             return new ResultMap(CodeType.ERROR_STATE, "获取奖品信息错误,请重试");
         }
     }
+
+    @Override
+    public JSONObject getPrizes(PageParams pageParams, String itemCode) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("count", pageParams.getCount());
+        params.put("page", pageParams.getPage());
+        params.put("itemCode", StringUtils.isEmpty(itemCode) ? "" : itemCode);
+
+        try {
+            Response response = HttpUtil.sendGetRequest(sysConf.getLottery() + GET_PRIZES_PAGE_URL, params);
+            return JSON.parseObject(response.getResponseText());
+        } catch (Exception e) {
+            throw new IllegalOperatorException("获取奖品信息错误,请重试");
+        }
+    }
+
+    @Override
+    public ResultMap updateWeight(String code, Double weight) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("code", code);
+        params.put("weight", weight);
+
+        try {
+            Response response = HttpUtil.sendPostRequest(sysConf.getLottery() + UPDATE_WEIGHT_URL, params);
+            return JSON.parseObject(response.getResponseText(), ResultMap.class);
+        } catch (Exception e) {
+            throw new IllegalOperatorException("获取奖品信息错误,请重试");
+        }
+    }
+
+    @Override
+    public ResultMap updateAmount(String code, Integer amount) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("code", code);
+        params.put("amount", amount);
+
+        try {
+            Response response = HttpUtil.sendPostRequest(sysConf.getLottery() + UPDATE_AMOUNT_URL, params);
+            return JSON.parseObject(response.getResponseText(), ResultMap.class);
+        } catch (Exception e) {
+            throw new IllegalOperatorException("获取奖品信息错误,请重试");
+        }
+    }
 }

+ 2 - 0
src/main/webapp/WEB-INF/views/normal/adminWithNav.html

@@ -241,6 +241,8 @@
 					class="fa fa-upload"></i><span> 器件推广</span></a></li>
 			<li class="nav-node"><a href="#ads/lotteryUsers" ><i
 					class="fa fa-upload"></i><span> 抽奖活动用户信息</span></a></li>
+			<li class="nav-node"><a href="#ads/prizes" ><i
+					class="fa fa-upload"></i><span> 奖品信息</span></a></li>
 			<li class="nav-node"><a href="#ads/winningHistories" ><i
 					class="fa fa-upload"></i><span> 中奖记录</span></a></li>
 

+ 7 - 0
src/main/webapp/resources/js/admin/app.js

@@ -805,6 +805,13 @@
       controller: 'LotteryUsersCtrl',
       controllerUrl: 'app/controllers/ads/lotteryUsersCtrl',
       title: '抽奖活动用户'
+    })).state('adsPrizes', angularAMD.route({
+      // 抽奖活动奖品信息
+      url: '/ads/prizes',
+      templateUrl: 'static/view/admin/ads/ads_prizes.html',
+      controller: 'PrizeCtrl',
+      controllerUrl: 'app/controllers/ads/prizesCtrl',
+      title: '抽奖活动奖品信息'
     })).state('adsWinningHistories', angularAMD.route({
       // 中奖记录
       url: '/ads/winningHistories',

+ 50 - 82
src/main/webapp/resources/js/admin/controllers/ads/lotteryUsersCtrl.js

@@ -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();
     };
   }]);
 });

+ 128 - 0
src/main/webapp/resources/js/admin/controllers/ads/prizesCtrl.js

@@ -0,0 +1,128 @@
+define([ 'app/app' ], function(app) {
+	//品牌审批
+	app.register.controller('PrizeCtrl', ['$scope', 'ngTableParams', 'Lottery', 'BaseService', 'toaster', function($scope, ngTableParams, Lottery, BaseService, toaster) {
+    BaseService.scrollBackToTop();
+
+		$scope.active = 'all';
+		var weightReg = '^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+))$';
+		var amountReg = '^\\d+$';
+
+    $scope.setActive = function(state) {
+      if($scope.active != state) {
+        $scope.active = state;
+        if($scope.prizeTableParams.page() == 1)
+          $scope.prizeTableParams.reload();
+        else
+          $scope.prizeTableParams.page(1);
+      }
+    };
+
+		var getState = function() {
+			var state = 'get';
+			switch($scope.active) {
+				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 loadData = function() {
+      $scope.prizeTableParams = new ngTableParams({
+        page : 1,
+        count : 10,
+      }, {
+        total : 0,
+        getData : function($defer, params) {
+          var param = BaseService.parseParams(params.url());
+          param.activityCode = '11wwwwwwww';
+          param.itemCode = getState();
+          Lottery.getAllPrizes(param, function(page) {
+            if (page) {
+              angular.forEach(page.content, function (prize) {
+                prize.updateWeight = false;
+                prize.upadteAmount = false;
+              });
+              params.total(page.totalElements);
+              $defer.resolve(page.content);
+            }
+          });
+        }
+      });
+		};
+
+		loadData();
+
+		// 修改权重
+		$scope.updateWeight = function (prize) {
+		  prize.originalWeight = prize.weight;
+      prize.updateWeight = true;
+    };
+
+		// 保存权重
+    $scope.saveWeight = function (prize) {
+      if (validate(prize.weight, weightReg)) {
+        Lottery.updatePrizeWeight({code: prize.code, weight: prize.weight}, {}, function (data) {
+          if (data.code == 200) {
+            prize.updateWeight = false;
+            $scope.prizeTableParams.reload();
+          } else {
+            toaster.pop('error', '修改权重失败:' + data.message);
+          }
+        });
+      } else {
+        toaster.pop('warning', "请输入正小数");
+      }
+    }
+
+    // 取消修改权重
+    $scope.cancelWeight = function (prize) {
+      prize.weight = prize.originalWeight;
+      prize.updateWeight = false;
+    }
+
+    // 修改剩余数量
+    $scope.updateAmount = function (prize) {
+      prize.originalAmount = prize.amount;
+      prize.upadteAmount = true;
+    };
+
+    // 取消修改剩余数量
+    $scope.cancelAmount = function (prize) {
+      prize.amount = prize.originalAmount;
+      prize.upadteAmount = false;
+    }
+
+    // 保存剩余数量
+    $scope.saveAmount = function (prize) {
+      if (validate(prize.amount, amountReg)) {
+        Lottery.updatePrizeAmount({code: prize.code, amount: prize.amount}, {}, function (data) {
+          if (data.code == 200) {
+            prize.upadteAmount = false;
+            $scope.prizeTableParams.reload();
+          } else {
+            toaster.pop('error', '修改剩余数量失败:' + data.message);
+          }
+        });
+      } else {
+        toaster.pop('warning',"请输入正整数数");
+      }
+    };
+
+    var validate = function(number, reg){
+      var reg = new RegExp(reg);
+      if(!reg.test(number)){
+        return false;
+      }
+      return true;
+    };
+
+  }]);
+});

+ 18 - 0
src/main/webapp/resources/js/common/query/lottery.js

@@ -1,17 +1,35 @@
 define([ 'ngResource'], function() {
   angular.module('lotteryServices', [ 'ngResource']).factory('Lottery', ['$resource' , function($resource) {
     return $resource('lottery', {}, {
+      // 获取中奖记录
       getWinningHistories: {
         url: 'lottery/user/winninghistories',
         method : 'GET'
       },
+      // 兑奖
       redempte: {
         url: 'lottery/redempte',
         method: 'PUT'
       },
+      // 获取全部用户信息
       getAllUsers: {
         url: 'lottery/user/userinfos',
         method : 'GET'
+      },
+      // 获取全部奖品信息
+      getAllPrizes: {
+        url: 'lottery/user/prizes/page',
+        method : 'GET'
+      },
+      // 更新奖品权重
+      updatePrizeWeight: {
+        url: 'lottery/updateweight',
+        method: 'PUT'
+      },
+      // 更新奖品剩余数量
+      updatePrizeAmount: {
+        url: 'lottery/updateamount',
+        method: 'PUT'
       }
     });
   }]);

+ 1 - 141
src/main/webapp/resources/view/admin/ads/ads_lotteryUsers.html

@@ -1,147 +1,7 @@
-<style>
-    .checkout-steps {
-        background-color: #fff;
-        padding: 0 15px;
-        border: 1px solid #f0f0f0;
-        width: 990px;
-        margin: 10px auto;
-    }
-
-    .checkout-steps .basetop {
-        margin-bottom: 20px;
-    }
-
-    .checkout-steps .titletip {
-        height: 35px;
-        line-height: 35px;
-    }
-
-    .checkout-steps .smalltitle {
-        font-size: 14px;
-        font-weight: bold;
-        float: left;
-    }
-
-    .checkout-steps .in-right {
-        color: #005ea7;
-        float: right;
-    }
-
-    .checkout-steps .item-select {
-        margin-left: 20px;
-        border: 2px solid #e4393c;
-        cursor: pointer;
-        padding: 6px 15px;
-    }
-
-    .checkout-steps .item-noselect {
-        margin-left: 20px;
-        border: 2px solid #ddd;;
-        cursor: pointer;
-        padding: 6px 15px;
-    }
-
-    .checkout-steps .item-noselect:hover {
-        border: 2px solid #e4393c;
-        cursor: pointer;
-        padding: 6px 15px;
-    }
-
-    .checkout-steps .hr {
-        border-bottom: 1px solid #e6e6e6;
-        height: 0;
-    }
-
-    .addr-detail {
-        float: left;
-        line-height: 24px;
-    }
-
-    .addr-detail span {
-        margin-left: 10px
-    }
-
-    .address_more {
-        position: relative;
-        line-height: 30px;
-        text-align: center;
-        border-top: 1px solid #DDD;
-    }
-
-    .address_more a {
-        position: relative;
-        display: inline-block;
-        margin-top: -1px;
-        height: 30px;
-        line-height: 30px;
-        padding: 0 10px 0 10px;
-        border-width: 1px;
-        border-style: solid;
-        border-color: #FFF #DDD #DDD;
-        background: #fff;
-        cursor: pointer;
-         -webkit-transition: border-color .15s ease-in-out;
-         -moz-transition: border-color .15s ease-in-out;
-        transition: border-color .15s ease-in-out;
-    }
-
-    .audit-failure-modal {
-        display: block !important;
-        position: fixed;
-        background-color: white;
-        opacity: 1;
-        width: 300px;
-        height: 140px;
-        top: 250px;
-        left: 554px;
-        font-family: "microsoft yahei";
-        border: 1px solid #d9d5ce;
-        z-index: 10;
-    }
-
-    .audit-failure-modal .title {
-        line-height: 31px;
-        height: 31px;
-        font-size: 14px;
-        background-color: #3a76e4;
-        color: white;
-        text-align: left;
-        font-family: microsoft yahei;
-        padding-left: 15px;
-    }
-
-    .audit-failure-modal .content input {
-        width: 80%;
-        height: 31px;
-        line-height: 31px;
-        border-radius: 4px;
-        margin-top: 10px;
-        margin-left: 28px;
-        margin-bottom: 15px;
-    }
-
-    .audit-failure-modal  .footer .confirm {
-        width: 90px;
-        padding: 5px 10px;
-        background-color: #3A76E4;
-        border: none;
-        color: white;
-        font-size: 14px;
-    }
-
-    .audit-failure-modal .footer .cancle-button {
-        width: 90px;
-        padding: 5px 10px;
-        background-color: #D9D5CE;
-        border: none;
-        color: #333333;
-        font-size: 14px;
-    }
-</style>
 <div class="row-fluid sortable">
     <div class="box">
         <div class="box-header well" data-original-title>
-            <i class="icon-user"></i> 中奖记录
+            <i class="icon-user"></i> 抽奖活动用户信息
         </div>
         <div class="box-content">
             <!-- ng-tableStart -->

+ 213 - 0
src/main/webapp/resources/view/admin/ads/ads_prizes.html

@@ -0,0 +1,213 @@
+<style>
+    .checkout-steps {
+        background-color: #fff;
+        padding: 0 15px;
+        border: 1px solid #f0f0f0;
+        width: 990px;
+        margin: 10px auto;
+    }
+
+    .checkout-steps .basetop {
+        margin-bottom: 20px;
+    }
+
+    .checkout-steps .titletip {
+        height: 35px;
+        line-height: 35px;
+    }
+
+    .checkout-steps .smalltitle {
+        font-size: 14px;
+        font-weight: bold;
+        float: left;
+    }
+
+    .checkout-steps .in-right {
+        color: #005ea7;
+        float: right;
+    }
+
+    .checkout-steps .item-select {
+        margin-left: 20px;
+        border: 2px solid #e4393c;
+        cursor: pointer;
+        padding: 6px 15px;
+    }
+
+    .checkout-steps .item-noselect {
+        margin-left: 20px;
+        border: 2px solid #ddd;;
+        cursor: pointer;
+        padding: 6px 15px;
+    }
+
+    .checkout-steps .item-noselect:hover {
+        border: 2px solid #e4393c;
+        cursor: pointer;
+        padding: 6px 15px;
+    }
+
+    .checkout-steps .hr {
+        border-bottom: 1px solid #e6e6e6;
+        height: 0;
+    }
+
+    .addr-detail {
+        float: left;
+        line-height: 24px;
+    }
+
+    .addr-detail span {
+        margin-left: 10px
+    }
+
+    .address_more {
+        position: relative;
+        line-height: 30px;
+        text-align: center;
+        border-top: 1px solid #DDD;
+    }
+
+    .address_more a {
+        position: relative;
+        display: inline-block;
+        margin-top: -1px;
+        height: 30px;
+        line-height: 30px;
+        padding: 0 10px 0 10px;
+        border-width: 1px;
+        border-style: solid;
+        border-color: #FFF #DDD #DDD;
+        background: #fff;
+        cursor: pointer;
+         -webkit-transition: border-color .15s ease-in-out;
+         -moz-transition: border-color .15s ease-in-out;
+        transition: border-color .15s ease-in-out;
+    }
+
+    .audit-failure-modal {
+        display: block !important;
+        position: fixed;
+        background-color: white;
+        opacity: 1;
+        width: 300px;
+        height: 140px;
+        top: 250px;
+        left: 554px;
+        font-family: "microsoft yahei";
+        border: 1px solid #d9d5ce;
+        z-index: 10;
+    }
+
+    .audit-failure-modal .title {
+        line-height: 31px;
+        height: 31px;
+        font-size: 14px;
+        background-color: #3a76e4;
+        color: white;
+        text-align: left;
+        font-family: microsoft yahei;
+        padding-left: 15px;
+    }
+
+    .audit-failure-modal .content input {
+        width: 80%;
+        height: 31px;
+        line-height: 31px;
+        border-radius: 4px;
+        margin-top: 10px;
+        margin-left: 28px;
+        margin-bottom: 15px;
+    }
+
+    .audit-failure-modal  .footer .confirm {
+        width: 90px;
+        padding: 5px 10px;
+        background-color: #3A76E4;
+        border: none;
+        color: white;
+        font-size: 14px;
+    }
+
+    .audit-failure-modal .footer .cancle-button {
+        width: 90px;
+        padding: 5px 10px;
+        background-color: #D9D5CE;
+        border: none;
+        color: #333333;
+        font-size: 14px;
+    }
+</style>
+<div class="row-fluid sortable">
+    <div class="box">
+        <div class="box-header well" data-original-title>
+            <i class="icon-user"></i> 中奖记录
+        </div>
+        <div class="box-content">
+            <!-- ng-tableStart -->
+            <div class="fullscreen" style="padding: 10px;">
+                <div class="row">
+                    <div class="col-sm-1">
+                        共<span class="badge">{{prizeTableParams.total()}} </span>条
+                    </div>
+                    <div class="col-sm-8">
+                        <div class="btn-group" role="group" aria-label="...">
+                            <button type="button" class="btn btn-default" ng-class="{'btn-primary':active=='all'}" ng-click="setActive('all')">全部</button>
+                            <button type="button" class="btn btn-default" ng-class="{'btn-primary':active=='bronze'}" ng-click="setActive('bronze')">青铜</button>
+                            <button type="button" class="btn btn-default" ng-class="{'btn-primary':active=='gold'}" ng-click="setActive('gold')">黄金</button>
+                            <button type="button" class="btn btn-default" ng-class="{'btn-primary':active=='diamond'}" ng-click="setActive('diamond')">钻石</button>
+                            <button type="button" class="btn btn-default" ng-class="{'btn-primary':active=='king'}" ng-click="setActive('king')">王者</button>
+                        </div>
+                    </div>
+                </div>
+                <table ng-table="prizeTableParams" class="table table-bordered table-striped" style="margin-top: 10px;">
+                    <thead>
+                    <tr>
+                        <th class="text-center" width="50">序号</th>
+                        <th class="text-center" width="100">奖品编号</th>
+                        <th class="text-center" width="200">奖品名称</th>
+                        <th class="text-center" width="100">奖品图片</th>
+                        <th class="text-center" width="100">奖品剩余数量</th>
+                        <th class="text-center" width="100">已抽中数量</th>
+                        <th class="text-center" width="100">等级</th>
+                        <th class="text-center" width="100">权重</th>
+                        <th class="text-center" width="250">操作</th>
+                    </tr>
+                    </thead>
+                    <tbody class="text-center">
+                    <tr class="text-center" ng-repeat="prize in $data">
+                        <td class="text-center">{{$index+1}}</td>
+                        <td class="text-center" ng-bind="prize.code"></td>
+                        <td class="text-center" ng-bind="prize.name"></td>
+                        <td class="text-center"><img ng-src="{{prize.img}}" /></td>
+                        <td class="text-center">
+                            <span ng-bind="prize.amount" ng-show="!prize.upadteAmount"></span>
+                            <input type="number" placeholder="填写奖品剩余数量" ng-model="prize.amount" ng-show="prize.upadteAmount">
+                        </td>
+                        <td class="text-center" ng-bind="prize.drawnAmount"></td>
+                        <td class="text-center" ng-bind="prize.itemName"></td>
+                        <td class="text-center">
+                            <span ng-bind="prize.weight" ng-show="!prize.updateWeight"></span>
+                            <input type="number" placeholder="填写奖品权重" ng-model="prize.weight" ng-show="prize.updateWeight">
+                        </td>
+                        <td class="text-center">
+                            <div class="row">
+                                <div class="col-xs-5" ng-show="!prize.updateWeight && !prize.upadteAmount">
+                                    <button class="btn btn-default btn-md" ng-click="updateWeight(prize)">修改权重</button>
+                                </div>
+                                <div class="col-xs-6" ng-show="!prize.updateWeight && !prize.upadteAmount">
+                                    <button class="btn btn-default btn-md" ng-click="updateAmount(prize)">修改剩余数量</button>
+                                </div>
+                                <button class="btn btn-default btn-md" ng-click="saveWeight(prize)" ng-show="prize.updateWeight">保存</button>
+                                <button class="btn btn-default btn-md" ng-click="cancelWeight(prize)" ng-show="prize.updateWeight">取消</button>
+                                <button class="btn btn-default btn-md" ng-click="saveAmount(prize)" ng-show="prize.upadteAmount">保存</button>
+                                <button class="btn btn-default btn-md" ng-click="cancelAmount(prize)" ng-show="prize.upadteAmount">取消</button>
+                            </div>
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+</div>

+ 0 - 140
src/main/webapp/resources/view/admin/ads/ads_winninghistories.html

@@ -1,143 +1,3 @@
-<style>
-    .checkout-steps {
-        background-color: #fff;
-        padding: 0 15px;
-        border: 1px solid #f0f0f0;
-        width: 990px;
-        margin: 10px auto;
-    }
-
-    .checkout-steps .basetop {
-        margin-bottom: 20px;
-    }
-
-    .checkout-steps .titletip {
-        height: 35px;
-        line-height: 35px;
-    }
-
-    .checkout-steps .smalltitle {
-        font-size: 14px;
-        font-weight: bold;
-        float: left;
-    }
-
-    .checkout-steps .in-right {
-        color: #005ea7;
-        float: right;
-    }
-
-    .checkout-steps .item-select {
-        margin-left: 20px;
-        border: 2px solid #e4393c;
-        cursor: pointer;
-        padding: 6px 15px;
-    }
-
-    .checkout-steps .item-noselect {
-        margin-left: 20px;
-        border: 2px solid #ddd;;
-        cursor: pointer;
-        padding: 6px 15px;
-    }
-
-    .checkout-steps .item-noselect:hover {
-        border: 2px solid #e4393c;
-        cursor: pointer;
-        padding: 6px 15px;
-    }
-
-    .checkout-steps .hr {
-        border-bottom: 1px solid #e6e6e6;
-        height: 0;
-    }
-
-    .addr-detail {
-        float: left;
-        line-height: 24px;
-    }
-
-    .addr-detail span {
-        margin-left: 10px
-    }
-
-    .address_more {
-        position: relative;
-        line-height: 30px;
-        text-align: center;
-        border-top: 1px solid #DDD;
-    }
-
-    .address_more a {
-        position: relative;
-        display: inline-block;
-        margin-top: -1px;
-        height: 30px;
-        line-height: 30px;
-        padding: 0 10px 0 10px;
-        border-width: 1px;
-        border-style: solid;
-        border-color: #FFF #DDD #DDD;
-        background: #fff;
-        cursor: pointer;
-         -webkit-transition: border-color .15s ease-in-out;
-         -moz-transition: border-color .15s ease-in-out;
-        transition: border-color .15s ease-in-out;
-    }
-
-    .audit-failure-modal {
-        display: block !important;
-        position: fixed;
-        background-color: white;
-        opacity: 1;
-        width: 300px;
-        height: 140px;
-        top: 250px;
-        left: 554px;
-        font-family: "microsoft yahei";
-        border: 1px solid #d9d5ce;
-        z-index: 10;
-    }
-
-    .audit-failure-modal .title {
-        line-height: 31px;
-        height: 31px;
-        font-size: 14px;
-        background-color: #3a76e4;
-        color: white;
-        text-align: left;
-        font-family: microsoft yahei;
-        padding-left: 15px;
-    }
-
-    .audit-failure-modal .content input {
-        width: 80%;
-        height: 31px;
-        line-height: 31px;
-        border-radius: 4px;
-        margin-top: 10px;
-        margin-left: 28px;
-        margin-bottom: 15px;
-    }
-
-    .audit-failure-modal  .footer .confirm {
-        width: 90px;
-        padding: 5px 10px;
-        background-color: #3A76E4;
-        border: none;
-        color: white;
-        font-size: 14px;
-    }
-
-    .audit-failure-modal .footer .cancle-button {
-        width: 90px;
-        padding: 5px 10px;
-        background-color: #D9D5CE;
-        border: none;
-        color: #333333;
-        font-size: 14px;
-    }
-</style>
 <div class="row-fluid sortable">
     <div class="box">
         <div class="box-header well" data-original-title>