Browse Source

采购数量校验

yangc 8 years ago
parent
commit
f19dd71ff4
1 changed files with 6 additions and 1 deletions
  1. 6 1
      components/applyPurchase/PublishApply.vue

+ 6 - 1
components/applyPurchase/PublishApply.vue

@@ -59,7 +59,7 @@
             <span>
               采购数量:
             </span>
-            <input type="number" class="form-control" :class="{'error': !validObj.amount}" v-model="applyObj.amount" @blur="checkAmount" />
+            <input type="text" class="form-control" :class="{'error': !validObj.amount}" v-model="applyObj.amount" @blur="checkAmount" @input="onAmountInput" />
           </div>
           <div class="form-item">
             <span>
@@ -332,6 +332,11 @@
           this.getSimilarBrand()
         }
       },
+      onAmountInput: function () {
+        if (this.applyObj.amount.length > 8 || !(/^[0-9]*$/).test(this.applyObj.amount)) {
+          this.applyObj.amount = this.applyObj.amount.substring(0, this.applyObj.amount.length - 1)
+        }
+      },
       onSuccess: function (data) {
         window.open('/applyPurchase/' + data.data)
       },