Browse Source

1:产品管理增加了可拆卖开关。
2:起订量、包装量、可拆卖逻辑的调整。

yujia 9 years ago
parent
commit
fefe4192e4

+ 41 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/Goods.java

@@ -464,6 +464,18 @@ public class Goods implements Serializable {
 	@Column(name = "go_lastreserve")
 	private Double lastReserve;
 
+	/**
+	 * 是否拆卖
+	 */
+	@Column(name = "go_isbreakup")
+	private Boolean breakUp;
+
+	/**
+	 * 每次加减单位数量,可拆卖,等于1,不可拆卖 等于最小包数量
+	 */
+	@Column(name= "go_perqty")
+	private Double perQty;
+
 	@Transient
 	private String selfSale;
 
@@ -631,6 +643,13 @@ public class Goods implements Serializable {
 		this.reserve = reserve;
 	}
 
+	public void setReserve(Goods goods) {
+		if(NumberUtil.compare(this.reserve, goods.reserve) != 0) {
+			this.lastReserve = goods.getReserve();
+		}
+		this.reserve = goods.getReserve();
+	}
+
 	public Double getOldReserve() {
 		return oldReserve;
 	}
@@ -954,6 +973,15 @@ public class Goods implements Serializable {
 		return this;
 	}
 
+	public Boolean getBreakUp() {
+		return breakUp;
+	}
+
+	public Goods setBreakUp(Boolean breakUp) {
+		this.breakUp = breakUp;
+		return this;
+	}
+
 	/**************************************************************************
 	 * Property Method
 	 **************************************************************************/
@@ -1374,4 +1402,17 @@ public class Goods implements Serializable {
 		return true;
 	}
 
+	public Double getPerQty() {
+		return perQty;
+	}
+
+	public Goods setPerQty(Double perQty) {
+		this.perQty = perQty;
+		return this;
+	}
+
+	public Goods setPerQty() {
+		this.perQty = (this.breakUp != null && this.breakUp) ? 1d : this.minPackQty;
+		return this;
+	}
 }

+ 32 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/model/GoodsHistory.java

