Browse Source

配送规则提示暂全显示

hulh 8 years ago
parent
commit
025b848f39

+ 41 - 0
src/main/webapp/resources/js/vendor/app.js

@@ -890,6 +890,47 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 
 	}]);
 
+	/**
+	 * 配送规则提示共用控制器
+	 */
+	app.controller('rule_tip_ctrl', ['$scope', 'toaster', '$modalInstance', function ($scope, toaster, $modalInstance) {
+		$scope.tipModal = true;
+
+		$scope.cancelDelete = function () {
+			$scope.tipModal = false;
+			$modalInstance.dismiss();
+		};
+
+		$scope.hrefToRule = function () {
+			$modalInstance.dismiss();
+			window.location.href = 'vendor#vendor_deliveryRule';
+		};
+
+		/**
+		 * 监听点击的事件
+		 */
+		document.onclick = function (event) {
+			if($scope.tipModal) {
+				if(event) {
+					var tag = event.target;
+					if(tag) {
+						var attribute = tag.getAttribute("name");
+						while(tag.nodeName != 'BODY') {
+							if(attribute == 'rule_model' ||
+								attribute == 'rule_cancel' || attribute == 'rule_href') {
+								return ;
+							}
+							tag = tag.parentElement;
+							attribute = tag.getAttribute("name");
+						}
+						$scope.tipModal = false;
+						$modalInstance.dismiss();
+					}
+				}
+			}
+		};
+	}]);
+
 
 	//币别的过滤器
 	app.filter('currencySysmbol', function() {

+ 6 - 33
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_index_ctrl.js

@@ -54,7 +54,12 @@ define(['app/app', 'calendar'], function(app) {
                     $modal.open({
                         animation: true,
                         templateUrl: 'static/view/common/modal/delivery_rule_modal.html',
-                        controller: 'delete_ctrl'
+                        controller: 'rule_tip_ctrl',
+                        resolve : {
+                            center : function() {
+                                return true;
+                            }
+                        }
                     });
                 }
             }
@@ -62,36 +67,4 @@ define(['app/app', 'calendar'], function(app) {
 
     }]);
 
-    app.register.controller('delete_ctrl', ['$scope', 'toaster', '$modalInstance', function ($scope, toaster, $modalInstance) {
-        $scope.tipModal = true;
-
-        $scope.cancelDelete = function () {
-            $scope.tipModal = false;
-            $modalInstance.dismiss();
-        };
-
-        /**
-         * 监听点击的事件
-         */
-        document.onclick = function (event) {
-            if($scope.tipModal) {
-                if(event) {
-                    var tag = event.target;
-                    if(tag) {
-                        var attribute = tag.getAttribute("name");
-                        while(tag.nodeName != 'BODY') {
-                            if(attribute == 'rule_model' ||
-                                attribute == 'rule_cancel' || attribute == 'rule_href') {
-                                return ;
-                            }
-                            tag = tag.parentElement;
-                            attribute = tag.getAttribute("name");
-                        }
-                        $scope.tipModal = false;
-                        $modalInstance.dismiss();
-                    }
-                }
-            }
-        };
-    }]);
 });

+ 29 - 4
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js

