From 44dedf3e89814fc1c3deff2c8eeda7f80d6fdc83 Mon Sep 17 00:00:00 2001
From: guaishoudemao <598705433@qq.com>
Date: Tue, 22 Aug 2023 18:12:38 +0800
Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=95=86?=
=?UTF-8?q?=E5=93=81=E6=B7=BB=E5=8A=A0=E4=B8=AD=E5=95=86=E5=93=81=E7=9A=84?=
=?UTF-8?q?=E4=BB=B7=E6=A0=BC=E6=A0=A1=E9=AA=8C=EF=BC=8C=E6=9C=80=E5=B0=8F?=
=?UTF-8?q?=E5=80=BC=E4=B8=BA0.01=EF=BC=8C=E5=BA=93=E5=AD=98=E6=AD=A3?=
=?UTF-8?q?=E6=95=B4=E6=95=B0=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
admin/src/views/store/creatStore/index.vue | 32 ++++++++++++++--------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/admin/src/views/store/creatStore/index.vue b/admin/src/views/store/creatStore/index.vue
index 2118ef13..cb1922c6 100644
--- a/admin/src/views/store/creatStore/index.vue
+++ b/admin/src/views/store/creatStore/index.vue
@@ -177,7 +177,7 @@
-
+
@@ -216,7 +216,7 @@
-
+
@@ -260,7 +260,8 @@
-
+
@@ -587,30 +588,37 @@
methods: {
// 校验输入框不能输入0,保留2位小数,库存为正整数
keyupEvent(key, val, index, num) {
+ if (key === 'barCode') return;
var re = /^\D*([0-9]\d*\.?\d{0,2})?.*$/;
switch (num) {
case 1:
- if (val <= 0) {
- this.oneFormBatch[index][key] = 0.01;
+ if (val == 0) {
+ this.oneFormBatch[index][key] = key === 'stock' ? 0 : 0.01;
} else {
this.oneFormBatch[index][key] =
- key === 'stock' ? parseInt(val) : this.$set(this.oneFormBatch[index], key, val.replace(re, '$1'));
+ key === 'stock'
+ ? parseInt(val)
+ : this.$set(this.oneFormBatch[index], key, val.toString().replace(re, '$1'));
}
break;
case 2:
- if (val <= 0) {
- this.OneattrValue[index][key] = 0.01;
+ if (val == 0) {
+ this.OneattrValue[index][key] = key === 'stock' ? 0 : 0.01;
} else {
this.OneattrValue[index][key] =
- key === 'stock' ? parseInt(val) : this.$set(this.OneattrValue[index], key, val.replace(re, '$1'));
+ key === 'stock'
+ ? parseInt(val)
+ : this.$set(this.OneattrValue[index], key, val.toString().replace(re, '$1'));
}
break;
default:
- if (val <= 0) {
- this.ManyAttrValue[index][key] = 0.01;
+ if (val == 0) {
+ this.ManyAttrValue[index][key] = key === 'stock' ? 0 : 0.01;
} else {
this.ManyAttrValue[index][key] =
- key === 'stock' ? parseInt(val) : this.$set(this.ManyAttrValue[index], key, val.replace(re, '$1'));
+ key === 'stock'
+ ? parseInt(val)
+ : this.$set(this.ManyAttrValue[index], key, val.toString().replace(re, '$1'));
}
break;
}