console error fixed

This commit is contained in:
Burak Civan 2022-12-06 13:58:50 +03:00
parent ad0a81a53a
commit 7e83aefa37

View File

@ -811,15 +811,20 @@ const app = new Vue({
watch: { watch: {
'form.discount': function (newVal, oldVal) { 'form.discount': function (newVal, oldVal) {
if (newVal != '' && newVal.search('^(?=.*?[0-9])[0-9.,]+$') !== 0) { if (newVal > 99) {
newVal = oldVal;
return;
}
if (newVal != '' && newVal.search('^[-+]?([0-9]|[1-9][0-9]|100)*\.?[0-9]+$') !== 0) {
this.form.discount = oldVal; this.form.discount = oldVal;
this.form.discount = this.form.discount.replace(',', '.'); this.form.discount = this.form.discount ? this.form.discount.replace(',', '.') : '';
return; return;
} }
for (let item of this.regex_condition) { for (let item of this.regex_condition) {
if (this.form.discount.includes(item)) { if (this.form.discount && this.form.discount.includes(item)) {
const removeLastChar = newVal.length - 1; const removeLastChar = newVal.length - 1;
const inputShown = newVal.slice(0, removeLastChar); const inputShown = newVal.slice(0, removeLastChar);
@ -827,7 +832,7 @@ const app = new Vue({
} }
} }
this.form.discount = this.form.discount.replace(',', '.'); this.form.discount = this.form.discount ? this.form.discount.replace(',', '.') : '';
}, },
'form.loading': function (newVal, oldVal) { 'form.loading': function (newVal, oldVal) {