Explorar el Código

发货之后跳到发货单详情页

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@1371 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
suntg hace 10 años
padre
commit
fe399b73ff

+ 27 - 10
src/main/webapp/resources/js/index/app.js

@@ -366,7 +366,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			});
 		};
 	}]);
-	app.controller('TruckModalCtrl', ['$scope', '$rootScope', '$modalInstance', 'SaleTruck', 'PurcNotice', 'toaster', function($scope, $rootScope, $modalInstance, SaleTruck, PurcNotice, toaster){
+	app.controller('TruckModalCtrl', ['$scope', '$rootScope', '$modalInstance', 'SaleTruck', 'PurcNotice', 'toaster', '$state', function($scope, $rootScope, $modalInstance, SaleTruck, PurcNotice, toaster, $state){
 		$scope.saleSend = {sendItems: []};
 		SaleTruck.detail({}, function(data){
 			$scope.notices = data;
@@ -421,8 +421,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 					sendItems: items
 				});
 				PurcNotice.sendByBatch({}, send, function(data){
-					toaster.pop('success', '提示', '发货成功。');
+					toaster.pop('success', '提示', '发货成功,跳转至发货单:' + send.code);
 					$modalInstance.close(true);
+					$state.go('sale.send_detail', {id: data.id});
 				}, function(response){
 					toaster.pop('error', '错误', response.data);
 				});
@@ -1627,7 +1628,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 	}]);
 	
 	// 发货提醒
-	app.controller('SaleNoticeCtrl', ['$scope', '$rootScope', '$filter', 'PurcNotice', 'ngTableParams', 'toaster', 'BaseService', 'PurcNoticeHis', '$modal', 'SaleTruck', 'Symbol', function($scope, $rootScope, $filter, PurcNotice, ngTableParams, toaster, BaseService, PurcNoticeHis, $modal, SaleTruck, Symbol){
+	app.controller('SaleNoticeCtrl', ['$scope', '$rootScope', '$filter', 'PurcNotice', 'ngTableParams', 'toaster', 'BaseService', 'PurcNoticeHis', '$modal', 'SaleTruck', 'Symbol', '$state', function($scope, $rootScope, $filter, PurcNotice, ngTableParams, toaster, BaseService, PurcNoticeHis, $modal, SaleTruck, Symbol, $state){
 		$scope.active = 'todo';
 		$scope.currency = Symbol.currency;
 		$scope.dateZoneText = '不限';
@@ -1715,13 +1716,13 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			} else {
 				var send = {code: notice.send.code, remark: notice.send.remark, sendItems: [{qty: notice.send.qty}]};
 				$scope.loading = true;
-				PurcNotice.save({id: notice.id}, send, function(){
+				PurcNotice.save({id: notice.id}, send, function(data){
 					$scope.loading = false;
-					toaster.pop('success', '提示', '发货成功');
-					$scope.tableParams.reload();
+					toaster.pop('success', '提示', '发货成功,跳转至发货单:' + notice.send.code);
+					$state.go('sale.send_detail', {id: data.id});
 				}, function(response){
 					$scope.loading = false;
-					toaster.pop('error', '失败', response.data);
+					toaster.pop('error', '发货失败', response.data);
 				});
 			}
 		};
@@ -1753,7 +1754,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		$scope.sendByBatch = function(){
 			var modalInstance = $modal.open({
 				animation: true,
-				templateUrl: 'sendByBatch.html',
+				templateUrl: 'static/tpl/index/sale/sendByBatch.html',
 				controller: 'SaleNoticeSendByBatchCtrl',
 				size: 'lg',
 				resolve: {
@@ -1826,7 +1827,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			data &&	($scope.tableParams.reload());
 		}, true);
 	}]);
-	app.controller('SaleNoticeSendByBatchCtrl', ['$scope', '$modalInstance', 'Symbol', 'selectedNotices', 'PurcNotice', 'toaster', function($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster){
+	app.controller('SaleNoticeSendByBatchCtrl', ['$scope', '$modalInstance', 'Symbol', 'selectedNotices', 'PurcNotice', 'toaster', '$state', function($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster, $state){
 		$scope.notices = angular.copy(selectedNotices);
 		$scope.currency = Symbol.currency;//将币别转化为对应的符号
 		$scope.saleSend = {
@@ -1840,6 +1841,21 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			
 		};
 		
+		// 计算总数、总额
+		$scope.$watch(function(){
+			return $scope.notices;
+		}, function(data) {
+			var q = 0, t = 0;
+			if(data) {
+				angular.forEach(data,function(d){
+					q += d.thisSendQty;
+					t += d.thisSendQty * d.orderItem.price;
+				});
+			}
+			$scope.totalQty = q;
+			$scope.total = t;
+		}, true);
+		
 		/**
 		 * 删除一个已选中的送货提醒
 		 */
@@ -1877,8 +1893,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 				toaster.pop('error', '错误', '只有客户一致、币别一致、付款方式一致才能一起发货。');
 			} else {
 				PurcNotice.sendByBatch({}, $scope.saleSend, function(data){
-					toaster.pop('success', '提示', '批量发货成功。');
+					toaster.pop('success', '提示', '发货成功,跳转至发货单:' + $scope.saleSend.code);
 					$modalInstance.close('success');
+					$state.go('sale.send_detail', {id: data.id});
 				}, function(response){
 					toaster.pop('error', '错误', response.data);
 				});

+ 1 - 78
src/main/webapp/resources/tpl/index/sale/notice.html

@@ -471,81 +471,4 @@
 		</tr>
 	</tbody>
 </table>
-</div>
-	<script type="text/ng-template" id="sendByBatch.html">
-        <div class="modal-header">
-            <h3 class="modal-title">批量发货</h3>
-        </div>
-		<form class="sampleSend" name="sampleSendForm" ng-submit="ok(sampleSendForm)">
-        	<div class="modal-body">
-				<div class="row" style="margin-bottom:10px;line-height:30px;">
-					<label class="col-md-3 col-sm-3 text-right"><span class="text-inverse">*</span> 发货单号:</label>
-					<div class="col-md-6 col-sm-6">
-					<input class="form-control input-sm" ng-model="saleSend.code" required type="text" placeholder="请输入发货单号"></div>
-				</div>
-				<div class="row" style="margin-bottom:10px;line-height:30px;">
-					<label class="col-md-3 col-sm-3 text-right">备注:</label>
-					<div class="col-md-6 col-sm-6">
-					<input class="form-control input-sm" ng-model="saleSend.remark" type="text" placeholder="备注"></div>
-				</div>
-				<div id="batchContainer" style="height:450px;overflow-y :scroll;border-collapse: collapse; ">
-					<table class="table table-bordered table-hover">
-						<tbody id="fixedHeader" class="fixedHeader">
-							<tr class="text-center">
-								<th width="30px"></th>
-								<th>商品</th>
-								<th width="90px">剩余未发</th>
-								<th width="100px">本次发货</th>
-								<th width="120px">单价</th>
-								<th width="120px">交货日期</th>
-								<th width="120px">订单</th>
-								<th width="50px" class="text-center">操作</th>
-							</tr>
-						</tbody>
-						<tbody>
-							<tr class="repeat" ng-repeat="notice in notices | orderBy: 'notice.orderItem.product.code'" ng-if="notice.$selected">
-								<td>
-									{{$index+1}}
-								</td>
-								<td>
-									<div ng-bind="::notice.orderItem.product.code"></div>
-									<div ng-bind="::notice.orderItem.product.title"></div>
-									<div class="text-muted" ng-bind="::notice.orderItem.product.spec"></div>
-								</td>
-								<td valign="middle" >
-									<div>
-										<span class="text-num" ng-bind="notice.qty-notice.endQty"></span>&nbsp;
-										<span ng-bind="notice.orderItem.product.unit"></span>
-									</div>
-								</td>
-								<td>
-									<input style="width:80px;" ng-model="notice.thisSendQty" 
-									ng-init="notice.thisSendQty = notice.qty-notice.endQty" class="form-control input-sm" type="number">
-								</td>
-								<td>
-									<div class="text-num">
-										<span ng-bind="::currency(notice.orderItem.order.currency)"></span>
-										<span ng-bind="::notice.orderItem.price|number:6"></span>
-									</div>
-								</td>
-								<td>
-									<div ng-bind="::notice.delivery | date: 'yyyy-MM-dd'"></div>
-								</td>
-								<td>
-									<div ng-bind="::notice.orderItem.order.code"></div>
-									<div>第 <span ng-bind="::notice.orderItem.number"></span> 行</div>
-								</td>
-								<td class="text-center">
-									<a ng-click="removeOne($index)"><i class="fa fa-trash-o fa-lg"></i></a>
-								</td>
-							</tr>
-						</tbody>
-					</table>
-				</div>
-        	</div>
-        	<div class="modal-footer">
-            	<button class="btn btn-primary" ng-click="sendByBatch()" type="button">确认发货</button>
-            	<button class="btn btn-warning" ng-click="cancel()" type="button">取消</button>
-        	</div>
-		</form>
-    </script>
+</div>

+ 93 - 0
src/main/webapp/resources/tpl/index/sale/sendByBatch.html

@@ -0,0 +1,93 @@
+<form class="sampleSend" name="sampleSendForm"
+	ng-submit="ok(sampleSendForm)">
+	<div class="modal-body">
+		<div class="headerline">
+			<span class="content"><i class="fa fa-fw fa-edit text-primary"></i>填写发货信息</span>
+		</div>
+		<div class="row" style="margin-bottom: 10px; line-height: 30px;">
+			<label class="col-md-3 col-sm-3 text-right"><strong
+				class="text-inverse">*</strong> 发货单号:</label>
+			<div class="col-md-6 col-sm-6">
+				<input class="form-control input-sm" ng-model="saleSend.code"
+					required type="text" placeholder="请输入本次发货单号">
+			</div>
+		</div>
+		<div class="row" style="margin-bottom: 10px; line-height: 30px;">
+			<label class="col-md-3 col-sm-3 text-right">备注:</label>
+			<div class="col-md-6 col-sm-6">
+				<input class="form-control input-sm" ng-model="saleSend.remark"
+					type="text" placeholder="填写备注信息">
+			</div>
+		</div>
+		<div class="headerline">
+			<span class="content"><i class="fa fa-fw fa-truck text-primary"></i>货车商品一览</span>
+		</div>
+		<div id="batchContainer"
+			style="height: 450px; overflow-y: scroll; border-collapse: collapse;">
+			<table class="table table-bordered table-hover">
+				<tbody id="fixedHeader" class="fixedHeader">
+					<tr class="text-center">
+						<th width="30px"></th>
+						<th>商品</th>
+						<th width="90px">剩余未发</th>
+						<th width="100px">本次发货</th>
+						<th width="120px">单价</th>
+						<th width="120px">交货日期</th>
+						<th width="120px">订单</th>
+						<th width="50px" class="text-center">操作</th>
+					</tr>
+				</tbody>
+				<tbody>
+					<tr class="repeat"
+						ng-repeat="notice in notices | orderBy: 'notice.orderItem.product.code'"
+						ng-if="notice.$selected">
+						<td>{{$index+1}}</td>
+						<td>
+							<div ng-bind="::notice.orderItem.product.code"></div>
+							<div ng-bind="::notice.orderItem.product.title"></div>
+							<div class="text-muted" ng-bind="::notice.orderItem.product.spec"></div>
+						</td>
+						<td valign="middle">
+							<div>
+								<span class="text-num" ng-bind="notice.qty-notice.endQty"></span>&nbsp;
+								<span ng-bind="notice.orderItem.product.unit"></span>
+							</div>
+						</td>
+						<td><input style="width: 80px;" ng-model="notice.thisSendQty"
+							ng-init="notice.thisSendQty = notice.qty-notice.endQty"
+							class="form-control input-sm" type="number"></td>
+						<td>
+							<div class="text-num">
+								<span ng-bind="::currency(notice.orderItem.order.currency)"></span>
+								<span ng-bind="::notice.orderItem.price|number:6"></span>
+							</div>
+						</td>
+						<td>
+							<div ng-bind="::notice.delivery | date: 'yyyy-MM-dd'"></div>
+						</td>
+						<td>
+							<div ng-bind="::notice.orderItem.order.code"></div>
+							<div>
+								第 <span ng-bind="::notice.orderItem.number"></span> 行
+							</div>
+						</td>
+						<td class="text-center"><a ng-click="removeOne($index)"><i
+								class="fa fa-trash-o fa-lg"></i><br>取消</a></td>
+					</tr>
+				</tbody>
+			</table>
+		</div>
+	</div>
+	<div class="modal-footer">
+		<div class="pull-left">
+			<ul class="list-inline">
+				<li><span class="text-muted">总数量:</span> <span
+					class="text-num text-bold" ng-bind="totalQty"></span></li>
+				<li><span class="text-muted">总金额:</span> <span
+					class="text-num text-bold" ng-bind="total | number:2"></span></li>
+			</ul>
+		</div>
+		<button class="btn btn-primary" ng-click="sendByBatch()" type="button">确认发货</button>
+		<button class="btn btn-warning" ng-click="cancel()" type="button">取消</button>
+	</div>
+</form>

+ 3 - 2
src/main/webapp/resources/tpl/index/sale/send_detail.html

@@ -3,8 +3,9 @@
 </div>
 <div class="pane base-info">
 	<div class="pane-header f16">
-		发货单<a ng-click="print(order)" class="pull-right text-simple"><i
-			class="fa fa-print fa-fw"></i>打印</a>
+		发货单
+		<!-- <a ng-click="print(order)" class="pull-right text-simple"><i
+			class="fa fa-print fa-fw"></i>打印</a> -->
 	</div>
 	<div class="pane-body">
 		<div class="headerline">