Browse Source

feat(lottery):增加兑奖功能

wangyc 7 years ago
parent
commit
be5157be42

+ 43 - 2
src/main/webapp/resources/js/admin/controllers/ads/winningHistoriesCtrl.js

@@ -1,6 +1,6 @@
 define([ 'app/app' ], function(app) {
 	//品牌审批
-	app.register.controller('WinningHistoriesCtrl', ['$scope', 'ngTableParams', 'Lottery', 'BaseService', function($scope, ngTableParams, Lottery, BaseService) {
+	app.register.controller('WinningHistoriesCtrl', ['$scope', 'ngTableParams', 'Lottery', 'BaseService', '$modal', function($scope, ngTableParams, Lottery, BaseService, $modal) {
     BaseService.scrollBackToTop();
 
 		$scope.active = 'all';
@@ -69,6 +69,47 @@ define([ 'app/app' ], function(app) {
 		//根据订单号搜索
 		$scope.onSearch = function() {
 			$scope.winningTableParams.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.winningTableParams.reload();
+      }, function(reason){
+
+      });
+    };
 	}]);
+
+  //兑奖信息模态框的controller
+  app.register.controller('RedempteModalCtrl', ['$scope', '$modalInstance', 'Lottery', 'toaster', 'winningHistoryId', function($scope, $modalInstance, Lottery, toaster, winningHistoryId) {
+
+    $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);
+        }
+      });
+    };
+  }]);
 });

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

@@ -5,9 +5,9 @@ define([ 'ngResource'], function() {
         url: 'lottery/user/winninghistories',
         method : 'GET'
       },
-      saveMakeDemandAuthentic: {
-        url: 'trade/help/makeDemand/save/entity',
-        method : 'POST'
+      redempte: {
+        url: 'lottery/redempte',
+        method : 'PUT'
       }
     });
   }]);

+ 4 - 2
src/main/webapp/resources/view/admin/ads/ads_winninghistories.html

@@ -173,10 +173,11 @@
                     <thead>
                     <tr>
                         <th class="text-center" width="50">序号</th>
-                        <th class="text-center" width="auto">中奖码</th>
+                        <th class="text-center" width="auto">兑换码</th>
                         <th class="text-center" width="75">等级</th>
                         <th class="text-center" width="75">中奖人uu</th>
                         <th class="text-center" width="100">中奖人姓名</th>
+                        <th class="text-center" width="100">中奖人手机号</th>
                         <th class="text-center" width="75">中奖人企业uu</th>
                         <th class="text-center" width="100">中奖人企业名称</th>
                         <th class="text-center" width="100">奖品编号</th>
@@ -194,6 +195,7 @@
                         <td class="text-center" ng-bind="history.itemName"></td>
                         <td class="text-center" ng-bind="history.userUU"></td>
                         <td class="text-center" ng-bind="history.userName"></td>
+                        <td class="text-center" ng-bind="history.userTel"></td>
                         <td class="text-center" ng-bind="history.enUU"></td>
                         <td class="text-center" ng-bind="history.enName"></td>
                         <td class="text-center" ng-bind="history.prizeCode"></td>
@@ -201,7 +203,7 @@
                         <td class="text-center" ng-bind="history.drawnTime"></td>
                         <td class="text-center"><span ng-show="history.status==100">已兑奖</span><span ng-show="history.status==101">待兑奖</span></td>
                         <td class="text-center" ng-bind="history.redemptiveDate"></td>
-                        <td class="text-center"><button class="btn btn-primary" ng-show="history.status==101">兑奖</button></td>
+                        <td class="text-center"><button class="btn btn-primary" ng-show="history.status==101" ng-click="openRedempte(history.id)">兑奖</button></td>
                     </tr>
                     </tbody>
                 </table>

+ 33 - 0
src/main/webapp/resources/view/admin/ads/redempte_modal.html

@@ -0,0 +1,33 @@
+<style>
+  .help-list{
+    max-height:450px;
+    overflow-y: auto;
+  }
+
+  .form-group {
+    height: 30px;
+  }
+</style>
+<div class="modal-header">
+  <h3 class="modal-title">填写兑奖信息</h3>
+</div>
+<div class="modal-body f14 row help-list text-center">
+  <div class="form-group">
+    <label class="f14 col-xs-4">兑换码:</label>
+    <div class="col-xs-8">
+      <input type="text" class="form-control" placeholder="填写兑换码"
+             ng-model="code">
+    </div>
+  </div>
+  <div class="form-group">
+    <label class="f14 col-xs-4">中奖人手机号:</label>
+    <div class="col-xs-8">
+      <input type="text" class="form-control" placeholder="填写中奖码"
+             ng-model="userTel">
+    </div>
+  </div>
+</div>
+<div class="modal-footer">
+  <button  class="btn btn-success" ng-click="confirm()" ng-disabled="!userTel || !code">确认</button>
+  <button class="btn btn-default" ng-click="cancel()">取消</button>
+</div>