Procházet zdrojové kódy

1:产品管理bug处理。

yujia před 8 roky
rodič
revize
e177d60fc7

+ 18 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/model/GoodsSimple.java

@@ -215,6 +215,12 @@ public class GoodsSimple {
 	@Column(name = "go_perqty")
 	private Double perQty;
 
+	/**
+	 * 是否拆卖
+	 */
+	@Column(name = "go_isbreakup")
+	private Boolean breakUp;
+
 	/**
 	 * 包装
 	 */
@@ -568,6 +574,7 @@ public class GoodsSimple {
 		this.lastReserve = goods.getLastReserve();
 		this.status = goods.getStatus();
 		this.perQty = goods.getPerQty();
+		this.breakUp = goods.getBreakUp();
 	}
 
 	public Short getB2cDeliveryDemMaxTime() {
@@ -614,7 +621,17 @@ public class GoodsSimple {
 		this.perQty = perQty;
 		return this;
 	}
-/*
+
+	public Boolean getBreakUp() {
+		return breakUp;
+	}
+
+	public GoodsSimple setBreakUp(Boolean breakUp) {
+		this.breakUp = breakUp;
+		return this;
+	}
+
+	/*
 	 * public GoodsSimpleUas converUas(){ GoodsSimpleUas uas = new
 	 * GoodsSimpleUas(); uas.setBatchCode(this.batchCode);
 	 * uas.setCreatedDate(this.createdDate);

+ 24 - 18
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsServiceImpl.java

@@ -264,7 +264,7 @@ public class GoodsServiceImpl implements GoodsService {
         }
         Double end = Double.MIN_VALUE;
         for (GoodsQtyPrice price : prices) {
-            if(NumberUtil.compare(price.getStart(), price.getEnd()) > - 1) {
+            if(NumberUtil.compare(price.getStart(), price.getEnd()) > 0) {
 				throw new IllegalOperatorException("分段价格中存在分段起始值大于分段结束值");
             }
             if(NumberUtil.compare(end, price.getStart()) > -1) {
@@ -1097,6 +1097,21 @@ public class GoodsServiceImpl implements GoodsService {
 		nowGoods.setSelfDeliveryDemMinTime(oldGoods.getSelfDeliveryDemMinTime());
 		nowGoods.setSelfDeliveryHKMaxTime(oldGoods.getSelfDeliveryHKMaxTime());
 		nowGoods.setSelfDeliveryHKMinTime(oldGoods.getSelfDeliveryHKMinTime());
+
+		if(Integer.valueOf(oldGoods.getSelfSale()).equals(IntegerConstant.B2C_SALE)) {
+			nowGoods.setStoreid(sysConf.getStoreid());
+			nowGoods.setStoreName(sysConf.getEnName());
+		}else if(Integer.valueOf(oldGoods.getSelfSale()).equals(IntegerConstant.SELF_SALE)){
+			StoreIn storeIn = storeInService.findByEnUU(nowGoods.getEnUU());
+			if(storeIn.getStatus() == StoreStatus.OPENED) {
+				nowGoods.setStoreid(storeIn.getUuid());
+				nowGoods.setStoreName(storeIn.getStoreName());
+			}else {
+				throw new IllegalOperatorException("您还未开店铺,不能选择自营");
+			}
+		}else {
+			throw new IllegalOperatorException("您选择的销售方式不存在");
+		}
 		// 设置货到香港,货到大陆的延长时间
 		setB2CDelayTime(nowGoods);
 
@@ -1129,21 +1144,6 @@ public class GoodsServiceImpl implements GoodsService {
 			return null;
 		}
 
-		if(Integer.valueOf(oldGoods.getSelfSale()).equals(IntegerConstant.B2C_SALE)) {
-			nowGoods.setStoreid(sysConf.getStoreid());
-			nowGoods.setStoreName(sysConf.getEnName());
-		}else if(Integer.valueOf(oldGoods.getSelfSale()).equals(IntegerConstant.SELF_SALE)){
-			StoreIn storeIn = storeInService.findByEnUU(nowGoods.getEnUU());
-			if(storeIn.getStatus() == StoreStatus.OPENED) {
-				nowGoods.setStoreid(storeIn.getUuid());
-				nowGoods.setStoreName(storeIn.getStoreName());
-			}else {
-				throw new IllegalOperatorException("您还未开店铺,不能选择自营");
-			}
-		}else {
-			throw new IllegalOperatorException("您选择的销售方式不存在");
-		}
-
 		GoodsHistory history = goodsHistoryService.initByGoods(nowGoods, OperateType.Update);
 		List<Order> orders = detailService.updateOrderDetailsByGoods(nowGoods);
 		//更新购物车信息
@@ -1368,8 +1368,10 @@ public class GoodsServiceImpl implements GoodsService {
 				if (CollectionUtils.isEmpty(delayTime3)) {
 					throw new IllegalOperatorException("请联系商城,您供应商交货延长时间 国内发往国内没设置。");
 				}
-				goods.setB2cDeliveryDemMaxTime((short) (delayTime3.get(0).getMaxTime() + goods.getSelfDeliveryDemMaxTime()));
-				goods.setB2cDeliveryDemMinTime((short) (delayTime3.get(0).getMinTime() + goods.getSelfDeliveryDemMinTime()));
+				goods.setB2cDeliveryDemMaxTime((short) (delayTime3.get(0).getMaxTime() + Short.valueOf(goods.getSelfDeliveryDemMaxTime() == null ? 0 : goods.getSelfDeliveryDemMaxTime())));
+				goods.setB2cDeliveryDemMinTime((short) (delayTime3.get(0).getMinTime() + Short.valueOf(goods.getSelfDeliveryDemMinTime() == null ? 0 : goods.getSelfDeliveryDemMinTime())));
+				goods.setB2cMaxDelivery((short) (delayTime3.get(0).getMinTime() + Short.valueOf(goods.getMaxDelivery() == null ? 0 : goods.getMaxDelivery())));
+				goods.setB2cMinDelivery((short) (delayTime3.get(0).getMinTime() + Short.valueOf(goods.getMinDelivery() == null ? 0 : goods.getMinDelivery())));
 			}
 			if (goods.getCurrencyName().indexOf("USD") > -1) {
 				List<TradeDeliveryDelayTime> delayTime1 = tradeDeliveryDelayTimeDao.getByType(2);
@@ -1378,12 +1380,16 @@ public class GoodsServiceImpl implements GoodsService {
 				}
 				goods.setB2cDeliveryHKMaxTime((short) (delayTime1.get(0).getMaxTime() + goods.getSelfDeliveryHKMaxTime()));
 				goods.setB2cDeliveryHKMinTime((short) (delayTime1.get(0).getMinTime() + goods.getSelfDeliveryHKMinTime()));
+				goods.setB2cMaxDelivery((short) (delayTime1.get(0).getMinTime() + Short.valueOf(goods.getMaxDelivery() == null ? 0 : goods.getMaxDelivery())));
+				goods.setB2cMinDelivery((short) (delayTime1.get(0).getMinTime() + Short.valueOf(goods.getMinDelivery() == null ? 0 : goods.getMinDelivery())));
 			}
 		}else { //如果是店铺自营
 			goods.setB2cDeliveryDemMaxTime(goods.getSelfDeliveryDemMaxTime());
 			goods.setB2cDeliveryDemMinTime(goods.getSelfDeliveryDemMinTime());
 			goods.setB2cDeliveryHKMaxTime(goods.getSelfDeliveryHKMaxTime());
 			goods.setB2cDeliveryHKMinTime(goods.getSelfDeliveryHKMinTime());
+			goods.setB2cMaxDelivery(goods.getMaxDelivery());
+			goods.setB2cMinDelivery(goods.getMinDelivery());
 		}
 	}
 

+ 3 - 3
src/main/java/com/uas/platform/b2c/trade/presale/service/impl/CartServiceImpl.java

@@ -103,7 +103,7 @@ public class CartServiceImpl implements CartService {
 	 */
 	@Override
 	public List<Cart> saveCart(List<Cart> carts) {
-		List<Cart> cartsReserveShortage = new ArrayList<Cart>();
+//		List<Cart> cartsReserveShortage = new ArrayList<Cart>();
 		// 检查库存如果不足,则将采购数量设为0,并置入
 		/*
 		 * for (Cart cart : carts) { Double price =
@@ -116,8 +116,8 @@ public class CartServiceImpl implements CartService {
 		 * IllegalOperatorException("以下批次数量不满足最小起订量,请您重新选择:" +
 		 * cart.getBatchCode()); } else { cartsReserveShortage.add(cart); } }
 		 */
-		cartDao.save(cartsReserveShortage);
-		return cartsReserveShortage;
+		cartDao.save(carts);
+		return carts;
 	}
 
 	@Deprecated

+ 6 - 0
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_cart_ctrl.js

@@ -231,10 +231,16 @@ define(["app/app", 'jquery-summernote'], function(app) {
 				}else {
 					c.number = Number(NumberService.sub(c.goods.reserve, c.goods.reserve % c.goods.minPackQty));
 				}
+				if(Number(c.number) < Number(c.goods.minBuyQty)) {
+					c.number = c.goods.minBuyQty;
+				}
 			}else {
 				if(!c.goods.breakUp) {
 					c.number = NumberService.sub(c.number, c.number % c.goods.minPackQty);
 				}
+				if(Number(c.number) < Number(c.goods.minBuyQty)) {
+					c.number = c.goods.minBuyQty;
+				}
 			}
 			$scope.disabledAddAndSub(c);
 			$scope.getPrice(c);

+ 162 - 148
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js

@@ -1,12 +1,22 @@
 define([ 'app/app' ], function(app) {
 	'use strict';
-	app.register.controller('vendor_materialCtrl', ['$scope', '$rootScope', 'Material', 'toaster', 'ComponentActive', 'Enterprise', function ($scope, $rootScope, Material, toaster, ComponentActive, Enterprise) {
+	app.register.controller('vendor_materialCtrl', ['$scope', '$rootScope', 'Material', 'toaster', 'ComponentActive', 'Enterprise', '$q', 'NumberService', function ($scope, $rootScope, Material, toaster, ComponentActive, Enterprise, $q, NumberService) {
 		$rootScope.active = 'vendor_material';
 
 		$scope.tab = 'material';
 		$scope.standard_tab = 'standard';
 		$scope.choosedIds = [];
 		$scope.deleteDiv = false;
+		/**
+		 * 最大
+		 * @type {number}
+		 */
+		$scope.maxReserve = 999999999;
+		/**
+		 * 最小包装量的最大值
+		 */
+		$scope.maxPackQty = 999999;
+		$scope.minReserve = 1;
 
 		$scope.param = {
 			page : 1,
@@ -14,10 +24,11 @@ define([ 'app/app' ], function(app) {
 			sorting : {
 				id : 'DESC'
 			},
-			isStandard : true
+			isStandard : true,
+			type : "standard"
 		};
 
-		$scope.goods = { isBreakUp: 1, isSelfSupport: 1, prices: [{}] };
+		$scope.goods = { breakUp: 1, isSelfSupport: 1, prices: [{}] };
 		$scope.isSelfSupport = true;
 		$scope.showShelfArea = showShelfArea;
 		$scope.closeShelArea = closeShelArea;
@@ -25,6 +36,7 @@ define([ 'app/app' ], function(app) {
 
 		$scope.setPriceMinAmount = setPriceMinAmount;
 		$scope.setPriceMaxAmount = setPriceMaxAmount;
+		$scope.setPriceMinPackAmount = setPriceMinPackAmount;
 
 		$scope.addPrice = addPrice;
 		$scope.deletePrice = deletePrice;
@@ -37,9 +49,25 @@ define([ 'app/app' ], function(app) {
 		$scope.error = {};
 
 		//获取币别信息
+		var deferred = $q.defer();
 		Enterprise.getCurrencyByRegisterAddress(null, function (data) {
-			if(data.code == 1) {
-				if(data.data == 'USD') {
+			deferred.resolve(data);
+
+		}, function (response) {
+			deferred.reject(response);
+			toaster.pop('info', '提示', '获取不到公司的币别信息');
+		});
+
+		var currencyPromise = deferred.promise;
+
+		$q.all([currencyPromise, $rootScope.storePromise]).then(function (result) {
+			console.log(result);
+			var curData = result[0];
+			if(!$scope.store) {
+				$scope.store = {};
+			}
+			if(curData.code == 1) {
+				if(curData.data == 'USD') {
 					$scope.store.enType = 'HK'
 				}else {
 					$scope.store.enType = 'MAINLAND'
@@ -49,8 +77,20 @@ define([ 'app/app' ], function(app) {
 				toaster.pop('info', '提示', '您公司的注册地址为空,无法确定币别,系统默认为人民币');
 				// $scope.onsale.currency = 'RMB';
 			}
-		}, function (response) {
-			toaster.pop('info', '提示', '获取不到公司的币别信息');
+		})['catch'](function (error) {
+			if(!$scope.store) {
+				$scope.store = {};
+			}
+			var curData = error[0];
+			if(curData.code == 1) {
+				if(curData.data == 'USD') {
+					$scope.store.enType = 'HK';
+				}else {
+					$scope.store.enType = 'MAINLAND';
+				}
+			}else {
+				$scope.store.enType = 'MAINLAND';
+			}
 		});
 
 		/**
@@ -423,11 +463,9 @@ define([ 'app/app' ], function(app) {
 		function publishGoods(product) {
 			if (!validateGoods($scope.goods)) return ;
 
-			$scope.goods.minPackQty = $scope.goods.minBuyQty;
-
 			console.log('product', product);
 			console.log($scope.goods);
-			$scope.goods.isBreakUp = 1 === $scope.goods.isBreakUp;
+			$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) {
@@ -463,6 +501,12 @@ define([ 'app/app' ], function(app) {
 				toaster.pop('error', '商品的起拍数量不能为空');
 				return false;
 			}
+			if(!goods.minPackQty || goods.minPackQty === '') {
+				goods.minPackQty = 1;
+			}
+			if(!goods.breakUp) {
+				$scope.isNotBreakUp(goods);
+			}
 
 			//console.log($scope.store.enType);
 			// 根据价格生成币别
@@ -537,18 +581,14 @@ define([ 'app/app' ], function(app) {
 				}
 			}
 
-			// 验证交期
-			if (goods.currencyName.indexOf('RMB') > -1) {
-				if ((!goods.selfDeliveryDemMinTime || goods.selfDeliveryDemMinTime === '') || (!goods.selfDeliveryDemMaxTime || goods.selfDeliveryDemMaxTime === '')) {
-					toaster.pop('error', '国内最长和最短交期不能为空');
-					return false;
-				}
-			}
-			if (goods.currencyName.indexOf('USD') > -1) {
-				if ((!goods.selfDeliveryHKMinTime || goods.selfDeliveryHKMinTime === '') || (!goods.selfDeliveryHKMaxTime || goods.selfDeliveryHKMaxTime === '')) {
-					toaster.pop('error', '香港最长和最短交期不能为空');
-					return false;
+			if ((!goods.minDelivery || goods.minDelivery === '') || (!goods.maxDelivery || goods.maxDelivery === '') ||
+				(goods.minDelivery < 1 || goods.minDelivery > 31) || (goods.maxDelivery < 0 || goods.maxDelivery > 31)) {
+				if(goods.currencyName.indexOf('RMB') > -1) {
+					toaster.pop('error', '国内最长和最短交期必须填写且必须在1-31区间之间');
+				}else {
+					toaster.pop('error', '香港最长和最短交期必须填写且必须在1-31区间之间');
 				}
+				return false;
 			}
 			return true;
 		}
@@ -567,7 +607,8 @@ define([ 'app/app' ], function(app) {
 					});
 					$scope.goods = { isBreakUp: 1, isSelfSupport: 1, prices: [{}] };
 					$scope.goods.prices = [];
-					$scope.goods.prices.push({start : 1, end : 999999999});
+					$scope.goods.prices.push({start : $scope.minReserve, end : $scope.maxReserve});
+					$scope.goods.isSelfSupport = $scope.store.status == 'OPENED' ? 1 : 0;
 					product.img = component.img || null;
 					product.selected = true;
 				} else {
@@ -596,39 +637,41 @@ define([ 'app/app' ], function(app) {
 		 * @param goods		商品信息
 		 */
 		function setPriceMinAmount(goods) {
-			if (goods.minBuyQty === undefined || goods.minBuyQty === null ) {
-				if (goods.prices && goods.prices.length > 0) {
-					goods.prices[0].start = goods.minBuyQty;
-				}
-				return ;
-			}
 			if (goods.minBuyQty <= 0) {
 				toaster.pop('error', '商品起拍数量必须大于0');
 				delete goods.minBuyQty;
-				if (goods.prices && goods.prices.length > 0) {
-					goods.prices[0].start = goods.minBuyQty;
-				}
 				return ;
 			}
 			if (goods.reserve !== undefined && goods.reserve != null) {
 				if (goods.minBuyQty > goods.reserve) {
 					toaster.pop('error', '商品起拍数量不能大于库存数量');
 					delete goods.minBuyQty;
-					if (goods.prices && goods.prices.length > 0) {
-						goods.prices[0].start = goods.minBuyQty;
-					}
 					return ;
 				}
 			}
-			if (goods.prices && goods.prices.length > 0) {
-				if (goods.prices[0].end != null) {
-					if (goods.minBuyQty > goods.prices[0].end) {
-						toaster.pop('error', '商品起拍数量不能大于第一价格梯度的终止数量');
-						goods.minBuyQty = goods.prices[0].start;
-						return ;
-					}
-				}
-				goods.prices[0].start = goods.minBuyQty;
+			if(!goods.breakUp) {
+				$scope.isNotBreakUp(goods);
+			}
+		}
+
+		/**
+		 * 设置最小包数量
+		 *
+		 * @param goods		商品信息
+		 */
+		function setPriceMinPackAmount(goods) {
+			if (goods.minPackQty <= 0) {
+				toaster.pop('error', '商品起拍数量必须大于0');
+				delete goods.minPackQty;
+				return ;
+			}
+			if(goods.minPackQty > $scope.maxPackQty) {
+				toaster.pop('error', '商品起拍数量必须小于' + $scope.maxPackQty);
+				delete goods.minPackQty;
+				return ;
+			}
+			if(!goods.breakUp) {
+				$scope.isNotBreakUp(goods);
 			}
 		}
 
@@ -644,12 +687,10 @@ define([ 'app/app' ], function(app) {
 			if (goods.reserve <= 0) {
 				toaster.pop('error', '商品库存数量必须大于0');
 				delete goods.reserve;
-				if (goods.prices && goods.prices.length > 0) {
-					goods.prices[goods.prices.length - 1].end = goods.reserve;
-				}
 				return ;
-			}else if(goods.reserve > 999999999) {
-				toaster.pop('error', '商品库存数量必须小于999999999');
+			}else if(goods.reserve > $scope.maxReserve) {
+				toaster.pop('error', '商品库存数量必须小于' + $scope.maxReserve);
+				delete goods.reserve;
 			}
 			if (goods.minBuyQty !== undefined && goods.minBuyQty != null) {
 				if (goods.minBuyQty > goods.reserve) {
@@ -658,6 +699,9 @@ define([ 'app/app' ], function(app) {
 					return ;
 				}
 			}
+			if(!goods.breakUp) {
+				$scope.isNotBreakUp(goods);
+			}
 		}
 
 		/**
@@ -673,13 +717,8 @@ define([ 'app/app' ], function(app) {
 			}
 			var price = {};
 			var lastPrice = goods.prices[index];
-			if (index < goods.prices.length - 1) {
-				price.end = lastPrice.end;
-				delete lastPrice.end;
-			} else {
-				price.start = lastPrice.end;
-			}
-
+			price.end = lastPrice.end;
+			delete lastPrice.end;
 			var newPrices = [];
 			for (var i = 0; i < goods.prices.length; i++) {
 				newPrices.push(angular.copy(goods.prices[i]));
@@ -688,6 +727,7 @@ define([ 'app/app' ], function(app) {
 				}
 			}
 			goods.prices = newPrices;
+			console.log(goods.prices);
 		}
 
 		/**
@@ -701,26 +741,14 @@ define([ 'app/app' ], function(app) {
 				toaster.pop('error', '价格区间至少包含一个');
 				return ;
 			}
-			if (index > 0) {
-				var lastPrice = goods.prices[index - 1];
-				var price = goods.prices[index];
-				if (price.end && price.end !== '') {
-					lastPrice.end = price.end;
-				}
-			} else {
-				var nextPrice = goods.prices[index + 1];
-				if (goods.minBuyQty && goods.minBuyQty !== '') {
-					nextPrice.start = goods.minBuyQty;
-				}
-			}
-
-			var newPrices = [];
-			for (var i = 0; i < goods.prices.length; i++) {
-				if (i !== index) {
-					newPrices.push(angular.copy(goods.prices[i]));
-				}
+			if(index == goods.prices.length -1) {
+				goods.prices[index - 1].end = goods.prices[index].end;
+				goods.prices.pop();
+			}else {
+				goods.prices[index + 1].start = goods.prices[index].start;
+				goods.prices.splice(index, 1);
 			}
-			goods.prices= newPrices;
+			console.log(goods.prices);
 		}
 
 		/**
@@ -737,8 +765,8 @@ define([ 'app/app' ], function(app) {
 						toaster.pop('error', '当前价格区间的起始数量必须大于0');
 						delete price.start;
 					} else {
-						if (price.end != null && price.start >= price.end) {
-							toaster.pop('error', '当前价格区间的起始数量必须小于终止数量');
+						if (price.end != null && price.start > price.end) {
+							toaster.pop('error', '当前价格区间的起始数量必须小于等于终止数量');
 							delete price.start;
 						} else {
 							if (goods.reserve != null && price.start > goods.reserve) {
@@ -795,18 +823,12 @@ define([ 'app/app' ], function(app) {
 						toaster.pop('error', '当前价格区间的终止数量必须大于0');
 						delete price.end;
 					} else {
-						if (price.start != null && price.start >= price.end) {
-							toaster.pop('error', '当前价格区间的终止数量必须大于起始数量');
+						if (price.start != null && price.start > price.end) {
+							toaster.pop('error', '当前价格区间的终止数量必须大于等于起始数量');
 							delete price.end;
-						} else {
-							if (goods.minBuyQty != null && price.end < goods.minBuyQty) {
-								toaster.pop('error', '最后一价格区间的终止数量不能小于起拍数量');
-								delete price.end;
-							}
 						}
 					}
 				}
-				goods.reserve = price.end;
 				return ;
 			}
 			var nextPrice = goods.prices[index + 1];
@@ -819,8 +841,8 @@ define([ 'app/app' ], function(app) {
 				return ;
 			}
 			if (price.start && price.start !== '') {
-				if (Number(price.start) >= Number(price.end)) {
-					toaster.pop('error', '当前价格区间的终止数量必须大于起始数量');
+				if (Number(price.start) > Number(price.end)) {
+					toaster.pop('error', '当前价格区间的终止数量必须大于等于起始数量');
 					if (nextPrice.start && nextPrice.start !== '') {
 						price.end = nextPrice.start - 1;
 					} else {
@@ -850,37 +872,27 @@ define([ 'app/app' ], function(app) {
 		 * @param type			交期类型
 		 */
 		function checkMinDelivery(goods, type) {
-			if (type === 'DEM') {
-				if (goods.selfDeliveryDemMinTime == null) {
-					delete goods.selfDeliveryDemMinTime;
-					return ;
-				}
-				if (goods.selfDeliveryDemMinTime < 0 || goods.selfDeliveryDemMinTime > 30) {
-					delete goods.selfDeliveryDemMinTime;
-					toaster.pop('error', '国内最短交期必须在0~30天之间');
-					return ;
-				}
-				if (goods.selfDeliveryDemMaxTime && goods.selfDeliveryDemMinTime > goods.selfDeliveryDemMaxTime) {
-					delete goods.selfDeliveryDemMinTime;
-					toaster.pop('error', '国内最短交期必须小于国内最长交期');
-					return ;
-				}
+			if (goods.minDelivery == null) {
+				delete goods.minDelivery;
+				return ;
 			}
-			if (type === 'HK') {
-				if (goods.selfDeliveryHKMinTime == null) {
-					delete goods.selfDeliveryHKMinTime;
-					return ;
-				}
-				if (goods.selfDeliveryHKMinTime < 0 || goods.selfDeliveryHKMinTime > 30) {
-					delete goods.selfDeliveryHKMinTime;
-					toaster.pop('error', '香港最短交期必须在0~30天之间');
-					return ;
+			if (goods.minDelivery < 0 || goods.minDelivery > 31) {
+				delete goods.minDelivery;
+				if (type === 'DEM') {
+					toaster.pop('error', '国内最短交期必须在0~31天之间');
+				}else {
+					toaster.pop('error', '香港最短交期必须在0~31天之间');
 				}
-				if (goods.selfDeliveryHKMaxTime && goods.selfDeliveryHKMinTime > goods.selfDeliveryHKMaxTime) {
-					delete goods.selfDeliveryHKMinTime;
+				return ;
+			}
+			if (goods.minDelivery && goods.minDelivery > goods.maxDelivery) {
+				delete goods.minDelivery;
+				if (type === 'DEM') {
+					toaster.pop('error', '国内最短交期必须小于国内最长交期');
+				}else {
 					toaster.pop('error', '香港最短交期必须小于香港最长交期');
-					return ;
 				}
+				return ;
 			}
 			return true;
 		}
@@ -892,37 +904,27 @@ define([ 'app/app' ], function(app) {
 		 * @param type			交期类型
 		 */
 		function checkMaxDelivery(goods, type) {
-			if (type === 'DEM') {
-				if (goods.selfDeliveryDemMaxTime == null) {
-					delete goods.selfDeliveryDemMaxTime;
-					return ;
-				}
-				if (goods.selfDeliveryDemMaxTime < 0 || goods.selfDeliveryDemMaxTime > 30) {
-					delete goods.selfDeliveryDemMaxTime;
-					toaster.pop('error', '国内最长交期必须在0~30天之间');
-					return ;
-				}
-				if (goods.selfDeliveryDemMinTime && goods.selfDeliveryDemMinTime > goods.selfDeliveryDemMaxTime) {
-					delete goods.selfDeliveryDemMaxTime;
-					toaster.pop('error', '国内最长交期必须大于国内最短交期');
-					return ;
-				}
+			if (goods.maxDelivery == null) {
+				delete goods.maxDelivery;
+				return ;
 			}
-			if (type === 'HK') {
-				if (goods.selfDeliveryHKMaxTime == null) {
-					delete goods.selfDeliveryHKMaxTime;
-					return ;
-				}
-				if (goods.selfDeliveryHKMaxTime < 0 || goods.selfDeliveryHKMaxTime > 30) {
-					delete goods.selfDeliveryHKMaxTime;
-					toaster.pop('error', '香港最长交期必须在0~30天之间');
-					return ;
+			if (goods.maxDelivery < 0 || goods.maxDelivery > 31) {
+				delete goods.maxDelivery;
+				if (type === 'HK') {
+					toaster.pop('error', '香港最长交期必须在0~31天之间');
+				}else {
+					toaster.pop('error', '国内最长交期必须在0~31天之间');
 				}
-				if (goods.selfDeliveryHKMinTime && goods.selfDeliveryHKMinTime > goods.selfDeliveryHKMaxTime) {
-					delete goods.selfDeliveryHKMaxTime;
+				return ;
+			}
+			if (goods.maxDelivery && goods.minDelivery > goods.maxDelivery) {
+				delete goods.maxDelivery;
+				if(type === 'HK') {
 					toaster.pop('error', '香港最长交期必须大于香港最短交期');
-					return ;
+				}else {
+					toaster.pop('error', '国内最长交期必须大于国内最短交期');
 				}
+				return ;
 			}
 			return true;
 		}
@@ -930,15 +932,27 @@ define([ 'app/app' ], function(app) {
 		 * 是否可拆卖
 		 * @param commodity
 		 */
-		$scope.toggleIsBreadUp = function (commodity) {
-			commodity.editBreakUp = !commodity.editBreakUp;
-			if(!commodity.editBreakUp) {
-				if(commodity.editMinPackQty&&commodity.editMinBuyQty) {
-					commodity.editMinBuyQty = Number(NumberService.sub(commodity.editMinBuyQty, (commodity.editMinBuyQty % commodity.editMinPackQty)));
-					if(commodity.editMinBuyQty < 1) {
-						commodity.editMinBuyQty = commodity.editMinPackQty;
+		$scope.toggleIsBreadUp = function (goods) {
+			goods.breakUp = !goods.breakUp;
+			if(!goods.breakUp) {
+				$scope.isNotBreakUp(goods);
+			}
+		};
+
+		/**
+		 * 如果不拆分需要重新计算最小起订量的信息
+		 * @param goods
+		 */
+		$scope.isNotBreakUp = function (goods) {
+			if(goods.minPackQty&&goods.minBuyQty) {
+				var remainder = goods.minBuyQty % goods.minPackQty;
+				if(remainder != 0) {
+					goods.minBuyQty = Number(NumberService.add((NumberService.sub(goods.minBuyQty, (goods.minBuyQty % goods.minPackQty))), goods.minPackQty));
+				}
+				if(goods.reserve) {
+					if(goods.minBuyQty > goods.reserve) {
+						goods.minBuyQty = Number(NumberService.sub(goods.reserve, (goods.reserve % goods.minPackQty)));
 					}
-					$scope.changeMinBuyQty(commodity);
 				}
 			}
 		}

+ 187 - 213
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_onSaleCtrl.js

@@ -15,6 +15,17 @@ define([ 'app/app' ], function(app) {
             status : 601
         };
 
+        /**
+         * 最大
+         * @type {number}
+         */
+        $scope.maxReserve = 999999999;
+        /**
+         * 最小包装量的最大值
+         */
+        $scope.maxPackQty = 999999;
+        $scope.minReserve = 1;
+
         // 商品分页数据
         $scope.goodsPageParams = {};
         $scope.selfSupportType = {
@@ -425,8 +436,10 @@ define([ 'app/app' ], function(app) {
                 price.uSDPricePre = price.uSDPrice;
                 price.uSDPriceDirty = false;
             });
-            commodity.editPrices[commodity.editPrices.length - 1].end = commodity.reserve;
-            commodity.editPrices[commodity.editPrices.length - 1].endPre = commodity.reserve;
+            commodity.editPrices[commodity.editPrices.length - 1].end = $scope.maxReserve;
+            commodity.editPrices[commodity.editPrices.length - 1].endPre = $scope.maxReserve;
+            commodity.editPrices[0].start = $scope.minReserve;
+            commodity.editPrices[0].startPre = $scope.minReserve;
 
             commodity.editReserve = commodity.reserve;
             commodity.editReservePre = commodity.reserve;
@@ -468,6 +481,14 @@ define([ 'app/app' ], function(app) {
             commodity.editSelfDeliveryDemMaxTimePre = commodity.selfDeliveryDemMaxTime;
             commodity.editSelfDeliveryDemMaxTimeDirty = false;
 
+            commodity.editMinDelivery = commodity.minDelivery;
+            commodity.editMinDeliveryPre = commodity.minDelivery;
+            commodity.editMinDeliveryDirty = false;
+
+            commodity.editMaxDelivery = commodity.maxDelivery;
+            commodity.editMaxDeliveryPre = commodity.maxDelivery;
+            commodity.editMaxDeliveryDirty = false;
+
             commodity.editSelfSale = $scope.storeInfo.uuid != 'undefind' && commodity.storeid == $scope.storeInfo.uuid && $scope.storeInfo.storeName.indexOf('优软测试二') < 0 && $scope.storeInfo.storeName.indexOf('优软商城') < 0 ? 1 : 2;
         };
 
@@ -478,13 +499,7 @@ define([ 'app/app' ], function(app) {
         $scope.toggleIsBreadUp = function (commodity) {
             commodity.editBreakUp = !commodity.editBreakUp;
             if(!commodity.editBreakUp) {
-                if(commodity.editMinPackQty&&commodity.editMinBuyQty) {
-                    commodity.editMinBuyQty = Number(NumberService.sub(commodity.editMinBuyQty, (commodity.editMinBuyQty % commodity.editMinPackQty)));
-                    if(commodity.editMinBuyQty < 1) {
-                        commodity.editMinBuyQty = commodity.editMinPackQty;
-                    }
-                    $scope.changeMinBuyQty(commodity);
-                }
+                $scope.isNotBreakUp(commodity);
             }
         };
 
@@ -536,7 +551,7 @@ define([ 'app/app' ], function(app) {
             }
             if(isEnd) {
                 if(index < commodity.editPrices.length - 1) {
-                    if(commodity.editPrices[index].end <= commodity.editPrices[index].start) {
+                    if(commodity.editPrices[index].end < commodity.editPrices[index].start) {
                         toaster.pop('warning', '提示', '修改之后当前分段的结束值' + parseInt(commodity.editPrices[index].end) + '小于' + commodity.editPrices[index].start);
                         commodity.editPrices[index].end = commodity.editPrices[index].endPre;
                     }else if((commodity.editPrices[index + 1].end)&&(parseInt(commodity.editPrices[index].end) + 1) >= parseInt(commodity.editPrices[index + 1].end)) {
@@ -547,55 +562,56 @@ define([ 'app/app' ], function(app) {
                         commodity.editPrices[index].endPre = commodity.editPrices[index].end;
                         commodity.editPrices[index + 1].startPre = commodity.editPrices[index + 1].start;
                     }
-                }else {
-                    if(commodity.editPrices[index].end > commodity.editMinBuyQty) {
-                        if(commodity.editPrices[index].end > commodity.reserve) {
-                            toaster.pop('warning', '提示', '修改最后一个分段的结束值之后,新的库存量大于原有的库存量');
-                            commodity.editPrices[index].end = commodity.editPrices[index].endPre;
-                        }else {
-                            commodity.editReserve = commodity.editPrices[index].end;
-                            commodity.editPrices[index].endPre = commodity.editPrices[index].end;
-                            commodity.editReservePre = commodity.editReserve;
-                        }
-                    }else {
-                        toaster.pop('warning', '提示', '修改最后一个分段的结束值之后导致库存量小于起拍量');
-                        commodity.editPrices[index].end = commodity.editPrices[index].endPre;
-                    }
                 }
+                // else {
+                //     if(commodity.editPrices[index].end > commodity.editMinBuyQty) {
+                //         if(commodity.editPrices[index].end > commodity.reserve) {
+                //             toaster.pop('warning', '提示', '修改最后一个分段的结束值之后,新的库存量大于原有的库存量');
+                //             commodity.editPrices[index].end = commodity.editPrices[index].endPre;
+                //         }else {
+                //             commodity.editReserve = commodity.editPrices[index].end;
+                //             commodity.editPrices[index].endPre = commodity.editPrices[index].end;
+                //             commodity.editReservePre = commodity.editReserve;
+                //         }
+                //     }else {
+                //         toaster.pop('warning', '提示', '修改最后一个分段的结束值之后导致库存量小于起拍量');
+                //         commodity.editPrices[index].end = commodity.editPrices[index].endPre;
+                //     }
+                // }
             }else {
                 if(index != 0) {
-                    if(parseInt(commodity.editPrices[index].start) >= parseInt(commodity.editPrices[index].end)) {
-                        toaster.pop('warning', '提示', '修改本分段之后,会导致分段的起始值' + commodity.editPrices[index ].start + '大于等于结束值' + parseInt(commodity.editPrices[index].end));
+                    if(parseInt(commodity.editPrices[index].start) > parseInt(commodity.editPrices[index].end)) {
+                        toaster.pop('warning', '提示', '修改本分段之后,会导致分段的起始值' + commodity.editPrices[index ].start + '大于结束值' + parseInt(commodity.editPrices[index].end));
                         commodity.editPrices[index].start = commodity.editPrices[index].startPre;
-                    }else if((parseInt(commodity.editPrices[index].start) - 1) <= commodity.editPrices[index - 1].start) {
-                        toaster.pop('warning', '提示', '修改本分段之后,会导致前一个分段的起始值' + commodity.editPrices[index - 1].start + '大于等于结束值' + (parseInt(commodity.editPrices[index].start) - 1));
+                    }else if((parseInt(commodity.editPrices[index].start) - 1) < commodity.editPrices[index - 1].start) {
+                        toaster.pop('warning', '提示', '修改本分段之后,会导致前一个分段的起始值' + commodity.editPrices[index - 1].start + '大于结束值' + (parseInt(commodity.editPrices[index].start) - 1));
                         commodity.editPrices[index].start = commodity.editPrices[index].startPre;
                     }else {
                         commodity.editPrices[index - 1].end = parseInt(commodity.editPrices[index].start) - 1;
                         commodity.editPrices[index].startPre = commodity.editPrices[index].start;
                         commodity.editPrices[index - 1].endPre = commodity.editPrices[index - 1].end;
                     }
-                }else {
-                    if(commodity.editMinPackQty) {
-                        if(commodity.editPrices[index].start % commodity.editMinPackQty != 0) {
-                            commodity.editPrices[index].startInValid = false;
-                            commodity.editPrices[index].start = commodity.editMinBuyQty;
-                            commodity.editPrices[index].startPre = commodity.editMinBuyQty;
-                            toaster.pop('warning', '提示', '第一个分段的起始量必须是倍数(' + commodity.editMinPackQty + ")的整数倍");
-                        }else {
-                            commodity.editMinBuyQty = commodity.editPrices[index].start;
-                            commodity.editMinBuyQtyPre = commodity.editPrices[index].start;
-                            commodity.editMinBuyQtyInValid = false;
-                        }
-                    }else {
-                        commodity.editMinBuyQty = commodity.editPrices[index].start;
-                        commodity.editMinBuyQtyPre = commodity.editMinBuyQty;
-                        commodity.editPrices[index].startPre = commodity.editPrices[index].start;
-                        commodity.editMinBuyQtyInValid = false;
-                    }
-                }
+                 }//else {
+                //     if(commodity.editMinPackQty) {
+                //         if(commodity.editPrices[index].start % commodity.editMinPackQty != 0) {
+                //             commodity.editPrices[index].startInValid = false;
+                //             commodity.editPrices[index].start = commodity.editMinBuyQty;
+                //             commodity.editPrices[index].startPre = commodity.editMinBuyQty;
+                //             toaster.pop('warning', '提示', '第一个分段的起始量必须是倍数(' + commodity.editMinPackQty + ")的整数倍");
+                //         }else {
+                //             commodity.editMinBuyQty = commodity.editPrices[index].start;
+                //             commodity.editMinBuyQtyPre = commodity.editPrices[index].start;
+                //             commodity.editMinBuyQtyInValid = false;
+                //         }
+                //     }else {
+                //         commodity.editMinBuyQty = commodity.editPrices[index].start;
+                //         commodity.editMinBuyQtyPre = commodity.editMinBuyQty;
+                //         commodity.editPrices[index].startPre = commodity.editPrices[index].start;
+                //         commodity.editMinBuyQtyInValid = false;
+                //     }
+                // }
             }
-        }
+        };
 
         /**
          * @param commodity 需要验证的批次的信息
@@ -622,19 +638,13 @@ define([ 'app/app' ], function(app) {
                     toaster.pop('warning', "提示", "分段数量必须是数字");
                     return false;
                 }
-                if(parseInt(price[i].start) >= parseInt(price[i].end)) {
+                if(parseInt(price[i].start) > parseInt(price[i].end)) {
                     price[i].startInValid = true;
-                    toaster.pop('warning', "提示", "存在分段的起始值大于等于分段的结束值");
-                    return false;
-                }
-                if(parseInt(price[i].end) > parseInt(commodity.editReserve)){
-                    price[i].endInValid = true;
-                    toaster.pop('warning', "提示", "存在分段的结束值大于新库存数量");
+                    toaster.pop('warning', "提示", "存在分段的起始值大于分段的结束值");
                     return false;
                 }
                 previousEnd = price[i].end;
             }
-            commodity.editPrices[0].start = commodity.editMinBuyQty || 0;
             return true;
         };
 
@@ -660,30 +670,25 @@ define([ 'app/app' ], function(app) {
                 toaster.pop('warning', '提示', '修改的库存只能减少库存量');
                 return false;
             }
-            if(parseInt(commodity.editReserve) <= parseInt(commodity.editMinBuyQty)) {
+            if(parseInt(commodity.editReserve) < parseInt(commodity.editMinBuyQty)) {
                 commodity.editReserve = commodity.editReservePre;
                 commodity.editReserveInvalid = false;
                 toaster.pop('warning', '提示', '起拍量不能大于库存量');
                 return false;
             }
-            if(parseInt(commodity.editReserve) > 99999999 || commodity.editReserve < 1) {
+            if(parseInt(commodity.editReserve) > $scope.maxReserve || commodity.editReserve < $scope.minReserve) {
                 commodity.editReserve = commodity.editReservePre;
                 commodity.editReserveInvalid = false;
-                toaster.pop('warning', '提示', '总库存量的数量必须介于1 ~ 99999999');
+                toaster.pop('warning', '提示', '总库存量的数量必须介于' + $scope.minReserve+' ~ ' + $scope.maxReserve);
                 return false;
             }
-            if(parseInt(commodity.editPrices[commodity.editPrices.length - 1].start) >= parseInt(commodity.editReserve)) {
-                commodity.editReserve = commodity.editReservePre;
-                commodity.editReserveInvalid = false;
-                toaster.pop('warning', '提示', '最新库存量必须要大于最后一个分段的起始量。');
-                return false;
-            }else {
-                commodity.editPrices[commodity.editPrices.length - 1].end = commodity.editReserve;
-                commodity.editPrices[commodity.editPrices.length - 1].endPre = commodity.editPrices[commodity.editPrices.length - 1].end;
-                commodity.editReservePre = commodity.editReserve;
-                commodity.editReserveInvalid = false;
-                return true;
+            commodity.editReservePre = commodity.editReserve;
+            commodity.editReserveInvalid = false;
+            if(!commodity.breakUp) {
+                $scope.isNotBreakUp(commodity);
             }
+            return true;
+
         }
 
         /**
@@ -699,7 +704,7 @@ define([ 'app/app' ], function(app) {
             }
             if(!$scope.isInt.test(commodity.editMinBuyQty)) {
                 commodity.editMinBuyQty = null;
-                toaster.pop('warning', '提示', '起拍量必须是数');
+                toaster.pop('warning', '提示', '起拍量必须是正整数');
                 return false;
             }
             if(commodity.editMinBuyQty > commodity.editReserve) {
@@ -713,24 +718,10 @@ define([ 'app/app' ], function(app) {
                 return false;
             }
 
+            commodity.editMinBuyQtyPre = commodity.editMinBuyQty;
+            commodity.editMinBuyQtyInValid = false;
             if(!commodity.editBreakUp) {
-                if(commodity.editMinPackQty) {
-                    if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
-                        commodity.editMinBuyQty = null;
-                        toaster.pop('warning', '提示', '起拍量必须是倍数的整数倍');
-                        return false;
-                    }
-                }
-            }
-            if(!commodity.editPrices[0].end || commodity.editMinBuyQty < commodity.editPrices[0].end) {
-                commodity.editPrices[0].start = commodity.editMinBuyQty;
-                commodity.editPrices[0].startPre = commodity.editPrices[0].start;
-                commodity.editMinBuyQtyPre = commodity.editMinBuyQty;
-                commodity.editMinBuyQtyInValid = false;
-            }else {
-                toaster.pop('warning', '提示', '修改起拍量之后导致第一个分段的起始值'+ commodity.editMinBuyQty +'大于结束值' + commodity.editPrices[0].end);
-                commodity.editMinBuyQty = commodity.editMinBuyQtyPre;
-                commodity.editMinBuyQtyInValid = false;
+                $scope.isNotBreakUp(commodity);
             }
         }
 
@@ -746,27 +737,23 @@ define([ 'app/app' ], function(app) {
             }
             if(!$scope.isInt.test(commodity.editMinPackQty)) {
                 commodity.editMinPackQty = null;
-                toaster.pop('warning', '提示', '数必须是正整数');
+                toaster.pop('warning', '提示', '最小包装数必须是正整数');
                 return false;
             }
             if(commodity.editMinPackQty < 1) {
                 commodity.editMinPackQty = null;
-                toaster.pop('warning', '提示', '数必须大于0');
+                toaster.pop('warning', '提示', '最小包装数必须大于0');
                 return false;
             }
             if(commodity.editMinPackQty > commodity.editReserve) {
                 commodity.editMinPackQty = null;
-                toaster.pop('warning', '提示', '倍数必须是起拍量的整数倍且小于起拍量。');
+                toaster.pop('warning', '提示', '最小包装数必须小于等于库存量。');
                 return false;
             }
 
             if(commodity.editMinBuyQty) {
-                if(!commodity.editIsBreakUp) {
-                    if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
-                        commodity.editMinPackQty = null;
-                        toaster.pop('warning', '提示', '倍数必须是起拍量的整数倍且小于起拍量。');
-                        return false;
-                    }
+                if(!commodity.editBreakUp) {
+                    $scope.isNotBreakUp(commodity);
                 }
             }
             commodity.editMinPackQtyPre = commodity.editMinPackQty;
@@ -783,69 +770,49 @@ define([ 'app/app' ], function(app) {
          */
         $scope.compareNum = function(min, max, type, commodity) {
             if(!min) {
+                commodity.editMinDeliveryinValid = true;
                 if(type == 1) {
-                    commodity.selfDemMinTimeinValid = true;
-                    toaster.pop('warning', '大陆交期存在空值,请重新操作');
+                    toaster.pop('warning', '提示', '大陆交期存在空值,请重新操作');
                 }else if(type == 2){
-                    commodity.selfHkMinTimeinValid = true;
-                    toaster.pop('warning', '香港交期存在空值,请重新操作');
+                    toaster.pop('warning', '提示', '香港交期存在空值,请重新操作');
                 }
                 return false;
             }else if(!max) {
+                commodity.editMaxDeliveryinValid = true;
                 if(type == 1) {
-                    commodity.selfDemMaxTimeinValid = true;
-                    toaster.pop('warning', '大陆交期存在空值,请重新操作');
+                    toaster.pop('warning', '提示', '大陆交期存在空值,请重新操作');
                 }else if(type == 2){
-                    commodity.selfHkMaxTimeinValid = true;
-                    toaster.pop('warning', '香港交期存在空值,请重新操作');
+                    toaster.pop('warning', '提示', '香港交期存在空值,请重新操作');
                 }
                 return false;
             }
-            if(isNaN(min)) {
-                if(type == 1) {
-                    commodity.selfDemMinTimeinValid = true;
-                }else {
-                    commodity.selfHkMinTimeinValid = true;
-                }
-                toaster.pop('warning', '最小交期必须是数字');
+            if(!$scope.isInt.test(min)) {
+                commodity.editMinDeliveryinValid = true;
+                toaster.pop('warning', '提示', '最小交期必须是正整数');
                 return false;
             }
-            if(isNaN(max)) {
-                if(type == 1) {
-                    commodity.selfDemMaxTimeinValid = true;
-                }else {
-                    commodity.selfHkMaxTimeinValid = true;
-                }
-                toaster.pop('warning', '最大交期必须是数字');
+            if(!$scope.isInt.test(max)) {
+                commodity.editMaxDeliveryinValid = true;
+                toaster.pop('warning', '提示', '最大交期必须是正整数');
                 return false;
             }
-            if(min < 1 || min > 9) {
-                if(type == 1) {
-                    commodity.selfDemMinTimeinValid = true;
-                }else {
-                    commodity.selfHkMinTimeinValid = true;
-                }
-                toaster.pop('warning', '交期的时间必须是1-9天之内');
+            if(min < 1 || min > 31) {
+                commodity.editMinDeliveryinValid = true;
+                toaster.pop('warning', '提示', '交期的时间必须是1-31天之内');
                 return false;
             }
-            if(max < 1 || max > 9) {
-                if(type == 1) {
-                    commodity.selfDemMaxTimeinValid = true;
-                }else {
-                    commodity.selfHkMaxTimeinValid = true;
-                }
-                toaster.pop('warning', '交期的时间必须是1-9天之内');
+            if(max < 1 || max > 31) {
+                commodity.editMaxDeliveryinValid = true;
+                toaster.pop('warning', '提示', '交期的时间必须是1-31天之内');
                 return false;
             }
-            if(min > max) {
+            if(Number(min) > Number(max)) {
+                commodity.editMaxDeliveryinValid = true;
+                commodity.editMinDeliveryinValid = true;
                 if(type == 1) {
-                    commodity.selfDemMaxTimeinValid = true;
-                    commodity.selfDemMinTimeinValid = true;
-                    toaster.pop('warning', '大陆交期最短交期大于最大交期');
+                    toaster.pop('warning', '提示', '大陆交期填写错误,最短交期应小于等于最长交期');
                 }else if(type == 2){
-                    commodity.selfHkMaxTimeinValid = true;
-                    commodity.selfHkMinTimeinValid = true;
-                    toaster.pop('warning', '香港交期最短交期大于最大交期');
+                    toaster.pop('warning', '提示', '香港交期填写错误,最短交期应小于等于最长交期');
                 }
                 return false;
             }
@@ -860,68 +827,55 @@ define([ 'app/app' ], function(app) {
          * @param commodity 批次信息
          */
         $scope.changeDelivery = function(min, max, isMin, isHk, commodity) {
-            commodity.selfDemMinTimeinValid = false;
-            commodity.selfDemMaxTimeinValid = false;
-            commodity.selfHkMinTimeinValid = false;
-            commodity.selfHkMaxTimeinValid = false;
+            commodity.editMinDeliveryinValid = false;
+            commodity.editMaxDeliveryinValid = false;
             var day = -1;
             if(isMin) {
-                if(min && !isNaN(min)) {
+                if(min && $scope.isInt.test(min)) {
                     day = min;
                 }else {
-                    if(isNaN(min)) {
-                        toaster.pop('warning', '提示', '交期请输入1~9的数字');
-                    }
-                    if(isHk) {
-                        commodity.selfHkMinTimeinValid = true;
-                    }else {
-                        commodity.selfDemMinTimeinValid = true;
+                    if(!$scope.isInt.test(min)) {
+                        toaster.pop('warning', '提示', '交期请输入1~31的正整数');
                     }
+                    commodity.editMinDeliveryinValid = true;
                     return ;
                 }
 
             }else {
-                if(max && !isNaN(max)) {
+                if(max && $scope.isInt.test(max)) {
                     day = max;
                 }else {
-                    if(isNaN(max)) {
-                        toaster.pop('warning', '提示', '交期请输入1~9的数字');
-                    }
-                    if(isHk) {
-                        commodity.selfHkMaxTimeinValid = true;
-                    }else {
-                        commodity.selfDemMaxTimeinValid = true;
+                    if(!$scope.isInt.test(max)) {
+                        toaster.pop('warning', '提示', '交期请输入1~31的数字');
                     }
+                    commodity.editMaxDeliveryinValid = true;
                     return ;
                 }
 
             }
-            if(day > 9 || day < 1) {
+            if(day > 31 || day < 1) {
+                if(isMin) {
+                    commodity.editMinDeliveryinValid = true;
+                }else {
+                    commodity.editMaxDeliveryinValid = true;
+                }
                 if(isHk) {
-                    if(isMin) {
-                        commodity.selfHkMinTimeinValid = true;
-                    }else {
-                        commodity.selfHkMaxTimeinValid = true;
-                    }
+                    toaster.pop('warning', '提示', '香港交期填写错误,交期的范围必须在1~31天');
                 }else {
-                    if(isMin) {
-                        commodity.selfDemMinTimeinValid = true;
-                    }else {
-                        commodity.selfDemMaxTimeinValid = true;
-                    }
+                    toaster.pop('warning', '提示', '大陆交期填写错误,交期的范围必须在1~31天');
                 }
-                toaster.pop('warning', '提示', '交期的值必须在1~9天');
+
                 return ;
             }
-            if(min > max) {
+            if(Number(min) > Number(max)) {
+                commodity.editMinDeliveryinValid = true;
+                commodity.editMaxDeliveryinValid = true;
                 if(isHk) {
-                    commodity.selfHkMinTimeinValid = true;
-                    commodity.selfHkMaxTimeinValid = true;
+                    toaster.pop('warning', '提示', '香港交期填写错误,最短交期应小于等于最长交期');
                 }else {
-                    commodity.selfDemMinTimeinValid = true;
-                    commodity.selfDemMaxTimeinValid = true;
+                    toaster.pop('warning', '提示', '大陆交期填写错误,最短交期应小于等于最长交期');
                 }
-                toaster.pop('warning', '提示', '最小交期必须小于最大交期');
+
                 return ;
             }
         }
@@ -936,125 +890,125 @@ define([ 'app/app' ], function(app) {
         $scope.checkGoodsInfo = function (commodity) {
             var result = false;
             if(!commodity) {
-                toaster.pop('warning', '库存信息丢失,请重新操作');
+                toaster.pop('warning', '提示', '库存信息丢失,请重新操作');
                 return result;
             }
 
             if(!commodity.editPackaging) {
                 commodity.editPackagingInvalid = true;
-                toaster.pop('warning', '请填写包装方式');
+                toaster.pop('warning', '提示', '请填写包装方式');
                 return result;
             }
             if(!commodity.editProduceDate) {
                 commodity.editProduceDateInvalid = true;
-                toaster.pop('warning', '请填写生产日期');
+                toaster.pop('warning', '提示', '请填写生产日期');
                 return result;
             }
             if(isNaN(commodity.editReserve)) {
                 commodity.editReserveInvalid  = true;
-                toaster.pop('warning', '最新库存必须是数字');
+                toaster.pop('warning', '提示', '最新库存必须是数字');
                 return result;
             }
-            if(commodity.editReserve < 1) {
+            if(commodity.editReserve < $scope.minReserve) {
                 commodity.editReserveInvalid  = true;
-                toaster.pop('warning', '最新库存必须大于0');
+                toaster.pop('warning', '提示', '最新库存必须大于0');
                 return result;
             }
             if(commodity.editReserve > commodity.reserve) {
                 commodity.editReserveInvalid  = true;
-                toaster.pop('warning', '最新库存量只能小于原有库存');
+                toaster.pop('warning', '提示', '最新库存量只能小于原有库存');
                 return result;
             }
-            if(commodity.editReserve > 999999999) {
+            if(commodity.editReserve > $scope.maxReserve) {
                 commodity.editReserveInvalid  = true;
-                toaster.pop('warning', '最新库存量不能大于999999999');
+                toaster.pop('warning', '最新库存量不能大于' + $scope.maxReserve);
                 return result;
             }
-            if(isNaN(commodity.editMinBuyQty)) {
+            if(!$scope.isInt.test(commodity.editMinBuyQty)) {
                 commodity.editMinBuyQtyInValid  = true;
-                toaster.pop('warning', '最小起拍量必须是数');
+                toaster.pop('warning', '提示', '最小起拍量必须是正整数');
                 return result;
             }
             if(commodity.editReserve < commodity.editMinBuyQty) {
                 commodity.editReserveInvalid  = true;
                 commodity.editMinBuyQtyInValid = true;
-                toaster.pop('warning', '最新库存必须大于最小起拍量');
+                toaster.pop('warning', '提示', '最新库存必须大于最小起拍量');
                 return result;
             }
-            if(isNaN(commodity.editMinPackQty)) {
+            if(!$scope.isInt.test(commodity.editMinPackQty)) {
                 commodity.editMinPackQtyInValid  = true;
-                toaster.pop('warning', '倍数必须是数字');
+                toaster.pop('warning', '提示', '最小包装数必须是正整数');
                 return result;
             }
             if(!commodity.editMinBuyQty) {
                 commodity.editMinBuyQtyInValid = true;
-                toaster.pop('warning', '请填写起拍量之后再提交');
+                toaster.pop('warning', '提示', '请填写起拍量之后再提交');
                 return result;
             }
             if(!commodity.editMinPackQty) {
                 commodity.editMinPackQtyInValid = true;
-                toaster.pop('warning', '请填写倍数之后再提交');
+                toaster.pop('warning', '提示', '请填写最小包装量之后再提交');
+                return result;
+            }
+            if(Number(commodity.editMinPackQty) > $scope.maxPackQty) {
+                commodity.editMinPackQtyInValid = true;
+                toaster.pop('warning', '提示', '最小包装量数量必须小于' + $scope.maxPackQty);
                 return result;
             }
             if(!commodity.editBreakUp) {
-                if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
-                    commodity.editMinBuyQtyInValid = true;
-                    commodity.editMinPackQtyInValid = true;
-                    toaster.pop('warning', '起拍量必须是倍数的整数倍');
-                    return result;
-                }
+                $scope.isNotBreakUp(commodity);
             }
             var lastEnd = -1;
             for (var i = 0; i < commodity.editPrices.length; i++) {
                 if(isNaN(commodity.editPrices[i].start)) {
                     commodity.editPrices[i].startInValid = true;
-                    toaster.pop('warning', '分段数量必须是数字');
+                    toaster.pop('warning', '提示', '分段数量必须是数字');
                     return result;
                 }
                 if(commodity.editPrices[i].start <= lastEnd) {
                     commodity.editPrices[i].startInValid = true;
-                    toaster.pop('warning', "存在分段的起始值小于等于上一个分段的结束值");
+                    toaster.pop('warning', '提示', "存在分段的起始值小于等于上一个分段的结束值");
                     return result;
                 }
                 if(isNaN(commodity.editPrices[i].end)) {
                     commodity.editPrices[i].endInValid = true;
-                    toaster.pop('warning', '分段数量必须是数字');
+                    toaster.pop('warning', '提示', '分段数量必须是数字');
                     return result;
                 }
-                if(commodity.editPrices[i].start >= commodity.editPrices[i].end) {
+                if(commodity.editPrices[i].start > commodity.editPrices[i].end) {
                     commodity.editPrices[i].startInValid = true;
                     commodity.editPrices[i].endInValid = true;
-                    toaster.pop('warning', "存在分段的起始值大于等于分段的结束值");
+                    toaster.pop('warning', '提示', "存在分段的起始值大于分段的结束值");
                     return result;
                 }
                 if(commodity.currencyName.indexOf('USD') > -1) {
                     if(!commodity.editPrices[i].uSDPrice) {
                         commodity.editPrices[i].usdPriceInvalid = true;
-                        toaster.pop('warning', "香港交货($)为空,请填写后再次提交!");
+                        toaster.pop('warning', '提示', "香港交货($)为空,请填写后再次提交!");
                         return result;
                     }else if(isNaN(commodity.editPrices[i].uSDPrice)){
                         commodity.editPrices[i].usdPriceInvalid = true;
-                        toaster.pop('warning', "香港交货($)信息必须是数字");
+                        toaster.pop('warning', '提示', "香港交货($)信息必须是数字");
                         return result;
                     }
                 }
                 if(commodity.currencyName.indexOf('RMB') > -1) {
                     if(!commodity.editPrices[i].rMBPrice) {
                         commodity.editPrices[i].rmbPriceInvalid = true;
-                        toaster.pop('warning', "大陆交货(¥)为空,请填写后再次提交!");
+                        toaster.pop('warning', '提示', "大陆交货(¥)为空,请填写后再次提交!");
                         return result;
                     }else if(isNaN(commodity.editPrices[i].rMBPrice)){
                         commodity.editPrices[i].rmbPriceInvalid = true;
-                        toaster.pop('warning', "大陆交货(¥)信息必须是数字");
+                        toaster.pop('warning', '提示', "大陆交货(¥)信息必须是数字");
                         return result;
                     }
                 }
             }
-            if(commodity.currencyName.indexOf('USD') > -1 && !$scope.compareNum(commodity.editSelfDeliveryHKMinTime, commodity.editSelfDeliveryHKMaxTime, 2, commodity)) {
+            if(commodity.currencyName.indexOf('USD') > -1 && !$scope.compareNum(commodity.editMinDelivery, commodity.editMaxDelivery, 2, commodity)) {
                 return result;
             }
 
-            if(commodity.currencyName.indexOf('RMB') > -1 && !$scope.compareNum(commodity.editSelfDeliveryDemMinTime, commodity.editSelfDeliveryDemMaxTime, 1, commodity)) {
+            if(commodity.currencyName.indexOf('RMB') > -1 && !$scope.compareNum(commodity.editMinDelivery, commodity.editMaxDelivery, 1, commodity)) {
                 return result;
             }
 
@@ -1085,7 +1039,7 @@ define([ 'app/app' ], function(app) {
                     toaster.pop('success', '库存信息修改成功');
                     $scope.currenctGoods.splice(index, 1, data.data);
                 }else {
-                    toaster.pop('warning', '失败', data.message);
+                    toaster.pop('warning', '提示', '失败', data.message);
                 }
             }, function(response){
                 toaster.pop('error', '修改失败', response.data);
@@ -1103,6 +1057,8 @@ define([ 'app/app' ], function(app) {
             commodity.selfDeliveryHKMaxTime = commodity.editSelfDeliveryHKMaxTime;
             commodity.selfDeliveryDemMinTime = commodity.editSelfDeliveryDemMinTime;
             commodity.selfDeliveryDemMaxTime = commodity.editSelfDeliveryDemMaxTime;
+            commodity.minDelivery = commodity.editMinDelivery;
+            commodity.maxDelivery = commodity.editMaxDelivery;
             commodity.selfSale = commodity.editSelfSale;
             commodity.minPackQty = commodity.editMinPackQty;
             commodity.img = commodity.editPic;
@@ -1249,7 +1205,7 @@ define([ 'app/app' ], function(app) {
         $scope.downGoods = function () {
             var listId = getDownLoadGoodsId();
             if(listId.length < 1) {
-                toaster.pop('warning', '当前需要下载的订单条数为0');
+                toaster.pop('warning', '提示', '当前需要下载的订单条数为0');
                 return ;
             }
             Loading.show();
@@ -1333,6 +1289,24 @@ define([ 'app/app' ], function(app) {
             $scope.selfSupport = type;
             loadDataReload();
         };
+
+        /**
+         * 如果不拆分需要重新计算最小起订量的信息
+         * @param goods
+         */
+        $scope.isNotBreakUp = function (commodity) {
+            if(commodity.editMinPackQty&&commodity.editMinBuyQty) {
+                var remainder = commodity.editMinBuyQty % commodity.editMinPackQty;
+                if(remainder != 0) {
+                    commodity.editMinBuyQty = Number(NumberService.add((NumberService.sub(commodity.editMinBuyQty, (commodity.editMinBuyQty % commodity.editMinPackQty))), commodity.editMinPackQty));
+                }
+                if(commodity.editReserve) {
+                    if(commodity.editMinBuyQty > commodity.editReserve) {
+                        commodity.editMinBuyQty = Number(NumberService.sub(commodity.editReserve, (commodity.editReserve % commodity.editMinPackQty)));
+                    }
+                }
+            }
+        }
     }]);
 
     app.register.controller('editPictureCtrl', ['$scope', 'pic', '$modalInstance', function ($scope, pic, $modalInstance) {

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

@@ -527,7 +527,7 @@
 								</div>
 								<div>
 									<span>可拆卖:</span>
-									<span class="switch"><button ng-class="{'active' : material.editBreakUp}" ng-click="toggleIsBreadUp(material)"></button></span>
+									<span class="switch"><button ng-class="{'active' : goods.breakUp}" ng-click="toggleIsBreadUp(goods)"></button></span>
 								</div>
 							</div>
 							<div class="content">
@@ -536,6 +536,12 @@
 									<input type="number" class="wid48 form-control" name="reserve" title="reserve" placeholder="数量" ng-model="goods.reserve" ng-pattern="/^(-|)[0-9]*$/" ng-blur="setPriceMaxAmount(goods)"/>
 								</div>
 							</div>
+							<div class="content">
+								<p class="title">最小包装量</p>
+								<div class="input-list">
+									<input type="number" class="form-control" name="minPackQty" title="minPackQty"  placeholder="数量" ng-model="goods.minPackQty" ng-pattern="/^(-|)[0-9]*$/" ng-blur="setPriceMinPackAmount(goods)" style="width: 70px;"/>
+								</div>
+							</div>
 							<div class="content">
 								<p class="title">起拍</p>
 								<div class="input-list">
@@ -547,15 +553,15 @@
 								<div class="input-list">
 									<p ng-if="!store.enType || store.enType === 'HK'">
 										<span>香港:</span>
-										<span><input type="number" class="wid36 form-control" name="selfDeliveryHKMinTime" title="selfDeliveryHKMinTime" placeholder="天数" ng-model="goods.selfDeliveryHKMinTime" ng-blur="checkMinDelivery(goods, 'HK')"/></span>
+										<span><input type="number" class="wid36 form-control" name="minDelivery" title="最小交期" placeholder="天数" ng-model="goods.minDelivery" ng-blur="checkMinDelivery(goods, 'HK')"/></span>
 										<span style="margin-left: 4px;">–</span>
-										<span><input type="number" class="wid36 form-control" name="selfDeliveryHKMaxTime" title="selfDeliveryHKMaxTime" placeholder="天数" ng-model="goods.selfDeliveryHKMaxTime" ng-blur="checkMaxDelivery(goods, 'HK')"/></span>
+										<span><input type="number" class="wid36 form-control" name="maxDelivery" title="最大交期" placeholder="天数" ng-model="goods.maxDelivery" ng-blur="checkMaxDelivery(goods, 'HK')"/></span>
 									</p>
 									<p ng-if="!store.enType || store.enType === 'MAINLAND'">
 										<span>国内:</span>
-										<span><input type="number" class="wid36 form-control" name="selfDeliveryDemMinTime" title="selfDeliveryDemMinTime" placeholder="天数" ng-model="goods.selfDeliveryDemMinTime" ng-blur="checkMinDelivery(goods, 'DEM')"/></span>
+										<span><input type="number" class="wid36 form-control" name="minDelivery" title="最小交期" placeholder="天数" ng-model="goods.minDelivery" ng-blur="checkMinDelivery(goods, 'DEM')"/></span>
 										<span style="margin-left: 4px;">–</span>
-										<span><input type="number" class="wid36 form-control" name="selfDeliveryDemMaxTime" title="selfDeliveryDemMaxTime" placeholder="天数" ng-model="goods.selfDeliveryDemMaxTime" ng-blur="checkMaxDelivery(goods, 'DEM')"/></span>
+										<span><input type="number" class="wid36 form-control" name="maxDelivery" title="最大交期" placeholder="天数" ng-model="goods.maxDelivery" ng-blur="checkMaxDelivery(goods, 'DEM')"/></span>
 									</p>
 								</div>
 							</div>
@@ -591,7 +597,7 @@
 							<div class="content">
 								<p class="title">自营 / 寄售</p>
 								<div class="input-list">
-									<select name="isSelfSupport" title="isSelfSupport" class="wid92 select-adder form-control" ng-model="goods.isSelfSupport">
+									<select name="isSelfSupport" title="isSelfSupport" class="wid92 select-adder form-control" ng-model="goods.isSelfSupport" ng-disabled="store.status != 'OPENED'">
 										<option value="1">自营</option>
 										<option value="0">寄售</option>
 									</select>

+ 14 - 16
src/main/webapp/resources/view/vendor/forstore/vendor_onSale.html

@@ -259,7 +259,7 @@
         text-align: left !important;
     }
     .vendor-tab.table td .wid135{
-        width: 175px;
+        width: 143px;
         margin-left: 7px;
         position: relative;
         top: -10px;
@@ -569,9 +569,9 @@
                     <thead>
                     <tr>
                         <th width="50" style="padding:8px 0;">序号</th>
-                        <th width="260">产品信息</th>
+                        <th width="220">产品信息</th>
                         <th width="115">包装/生产日期</th>
-                        <th width="100">库存</th>
+                        <th width="140">库存</th>
                         <th width="105">数量</th>
                         <th ng-if="onsale.currency == 'USD'" width="116">香港交货<b style="font-size: 12px;font-weight: 600">($)</b></th>
                         <th ng-if="onsale.currency == 'RMB'" width="116">大陆交货<b style="font-size: 12px;font-weight: 600">(¥)</b></th>
@@ -653,14 +653,12 @@
                         </td>
                         <td>
                             <div ng-if="onsale.currency == 'RMB'">
-                                <span ng-if="(commodity.b2cDeliveryDemMinTime != commodity.b2cDeliveryDemMaxTime)&&!commodity.b2cMaxDelivery"  ng-bind="'大陆:' + commodity.b2cDeliveryDemMinTime + '-' + commodity.b2cDeliveryDemMaxTime"></span>
-                                <span ng-if="(commodity.b2cDeliveryDemMinTime == commodity.b2cDeliveryDemMaxTime)&&!commodity.b2cMaxDelivery"  ng-bind="'大陆:' + commodity.b2cDeliveryDemMinTime"></span>
-                                <span ng-if="commodity.b2cMaxDelivery" ng-bind="'大陆:' + commodity.b2cMinDelivery + '-'+ commodity.b2cMaxDelivery"></span>
+                                <span ng-if="commodity.b2cMaxDelivery && (commodity.b2cMaxDelivery != commodity.b2cMinDelivery)" ng-bind="'大陆:' + commodity.b2cMinDelivery + '-'+ commodity.b2cMaxDelivery"></span>
+                                <span ng-if="commodity.b2cMaxDelivery && (commodity.b2cMaxDelivery == commodity.b2cMinDelivery)" ng-bind="'大陆:' + commodity.b2cMinDelivery"></span>
                             </div>
                             <div ng-if="onsale.currency == 'USD'">
-                                <span ng-if="(commodity.b2cDeliveryHKMinTime != commodity.b2cDeliveryHKMaxTime)&&!commodity.b2cMaxDelivery" ng-bind="'香港:' + commodity.b2cDeliveryHKMinTime + '-' + commodity.b2cDeliveryHKMaxTime"></span>
-                                <span ng-if="(commodity.b2cDeliveryHKMinTime == commodity.b2cDeliveryHKMaxTime)&&!commodity.b2cMaxDelivery" ng-bind="'香港:' + commodity.b2cDeliveryHKMinTime"></span>
-                                <span ng-if="commodity.b2cMaxDelivery" ng-bind="'香港:' + commodity.b2cMinDelivery + '-'+ commodity.b2cMaxDelivery"></span>
+                                <span ng-if="commodity.b2cMaxDelivery && (commodity.b2cMinDelivery != commodity.b2cMaxDelivery)" ng-bind="'香港:' + commodity.b2cMinDelivery + '-'+ commodity.b2cMaxDelivery"></span>
+                                <span ng-if="commodity.b2cMaxDelivery && (commodity.b2cMinDelivery == commodity.b2cMaxDelivery)" ng-bind="'香港:' + commodity.b2cMinDelivery"></span>
                             </div>
                         </td>
                         <td>
@@ -714,7 +712,7 @@
                                 <span><input type="text" ng-blur="changeMinBuyQty(commodity)" ng-class="{'error' : commodity.editMinBuyQtyInValid}" placeholder="起拍" ng-model="commodity.editMinBuyQty" class="wid48 form-control"/></span>
                             </div>
                             <div>
-                                <span>数: </span>
+                                <span>最小包装数: </span>
                                 <span><input type="text" ng-blur="changeMinPackQty(commodity)" ng-class="{'error' : commodity.editMinPackQtyInValid}" placeholder="倍数" ng-model="commodity.editMinPackQty" class="wid48 form-control"/></span>
                             </div>
                             <!--<div>-->
@@ -728,9 +726,9 @@
                         </td>
                         <td>
                             <div ng-repeat="price in commodity.editPrices">
-                                <span style="margin-right: 0;"><input type="text" ng-blur="editQty(commodity, $index, false, price.start)" ng-class="{'error' : price.startInValid}" placeholder="数量"  ng-model="price.start" class="wid40 form-control"/></span>
+                                <span style="margin-right: 0;"><input type="text" ng-disabled="$index == 0" ng-blur="editQty(commodity, $index, false, price.start)" ng-class="{'error' : price.startInValid}" placeholder="数量"  ng-model="price.start" class="wid40 form-control"/></span>
                                 <span>-</span>
-                                <span><input type="text" ng-blur="editQty(commodity, $index, true, price.end)" ng-class="{'error' : price.endInValid}" placeholder="数量" ng-model="price.end" class="wid40 form-control"/></span>
+                                <span><input type="text" ng-disabled="$index == commodity.editPrices.length - 1" ng-blur="editQty(commodity, $index, true, price.end)" ng-class="{'error' : price.endInValid}" placeholder="数量" ng-model="price.end" class="wid40 form-control"/></span>
                             </div>
                         </td>
                         <td ng-if="onsale.currency == 'USD'">
@@ -756,15 +754,15 @@
                         <td>
                             <div ng-if="onsale.currency == 'RMB'">
                                 <span>大陆:</span>
-                                <span><input type="text" ng-class="{'error' : commodity.selfDemMinTimeinValid}" ng-blur="changeDelivery(commodity.editSelfDeliveryDemMinTime, commodity.editSelfDeliveryDemMaxTime, true, false, commodity)" placeholder="大陆最短交期" ng-model="commodity.editSelfDeliveryDemMinTime" class="wid25 form-control"/></span>
+                                <span><input type="text" ng-class="{'error' : commodity.editMinDeliveryinValid}" ng-blur="changeDelivery(commodity.editMinDelivery, commodity.editMaxDelivery, true, false, commodity)" placeholder="大陆最短交期" ng-model="commodity.editMinDelivery" class="wid25 form-control"/></span>
                                 <span>-</span>
-                                <span><input type="text" ng-class="{'error' : commodity.selfDemMaxTimeinValid}" ng-blur="changeDelivery(commodity.editSelfDeliveryDemMinTime, commodity.editSelfDeliveryDemMaxTime, false, false, commodity)" placeholder="大陆最长交期" ng-model="commodity.editSelfDeliveryDemMaxTime" class="wid25 form-control"/></span>
+                                <span><input type="text" ng-class="{'error' : commodity.editMaxDeliveryinValid}" ng-blur="changeDelivery(commodity.editMinDelivery, commodity.editMaxDelivery, false, false, commodity)" placeholder="大陆最长交期" ng-model="commodity.editMaxDelivery" class="wid25 form-control"/></span>
                             </div>
                             <div ng-if="onsale.currency == 'USD'">
                                 <span>香港:</span>
-                                <span><input type="text" placeholder="香港最短交期" ng-class="{'error' : commodity.selfHkMinTimeinValid}" ng-blur="changeDelivery(commodity.editSelfDeliveryHKMinTime, commodity.editSelfDeliveryHKMaxTime, true, true, commodity)" ng-model="commodity.editSelfDeliveryHKMinTime" class="wid25 form-control"/></span>
+                                <span><input type="text" placeholder="香港最短交期" ng-class="{'error' : commodity.editMinDeliveryinValid}" ng-blur="changeDelivery(commodity.editMinDelivery, commodity.editMaxDelivery, true, true, commodity)" ng-model="commodity.editMinDelivery" class="wid25 form-control"/></span>
                                 <span>-</span>
-                                <span><input type="text" placeholder="香港最长交期" ng-class="{'error' : commodity.selfHkMaxTimeinValid}" ng-blur="changeDelivery(commodity.editSelfDeliveryHKMinTime, commodity.editSelfDeliveryHKMaxTime, false, true, commodity)" ng-model="commodity.editSelfDeliveryHKMaxTime" class="wid25 form-control"/></span>
+                                <span><input type="text" placeholder="香港最长交期" ng-class="{'error' : commodity.editMaxDeliveryinValid}" ng-blur="changeDelivery(commodity.editMinDelivery, commodity.editMaxDelivery, false, true, commodity)" ng-model="commodity.editMaxDelivery" class="wid25 form-control"/></span>
                             </div>
 
                         </td>