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

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@1038 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d

administrator 11 лет назад
Родитель
Сommit
25d165f66e

+ 73 - 0
src/main/java/com/uas/platform/b2b/controller/TruckController.java

@@ -0,0 +1,73 @@
+package com.uas.platform.b2b.controller;
+
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.lang3.ArrayUtils;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 货车
+ * 
+ * @author yingp
+ * 
+ */
+@RestController
+@RequestMapping("/sale/truck")
+public class TruckController {
+
+	private static final String TRUCK = "_session_truck";
+
+	/**
+	 * 往货车加商品
+	 * 
+	 * @return
+	 */
+	@RequestMapping(method = RequestMethod.POST)
+	@ResponseBody
+	public void add(HttpSession session, Long noticeId) {
+		Object track = session.getAttribute(TRUCK);
+		Long[] noticeArray = null;
+		if (track != null)
+			noticeArray = (Long[]) track;
+		else
+			noticeArray = new Long[] {};
+		if (!ArrayUtils.contains(noticeArray, noticeId)) {
+			ArrayUtils.add(noticeArray, noticeId);
+			session.setAttribute(TRUCK, noticeArray);
+		}
+	}
+
+	/**
+	 * 去除货车的商品
+	 * 
+	 * @return
+	 */
+	@RequestMapping(method = RequestMethod.DELETE)
+	@ResponseBody
+	public void delete(HttpSession session, Long noticeId) {
+		Object track = session.getAttribute(TRUCK);
+		if (track != null) {
+			if (noticeId != null) {
+				Long[] noticeArray = (Long[]) track;
+				ArrayUtils.removeElement(noticeArray, noticeId);
+				session.setAttribute(TRUCK, noticeArray);
+			} else
+				session.removeAttribute(TRUCK);// 清除货车的商品
+		}
+	}
+
+	/**
+	 * 查找货车的商品
+	 * 
+	 * @return
+	 */
+	@RequestMapping(method = RequestMethod.GET)
+	@ResponseBody
+	public Object get(HttpSession session) {
+		return session.getAttribute(TRUCK);
+	}
+
+}

+ 1 - 1
src/main/webapp/WEB-INF/views/normal/index.html

@@ -192,7 +192,7 @@
 				</div>
 				</div>
 			</div>
 			</div>
 			<!-- 公司信息 End -->
 			<!-- 公司信息 End -->
-			<div ui-view="right-view"></div>
+			<div ui-view="right-view" class="view-slide-in"></div>
 		</div>
 		</div>
 	</div>
 	</div>
 	<!-- body End -->
 	<!-- body End -->

+ 24 - 20
src/main/webapp/resources/css/index.css

@@ -1897,25 +1897,29 @@ input.ng-invalid.ng-dirty,textarea.ng-invalid.ng-dirty {
 .tooltip.control-tooltip .tooltip-inner {
 .tooltip.control-tooltip .tooltip-inner {
 	padding: 5px 10px;
 	padding: 5px 10px;
 }
 }
-/*truck*/
-.truck {
-	position: fixed;
-	top: 88px;
-	right: 20px;
-	width: 100px;
-	height: 100px;
-	-webkit-transition: all 0.15s ease-in-out;
-	-moz-transition: all 0.15s ease-in-out;
-	transition: all 0.15s ease-in-out;
+/*ng-view*/
+.view-slide-in.ng-enter {
+  	transition: all .5s ease;
+  	-webkit-transition:all .5s ease;
+  	-moz-transition: all .5s ease;
+  	-o-transition: all .5s ease;
+  	position: relative;
+  	opacity: 0;
+  	top: 10px;
+  	left: 20px;
 }
 }
-
-.truck .icon {
-  	width: 60px;
-  	height: 60px;
-  	line-height: 60px;
-  	text-align: center;
-  	color: #56a022;
-  	font-size: 16px;
-  	border-radius: 50%;
-  	border: 1px solid #56a022;
+.view-slide-in.ng-enter.ng-enter-active {
+  	top: 0;
+  	left: 0;
+  	opacity: 1;
+}
+.view-slide-in.ng-leave.ng-leave-active{
+  	top: 5px;
+  	left: 5px;
+  	opacity: 1;
+}
+.view-slide-in.ng-leave{
+  	top: 0;
+  	left: 0;
+  	opacity: 0;
 }
 }

+ 29 - 1
src/main/webapp/resources/js/index/app.js

@@ -256,6 +256,12 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			$scope.todo = data;
 			$scope.todo = data;
 		});
 		});
 	});
 	});
