Jelajahi Sumber

1:处理加入购物的bug。
2:标准产品上架时增加输入控制。

yujia 8 tahun lalu
induk
melakukan
2db2f93d16

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

@@ -18,6 +18,7 @@ import com.uas.platform.b2c.prod.product.component.modal.Component;
 import com.uas.platform.b2c.prod.product.component.service.ComponentService;
 import com.uas.platform.b2c.prod.store.dao.StoreInDao;
 import com.uas.platform.b2c.prod.store.model.StoreIn;
+import com.uas.platform.b2c.trade.order.StringConstant.Currency;
 import com.uas.platform.b2c.trade.presale.dao.CartDao;
 import com.uas.platform.b2c.trade.presale.model.Cart;
 import com.uas.platform.b2c.trade.presale.service.CartService;
@@ -439,7 +440,7 @@ public class CartServiceImpl implements CartService {
 		}else {
 			cart.setNumber(commodity);
 		}
-		cart.setCurrencyName(commodity.getCurrencyName() == "USD" ? "USD" : "RMB");
+		cart.setCurrencyName(Currency.USD.equals(commodity.getCurrencyName())? "USD" : "RMB");
 		cart.setReturnInWeek(commodity.getReturnInWeek());
 		cart.setSupply(commodity.getOriginal());
 		cart.setPack(commodity.getPackaging());

+ 15 - 0
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialCtrl.js

@@ -18,6 +18,9 @@ define([ 'app/app' ], function(app) {
 		$scope.maxPackQty = 999999;
 		$scope.minReserve = 1;
 
+		//只包含中文和英文的字符
+		var pattern = /^[\u4e00-\u9fa5a-zA-Z]+$/;
+
 		$scope.param = {
 			page : 1,
 			count : 10,
@@ -487,10 +490,22 @@ define([ 'app/app' ], function(app) {
 				toaster.pop('error', '商品包装方式不能为空');
 				return false;
 			}
+			if(!pattern.test(goods.packaging)) {
+				toaster.pop('error', '商品包装方式只能包含中文和英文字符');
+				return false;
+			}
+			if(goods.packaging.length > 10) {
+				toaster.pop('error', '商品包装方式不能超过10个字符');
+				return false;
+			}
 			if (!goods.produceDate || goods.produceDate === '') {
 				toaster.pop('error', '商品生产日期不能为空');
 				return false;
 			}
+			if(goods.produceDate.length > 11) {
+				toaster.pop('error', '商品生产日期不能超过11个字符');
+				return false;
+			}
 			if (!goods.reserve || goods.reserve === '') {
 				toaster.pop('error', '商品库存信息不能为空');
 				return false;

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

@@ -516,10 +516,10 @@
 							<div class="content">
 								<p class="title">包装/生产日期</p>
 								<div class="input-list">
-									<input type="text" class="form-control" name="packaging" title="包装" placeholder="包装方式" style="width: 108px;" ng-model="goods.packaging"/>
+									<input type="text" class="form-control" name="packaging" ng-maxlength="10" title="包装" maxlength="10" placeholder="包装方式" style="width: 108px;" ng-model="goods.packaging"/>
 								</div>
 								<div class="input-list">
-									<input type="text" class="form-control" name="produceDate" title="生产日期" placeholder="生产日期" style="width: 108px;" ng-model="goods.produceDate"/>
+									<input type="text" class="form-control" name="produceDate" ng-maxlength="11" title="生产日期" maxlength="11" placeholder="生产日期" style="width: 108px;" ng-model="goods.produceDate"/>
 									<!--<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>-->