Browse Source

配送规则提示框调整

hulh 8 years ago
parent
commit
7f4411e38c

+ 8 - 5
src/main/webapp/resources/js/vendor/app.js

@@ -893,8 +893,9 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 	/**
 	 * 配送规则提示共用控制器
 	 */
-	app.controller('rule_tip_ctrl', ['$scope', 'toaster', '$modalInstance', function ($scope, toaster, $modalInstance) {
-		$scope.tipModal = true;
+	app.controller('rule_tip_ctrl', ['$scope', 'toaster', '$modalInstance', 'type', 'tipModal', function ($scope, toaster, $modalInstance, type, tipModal) {
+		$scope.tipModal = tipModal;
+		$scope.type = type;
 
 		$scope.cancelDelete = function () {
 			$scope.tipModal = false;
@@ -923,15 +924,17 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 							tag = tag.parentElement;
 							attribute = tag.getAttribute("name");
 						}
-						$scope.tipModal = false;
-						$modalInstance.dismiss();
+						$scope.$apply(function () {
+							$scope.tipModal = false;
+							$modalInstance.close();
+						});
+
 					}
 				}
 			}
 		};
 	}]);
 
-
 	//币别的过滤器
 	app.filter('currencySysmbol', function() {
 		return function(moneyParam, currency, add) {

+ 5 - 1
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_index_ctrl.js

@@ -56,7 +56,10 @@ define(['app/app', 'calendar'], function(app) {
                         templateUrl: 'static/view/common/modal/delivery_rule_modal.html',
                         controller: 'rule_tip_ctrl',
                         resolve : {
-                            center : function() {
+                            type : function() {
+                                return 'center';
+                            },
+                            tipModal : function() {
                                 return true;
                             }
                         }
@@ -67,4 +70,5 @@ define(['app/app', 'calendar'], function(app) {
 
     }]);
 
+
 });

+ 28 - 44
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js

@@ -163,24 +163,6 @@ define([ 'app/app' ], function(app) {
 				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.getChoosedInfo = function () {
@@ -538,37 +520,39 @@ define([ 'app/app' ], function(app) {
 		function publishGoods(product) {
 			if (!validateGoods($scope.goods)) return ;
 
-			if ($scope.needShowTip) {
-				$modal.open({
-					animation : true,
-					templateUrl : 'static/view/common/modal/delivery_rule_modal.html',
-					controller : 'rule_tip_ctrl',
-					resolve : {
-						center : function() {
-							return false;
-						}
+			$q.all([initRuleCount().$promise]).then(function (data) {
+				if (data){
+					if ($scope.needShowTip){
+						$modal.open({
+							templateUrl: 'static/view/common/modal/delivery_rule_modal.html',
+							controller: 'rule_tip_ctrl',
+							resolve : {
+								type : function() {
+									return 'product';
+								},
+								tipModal : function() {
+									return true;
+								}
+							}
+						});
+						return ;
 					}
-				});
-				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) {
-				if (result.success) {
-					toaster.pop('success', '商品上架成功');
-					closeShelArea(product);
-				} else {
-					toaster.pop('error', result.message);
+					$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) {
+						if (result.success) {
+							toaster.pop('success', '商品上架成功');
+							closeShelArea(product);
+						} else {
+							toaster.pop('error', result.message);
+						}
+					}, function (error) {
+						toaster.pop('error', error.data);
+					});
 				}
-			}, function (error) {
-				toaster.pop('error', error.data);
 			});
 		}
 
-		$scope.cancelDelete = function () {
-			$scope.showNoRuleTip = false;
-		};
-
 		/**
 		 * 验证商品信息
 		 *

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

@@ -1317,7 +1317,10 @@ define([ 'app/app' ], function(app) {
                         templateUrl: 'static/view/common/modal/delivery_rule_modal.html',
                         controller: 'rule_tip_ctrl',
                         resolve : {
-                            center : function() {
+                            type : function() {
+                                return 'product';
+                            },
+                            tipModal : function() {
                                 return true;
                             }
                         }

+ 31 - 28
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_upload_ctrl.js

@@ -90,6 +90,17 @@ 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();
+
 		// 查看范例
 		$scope.showImg = function() {
 			var src = '';
@@ -159,34 +170,6 @@ 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)) {
@@ -263,6 +246,25 @@ define([ 'app/app' ], function(app) {
 		$scope.publish = function(event) {
 			if ($scope.pageParams.totalElements > 0) {
 				ReleaseProductByBatch.batchRelease({batch : $scope.result.batch}, null, function(data) {
+					if ($scope.needShowTip){
+						$scope.relTableParams.page(1);
+						$scope.relTableParams.reload();
+						$scope.result.success = 0;//设置成0,让前端用户不能点击
+						$modal.open({
+							animation : true,
+							templateUrl : 'static/view/common/modal/product_upload_modal.html',
+							controller : 'rule_tip_ctrl',
+							resolve : {
+								type : function() {
+									return 'upload';
+								},
+								tipModal : function() {
+									return true;
+								}
+							}
+						});
+						return ;
+					}
 					toaster.pop("success", "提示", "发布成功 :" + data.data + "条");
 					$scope.relTableParams.page(1);
 					$scope.relTableParams.reload();
@@ -330,4 +332,5 @@ define([ 'app/app' ], function(app) {
 			$modalInstance.dismiss();
 		};
 	}]);
+
 });

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

@@ -97,12 +97,12 @@
         <a name="rule_cancel" ng-click="cancelDelete()"><i class="fa fa-close fa-lg"></i></a>
     </div>
     <!--卖家首页-->
-    <div class="content">
+    <div class="content" ng-if="type=='center'">
         <p><i class="fa fa-exclamation-circle"></i><span>您的店铺尚未设置配送规则,无法计算运费,建议尽快设置!</span></p>
         <div><a name="rule_cancel" ng-click="cancelDelete()">以后再说</a><a name="rule_href" ng-click="hrefToRule()">立即设置</a></div>
     </div>
     <!--其他页面-->
-    <div class="content">
+    <div class="content" ng-if="type=='product'">
         <p><i class="fa fa-exclamation-circle"></i><span>您当前尚未设置配送规则,买家将无法下单,建议尽快设置!</span></p>
         <div><a name="rule_href" ng-click="hrefToRule()">立即设置</a></div>
     </div>

+ 0 - 0
src/main/webapp/resources/view/common/modal/product_onload_modal.html → src/main/webapp/resources/view/common/modal/product_upload_modal.html


+ 6 - 2
src/main/webapp/resources/view/vendor/forstore/vendor_material.html

@@ -269,9 +269,9 @@
 		font-size: 14px;
 	}
 	.com-del-box .content div a:first-child{
+		margin-right: 10px!important;
 		background: #b4b5b9;
 		color: #333;
-		margin-right: 10px;
 	}
 	.com-del-box .content div a:last-child{
 		background: #5078cb;
@@ -447,7 +447,7 @@
 		line-height: 0;
 	}
 	.com-del-box .content p .fa-exclamation-circle{
-		float: left;
+		/*float: left;*/
 		margin-top: 3px;
 		margin-right: 6px;
 		font-size: 18px;
@@ -471,6 +471,10 @@
 	}
 	.modal-backdrop {
 		background-color: transparent ;
+		bottom: unset!important;
+	}
+	.modal{
+		bottom: unset!important;
 	}
 </style>
 <div class="user_right fr">