From 39a59f4b31181904497ecc1db26d1f0183b81d77 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期二, 04 十一月 2025 14:54:40 +0800
Subject: [PATCH] 字符串转换回数字进行比较,toFixed()方法返回字符串类型
---
pages/wareHouse/nuclearScale/index.vue | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/pages/wareHouse/nuclearScale/index.vue b/pages/wareHouse/nuclearScale/index.vue
index ef48e0d..373b07e 100644
--- a/pages/wareHouse/nuclearScale/index.vue
+++ b/pages/wareHouse/nuclearScale/index.vue
@@ -394,15 +394,15 @@
});
}
// 浣跨敤姝g‘鐨勫瓧娈靛悕suppliedQuantity锛岃�屼笉鏄痸oltage
- const magnetic =
+ const magnetic =(
Number(this.modalList.verificationWeight) -
Number(this.modalList.forkliftWeight) -
- grossWeightSum;
+ grossWeightSum).toFixed(1);
this.form.verificationWeight = this.modalList.verificationWeight;
this.form.forkliftWeight = this.modalList.forkliftWeight;
switch (this.form.productType) {
case "DT01":
- if (magnetic >= -3 && magnetic <= 3) {
+ if (Number(magnetic) >= -3 && Number(magnetic) <= 3) {
let that = this;
uni.showModal({
title: "鎻愮ず",
@@ -416,7 +416,7 @@
}
break;
case "DT02":
- if (magnetic >= -0.5 && magnetic <= 0.5) {
+ if (Number(magnetic) >= -0.5 && Number(magnetic) <= 0.5) {
// this.ScanCodeRecord.push(this.form);
this.allSubmit();
} else {
@@ -484,7 +484,12 @@
.catch(() => {
uni.hideLoading();
this.$refs.saveForm.cancel();
- this.$u.toast("缃戠粶寮傚父锛岃閲嶈瘯");
+ uni.showModal({
+ title: "鎻愮ず",
+ content: err.message || "缃戠粶寮傚父锛岃閲嶈瘯",
+ showCancel: true,
+ success: function (res) {},
+ });
});
},
// 鎻愪氦鎸夐挳
--
Gitblit v1.9.3