فهرست منبع

fix 处理报价没有必填也能报价问题

wangcz 7 سال پیش
والد
کامیت
47856ac3bc

+ 32 - 27
src/main/webapp/resources/js/vendor/controllers/forstore/seek_purchase_ctrl.js

@@ -8,6 +8,7 @@ define(['app/app'], function (app) {
           $rootScope.active = 'vendor_seek_purchase';
           $scope.storeType = 'seekPurchase';
           $scope.seekPurchaseRate = {};
+          $scope.inquiryItem = {};
           $scope.sayType = 'current'; // 报价类型,current为当前,replace为替代料
             var _formatDate = function (date, fmt) {
                 if (!date) {
@@ -51,22 +52,23 @@ define(['app/app'], function (app) {
 
           seekPurchase.getSeekUrl({}, function(data) {
             var seekUrl = data.url;
-          var initInquiryItem = function () {
-            $scope.validSayPrice = {
-              leadtime: false,
-              taxrate: false,
-              repliesPrice: false,
-              repliesLapQty: false,
-              replaceBrand: false,
-              replaceCmpCode: false,
-              replaceSpec: true
-            };
-            $scope.inquiryItem = {};
-          }
-          init();
-          initInquiryItem();
+              var initInquiryItem = function () {
+                $scope.validSayPrice = {
+                  leadtime: false,
+                  taxrate: false,
+                  repliesPrice: false,
+                  repliesLapQty: false,
+                  replaceBrand: false,
+                  replaceCmpCode: false,
+                  replaceSpec: true
+                };
+                $scope.inquiryItem = {};
+              }
+              init();
+              initInquiryItem();
 
             $scope.setSayType = function (type) {
+                initInquiryItem();
               if (type == 'current') {
                 delete $scope.inquiryItem.replaceBrand;
                 delete $scope.inquiryItem.replaceCmpCode;
@@ -74,6 +76,7 @@ define(['app/app'], function (app) {
                 // $scope.inquiryItem.isReplace = null;
               }
               $scope.inquiryItem.leadtime = '';
+              $scope.inquiryItem.taxrate = '';
               for (var i = 0; i < $scope.seekCurrency.length; i++) {
                 $scope.seekCurrency[i] = 'RMB';
               }
@@ -440,25 +443,27 @@ define(['app/app'], function (app) {
             if (!$scope.inquiryItem.leadtime || $scope.inquiryItem.leadtime < 1 || $scope.inquiryItem.leadtime >= 1000 || $scope.inquiryItem.leadtime.toString().indexOf('.') !== -1) {
               $scope.validSayPrice.leadtime = false;
               toaster.pop('error', '交期请填写1-999之间的正整数');
+                $scope.inquiryItem.leadtime = '';
             } 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.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.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之间的正整数');
+                  $scope.inquiryItem.taxrate = '';
+              } else {
+                  $scope.validSayPrice.taxrate = true;
+              }
+          };
 
             $scope.onReplaceBrandBlur = function () {
               if (!$scope.inquiryItem.replaceBrand || $scope.inquiryItem.replaceBrand.length == 0) {

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

@@ -1143,11 +1143,11 @@
                 <div class="content-line">
                     <div class="form-item form-left">
                         <span><i>*</i>交期(天):</span>
-                        <input type="number" class="form-control" ng-change="onLeadtimeInput()" ng-blur="onLeadtimeBlur()" ng-model="inquiryItem.leadtime" placeholder="最长交期">
+                        <input type="text" 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="税率">%
+                        <input type="text" 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">
                         <!--
@@ -1170,7 +1170,7 @@
                         <input type="text" class="form-control" placeholder="数量">
                         -
                         -->
-                        <input type="number" class="form-control" ng-blur="onReplyLapQtyBlur($index)" ng-change="onReplyLapQtyInput($index)" ng-model="reply.lapQty" placeholder="分段数量">
+                        <input type="text" class="form-control" ng-blur="onReplyLapQtyBlur($index)" ng-change="onReplyLapQtyInput($index)" ng-model="reply.lapQty" placeholder="分段数量">
                     </div>
                     <div class="form-item form-right">
                         <span><i>*</i>单价<span ng-if="inquiryItem.currency" ng-bind="inquiryItem.currency == 'USD' ? '$' : '¥'"></span>:</span>
@@ -1178,7 +1178,7 @@
                             <option value="RMB">¥</option>
                             <option value="USD">$</option>
                         </select>
-                        <input type="number" class="form-control" ng-change="onReplyPriceInput($index)" ng-blur="onReplyPriceBlur($index)" ng-model="reply.price" placeholder="分段单价">
+                        <input type="text" class="form-control" ng-change="onReplyPriceInput($index)" ng-blur="onReplyPriceBlur($index)" ng-model="reply.price" placeholder="分段单价">
                         <i class="fa fa-minus-circle" ng-if="inquiryItem.replies.length > 1" ng-click="setReplies('sub', $index)"></i>
                         <i class="fa fa-plus-circle" ng-if="inquiryItem.replies.length < 5" ng-click="setReplies('add', $index)"></i>
                     </div>