Browse Source

合作伙伴增加启用禁用状态

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

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

@@ -10528,7 +10528,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 	/**
 	 * 建立合作关系申请
 	 */
-	app.controller('AddPartnerRequestCtrl', ['$scope', 'AddPartnerMyRequest', 'toaster', 'BaseService', 'ngTableParams', 'AddPartner', '$timeout', '$rootScope', function($scope, AddPartnerMyRequest, toaster, BaseService, ngTableParams, AddPartner, $timeout, $rootScope) {
+	app.controller('AddPartnerRequestCtrl', ['$scope', 'AddPartnerMyRequest', 'toaster', 'BaseService', 'ngTableParams', 'AddPartner', '$timeout', '$rootScope', 'VendorInfo', function($scope, AddPartnerMyRequest, toaster, BaseService, ngTableParams, AddPartner, $timeout, $rootScope, VendorInfo) {
 		BaseService.scrollBackToTop();
 		$scope.status = "partner";
 		$scope.active = 'all';
@@ -10659,6 +10659,57 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			});
 		}
 		
+		// 取消供应商关系
+		$scope.relieve = function(id) {
+			VendorInfo.relieve({id: id}, {}, function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+				}
+				$scope.tableParams.page(1);
+				$scope.tableParams.reload();
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			});
+		}
+		
+		// 建立供应商关系
+		$scope.activeVend = function(id) {
+			VendorInfo.activeVend({id: id}, {}, function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+				}
+				$scope.tableParams.page(1);
+				$scope.tableParams.reload();
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			});
+		}
+		
+		// 取消客户关系
+		$scope.disableCust = function(id) {
+			VendorInfo.disableCust({id: id}, {}, function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+				}
+				$scope.tableParams.page(1);
+	  			$scope.tableParams.reload();
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			});
+		}
+		
+		// 激活客户关系
+		$scope.activeCust = function(id) {
+			VendorInfo.activeCust({id: id}, {}, function(data) {
+				if(data.success) {
+					toaster.pop('success', '提示', data.success);
+				}
+				$scope.tableParams.page(1);
+	  			$scope.tableParams.reload();
+			}, function(response) {
+				toaster.pop('error', '提示', response.data);
+			});
+		}
 	}]);
 	
 	

+ 4 - 2
src/main/webapp/resources/tpl/index/baseInfo/myRequest.html

@@ -356,8 +356,10 @@
 				</div> -->
 			<td width="200" class="text-center">
 				<p><a class="btn label-success white" ng-click="addSupplier(request.vendUID)" ng-if="request.statusCode==313 && request.vendor == 0">添加供应商 </a></p>
-				<p><span class="btn01 btn label-danger white" ng-if="request.statusCode==313 && request.vendor == 1">供应商 </span></p>
-				<p><span class="btn01 btn label-danger white" ng-if="request.statusCode==313 && request.customer == 1">客户</span></p>
+				<p><span class="btn01 btn label-danger white" ng-if="request.vendor == 1 && request.vendswitch == 1">供应商启用 状态<a ng-click="relieve(request.vendorId)">禁用</a></span></p>
+				<p><span class="btn01 btn label-danger white" ng-if="request.vendor == 1 && request.vendswitch == 0">供应商禁用 状态<a ng-click="activeVend(request.vendorId)">启用</a></span></p>
+				<p><span class="btn01 btn label-danger white" ng-if="request.customer == 1 && request.custswitch == 1">客户启用状态<a ng-click="disableCust(request.custId)">禁用</a></span></p>
+				<p><span class="btn01 btn label-danger white" ng-if="request.customer == 1 && request.custswitch == 0">客户禁用状态<a ng-click="activeCust(request.custId)">启用</a></span></p>
 				<p><a class="btn label-danger white" ng-click="addCust(request.vendUID)" ng-if="request.statusCode==313 && request.customer == 0">添加客户</a></p>
 				<p><a  class="btn label-success white" ng-click="agree(request.id)" ng-if="request.statusCode==311 && request.method==0">同意</a></p>
 				<p><a  class="btn  label-danger white" ng-click="refuse(request.id, request.reason)" ng-if="request.statusCode==311 && request.method==0">拒绝</a></p>