Browse Source

客户资料中心增加主动报价功能

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@7950 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 9 years ago
parent
commit
93a5a931ba

+ 18 - 0
src/main/java/com/uas/platform/b2b/controller/PurcOrderController.java

@@ -30,9 +30,27 @@ public class PurcOrderController {
 		return purcOrderService.getVendorInfo(businessCode);
 		return purcOrderService.getVendorInfo(businessCode);
 	}
 	}
 
 
+	/**
+	 * 物料详情
+	 * 
+	 * @param id
+	 * @return
+	 */
 	@RequestMapping(value = "/getProdInfo/{id}", method = RequestMethod.GET)
 	@RequestMapping(value = "/getProdInfo/{id}", method = RequestMethod.GET)
 	@ResponseBody
 	@ResponseBody
 	public Product getProdInfoById(@PathVariable Long id) {
 	public Product getProdInfoById(@PathVariable Long id) {
 		return purcOrderService.getProductInfoById(id);
 		return purcOrderService.getProductInfoById(id);
 	}
 	}
+
+	/**
+	 * 查询客户资料
+	 * 
+	 * @param custuu
+	 * @return
+	 */
+	@RequestMapping(value ="/customerInfo/{custuu}", method = RequestMethod.GET)
+	@ResponseBody
+	public Vendor getCustomerInfo(@PathVariable Long custuu) {
+		return purcOrderService.getCustomerInfo(custuu);
+	}
 }
 }

+ 8 - 0
src/main/java/com/uas/platform/b2b/service/PurcOrderService.java

@@ -22,4 +22,12 @@ public interface PurcOrderService {
 	 */
 	 */
 	public Product getProductInfoById(Long id);
 	public Product getProductInfoById(Long id);
 
 
+	/**
+	 * 得到客户信息
+	 * 
+	 * @param custuu
+	 * @return
+	 */
+	public Vendor getCustomerInfo(Long custuu);
+
 }
 }

+ 5 - 0
src/main/java/com/uas/platform/b2b/service/impl/PurcOrderServiceImpl.java

@@ -34,4 +34,9 @@ public class PurcOrderServiceImpl implements PurcOrderService {
 		return productDao.findOne(id);
 		return productDao.findOne(id);
 	}
 	}
 
 
+	@Override
+	public Vendor getCustomerInfo(Long custuu) {
+		return vendorDao.findByMyEnUUAndVendUU(custuu, SystemSession.getUser().getEnterprise().getUu()).get(0);
+	}
+
 }
 }

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

@@ -1688,6 +1688,12 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 				toaster.pop('error', '您不是管理员,无权限分配用户!');
 				toaster.pop('error', '您不是管理员,无权限分配用户!');
 			}
 			}
 		}
 		}
+		
+		$scope.Quotation = function(uu, id) {
+			$rootScope.custuu = uu;
+			$rootScope.prodId = id;
+			window.location.hash = "#/sale/quotation/new";
+		}
 	}]);
 	}]);
 	
 	
 	app.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', function($scope, $modalInstance, customer, AccountUser, toaster){
 	app.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', function($scope, $modalInstance, customer, AccountUser, toaster){
@@ -3628,7 +3634,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 	}]);
 	}]);
 	
 	
 	// Controller 主动报价 - 新增
 	// Controller 主动报价 - 新增
-	app.controller('SaleQuotationNewCtrl', ['$scope', '$stateParams', '$filter', 'ngTableParams', 'toaster', 'BaseService', '$modal', 'Quotation', function($scope, $stateParams, $filter, ngTableParams, toaster, BaseService, $modal, Quotation){
+	app.controller('SaleQuotationNewCtrl', ['$scope', '$stateParams', '$filter', 'ngTableParams', 'toaster', 'BaseService', '$modal', 'Quotation', 'VendorInfo', '$rootScope', function($scope, $stateParams, $filter, ngTableParams, toaster, BaseService, $modal, Quotation, VendorInfo, $rootScope){
 		BaseService.scrollBackToTop();
 		BaseService.scrollBackToTop();
 		var staticItem = null;
 		var staticItem = null;
 		
 		
@@ -3704,6 +3710,26 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			}
 			}
 		};
 		};
 		
 		
+		// 赋值客户信息
+		if($rootScope.custuu) {
+			VendorInfo.customerInfo({custuu: $rootScope.custuu}, {}, function(data) {
+				$scope.item.quotation.cust = data.myEnterprise;
+				$scope.item.quotation.custUser = data.myUser;
+			})
+		}
+		
+		// 赋值物料信息
+		if($rootScope.prodId) {
+			VendorInfo.getProdInfo({id: $rootScope.prodId}, {}, function(data) {
+				$scope.item.product.code = data.code;
+				$scope.item.product.title = data.title;
+				$scope.item.product.spec = data.spec;
+				$scope.item.product.unit = data.unit;
+				$scope.item.product.id = data.id;
+			}, function(response) {
+				
+			});
+		}
 		// 查找客户物料
 		// 查找客户物料
 		$scope.dbfindCustProd = function(){
 		$scope.dbfindCustProd = function(){
 			if($scope.item.$editing) {
 			if($scope.item.$editing) {

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

@@ -728,6 +728,10 @@ define([ 'ngResource'], function() {
 			getProdInfo: {
 			getProdInfo: {
 				url: 'purchase/getProdInfo/:id',
 				url: 'purchase/getProdInfo/:id',
 				method: 'GET'
 				method: 'GET'
+			},
+			customerInfo: {
+				url: 'purchase/customerInfo/:custuu',
+				method: 'GET'
 			}
 			}
 		});
 		});
 	}]).factory('ShipAddress', ['$resource', function($resource){
 	}]).factory('ShipAddress', ['$resource', function($resource){

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

@@ -116,7 +116,7 @@
 						<th width="160px">名称</th>
 						<th width="160px">名称</th>
 						<th>规格</th>
 						<th>规格</th>
 						<th width="80px">单位</th>
 						<th width="80px">单位</th>
-						<!-- <th width="50px">选择</th> -->
+						<th width="50px">操作</th>
 					</tr>
 					</tr>
 				</thead>
 				</thead>
 				<tbody ng-if="tableParams.total() == 0">
 				<tbody ng-if="tableParams.total() == 0">
@@ -138,7 +138,7 @@
 						<td class="text-center" ng-bind="::product.title"></td>
 						<td class="text-center" ng-bind="::product.title"></td>
 						<td class="text-center f12" ng-bind="::product.spec"></td>
 						<td class="text-center f12" ng-bind="::product.spec"></td>
 						<td class="text-center" ng-bind="::product.unit"></td>
 						<td class="text-center" ng-bind="::product.unit"></td>
-						<td class="text-center" ><a title="主动报价" href="javascript:void(0)" style="text-decoration: none; color: #327ebe;" id="click" class="add01"></a>
+						<td class="text-center" ><a title="主动报价" href="javascript:void(0)" style="text-decoration: none; color: #327ebe;" id="click" class="add01" ng-click="Quotation(customer.uu, product.id)">报价</a>
 						</td>
 						</td>
 					</tr>
 					</tr>
 				</tbody>
 				</tbody>