+	app.controller('TruckCtrl', function($scope, $rootScope, SaleTruck){
+		SaleTruck.query({}, function(data){
+			$rootScope.truck = data;
+			$scope.truckCount = data ? data.length : 0;
+		});
+	});
 	app.controller('PersonalSaleStatCtrl', function($scope, SaleStat) {
 	app.controller('PersonalSaleStatCtrl', function($scope, SaleStat) {
 		SaleStat.cust({}, function(data){
 		SaleStat.cust({}, function(data){
 			var p = [], q = [];
 			var p = [], q = [];
@@ -1038,7 +1044,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			}
 			}
 		};
 		};
 	});
 	});
-	app.controller('SaleNoticeCtrl', function($scope, $filter, PurcNotice, ngTableParams, toaster, BaseService, PurcNoticeHis, $modal){
+	app.controller('SaleNoticeCtrl', function($scope, $rootScope, $filter, PurcNotice, ngTableParams, toaster, BaseService, PurcNoticeHis, $modal, SaleTruck){
 		$scope.active = 'todo';
 		$scope.active = 'todo';
 		$scope.dateZoneText = '一个月内';
 		$scope.dateZoneText = '一个月内';
 		$scope.condition = {dateZone: 1};
 		$scope.condition = {dateZone: 1};
@@ -1195,6 +1201,28 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		$scope.onSearch = function() {
 		$scope.onSearch = function() {
 			$scope.tableParams.reload();
 			$scope.tableParams.reload();
 		};
 		};
+		
+		//货车功能
+		var truck = $rootScope.truck;
+		if(!truck) {
+			SaleTruck.query({}, function(data){
+				truck =  $rootScope.truck = data;
+			});
+		}
+		$scope.isInTruck = function(noticeId) {
+			return truck.indexOf(noticeId) > -1;
+		};
+		$scope.addtoTruck = function(noticeId) {
+			SaleTruck.save({}, {noticeId: noticeId}, function(){
+				
+			});
+		};
+		$scope.delFromTruck = function(noticeId) {
+			SaleTruck.remove({}, {noticeId: noticeId}, function(){
+				
+			});
+		};
+		
 	});
 	});
 	app.controller('SaleNoticeSendByBatchCtrl', function($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster){
 	app.controller('SaleNoticeSendByBatchCtrl', function($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster){
 		$scope.notices = angular.copy(selectedNotices);
 		$scope.notices = angular.copy(selectedNotices);

+ 2 - 0
src/main/webapp/resources/js/index/services/Purc.js

@@ -290,5 +290,7 @@ define([ 'ngResource'], function() {
 				isArray: true
 				isArray: true
 			}
 			}
 		});
 		});
+	}).factory('SaleTruck', function($resource) {
+		return $resource('sale/truck', {});
 	});
 	});
 });
 });

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

@@ -423,7 +423,17 @@
 				</div>
 				</div>
 				<div ng-if="(!notice.endQty || notice.endQty<notice.qty) && !notice.end && !notice.waiting">
 				<div ng-if="(!notice.endQty || notice.endQty<notice.qty) && !notice.end && !notice.waiting">
 					<div ng-show="!notice.$editing">
 					<div ng-show="!notice.$editing">
-						<a ng-click="notice.$editing=!notice.$editing"><i class="fa fa-send-o fa-lg"></i><br>发 货</a>
+						<div ng-show="!isInTruck(notice.id)">
+							<div class="br-b">
+								<a ng-click="notice.$editing=!notice.$editing"><i class="fa fa-send-o fa-lg"></i><br>发 货</a>
+							</div>
+							<div>
+								<a ng-click="addtoTruck(notice.id)" class="text-simple"><i class="fa fa-truck fa-lg"></i><br>加入货车</a>
+							</div>
+						</div>
+						<div ng-show="isInTruck(notice.id)">
+							已加入货车
+						</div>
 					</div>
 					</div>
 					<div ng-show="notice.$editing">
 					<div ng-show="notice.$editing">
 						<div>
 						<div>

+ 40 - 29
src/main/webapp/resources/tpl/index/sale/right.html

