Pārlūkot izejas kodu

1:处理验收的bug。

yujia 8 gadi atpakaļ
vecāks
revīzija
1456036793

+ 35 - 14
src/main/java/com/uas/platform/b2c/prod/commodity/service/impl/ReleaseProductByBatchServiceImpl.java

@@ -320,29 +320,50 @@ public class ReleaseProductByBatchServiceImpl implements ReleaseProductByBatchSe
 						qtyPrice.setStart(DoubleConstant.minReserve);
 						if(Currency.USD.equals(releaseProductByBatch.getCurrency())) {
 							Double usdMinPackPrice = releaseProductByBatch.getUsdMinPackPrice();
-							qtyPrice.setUSDPrice(usdMinPackPrice);
-							qtyPrice.setUSDNTPrice(usdMinPackPrice);
-							priceMaxMinPrice[0] = usdMinPackPrice;
-							priceMaxMinPrice[1] = usdMinPackPrice;
+							if(usdMinPackPrice != null) {
+								qtyPrice.setUSDPrice(usdMinPackPrice);
+								qtyPrice.setUSDNTPrice(usdMinPackPrice);
+								priceMaxMinPrice[0] = usdMinPackPrice;
+								priceMaxMinPrice[1] = usdMinPackPrice;
+							}
+
 						}else {
 							Double rmbMinPackPrice = releaseProductByBatch.getRmbMinPackPrice();
-							qtyPrice.setRMBPrice(rmbMinPackPrice);
-							BigDecimal priceNum = new BigDecimal(rmbMinPackPrice);
-							BigDecimal taxNum = new BigDecimal(releaseProductByBatch.getRmbTaxRate() + 1);
-							qtyPrice.setRMBNTPrice(priceNum.divide(taxNum, 6, BigDecimal.ROUND_HALF_UP).doubleValue());
-							priceMaxMinPrice[0] = rmbMinPackPrice;
-							priceMaxMinPrice[1] = rmbMinPackPrice;
+							if(rmbMinPackPrice != null) {
+								qtyPrice.setRMBPrice(rmbMinPackPrice);
+								BigDecimal priceNum = new BigDecimal(rmbMinPackPrice);
+								BigDecimal taxNum = new BigDecimal(releaseProductByBatch.getRmbTaxRate() + 1);
+								qtyPrice.setRMBNTPrice(priceNum.divide(taxNum, 6, BigDecimal.ROUND_HALF_UP).doubleValue());
+								priceMaxMinPrice[0] = rmbMinPackPrice;
+								priceMaxMinPrice[1] = rmbMinPackPrice;
+							}
 						}
 						qtyPrice.setEnd(DoubleConstant.maxReserve);
 						prices.add(qtyPrice);
 					}
 					releaseProductByBatch.setPrices(prices);
 					if(Currency.USD.equals(releaseProductByBatch.getCurrency())) {
-						releaseProductByBatch.setMinPriceUSD(priceMaxMinPrice[0]);
-						releaseProductByBatch.setMaxPriceUSD(priceMaxMinPrice[1]);
+						if(NumberUtil.compare(priceMaxMinPrice[0], Double.MAX_VALUE) == 0) {
+							releaseProductByBatch.setMinPriceUSD(null);
+						}else {
+							releaseProductByBatch.setMinPriceUSD(priceMaxMinPrice[0]);
+						}
+						if(NumberUtil.compare(priceMaxMinPrice[1], Double.MIN_VALUE) == 0) {
+							releaseProductByBatch.setMaxPriceUSD(null);
+						}else {
+							releaseProductByBatch.setMaxPriceUSD(priceMaxMinPrice[1]);
+						}
 					}else {
-						releaseProductByBatch.setMinPriceRMB(priceMaxMinPrice[0]);
-						releaseProductByBatch.setMaxPriceRMB(priceMaxMinPrice[1]);
+						if(NumberUtil.compare(priceMaxMinPrice[0], Double.MAX_VALUE) == 0) {
+							releaseProductByBatch.setMinPriceRMB(null);
+						}else {
+							releaseProductByBatch.setMinPriceRMB(priceMaxMinPrice[0]);
+						}
+						if(NumberUtil.compare(priceMaxMinPrice[1], Double.MIN_VALUE) == 0) {
+							releaseProductByBatch.setMaxPriceRMB(null);
+						}else {
+							releaseProductByBatch.setMaxPriceRMB(priceMaxMinPrice[1]);
+						}
 					}
 
 

+ 25 - 2
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_onSaleCtrl.js