@@ -1,6 +1,6 @@
 define([ 'app/app' ], function(app) {
 	'use strict';
-	app.register.controller('vendor_materialCtrl', ['$scope', '$rootScope', 'Material', 'toaster', 'ComponentActive', 'Enterprise', '$q', 'NumberService', 'DistributionRule', function ($scope, $rootScope, Material, toaster, ComponentActive, Enterprise, $q, NumberService, DistributionRule) {
+	app.register.controller('vendor_materialCtrl', ['$scope', '$rootScope', 'Material', 'toaster', 'ComponentActive', 'Enterprise', '$q', 'NumberService', 'DistributionRule', '$modal', function ($scope, $rootScope, Material, toaster, ComponentActive, Enterprise, $q, NumberService, DistributionRule, $modal) {
 		$rootScope.active = 'vendor_material';
 		document.title = '卖家产品库-优软商城';
 		$scope.tab = 'material';
@@ -155,7 +155,7 @@ define([ 'app/app' ], function(app) {
 		};
 
 		var initRuleCount = function () {
-			DistributionRule.findCountOfActiveRule({},{},function (data) {
+			return DistributionRule.findCountOfActiveRule({},{},function (data) {
 				if (data.success){
 					$scope.needShowTip = data.data;
 				}
@@ -165,6 +165,23 @@ define([ 'app/app' ], function(app) {
 		};
 		initRuleCount();
 
+		$q.all([initRuleCount().$promise]).then(function (data) {
+			if (data){
+				if ($scope.needShowTip){
+					$modal.open({
+						animation: true,
+						templateUrl: 'static/view/common/modal/delivery_rule_modal.html',
+						controller: 'rule_tip_ctrl',
+						resolve : {
+							center : function() {
+								return true;
+							}
+						}
+					});
+				}
+			}
+		});
+
 		//获取选中之后的信息
 		$scope.getChoosedInfo = function () {
 			angular.forEach($scope.currenctMaterial, function (material) {
@@ -522,10 +539,18 @@ define([ 'app/app' ], function(app) {
 			if (!validateGoods($scope.goods)) return ;
 
 			if ($scope.needShowTip) {
-				$scope.showNoRuleTip = true;
+				$modal.open({
+					animation : true,
+					templateUrl : 'static/view/common/modal/delivery_rule_modal.html',
+					controller : 'rule_tip_ctrl',
+					resolve : {
+						center : function() {
+							return false;
+						}
+					}
+				});
 				return;
 			}
-
 			$scope.goods.breakUp = 1 === $scope.goods.breakUp;
 			$scope.isSelfSupport = 1 === $scope.goods.isSelfSupport;
 			Material.newStockByStandardProduct({ id: product.id, isSelfSupport: $scope.isSelfSupport}, $scope.goods, function (result) {

+ 29 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_onSaleCtrl.js

@@ -1,6 +1,6 @@
 define([ 'app/app' ], function(app) {
     'use strict';
-    app.register.controller('vendor_onSaleCtrl', ['$scope', '$rootScope', 'Goods', '$modal', 'toaster', 'Loading', 'StoreInfo', 'AuthenticationService', '$q', 'StoreCms', 'NumberService', 'Enterprise', function ($scope, $rootScope, Goods, $modal, toaster, Loading, StoreInfo, AuthenticationService, $q, StoreCms, NumberService, Enterprise) {
+    app.register.controller('vendor_onSaleCtrl', ['$scope', '$rootScope', 'Goods', '$modal', 'toaster', 'Loading', 'StoreInfo', 'AuthenticationService', '$q', 'StoreCms', 'NumberService', 'Enterprise', 'DistributionRule', function ($scope, $rootScope, Goods, $modal, toaster, Loading, StoreInfo, AuthenticationService, $q, StoreCms, NumberService, Enterprise, DistributionRule) {
         $rootScope.active = 'vendor_material';
         $scope.keyword = '';
         $scope.tab = 'onSale';
@@ -1298,6 +1298,34 @@ define([ 'app/app' ], function(app) {
             getDownLoadStatus();
         };
 
+        var initRuleCount = function () {
+            return DistributionRule.findCountOfActiveRule({},{},function (data) {
+                if (data.success){
+                    $scope.needShowTip = data.data;
+                }
+            }, function (error) {
+                toaster.pop("error", error.data);
+            })
+        };
+        initRuleCount();
+
+        $q.all([initRuleCount().$promise]).then(function (data) {
+            if (data){
+                if ($scope.needShowTip){
+                    $modal.open({
+                        animation: true,
+                        templateUrl: 'static/view/common/modal/delivery_rule_modal.html',
+                        controller: 'rule_tip_ctrl',
+                        resolve : {
+                            center : function() {
+                                return true;
+                            }
+                        }
+                    });
+                }
+            }
+        });
+
         // 点击下架操作
         $scope.soldOut = function (commodity) {
             $scope.isSoldOut = true;

+ 29 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_upload_ctrl.js

@@ -8,7 +8,7 @@ define([ 'app/app' ], function(app) {
 	}]);
 
 	//批量上架的Ctrl
-	app.register.controller('batchPutOnCtrl', ['$scope', '$rootScope', 'ngTableParams', '$upload', '$q', 'AuthenticationService', 'BaseService', 'StoreInfo', 'SessionService', '$modal', 'toaster', 'ReleaseProductByBatch', 'Loading', 'Enterprise', function ($scope, $rootScope, ngTableParams, $upload, $q, AuthenticationService, BaseService, StoreInfo, SessionService, $modal, toaster, ReleaseProductByBatch, Loading, Enterprise) {
+	app.register.controller('batchPutOnCtrl', ['$scope', '$rootScope', 'ngTableParams', '$upload', '$q', 'AuthenticationService', 'BaseService', 'StoreInfo', 'SessionService', '$modal', 'toaster', 'ReleaseProductByBatch', 'Loading', 'Enterprise', 'DistributionRule', function ($scope, $rootScope, ngTableParams, $upload, $q, AuthenticationService, BaseService, StoreInfo, SessionService, $modal, toaster, ReleaseProductByBatch, Loading, Enterprise, DistributionRule) {
 
 		//获取币别信息
 		Enterprise.getCurrencyByRegisterAddress(null, function (data) {
@@ -159,6 +159,34 @@ define([ 'app/app' ], function(app) {
 			}
 		};
 
+		var initRuleCount = function () {
+			return DistributionRule.findCountOfActiveRule({},{},function (data) {
+				if (data.success){
+					$scope.needShowTip = data.data;
+				}
+			}, function (error) {
+				toaster.pop("error", error.data);
+			})
+		};
+		initRuleCount();
+
+		$q.all([initRuleCount().$promise]).then(function (data) {
+			if (data){
+				if ($scope.needShowTip){
+					$modal.open({
+						animation: true,
+						templateUrl: 'static/view/common/modal/delivery_rule_modal.html',
+						controller: 'rule_tip_ctrl',
+						resolve : {
+							center : function() {
+								return true;
+							}
+						}
+					});
+				}
+			}
+		});
+
 		// 上传Excel批量发布(大量)
 		$scope.upload = function() {
 			if(($scope.batch.myFiles == null) || ($scope.batch.myFiles.length == 0)) {

+ 1 - 1
src/main/webapp/resources/view/common/modal/delivery_rule_modal.html

@@ -82,6 +82,6 @@
     </div>
     <div class="content">
         <p><i class="fa fa-exclamation-circle"></i><span>您的店铺尚未设置配送规则,无法计算运费,建议尽快设置!</span></p>
-        <div><a name="rule_cancel" ng-click="cancelDelete()">以后再说</a><a name="rule_href" href="vendor#vendor_deliveryRule">立即设置</a></div>
+        <div><a name="rule_cancel" ng-click="cancelDelete()">以后再说</a><a name="rule_href" ng-click="hrefToRule()">立即设置</a></div>
     </div>
 </div>

+ 9 - 9
src/main/webapp/resources/view/vendor/forstore/vendor_index.html

@@ -180,12 +180,12 @@
     </div>
 </div>
 <!--未设置配送规则提醒-->
-<div class="com-del-box" ng-if="showNoRuleTip">
-    <div class="title">
-        <a ng-click="cancelDelete()"><i class="fa fa-close fa-lg"></i></a>
-    </div>
-    <div class="content">
-        <p><i class="fa fa-exclamation-circle"></i><span>您的店铺尚未设置配送规则,无法计算运费,建议尽快设置!</span></p>
-        <div><a ng-click="cancelDelete()">以后再说</a><a href="vendor#/vendor_deliveryRule">立即设置</a></div>
-    </div>
-</div>
+<!--<div class="com-del-box" ng-if="showNoRuleTip">-->
+    <!--<div class="title">-->
+        <!--<a ng-click="cancelDelete()"><i class="fa fa-close fa-lg"></i></a>-->
+    <!--</div>-->
+    <!--<div class="content">-->
+        <!--<p><i class="fa fa-exclamation-circle"></i><span>您的店铺尚未设置配送规则,无法计算运费,建议尽快设置!</span></p>-->
+        <!--<div><a ng-click="cancelDelete()">以后再说</a><a href="vendor#/vendor_deliveryRule">立即设置</a></div>-->
+    <!--</div>-->
+<!--</div>-->