@@ -1,4 +1,4 @@
-<div ui-view class="sale-view"></div>
+<div ui-view class="sale-view view-slide-in"></div>
 <style>
 <style>
 .rbar {
 .rbar {
 	opacity: 1;
 	opacity: 1;
@@ -23,6 +23,14 @@
 	background: -o-linear-gradient(left, #e9e9e9, #fafafa);
 	background: -o-linear-gradient(left, #e9e9e9, #fafafa);
 }
 }
 
 
+.rbar a:hover {
+	color: #fff;
+}
+
+.rbar a:hover,.rbar a:focus,.rbar a:active {
+	text-decoration: none;
+}
+
 .rbar .item-wrap {
 .rbar .item-wrap {
 	position: relative;
 	position: relative;
 	cursor: pointer;
 	cursor: pointer;
@@ -37,7 +45,7 @@
 .rbar .item-inner {
 .rbar .item-inner {
 	border-bottom: 1px solid #e3e3e3;
 	border-bottom: 1px solid #e3e3e3;
 	width: 34px;
 	width: 34px;
-	
+	display: block;
 }
 }
 
 
 .rbar .item-wrap:hover {
 .rbar .item-wrap:hover {
@@ -116,48 +124,51 @@
 	border-top: 1px solid #e3e3e3;
 	border-top: 1px solid #e3e3e3;
 }
 }
 
 
-.bar-bottom .item-wrap:first-child .item-inner{
-  	border-top: 1px solid #f9f9f9;
+.bar-bottom .item-wrap:first-child .item-inner {
+	border-top: 1px solid #f9f9f9;
 }
 }
 </style>
 </style>
 <!-- right static-bar Start -->
 <!-- right static-bar Start -->
 <div class="rbar">
 <div class="rbar">
-	<div class="item-wrap">
+	<div class="item-wrap" ng-controller="TruckCtrl">
 		<div class="item-inner">
 		<div class="item-inner">
-			<span class="inner-text"><!-- <i class="fa fa-fw fa-truck fa-2x"></i> -->我的货车</span>
-			<span class="badge">0</span>
+			<span class="inner-text"> <!-- <i class="fa fa-fw fa-truck fa-2x"></i> -->我的货车
+			</span> <span class="badge" ng-bind="truckCount"></span>
 		</div>
 		</div>
-		<div class="tip">发货</div>
+		<div class="tip" style="display: none;">发货</div>
 	</div>
 	</div>
-	<div class="item-wrap">
-		<div class="item-inner">
-			<span class="inner-text">待报价</span>
-			<span class="badge">0</span>
+	<div class="bar-center" ng-controller="TodoCtrl">
+		<div class="item-wrap">
+			<a class="item-inner" ui-sref="sale.inquiry"> <span
+				class="inner-text">待报价</span> <span class="badge"
+				ng-bind="todo.inquiry"></span>
+			</a>
+			<div class="tip" style="display: none;">报价</div>
 		</div>
 		</div>
-		<div class="tip">报价</div>
-	</div>
-	<div class="item-wrap">
-		<div class="item-inner">
-			<span class="inner-text">待回复</span>
-			<span class="badge">0</span>
+		<div class="item-wrap">
+			<a class="item-inner" ui-sref="sale.order"> <span
+				class="inner-text">待回复</span> <span class="badge"
+				ng-bind="todo.order"></span>
+			</a>
 		</div>
 		</div>
-	</div>
-	<div class="item-wrap">
-		<div class="item-inner">
-			<span class="inner-text">变更中</span>
-			<span class="badge">0</span>
+		<div class="item-wrap">
+			<a class="item-inner" ui-sref="sale.change"> <span
+				class="inner-text">变更中</span> <span class="badge"
+				ng-bind="todo.orderChange"></span>
+			</a>
 		</div>
 		</div>
-	</div>
-	<div class="item-wrap">
-		<div class="item-inner">
-			<span class="inner-text">待发货</span>
-			<span class="badge">123</span>
+		<div class="item-wrap">
+			<a class="item-inner" ui-sref="sale.notice"> <span
+				class="inner-text">待发货</span> <span class="badge"
+				ng-bind="todo.notice"></span>
+			</a>
 		</div>
 		</div>
 	</div>
 	</div>
 	<div class="bar-bottom">
 	<div class="bar-bottom">
 		<div class="item-wrap">
 		<div class="item-wrap">
 			<div class="item-inner">
 			<div class="item-inner">
-				<span class="inner-text"><i class="fa fa-fw fa-headphones fa-lg"></i></span>
+				<span class="inner-text"><i
+					class="fa fa-fw fa-headphones fa-lg"></i></span>
 			</div>
 			</div>
 		</div>
 		</div>
 		<div class="item-wrap">
 		<div class="item-wrap">