Refactor function
This commit is contained in:
parent
5148255dde
commit
cfa3c2091d
13
resources/assets/js/views/common/items.js
vendored
13
resources/assets/js/views/common/items.js
vendored
@ -55,16 +55,15 @@ const app = new Vue({
|
||||
},
|
||||
|
||||
'form.purchase_price': function (newVal, oldVal) {
|
||||
if (newVal != '' && newVal.search('^(?=.*?[0-9])[0-9.,]+$') == -1) {
|
||||
if (newVal != '' && newVal.search('^(?=.*?[0-9])[0-9.,]+$') !== 0) {
|
||||
this.form.purchase_price = oldVal;
|
||||
return;
|
||||
}
|
||||
|
||||
if (newVal.search('^(?=.*?[0-9])[0-9.,]+$') == 0) {
|
||||
for (let item of this.regex_condition) {
|
||||
if (this.form.purchase_price.includes(item)) {
|
||||
this.splice_value = this.form.purchase_price.replace(item, '');
|
||||
this.form.purchase_price = this.splice_value;
|
||||
}
|
||||
for (let item of this.regex_condition) {
|
||||
if (this.form.purchase_price.includes(item)) {
|
||||
this.splice_value = this.form.purchase_price.replace(item, '');
|
||||
this.form.purchase_price = this.splice_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user