Kaynağa Gözat

处理税率BUG

wangcz 7 yıl önce
ebeveyn
işleme
c66220fcea

+ 19 - 3
src/main/webapp/resources/js/vendor/controllers/forstore/seek_purchase_ctrl.js

@@ -412,6 +412,7 @@ define(['app/app'], function (app) {
                   }
                   $scope.inquiryItem = seek;
                   $scope.inquiryItem.leadtime = '';
+                  $scope.inquiryItem.taxrate = '';
                   $scope.inquiryItem.replies = [
                     {
                       lapQty: '',
@@ -428,7 +429,6 @@ define(['app/app'], function (app) {
 
           $scope.onLeadtimeInput = function () {
             var time = $scope.inquiryItem.leadtime.toString();
-            // console.info();
             if (time.length > 3) {
               $scope.inquiryItem.leadtime = Number(time.substring(0, 3));
             }
@@ -440,7 +440,23 @@ define(['app/app'], function (app) {
             } else {
               $scope.validSayPrice.leadtime = true;
             }
-          }
+          };
+
+              $scope.onTaxrateInput = function () {
+                  var time = $scope.inquiryItem.taxrate.replace(/[^\-?\d.]/g, '');
+                  if (time.length > 2) {
+                      $scope.inquiryItem.taxrate = Number(time.substring(0, 2));
+                  }
+              }
+              $scope.onTaxrateBlur = function () {
+                  if ($scope.inquiryItem.taxrate < 0 || $scope.inquiryItem.taxrate >= 100 || $scope.inquiryItem.taxrate.toString().indexOf('.') !== -1) {
+                      $scope.validSayPrice.taxrate = false;
+                      toaster.pop('error', '税率请填写0-99之间的正整数');
+                  } else {
+                      $scope.validSayPrice.taxrate = true;
+                  }
+              };
+
             $scope.onReplaceBrandBlur = function () {
               if (!$scope.inquiryItem.replaceBrand || $scope.inquiryItem.replaceBrand.length == 0) {
                 $scope.validSayPrice.replaceBrand = false;
@@ -701,7 +717,7 @@ define(['app/app'], function (app) {
                 return false;
               }
             }
-            return $scope.validSayPrice.leadtime && $scope.validSayPrice.repliesLapQty && $scope.validSayPrice.repliesPrice && validReplace;
+            return $scope.validSayPrice.leadtime && $scope.validSayPrice.taxrate && $scope.validSayPrice.repliesLapQty && $scope.validSayPrice.repliesPrice && validReplace;
           }
 
           $scope.setReplies = function (type, index) {

+ 4 - 0
src/main/webapp/resources/view/vendor/forstore/seekPurchase.html

@@ -1142,6 +1142,10 @@
                         <span><i>*</i>交期:</span>
                         <input type="number" class="form-control" ng-change="onLeadtimeInput()" ng-blur="onLeadtimeBlur()" ng-model="inquiryItem.leadtime" placeholder="天数">
                     </div>
+                    <div class="form-item form-right">
+                        <span><i>*</i>税率:</span>
+                        <input type="number" style="width:133px;margin-right:5px;" class="form-control" ng-change="onTaxrateInput()" ng-blur="onTaxrateBlur()" ng-model="inquiryItem.taxrate" placeholder="税率">%
+                    </div>
                     <div class="form-item form-upload">
                         <!--
                         <label>