Browse Source

0值判断修改

yangc 8 years ago
parent
commit
c36bf7cb9d
1 changed files with 5 additions and 3 deletions
  1. 5 3
      components/applyPurchase/ApplyInfo.vue

+ 5 - 3
components/applyPurchase/ApplyInfo.vue

@@ -235,7 +235,7 @@
       },
       },
       onUnitPriceBlur: function () {
       onUnitPriceBlur: function () {
         if (this.sayPriceObj.unitPrice) {
         if (this.sayPriceObj.unitPrice) {
-          if (this.sayPriceObj.unitPrice < 0) {
+          if (this.sayPriceObj.unitPrice <= 0) {
             this.$message.error('单价必须是大于0的数字')
             this.$message.error('单价必须是大于0的数字')
             this.validSayPrice.unitPrice = false
             this.validSayPrice.unitPrice = false
           } else {
           } else {
@@ -260,7 +260,8 @@
         }
         }
       },
       },
       onMinDayInput: function () {
       onMinDayInput: function () {
-        if (this.sayPriceObj.minDay < 1 || this.sayPriceObj.minDay > 31 || this.sayPriceObj.minDay.indexOf('.') !== -1) {
+        this.sayPriceObj.minDay = Number(this.sayPriceObj.minDay)
+        if (this.sayPriceObj.minDay < 1 || this.sayPriceObj.minDay > 31 || this.sayPriceObj.minDay.toString().indexOf('.') !== -1) {
           this.validSayPrice.minDay = false
           this.validSayPrice.minDay = false
           this.$message.error('交期只能填写1-31之间的整数值')
           this.$message.error('交期只能填写1-31之间的整数值')
         } else if (this.sayPriceObj.maxDay && this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {
         } else if (this.sayPriceObj.maxDay && this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {
@@ -276,7 +277,8 @@
         }
         }
       },
       },
       onMaxDayInput: function () {
       onMaxDayInput: function () {
-        if (this.sayPriceObj.maxDay < 1 || this.sayPriceObj.maxDay > 31 || this.sayPriceObj.maxDay.indexOf('.') !== -1) {
+        this.sayPriceObj.maxDay = Number(this.sayPriceObj.maxDay)
+        if (this.sayPriceObj.maxDay < 1 || this.sayPriceObj.maxDay > 31 || this.sayPriceObj.maxDay.toString().indexOf('.') !== -1) {
           this.validSayPrice.maxDay = false
           this.validSayPrice.maxDay = false
           this.$message.error('交期只能填写1-31之间的整数值')
           this.$message.error('交期只能填写1-31之间的整数值')
         } else if (this.sayPriceObj.minDay && this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {
         } else if (this.sayPriceObj.minDay && this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {