Просмотр исходного кода

Merge remote-tracking branch 'origin/feature-material-wangcz' into feature-material-wangcz

yujia 7 лет назад
Родитель
Сommit
08be2ab7f1

+ 18 - 1
src/main/webapp/resources/js/common/controllers/commonCtrls.js

@@ -121,10 +121,27 @@ define([ 'app/app' ], function(app) {
 				});
 			};
 
+      var Ajax={
+        get: function(url, fn) {
+          // XMLHttpRequest对象用于在后台与服务器交换数据
+          var xhr = new XMLHttpRequest();
+          xhr.open('GET', url, false);
+          xhr.onreadystatechange = function() {
+            // readyState == 4说明请求已完成
+            if (xhr.readyState == 4 && xhr.status == 200 || xhr.status == 304) {
+              // 从服务器获得数据
+              fn.call(this, xhr.responseText);
+            }
+          };
+          xhr.send();
+        }
+      }
 			// 是否已经登录
 			$scope.isAuthed = AuthenticationService.isAuthed();
 			$scope.userInfo = {};
-
+      Ajax.get('/user/authentication',function(data) {
+        $scope.userInfo = data
+      })
 			// 获取已登录的用户信息
 			var getAuthentication = function() {
 				return AuthenticationService.getAuthentication().success(function(data) {

+ 6 - 0
src/main/webapp/resources/js/common/query/order.js

@@ -363,6 +363,12 @@ define([ 'ngResource' ], function() {
                 method : 'PUT',
                 params : { _status : 'ensureaccept'}
             },
+              // 分批确认收货
+              mutilpEnsureAccept: {
+                url : 'trade/order/signReceive',
+                method : 'PUT',
+                params : { _status : 'ensureaccept'}
+              },
             releaseOrder: {
                 url : 'trade/order/simpleinfo/ones/:orderid/release',
                 method : 'PUT'

+ 21 - 9
src/main/webapp/resources/js/usercenter/controllers/forstore/order_detail_ctrl.js

@@ -1,14 +1,14 @@
 
 define(['app/app'], function(app) {
 	"use strict";
-	app.register.controller('orderDetailCtrl', ['$scope', 'Order', 'Logistics', 'ComponentActive', 'toaster', '$stateParams', 'KdnLogistics', '$state', 'StoreInfo', 'NumberService', '$location', function($scope, Order, Logistics, ComponentActive, toaster, $stateParams, KdnLogistics, $state, StoreInfo, NumberService, $location) {
+	app.register.controller('orderDetailCtrl', ['$scope', 'Order', 'Logistics', 'ComponentActive', 'toaster', '$stateParams', 'KdnLogistics', '$state', 'StoreInfo', 'NumberService', '$location', 'OrderSimpleInfo',function($scope, Order, Logistics, ComponentActive, toaster, $stateParams, KdnLogistics, $state, StoreInfo, NumberService, $location, OrderSimpleInfo) {
 
 		document.title = '订单详情-优软商城';
 		// 保存订单编号信息
 		$scope.orderId = $stateParams.orderid;
-		$scope.acceptGoods = $location.search().fromPage || false // 是否是 收货入库进来
+		$scope.acceptGoods = false // 是否是 收货入库进来
 		$scope.CheckId = 'autoMonth0' // 当前发货点选择按钮
-    $scope.ChooseItem = {} // 当前选择发货单
+    $scope.ChooseItem = '' // 当前选择发货单
 
     // 记录状态激活信息
 		$scope.steps = {
@@ -196,6 +196,9 @@ define(['app/app'], function(app) {
 				}
 				$scope.order = data;
         $scope.sendGoodsList = $scope.order.inIds.split(',')
+        $scope.ChooseItem = $scope.sendGoodsList.length > 0 ? $scope.sendGoodsList[0] : ''
+				// todo 这里需要根据 是否存在已收货数据
+        $scope.acceptGoods = ($scope.sendGoodsList.length > 0 && ) ? true : false
 				$scope.order.orderHistory = angular.fromJson($scope.order.statushistory);
 				if ($scope.order.orderRemark){
 					$scope.remarkList = angular.fromJson($scope.order.orderRemark);
@@ -256,12 +259,21 @@ define(['app/app'], function(app) {
     $scope.ensureAccept = function() {
       // var orderids = Object.getOwnPropertyNames($scope.store);
       var ids = $scope.order.id
-      OrderSimpleInfo.ensureAccept({ids: ids},{invoiceId: $scope.ChooseItem},function(data){
-        toaster.pop('success', '成功' ,'确认收货成功');
-        $scope.goBack()
-      }, function(res){
-        toaster.pop('error', '失败!' + res.data);
-      });
+	    if ($scope.ChooseItem === '') {
+	      OrderSimpleInfo.mutilpEnsureAccept({id: ids},{},function(data){
+	        toaster.pop('success', '成功' ,'确认收货成功');
+	        $scope.goBack()
+	      }, function(res){
+	        toaster.pop('error', '失败!' + res.data);
+	      });
+	    } else {
+        OrderSimpleInfo.mutilpEnsureAccept({id: ids, invoiceId: $scope.ChooseItem},{},function(data){
+          toaster.pop('success', '成功' ,'确认收货成功');
+          $scope.goBack()
+        }, function(res){
+          toaster.pop('error', '失败!' + res.data);
+        });
+	    }
     };
 
 		// 取消收货

+ 4 - 4
src/main/webapp/resources/view/usercenter/forstore/order_detail.html

@@ -572,7 +572,7 @@
 								<!--</div>-->
 								<!-- 已收货 -->
 								<div class="text-area">
-                  <i >80</i>
+                  <i >{{detail.shipQty || '-'}}</i>
                 </div>
 							</span>
 							<span class="wd01" style="line-height: 18px;">
@@ -582,7 +582,7 @@
 								<!--</div>-->
 								<!-- 本次收货 -->
 								<div class="text-area">
-                  <i>80</i>
+                  <i>{{detail.shipQty || '-'}}</i>
                 </div>
 							</span>
 						</dd>
@@ -650,8 +650,8 @@
 				</dl>
 			</div>
 			<div class="order_btn" ng-if="acceptGoods">
-				<div ng-click="goBack()">取消</div>
-				<div ng-click="ensureAccept()">确认收货</div>
+				<div ng-click="goBack()" style="background:#aaaaaa">取消</div>
+				<div ng-click="ensureAccept()" style="background:#5078cb">确认收货</div>
 			</div>
 			<div style="clear: both"></div>
 		</div>