Ver Fonte

新增采购单:新增联系人或收货地址即时更新

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@7679 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq há 9 anos atrás
pai
commit
2259151f03
1 ficheiros alterados com 29 adições e 1 exclusões
  1. 29 1
      src/main/webapp/resources/js/index/app.js

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

@@ -8292,9 +8292,12 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		
 		// 新增收货地址保存
 		$scope.saveShipAddress = function(ship) {
-			ship.address = ship.province + ship.city + ship.district;
 			ShipAddress.saveAddress( {}, ship, function(data) {
 				if(data.success) {
+					ShipAddress.shipAddList({}, function(data) {
+						$scope.ships = data;
+						$scope.order.shipadd = $scope.ships[0];
+					});
 					toaster.pop('success', '提示', data.success);
 				}
 				if(data.error) {
@@ -8303,6 +8306,31 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			});
 		}
 		
+		// 新增供应商联系人
+		$scope.addContact = function(uu) {
+			console.log(uu);
+			var modalInstance = $modal.open({
+				animation: true,
+				templateUrl: 'static/tpl/index/purc/modal/contact_person_modal.html',
+				controller: 'AddContacCtrl',
+				resolve: {
+				}
+			});
+			modalInstance.result.then(function(data) {
+				$scope.contact = data;
+				$scope.contact.venduu = uu;
+				Vendor.saveContact({}, $scope.contact, function(data) {
+					Vendor.contacts({venduu: $scope.order.cust.uu}, {}, function(data) {
+						$scope.contacts = data;
+						$scope.order.vendor = $scope.contacts[0];
+					});
+					toaster.pop('success', '提示', '联系人保存成功');
+				}, function(response) {
+					toaster.pop('error', '失败', response.data);
+				});
+			});
+		}
+		
 	}]);
 	
 	// 查找供应商