ソースを参照

1:购物车bug的处理。
2:增加正则表达式常量

yujia 8 年 前
コミット
3205c3e0d1

+ 16 - 0
src/main/java/com/uas/platform/b2c/core/utils/RegexConstant.java

@@ -0,0 +1,16 @@
+package com.uas.platform.b2c.core.utils;
+
+/**
+ * 正则表达式的常量
+ *
+ * @author yuj 2017-09-05 11:08
+ */
+public class RegexConstant {
+
+    /**
+     * 匹配中文和英文的正则表达式
+     */
+    public static final String chineseAndEnglish = "^[\\u4e00-\\u9fa5a-zA-Z]+$";
+
+    public static final String NumberDate = "^$";
+}

+ 2 - 2
src/main/webapp/resources/js/admin/app.js

@@ -805,9 +805,9 @@
                  moneyParam = 0;
              }
              if(currency == 'RMB') {
-                 return "¥ " + moneyParam + " " + (typeof(add) == "undefined" ? '' : add);
+                 return "¥" + moneyParam + (typeof(add) == "undefined" ? '' : add);
              }else if(currency == "USD"){
-                 return "$ " + moneyParam;
+                 return "" + moneyParam;
              }else {
                  return moneyParam;
              }

+ 24 - 23
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_cart_ctrl.js

@@ -11,7 +11,7 @@ define(["app/app", 'jquery-summernote'], function(app) {
 		 * */
 		var enIdFilter = $filter('EncryptionFilter');
 		$scope.cartExist = true;
-		$scope.isLoading = false;
+		$scope.isDataLoading = false;
 		$scope.errors = null;
 		$scope.goodsInfo = [];
 		$scope.carts = [];
@@ -39,19 +39,13 @@ define(["app/app", 'jquery-summernote'], function(app) {
 		$scope.cartMap = [];
 
 		$scope.loadData = function (){
-			if(!$scope.isLoading) {
-				$scope.isLoading = true;
 				Cart.getPageInfo($scope.pageInfo, function(data) {
-					$scope.isLoading = false;
+					$scope.isDataLoading = false;
 					$scope.total = data.totalElements;
 					$scope.pageNum = data.totalPages;
 
 					angular.forEach(data.content, function (cart) {
-						if(cart.currencyName.indexOf("RMB") > -1) {
-							cart.buyCurrency = "RMB";
-						}else {
-							cart.buyCurrency = "USD";
-						}
+						cart.buyCurrency = cart.currencyName.indexOf("RMB") > -1 ? "RMB" : "USD";
 						cart.isSelect = false;
 						//计算分段和统计一下价格
 						$scope.getPrice(cart);
@@ -75,11 +69,7 @@ define(["app/app", 'jquery-summernote'], function(app) {
 							$scope.cartMap.push(obj);
 						}
 					});
-					if(!$scope.carts.length) {
-						$scope.cartIsEmpty = true;
-					}else {
-						$scope.cartIsEmpty = false;
-					}
+					$scope.cartIsEmpty = !$scope.carts.length ? true : false;
 					//设置全选的复选框
 					$scope.isChooseAll = $scope.isAllSelect($scope.carts);
 
@@ -90,7 +80,6 @@ define(["app/app", 'jquery-summernote'], function(app) {
 				},function() {
 					toaster.pop('error', "提示", "获取购物车信息失败,请刷新页面");
 				});
-			}
 		};
 
 		$scope.loadData();
@@ -100,8 +89,11 @@ define(["app/app", 'jquery-summernote'], function(app) {
 		 */
 		$scope.scrollLoadData = function () {
 			if($scope.pageInfo.page < $scope.pageNum) {
-				$scope.pageInfo.page++;
-				$scope.loadData();
+				if(!$scope.isDataLoading) {
+					$scope.isDataLoading = true;
+					$scope.pageInfo.page++;
+					$scope.loadData();
+				}
 			}
 		};
 
@@ -613,13 +605,18 @@ define(["app/app", 'jquery-summernote'], function(app) {
 
 		//检查是否所有的状态都已经选中或者取消了。
 		$scope.isAllSelect = function (carts) {
-			var isAllChecked = true;//假定都选中,
-			angular.forEach(carts, function(cart) {
-				if(cart.status != 1 && !cart.isSelect) {
-					isAllChecked = false;
+			var isAllChecked = true;//假定都选中
+			var isAlldisabled = true;
+			for(var i = 0; i < carts.length; i++) {
+				var cart = carts[i];
+				if(cart.status != 1) {
+					isAlldisabled = false;
+					if(!cart.isSelect) {
+						isAllChecked = false;
+					}
 				}
-			});
-			return isAllChecked;
+			}
+			return !isAlldisabled&&isAllChecked;
         };
         /**
 		 * 店铺选中状态信息
@@ -897,6 +894,10 @@ define(["app/app", 'jquery-summernote'], function(app) {
 						}
 					});
 				});
+				if (uuids.length == 0){
+					toaster.pop('info', '你还未选择任何产品');
+					return;
+				}
                 collectionService.saveStores({ }, uuids, function(response){
 					if(response.data == "success"){
                         $scope.collectDelete();