@@ -461,7 +461,7 @@ define([ 'app/app' ], function(app) {
             commodity.editPackagingPre = commodity.packaging;
             commodity.editPackagingDirty = false;
 
-            commodity.editProduceDate = new String(commodity.produceDate);
+            commodity.editProduceDate = new String(commodity.produceDate || '');
             commodity.editProduceDatePre = commodity.produceDate;
             commodity.editProduceDateDirty = false;
 
@@ -990,6 +990,10 @@ define([ 'app/app' ], function(app) {
                         commodity.editPrices[i].usdPriceInvalid = true;
                         toaster.pop('warning', '提示', "香港交货($)信息必须是数字");
                         return result;
+                    }else if(Number(commodity.editPrices[i].uSDPrice) <= 0) {
+                        commodity.editPrices[i].usdPriceInvalid = true;
+                        toaster.pop('warning', '提示', "香港交货($)信息必须是大于0的数字");
+                        return result;
                     }
                 }
                 if(commodity.currencyName.indexOf('RMB') > -1) {
@@ -1001,6 +1005,10 @@ define([ 'app/app' ], function(app) {
                         commodity.editPrices[i].rmbPriceInvalid = true;
                         toaster.pop('warning', '提示', "大陆交货(¥)信息必须是数字");
                         return result;
+                    }else if(Number(commodity.editPrices[i].rMBPrice) <= 0){
+                        commodity.editPrices[i].rmbPriceInvalid = true;
+                        toaster.pop('warning', '提示', "大陆交货(¥)信息大于0的数字");
+                        return result;
                     }
                 }
             }
@@ -1084,7 +1092,6 @@ define([ 'app/app' ], function(app) {
                             price.usdPriceInvalid = true;
                         }
                     }
-
                 }
             }else {
                 price.rmbPriceInvalid = false;
@@ -1099,7 +1106,23 @@ define([ 'app/app' ], function(app) {
                             price.rmbPriceInvalid = true;
                         }
                     }
+                }
+            }
+        };
 
+        /**
+         * 验证价格信息
+         */
+        $scope.priceBlur = function (price, isUsd) {
+            if(isUsd) {
+                price.usdPriceInvalid = false;
+                if(isNaN(price.uSDPrice) || price.uSDPrice <= 0) {
+                    price.usdPriceInvalid = true;
+                }
+            }else {
+                price.rmbPriceInvalid = false;
+                if(isNaN(price.rMBPrice) ||  price.rMBPrice <= 0) {
+                    price.rmbPriceInvalid = true;
                 }
             }
         };

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

@@ -735,7 +735,7 @@
                             <div style="width: 99px;" ng-repeat="price in commodity.editPrices">
                                     <span ng-if="commodity.currencyName.indexOf('USD') > -1">
                                         <form name="usdForm">
-                                            <input type="text" name="usd" ng-keyup="priceValid(price, true)" ng-class="{'error' : price.usdPriceInvalid}" placeholder="香港交货($)" autocomplete="off" ng-model="price.uSDPrice" ng-model-options="{debounce : 100}" class="wid85 form-control"/>
+                                            <input type="text" name="usd" ng-blur="priceBlur(price, true)" ng-keyup="priceValid(price, true)" ng-class="{'error' : price.usdPriceInvalid}" placeholder="香港交货($)" autocomplete="off" ng-model="price.uSDPrice" ng-model-options="{debounce : 100}" class="wid85 form-control"/>
                                         </form>
                                     </span>
                             </div>
@@ -744,7 +744,7 @@
                             <div style="width: 99px;" ng-repeat="price in commodity.editPrices">
                                     <span ng-if="commodity.currencyName.indexOf('RMB') > -1">
                                         <form name="rmbForm">
-                                            <input type="text" name="rmb" ng-keyup="priceValid(price, false)" ng-class="{'error' : price.rmbPriceInvalid}" placeholder="大陆交货(¥)" autocomplete="off" ng-model="price.rMBPrice" ng-model-options="{debounce : 100}" class="wid85 form-control"/>
+                                            <input type="text" name="rmb" ng-blur="priceBlur(price, false)" ng-keyup="priceValid(price, false)" ng-class="{'error' : price.rmbPriceInvalid}" placeholder="大陆交货(¥)" autocomplete="off" ng-model="price.rMBPrice" ng-model-options="{debounce : 100}" class="wid85 form-control"/>
                                         </form>
                                     </span>
                                 <a class="reduce" ng-disabled="commodity.editPrices.length < 2" ng-click="deleteFragment(commodity, $index)"><i class="fa fa-minus-circle"></i></a>