Browse Source

搜索结果物料增加询价功能

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@8356 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 9 years ago
parent
commit
8033851b0f
1 changed files with 25 additions and 8 deletions
  1. 25 8
      src/main/webapp/resources/js/index/app.js

+ 25 - 8
src/main/webapp/resources/js/index/app.js

@@ -961,6 +961,11 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			window.location.hash = "#/purc/addOrder";
 		}
 		
+		$scope.PurcInquiry = function(businessCode, id){
+			$rootScope.prodId = id;
+			window.location.hash = "#/purc/purcinquiry/" + businessCode;
+		}
+		
 		/**
 		 * 邀请注册商务平台
 		 */
@@ -9787,6 +9792,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				item.unit = data.unit;
 				item.id = data.id;
 				$scope.order.orderItems.push(item);
+				$rootScope.prodId = null;// 清除掉prodId
 			}, function(response) {
 				
 			});
@@ -13627,8 +13633,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 	}]);
     
     // 平台新增的询价单(指定一个供应商)
-	app.controller('PurcInquiryNewCtrl', ['$scope', 'PurchaseInquiry', 'toaster', 'BaseService', '$upload', '$filter', '$modal', '$rootScope', 'ngTableParams', 'GetProductInfo', '$timeout', '$http', 'ShipAddress', '$stateParams', 'Vendor', 'Product', 'Search', 'ComponentActiveAPI', function($scope, PurchaseInquiry, toaster, BaseService, $upload, $filter, $modal, $rootScope, ngTableParams, GetProductInfo, $timeout, $http, ShipAddress, $stateParams, Vendor, Product, Search, ComponentActiveAPI) {
-		BaseService.scrollBackToTop();
+	app.controller('PurcInquiryNewCtrl', ['$scope', 'PurchaseInquiry', 'toaster', 'BaseService', '$upload', '$filter', '$modal', '$rootScope', 'ngTableParams', 'GetProductInfo', '$timeout', '$http', 'ShipAddress', '$stateParams', 'Vendor', 'Product', 'Search', 'ComponentActiveAPI', 'VendorInfo', function($scope, PurchaseInquiry, toaster, BaseService, $upload, $filter, $modal, $rootScope, ngTableParams, GetProductInfo, $timeout, $http, ShipAddress, $stateParams, Vendor, Product, Search, ComponentActiveAPI, VendorInfo) {
 		$scope.active = 'all';
 		
 		// 供应商信息
@@ -13872,23 +13877,35 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			$scope.inquiry.inquiryItems.push(
 				{ 	prodCode: null,
 					prodTitle: null,
-					unit: null,
+					unit: 'PCS',
 					ibrand: null,
 					currency: 'RMB',
 					toDate: null});
 		};
         //删除商品
-        $scope.del = function(index) {
-        	$scope.inquiry.inquiryItems.splice(index, 1);
-        };
-        //删除商品
         $scope.del = function(index) {
         	$scope.inquiry.inquiryItems.splice(index, 1);
         };
         
+        // 搜索结果询价
+    	if($rootScope.prodId) {
+			VendorInfo.getProdInfo({id: $rootScope.prodId}, {}, function(data) {
+				prod.prodCode = data.code;
+				prod.prodTitle = data.title;
+				prod.spec = data.spec;
+				prod.unit = data.unit;
+				prod.productId = data.id;
+				prod.inbrand = data.brand;
+				$scope.inquiry.inquiryItems.push(prod);
+				$rootScope.prodId = null;// 清除掉prodId
+			}, function(response) {
+				
+			});
+		}
+        
 		$scope.check = function(product) {
 			$scope.inquiry.inquiryItems.push({prodCode: product.code, prodTitle: product.title, spec: product.spec, unit: product.unit,
-                currency: null, toDate: null,  productId: product.id});
+                currency: null, toDate: null,  productId: product.id, inbrand: product.brand});
 		}	
 		
 		$scope.getMinDate = function(item) {