@@ -374,6 +374,18 @@ public class GoodsHistory {
 	@Column(name = "go_lastreserve")
 	private Double lastReserve;
 
+	/**
+	 * 每次加减单位数量,可拆卖,等于1,不可拆卖 等于最小包数量
+	 */
+	@Column(name = "go_perQty")
+	private Double perQty;
+
+	/**
+	 * 是否可拆卖
+	 */
+	@Column(name = "go_breakup")
+	private Boolean breakUp;
+
 	/**
 	 * 分段价格
 	 */
@@ -987,6 +999,8 @@ public class GoodsHistory {
 		this.selfDeliveryHKMaxTime = goods.getSelfDeliveryHKMaxTime();
 		this.selftDeliveryHKMinTime = goods.getSelfDeliveryHKMinTime();
 		this.updateDate = new Date();
+		this.perQty = goods.getPerQty();
+		this.breakUp = goods.getBreakUp();
     }
 
 	public Short getSelfDeliveryDemMinTime() {
@@ -1060,4 +1074,22 @@ public class GoodsHistory {
 		this.b2cDeliveryHKMinTime = b2cDeliveryHKMinTime;
 		return this;
 	}
+
+	public Double getPerQty() {
+		return perQty;
+	}
+
+	public GoodsHistory setPerQty(Double perQty) {
+		this.perQty = perQty;
+		return this;
+	}
+
+	public Boolean getBreakUp() {
+		return breakUp;
+	}
+
+	public GoodsHistory setBreakUp(Boolean breakUp) {
+		this.breakUp = breakUp;
+		return this;
+	}
 }

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

@@ -209,6 +209,12 @@ public class GoodsSimple {
 	@Column(name = "go_lastreserve")
 	private Double lastReserve;
 
+	/**
+	 * 每次加减单位数量,可拆卖,等于1,不可拆卖 等于最小包数量
+	 */
+	@Column(name = "go_perqty")
+	private Double perQty;
+
 	/**
 	 * 包装
 	 */
@@ -561,6 +567,7 @@ public class GoodsSimple {
 		this.img = goods.getImg();
 		this.lastReserve = goods.getLastReserve();
 		this.status = goods.getStatus();
+		this.perQty = goods.getPerQty();
 	}
 
 	public Short getB2cDeliveryDemMaxTime() {
@@ -599,7 +606,15 @@ public class GoodsSimple {
 		return this;
 	}
 
-	/*
+	public Double getPerQty() {
+		return perQty;
+	}
+
+	public GoodsSimple setPerQty(Double perQty) {
+		this.perQty = perQty;
+		return this;
+	}
+/*
 	 * public GoodsSimpleUas converUas(){ GoodsSimpleUas uas = new
 	 * GoodsSimpleUas(); uas.setBatchCode(this.batchCode);
 	 * uas.setCreatedDate(this.createdDate);

+ 1 - 0
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/GoodsHistoryServiceImpl.java

@@ -247,6 +247,7 @@ public class GoodsHistoryServiceImpl implements GoodsHistoryService {
 		GoodsHistory goodsHistory = new GoodsHistory(goods);
 		goodsHistory.setOperateUU(SystemSession.getUser().getUserUU());
 		goodsHistory.setOperateType(GoodsHistory.OperateType.Update.getPhrase());
+		goodsHistory.setOperateDate(new Date());
 		goodsHistory.setMessage(compareGoodsHistory(goodsHistory));
 		return goodsHistory;
 	}

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

@@ -214,15 +214,21 @@ public class GoodsServiceImpl implements GoodsService {
 		if (!"RMB".equals(goods.getCurrencyName())) {
 			goods.setTax((short) 0);
 		}
-		if (goods.getReserve() < 0 || goods.getReserve() > 99999999) {
+		if (goods.getReserve() < 0 || goods.getReserve() > 999999999) {
 			throw new IllegalOperatorException("库存数量必须在1~99999999之间");
 		}
-		if (goods.getMinPackQty() < 1 || goods.getMinPackQty() > 99999999) {
-			throw new IllegalOperatorException("最小包装量必须在1~99999999之间");
+		if (goods.getMinPackQty() < 1 || goods.getMinPackQty() > 999999) {
+			throw new IllegalOperatorException("最小包装量必须在1~999999之间");
 		}
-        if (goods.getMinBuyQty() % goods.getMinPackQty() != 0) {
-			throw new IllegalOperatorException("最小起订量必须为最小包装量的整数倍");
-        }
+		if (goods.getMinBuyQty() < 1 || (NumberUtil.compare(goods.getMinBuyQty(), goods.getReserve()) > 0)) {
+			throw new IllegalOperatorException("最小起订量必须在1~"+ goods.getReserve() +"之间");
+		}
+		if(!goods.getBreakUp()) {
+			if (goods.getMinBuyQty() % goods.getMinPackQty() != 0) {
+				throw new IllegalOperatorException("最小起订量必须为最小包装量的整数倍");
+			}
+		}
+
 		// 验证交货周期信息
         validDeliveryTime(goods);
 
@@ -485,7 +491,8 @@ public class GoodsServiceImpl implements GoodsService {
 		goods.setBatchCode(batchCode);
 		goods.setCreatedDate(new Date());
 		goods.setUpdateDate(goods.getCreatedDate());
-		goods.setLastReserve(goods.getReserve());
+		goods.setReserve(goods);
+		goods.setPerQty();
 		goods.setEnUU(SystemSession.getUser().getEnterprise().getUu());
 		goods.setEnterpriseName(SystemSession.getUser().getEnterprise().getEnName());
 		if (StringUtils.isEmpty(goods.getPublisherName())) {
@@ -1097,7 +1104,9 @@ public class GoodsServiceImpl implements GoodsService {
 		nowGoods.setImg(oldGoods.getImg());
 		nowGoods.setMinBuyQty(oldGoods.getMinBuyQty());
 		nowGoods.setMinPackQty(oldGoods.getMinPackQty());
-		nowGoods.setReserve(oldGoods.getReserve());
+		nowGoods.setBreakUp(oldGoods.getBreakUp());
+		nowGoods.setPerQty();
+		nowGoods.setReserve(oldGoods);
 		nowGoods.setPackaging(oldGoods.getPackaging());
 		// 用含税单价同步未含税单价
 		oldGoods.setWithOutTaxRMBPrice();
@@ -1135,7 +1144,6 @@ public class GoodsServiceImpl implements GoodsService {
 			throw new IllegalOperatorException("您选择的销售方式不存在");
 		}
 
-
 		GoodsHistory history = goodsHistoryService.initByGoods(nowGoods, OperateType.Update);
 		List<Order> orders = detailService.updateOrderDetailsByGoods(nowGoods);
 		//更新购物车信息

+ 12 - 0
src/main/java/com/uas/platform/b2c/trade/order/StringConstant/Currency.java

@@ -0,0 +1,12 @@
+package com.uas.platform.b2c.trade.order.StringConstant;
+
+/**
+ * 币别常量
+ *
+ * @author yuj 2017-09-07 9:57
+ */
+public class Currency {
+    public static final String RMB = "RMB";
+
+    public static final String USD = "USD";
+}

+ 17 - 7
src/main/java/com/uas/platform/b2c/trade/order/model/OrderDetail.java

@@ -852,14 +852,24 @@ public class OrderDetail extends Document implements Serializable{
 		if(this.minPackQty == null) {
 			this.minPackQty = goods.getMinPackQty();
 		}
-		double times = NumberUtil.div(this.number, this.minPackQty);
-		double qty1 = NumberUtil.mul(times, goods.getMinPackQty());
-		if(NumberUtil.compare(qty1, goods.getMinBuyQty()) <= 0) {
-			this.number = goods.getMinBuyQty();
-		}else if(NumberUtil.compare(qty1, goods.getReserve()) <= 0) {
-			this.number = qty1;
+		if(goods.getBreakUp()) {
+			if(NumberUtil.compare(this.number, goods.getMinBuyQty()) < 0) {
+				this.number = goods.getMinBuyQty();
+			}
 		}else {
-			this.number = NumberUtil.sub(goods.getReserve(), goods.getReserve() % goods.getMinPackQty());
+			Double remind = this.number % goods.getMinPackQty();
+			if(NumberUtil.compare(remind, 0.0) != 0) {
+				this.number = goods.getMinBuyQty();
+			}
+//			double times = NumberUtil.div(this.number, this.minPackQty)
+//			double qty1 = NumberUtil.mul(times, goods.getMinPackQty());
+//			if(NumberUtil.compare(qty1, goods.getMinBuyQty()) <= 0) {
+//				this.number = goods.getMinBuyQty();
+//			}else if(NumberUtil.compare(qty1, goods.getReserve()) <= 0) {
+//				this.number = qty1;
+//			}else {
+//				this.number = NumberUtil.sub(goods.getReserve(), goods.getReserve() % goods.getMinPackQty());
+//			}
 		}
 	}
 

+ 11 - 5
src/main/java/com/uas/platform/b2c/trade/order/service/impl/OrderDetailServiceImpl.java

@@ -12,6 +12,7 @@ import com.uas.platform.b2c.prod.commodity.service.GoodsService;
 import com.uas.platform.b2c.prod.product.common.service.CreateNumberService;
 import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
 import com.uas.platform.b2c.prod.product.component.modal.Component;
+import com.uas.platform.b2c.trade.order.StringConstant.Currency;
 import com.uas.platform.b2c.trade.order.dao.OrderDao;
 import com.uas.platform.b2c.trade.order.dao.OrderDetailDao;
 import com.uas.platform.b2c.trade.order.dao.PurchaseDetailDao;
@@ -545,11 +546,16 @@ public class OrderDetailServiceImpl implements OrderDetailService {
 		detail.setImg(goods.getImg());
 		detail.setStoreid(goods.getStoreid());
 		detail.setStoreName(goods.getStoreName());
-		if (goods.getB2cMaxDelivery() != null){
-			detail.setB2cMaxDelivery(goods.getB2cMaxDelivery());
-		}
-		if (goods.getB2cMinDelivery() != null){
-			detail.setB2cMinDelivery(goods.getB2cMinDelivery());
+		if(Currency.RMB.equals(detail.getCurrencyName())) {
+			Short maxDelivery = goods.getB2cMaxDelivery() == null ? goods.getB2cDeliveryDemMaxTime() : goods.getB2cMaxDelivery();
+			detail.setB2cMaxDelivery(maxDelivery);
+			Short minDelivery = goods.getB2cMinDelivery() == null ? goods.getB2cDeliveryHKMinTime()  : goods.getB2cMinDelivery();
+			detail.setB2cMinDelivery(minDelivery);
+		}else {
+			Short maxDelivery = goods.getB2cMaxDelivery() == null ? goods.getB2cDeliveryHKMaxTime() : goods.getB2cMaxDelivery();
+			detail.setB2cMaxDelivery(maxDelivery);
+			Short minDelivery = goods.getB2cMinDelivery() == null ? goods.getB2cDeliveryHKMinTime()  : goods.getB2cMinDelivery();
+			detail.setB2cMinDelivery(minDelivery);
 		}
 		Order order = detail.getOrder();
 		orderService.updateByDetail(order);

+ 19 - 9
src/main/java/com/uas/platform/b2c/trade/presale/model/Cart.java

@@ -306,17 +306,27 @@ public class Cart {
 		if(this.minPackQty == null) {
 			this.minPackQty = goods.getMinPackQty();
 		}
-		double times = NumberUtil.div(this.number, this.minPackQty);
-		double qty1 = NumberUtil.mul(times, goods.getMinPackQty());
-		if(NumberUtil.compare(qty1, goods.getMinBuyQty()) <= 0) {
-			this.number = goods.getMinBuyQty();
-		}else if(NumberUtil.compare(qty1, goods.getReserve()) <= 0) {
-			this.number = qty1;
+		if(goods.getBreakUp()) {
+			if(NumberUtil.compare(this.number, goods.getMinBuyQty()) < 0) {
+				this.number = goods.getMinBuyQty();
+			}
 		}else {
-			while (NumberUtil.compare(qty1, goods.getReserve()) > 0) {
-				qty1 -= goods.getMinPackQty();
+			Double remaind = this.number % goods.getMinPackQty();
+			if(NumberUtil.compare(remaind, 0.0) != 0) {
+				this.number = goods.getMinBuyQty();
 			}
-			this.number = qty1;
+//			double times = NumberUtil.div(this.number, this.minPackQty);
+//			double qty1 = NumberUtil.mul(times, goods.getMinPackQty());
+//			if(NumberUtil.compare(qty1, goods.getMinBuyQty()) <= 0) {
+//				this.number = goods.getMinBuyQty();
+//			}else if(NumberUtil.compare(qty1, goods.getReserve()) <= 0) {
+//				this.number = qty1;
+//			}else {
+//				while (NumberUtil.compare(qty1, goods.getReserve()) > 0) {
+//					qty1 -= goods.getMinPackQty();
+//				}
+//				this.number = qty1;
+//			}
 		}
 	}
 

BIN
src/main/webapp/resources/img/icon/check-off.png


BIN
src/main/webapp/resources/img/icon/check-ok.png


+ 11 - 5
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_cart_ctrl.js

@@ -103,7 +103,7 @@ define(["app/app", 'jquery-summernote'], function(app) {
 				toaster.pop('info', '提示', '该商品已经失效,请选择其他商品');
 				return ;
 			}
-			var num = Number(NumberService.add(cart.number, cart.goods.minPackQty));
+			var num = Number(NumberService.add(cart.number, cart.goods.perQty));
 			if(num > cart.goods.reserve) {
 				// cart.number = cart.number - cart.goods.minPackQty;
 				toaster.pop('info','提示','库存不足');
@@ -123,7 +123,7 @@ define(["app/app", 'jquery-summernote'], function(app) {
 				toaster.pop('info', '提示', '该商品已经失效,请选择其他商品');
 				return ;
 			}
-			var num = NumberService.sub(cart.number, cart.goods.minPackQty);
+			var num = NumberService.sub(cart.number, cart.goods.perQty);
 			if(Number(num) < cart.goods.minBuyQty) {
 				toaster.pop('info','提示','该商品最少购买' + cart.goods.minBuyQty + "件");
 				cart.number = cart.goods.minBuyQty;
@@ -226,9 +226,15 @@ define(["app/app", 'jquery-summernote'], function(app) {
 				c.number = c.goods.minBuyQty;
 			}else if(c.number > c.goods.reserve){
 				toaster.pop("info", "提示", "库存不足");
-				if(c.number > c.goods.reserve) {
+				if(c.goods.breakUp) {
+					c.number = c.goods.reserve;
+				}else {
 					c.number = Number(NumberService.sub(c.goods.reserve, c.goods.reserve % c.goods.minPackQty));
 				}
+			}else {
+				if(!c.goods.breakUp) {
+					c.number = NumberService.sub(c.number, c.number % c.goods.minPackQty);
+				}
 			}
 			$scope.disabledAddAndSub(c);
 			$scope.getPrice(c);
@@ -240,12 +246,12 @@ define(["app/app", 'jquery-summernote'], function(app) {
 		 * 是否失效- +
 		 */
 		$scope.disabledAddAndSub = function(c) {
-			if((Number(c.number) - Number(c.goods.minPackQty)) < Number(c.goods.minBuyQty)) {
+			if((Number(c.number) - Number(c.goods.perQty)) < Number(c.goods.minBuyQty)) {
 				c.minusDisabled = true;
 			}else {
 				c.minusDisabled = false;
 			}
-			if(Number(c.number) + Number(c.goods.minPackQty) > Number(c.goods.reserve)) {
+			if(Number(c.number) + Number(c.goods.perQty) > Number(c.goods.reserve)) {
 				c.addDisabled = true;
 			}else {
 				c.addDisabled = false;

+ 18 - 6
src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js

@@ -174,9 +174,13 @@ define(['app/app'], function(app) {
 
 		// 添加按钮,每次加1
 		$scope.add = function(detail){
-			var num = NumberService.add(detail.number, detail.goodsHistory.minPackQty);
+			var num = NumberService.add(detail.number, detail.goodsHistory.perQty);
 			if(Number(num) > detail.goodsHistory.reserve) {
-				detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
+				if(detail.goodsHistory.breakUp) {
+					detail.number = detail.goodsHistory.reserve;
+				}else {
+					detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
+				}
 				toaster.pop('info','提示','库存不足');
 			}else {
 				detail.number = num;
@@ -189,7 +193,7 @@ define(['app/app'], function(app) {
 
 		// 减少按钮,每次减minPackQty
 		$scope.reduce = function(detail){
-			var num = NumberService.sub(detail.number, detail.goodsHistory.minPackQty);
+			var num = NumberService.sub(detail.number, detail.goodsHistory.perQty);
 			if(Number(num) < detail.goodsHistory.minBuyQty) {
 				toaster.pop('info', '提示','该商品最少购买' + detail.goodsHistory.minBuyQty + "件");
 				detail.number = detail.goodsHistory.minBuyQty;
@@ -209,8 +213,16 @@ define(['app/app'], function(app) {
 				toaster.pop("info", "提示", "该商品最少购买" + detail.goodsHistory.minBuyQty + "件");
 				detail.number = detail.goodsHistory.minBuyQty;
 			}else if(detail.number > detail.goodsHistory.reserve){
-				detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
+				if(detail.goodsHistory.breakUp) {
+					detail.number = detail.goodsHistory.reserve;
+				}else{
+					detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
+				}
 				toaster.pop('info', '提示','库存不足');
+			}else {
+				if(!detail.goodsHistory.breakUp) {
+					detail.number = Number(NumberService.sub(detail.number, detail.number%detail.goodsHistory.minPackQty));
+				}
 			}
 			$scope.disabledAddAndSub(detail);
 			$scope.calculatePrice(detail.number, detail, detail.currencyName);
@@ -222,12 +234,12 @@ define(['app/app'], function(app) {
 		 * 是否失效- +
 		 */
 		$scope.disabledAddAndSub = function(detail) {
-			if((Number(detail.number) - Number(detail.goodsHistory.minPackQty)) < Number(detail.goodsHistory.minBuyQty)) {
+			if((Number(detail.number) - Number(detail.goodsHistory.perQty)) < Number(detail.goodsHistory.minBuyQty)) {
 				detail.minusDisabled = true;
 			}else {
 				detail.minusDisabled = false;
 			}
-			if(Number(detail.number) + Number(detail.goodsHistory.minPackQty) > Number(detail.goodsHistory.reserve)) {
+			if(Number(detail.number) + Number(detail.goodsHistory.perQty) > Number(detail.goodsHistory.reserve)) {
 				detail.addDisabled = true;
 			}else {
 				detail.addDisabled = false;

+ 7 - 3
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js

@@ -420,7 +420,7 @@ define([ 'app/app' ], function(app) {
 					toaster.pop('error', result.message);
 				}
 			}, function (error) {
-				console.log(error);
+				toaster.pop('error', error.data);
 			});
 		}
 
@@ -430,6 +430,10 @@ define([ 'app/app' ], function(app) {
 		 * @param goods		商品信息
 		 */
 		function validateGoods(goods) {
+			if(!goods.packaging || goods.packaging === '') {
+				toaster.pop('error', '商品包装方式不能为空');
+				return false;
+			}
 			if (!goods.produceDate || goods.produceDate === '') {
 				toaster.pop('error', '商品生产日期不能为空');
 				return false;
@@ -518,13 +522,13 @@ define([ 'app/app' ], function(app) {
 
 			// 验证交期
 			if (goods.currencyName.indexOf('RMB') > -1) {
-				if ((!goods.selfDeliveryDemMinTime || goods.selfDeliveryDemMinTime === '') && (!goods.selfDeliveryDemMaxTime || goods.selfDeliveryDemMaxTime === '')) {
+				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 === '')) {
+				if ((!goods.selfDeliveryHKMinTime || goods.selfDeliveryHKMinTime === '') || (!goods.selfDeliveryHKMaxTime || goods.selfDeliveryHKMaxTime === '')) {
 					toaster.pop('error', '香港最长和最短交期不能为空');
 					return false;
 				}

+ 46 - 18
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', function ($scope, $rootScope, Goods, $modal, toaster, Loading, StoreInfo, AuthenticationService, $q, StoreCms) {
+    app.register.controller('vendor_onSaleCtrl', ['$scope', '$rootScope', 'Goods', '$modal', 'toaster', 'Loading', 'StoreInfo', 'AuthenticationService', '$q', 'StoreCms', 'NumberService', function ($scope, $rootScope, Goods, $modal, toaster, Loading, StoreInfo, AuthenticationService, $q, StoreCms, NumberService) {
         $rootScope.active = 'vendor_material';
         $scope.keyword = '';
         $scope.tab = 'onSale';
@@ -417,6 +417,10 @@ define([ 'app/app' ], function(app) {
             commodity.editMinPackQtyPre = commodity.minPackQty;
             commodity.editMinPackQtyDirty = false;
 
+            commodity.editBreakUp = commodity.breakUp;
+            commodity.editBreakUpPre = commodity.breakUp;
+            commodity.editBreakUpDirty = false;
+
             commodity.editPackaging = commodity.packaging;
             commodity.editPackagingPre = commodity.packaging;
             commodity.editPackagingDirty = false;
@@ -444,6 +448,23 @@ define([ 'app/app' ], function(app) {
             commodity.editSelfSale = $scope.storeInfo.uuid != 'undefind' && commodity.storeid == $scope.storeInfo.uuid && $scope.storeInfo.storeName.indexOf('优软测试二') < 0 && $scope.storeInfo.storeName.indexOf('优软商城') < 0 ? 1 : 2;
         };
 
+        /**
+         * 是否可拆卖
+         * @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.changeMinBuyQty(commodity);
+                }
+            }
+        }
+
         /**
          * 修改commodity的系列的dirty属性 为true;
          * @param commodity
@@ -669,11 +690,13 @@ define([ 'app/app' ], function(app) {
                 return false;
             }
 
-            if(commodity.editMinPackQty) {
-                if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
-                    commodity.editMinBuyQty = null;
-                    toaster.pop('warning', '提示', '起拍量必须是倍数的整数倍');
-                    return 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) {
@@ -715,10 +738,12 @@ define([ 'app/app' ], function(app) {
             }
 
             if(commodity.editMinBuyQty) {
-                if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
-                    commodity.editMinPackQty = null;
-                    toaster.pop('warning', '提示', '倍数必须是起拍量的整数倍且小于起拍量。');
-                    return false;
+                if(!commodity.editIsBreakUp) {
+                    if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
+                        commodity.editMinPackQty = null;
+                        toaster.pop('warning', '提示', '倍数必须是起拍量的整数倍且小于起拍量。');
+                        return false;
+                    }
                 }
             }
             commodity.editMinPackQtyPre = commodity.editMinPackQty;
@@ -917,9 +942,9 @@ define([ 'app/app' ], function(app) {
                 toaster.pop('warning', '最新库存量只能小于原有库存');
                 return result;
             }
-            if(commodity.editReserve > 99999999) {
+            if(commodity.editReserve > 999999999) {
                 commodity.editReserveInvalid  = true;
-                toaster.pop('warning', '最新库存量不能大于99999999');
+                toaster.pop('warning', '最新库存量不能大于999999999');
                 return result;
             }
             if(isNaN(commodity.editMinBuyQty)) {
@@ -948,11 +973,13 @@ define([ 'app/app' ], function(app) {
                 toaster.pop('warning', '请填写倍数之后再提交');
                 return result;
             }
-            if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
-                commodity.editMinBuyQtyInValid = true;
-                commodity.editMinPackQtyInValid = true;
-                toaster.pop('warning', '起拍量必须是倍数的整数倍');
-                return result;
+            if(!commodity.editBreakUp) {
+                if(commodity.editMinBuyQty % commodity.editMinPackQty != 0) {
+                    commodity.editMinBuyQtyInValid = true;
+                    commodity.editMinPackQtyInValid = true;
+                    toaster.pop('warning', '起拍量必须是倍数的整数倍');
+                    return result;
+                }
             }
             var lastEnd = -1;
             for (var i = 0; i < commodity.editPrices.length; i++) {
@@ -1056,7 +1083,8 @@ define([ 'app/app' ], function(app) {
             commodity.selfSale = commodity.editSelfSale;
             commodity.minPackQty = commodity.editMinPackQty;
             commodity.img = commodity.editPic;
-        }
+            commodity.breakUp = typeof commodity.editBreakUp == 'undefined' ? false : commodity.editBreakUp;
+        };
 
         /**
          * 验证价格是否是合理的,

+ 7 - 4
src/main/webapp/resources/view/vendor/forstore/vendor_material.html

@@ -414,7 +414,7 @@
 			<ul class="fl" style="width: 100%">
 				<li ng-class="{'active': tab == 'material'}"><a ui-sref="vendor_material">产品库</a></li>
 				<li ng-class="{'active': tab == 'onSale'}"><a ui-sref="vendor_onSale">在售产品</a></li>
-				<li ng-class="{'active': tab == 'undercarriage'}"><a ui-sref="vendor_undercarriage">上下架产品</a></li>
+				<li ng-class="{'active': tab == 'undercarriage'}"><a ui-sref="vendor_undercarriage">上下架历史</a></li>
 			</ul>
 		</div>
 		<div class="com_tab">
@@ -498,9 +498,12 @@
 							</div>
 							<div class="content">
 								<p class="title">包装/生产日期</p>
+								<div class="input-list">
+									<input type="text" class="form-control" name="packaging" title="packaging" placeholder="包装方式" style="width: 108px;" ng-model="goods.packaging"/>
+								</div>
 								<div class="input-list">
 									<input type="text" class="form-control" name="produceDate" title="produceDate" placeholder="2016.01.23" style="width: 108px;" ng-model="goods.produceDate"/>
-									<select name="isBreakUp" title="isBreakUp" class="select-adder form-control" style="width: 108px;display: none;" ng-model="goods.isBreakUp">
+									<select name="breakUp" title="breakUp" class="select-adder form-control" style="width: 108px;" ng-model="goods.breakUp">
 										<option value="1">可拆卖</option>
 										<option value="0">不可拆卖</option>
 									</select>
@@ -548,13 +551,13 @@
 							<div class="content" ng-if="!store.enType || store.enType === 'HK'">
 								<p class="title">香港交货($)</p>
 								<div class="input-list" ng-repeat="price in goods.prices">
-									<input type="number" class="wid92 form-control"  placeholder="香港交货($) " ng-model="price.uSDPrice"/>
+									<input type="number" class="wid92 form-control"  placeholder="单价($) " ng-model="price.uSDPrice"/>
 								</div>
 							</div>
 							<div class="content" ng-if="!store.enType || store.enType === 'MAINLAND'">
 								<p class="title">大陆交货(¥)</p>
 								<div class="input-list" ng-repeat="price in goods.prices">
-									<input type="number" class="wid92 form-control"  placeholder="大陆交货(¥)" ng-model="price.rMBPrice"/>
+									<input type="number" class="wid92 form-control"  placeholder="单价(¥)" ng-model="price.rMBPrice"/>
 								</div>
 							</div>
 							<div class="content">

+ 43 - 7
src/main/webapp/resources/view/vendor/forstore/vendor_onSale.html

@@ -259,7 +259,7 @@
         text-align: left !important;
     }
     .vendor-tab.table td .wid135{
-        width: 115px;
+        width: 110px;
         margin-left: 7px;
         position: relative;
         top: -10px;
@@ -468,6 +468,37 @@
     .public-tab.table>tbody>tr>td div:last-child a.add[disabled], .public-tab.table>tbody>tr>td div:last-child a.reduce[disabled]{
         color: #c7c7c7 !important;
     }
+     .pro_management .table>tbody>tr>td div.img a.delete-img {
+         position: absolute;
+         top: 2px;
+         right: 0;
+         z-index: 20;
+         width: 20px;
+         height: 20px;
+         line-height: 16px;
+         border: none;
+     }
+    .pro_management .table>tbody>tr>td div.img a.delete-img i {
+        color: #fff;
+        font-size: 12px;
+    }
+    .public-tab.table tr td div span.switch{
+        width:39px;
+        height: 14px;
+        display: inline-block;
+    }
+    .public-tab.table tr td div span.switch button{
+        border: none;
+        position: relative;
+        top: 6px;
+        left: 5px;
+        width: 39px;
+        height: 14px;
+        background: url(static/img/icon/check-off.png) no-repeat center;
+    }
+    .public-tab.table tr td div span.switch button.active{
+        background: url("static/img/icon/check-ok.png") no-repeat center;
+    }
 </style>
 <div class="user_right fr">
     <!--货品管理-->
@@ -476,7 +507,7 @@
             <ul class="fl" style="width: 100%">
                 <li ng-class="{'active': tab == 'material'}"><a ui-sref="vendor_material">产品库</a></li>
                 <li ng-class="{'active': tab == 'onSale'}"><a ui-sref="vendor_onSale">在售产品</a></li>
-                <li ng-class="{'active': tab == 'undercarriage'}"><a ui-sref="vendor_undercarriage">下架产品</a></li>
+                <li ng-class="{'active': tab == 'undercarriage'}"><a ui-sref="vendor_undercarriage">上下架历史</a></li>
                 <li class="down-goods">
                     <!--<span ng-click="downGoods()">
                         <i class="fa fa-file-excel-o fa-fw"></i>导出Excel
@@ -539,7 +570,7 @@
                     <tr>
                         <th width="45" style="padding:8px 0;">序号</th>
                         <th>产品信息</th>
-                        <th width="110">包装/生产日期</th>
+                        <th width="115">包装/生产日期</th>
                         <th width="100">库存</th>
                         <th width="105">数量</th>
                         <th width="90">香港交货<b style="font-size: 12px;font-weight: 600">($)</b></th>
@@ -585,7 +616,10 @@
                                 <span ng-bind="commodity.packaging || '无包装信息'"></span><br/>
                             </div>
                             <div>
-                                <span ng-bind="commodity.produceDate"></span>
+                                <span ng-bind="commodity.produceDate || '-'"></span>
+                            </div>
+                            <div>
+                                <span ng-bind="commodity.breakUp ? '可拆卖' : '不可拆卖'">可拆卖</span>
                             </div>
                         </td>
                         <td style="padding: 8px 0;">
@@ -601,9 +635,6 @@
                                 <span>倍数: </span>
                                 <span ng-bind="commodity.minPackQty" title="{{commodity.minPackQty}}"></span>
                             </div>
-                            <!--<div>-->
-                            <!--<span>可拆卖</span>-->
-                            <!--</div>-->
                         </td>
                         <td>
                             <div ng-repeat="price in commodity.prices" >
@@ -651,6 +682,7 @@
                             <div class="fl img">
                                 <a><img ng-src="{{commodity.editPic ? commodity.editPic : 'static/img/store/common/default.png'}}"/></a>
                                 <div class="edit-img">
+                                    <a ng-click="commodity.editPic = null" class="delete-img" title="删除" ng-if="commodity.editPic"><i class="fa fa-trash"></i></a>
                                     <a ng-click="editGoodsPicture(commodity.editPic || 'static/img/store/common/default.png', commodity)" title="修改图片"><img src="static/img/icon/update-img.png" /></a>
                                 </div>
                             </div>
@@ -667,6 +699,10 @@
                             <div>
                                 <span><input type="text" ng-blur="editProduceDateFa(commodity)" placeholder="生产日期" maxlength="11" ng-model="commodity.editProduceDate" ng-class="{'error' : commodity.editProduceDateInvalid}" class="wid88 form-control"/></span>
                             </div>
+                            <div>
+                                <span>可拆卖:</span>
+                                <span class="switch"><button ng-class="{'active' : commodity.editBreakUp}" ng-click="toggleIsBreadUp(commodity)"></button></span>
+                            </div>
                         </td>
                         <td>
                             <div>