Explorar o código

修复卖家改价相应的逻辑

hulh %!s(int64=8) %!d(string=hai) anos
pai
achega
468b14b191

+ 11 - 2
src/main/webapp/resources/js/vendor/controllers/forstore/purchase_detail.js

@@ -185,7 +185,16 @@ define(['app/app'], function(app) {
 			});
 		}
 
-		$scope.updateTotal = function () {
+		$scope.updateTotal = function (data) {
+			if (isNaN(data.currentTaxUnitPrice)){
+				data.currentTaxUnitPrice = 0.000001;
+				toaster.pop('warning', '提示', '输入的价格必须是数字');
+				return ;
+			}
+			if (Number(data.currentTaxUnitPrice) <= 0){
+				data.currentTaxUnitPrice = 0.000001;
+			}
+			data.currentTaxUnitPrice = Number(NumberService.toCeil(data.currentTaxUnitPrice, 6));
 			$scope.purchase.currentTotal = 0;
 			angular.forEach($scope.purchase.purchaseDetails, function (detail) {
 				$scope.purchase.currentTotal += detail.currentTaxUnitPrice * detail.number;
@@ -217,7 +226,7 @@ define(['app/app'], function(app) {
                 var param = { };
                 param.detailid  = $scope.purchase.purchaseDetails[i].detailid;
                 param.modifyingUnitPrice = $scope.purchase.purchaseDetails[i].currentTaxUnitPrice;
-                if($scope.purchase.purchaseDetails[i].currentTaxUnitPrice <= 0.000001){
+                if($scope.purchase.purchaseDetails[i].currentTaxUnitPrice < 0.000001){
                     toaster.pop('info', '金额必须要大于0.000001');
                     return;
                 }

+ 1 - 1
src/main/webapp/resources/view/vendor/forstore/purchase_detail.html

@@ -386,7 +386,7 @@
 							<em  ng-show="!isChange" ng-bind="detail.taxUnitPrice | formateNumber : 6 | currencySysmbol : detail.currencyName" style="color: #333;"></em>
 							<em ng-show="isChange" class="price-style">
 								<em  ng-bind="'' | currencySysmbol : detail.currencyName"></em>
-								<input ng-model="detail.currentTaxUnitPrice" type="number" ng-change="updateTotal()"/>
+								<input ng-model="detail.currentTaxUnitPrice" type="number" ng-change="updateTotal(detail)"/>
 							</em>
 						</span>
 						<span style="width: 10%;" ng-bind="detail.number">100</span>