From 802b712e16c5f6a8ed50807b625b74d519ebc0de Mon Sep 17 00:00:00 2001
From: kyy <3283105747@qq.com>
Date: 星期六, 11 十月 2025 11:44:13 +0800
Subject: [PATCH] 1、采购验退新增克重
---
H5/Js/PurchaseInventoryReturn.js | 72 +++++++++++++++++++++++++++++++++++-
H5/PurchaseInventoryReturn.aspx | 31 +++++++++++++++
2 files changed, 100 insertions(+), 3 deletions(-)
diff --git a/H5/Js/PurchaseInventoryReturn.js b/H5/Js/PurchaseInventoryReturn.js
index 35c0cd0..5cf874c 100644
--- a/H5/Js/PurchaseInventoryReturn.js
+++ b/H5/Js/PurchaseInventoryReturn.js
@@ -11,6 +11,7 @@
sectionCode: "",
barcode: "",
itemNo: "",
+ weight: "",
sumQuantity:0,
barcodeQuantity: 0,
returnBarcode: "",
@@ -48,6 +49,37 @@
};
},
methods: {
+ handleWeightInput(value) {
+ const source = value === undefined || value === null ? "" : String(value);
+ let sanitized = source.replace(/[^0-9.]/g, "");
+ const dotIndex = sanitized.indexOf(".");
+ if (dotIndex !== -1) {
+ const before = sanitized.slice(0, dotIndex + 1);
+ const after = sanitized.slice(dotIndex + 1).replace(/\./g, "");
+ sanitized = before + after;
+ }
+ if (sanitized.startsWith(".")) {
+ sanitized = "0" + sanitized;
+ }
+ if (sanitized === "") {
+ this.formData.weight = "";
+ return;
+ }
+ this.formData.weight = sanitized;
+ },
+ handleWeightBlur() {
+ if (this.formData.weight === "") {
+ return;
+ }
+ const numeric = Number(this.formData.weight);
+ if (isNaN(numeric) || numeric <= 0) {
+ this.formData.weight = "";
+ this.$toast.fail("鍏嬮噸闇�涓哄ぇ浜�0鐨勬暟瀛�");
+ this.$playSound('error');
+ } else {
+ this.formData.weight = numeric.toString();
+ }
+ },
getModel() {
var that = this;
that.isLoading = true;
@@ -92,11 +124,29 @@
return;
}
+ if (that.formData.weight !== "" && that.formData.weight !== null && that.formData.weight !== undefined) {
+ var weightValue = Number(that.formData.weight);
+ if (isNaN(weightValue) || weightValue <= 0) {
+ that.formData.weight = "";
+ that.$toast.fail("鍏嬮噸闇�涓哄ぇ浜�0鐨勬暟瀛�");
+ that.$playSound('error');
+ that.$nextTick(() => {
+ if (that.$refs.weight && that.$refs.weight.focus) {
+ that.$refs.weight.focus();
+ }
+ });
+ return;
+ }
+ that.formData.weight = weightValue.toString();
+ } else {
+ that.formData.weight = "";
+ }
that.isLoading = true;
that.AxiosHttp("post", 'MesInvItemInCDetails/SaveBarCodes', {
sectionCode: that.sectionCode,
userName: that.userInfo.loginAccount,
barcode: that.formData.barcode,
+ weight: that.formData.weight ? Number(that.formData.weight) : null
}, false)
.then(function (res) {
var json = res;
@@ -194,6 +244,23 @@
that.$playSound('error');
return;
}
+ if (that.formData.weight !== "" && that.formData.weight !== null && that.formData.weight !== undefined) {
+ var weightValue = Number(that.formData.weight);
+ if (isNaN(weightValue) || weightValue <= 0) {
+ that.formData.weight = "";
+ that.$toast.fail("鍏嬮噸闇�涓哄ぇ浜�0鐨勬暟瀛�");
+ that.$playSound('error');
+ that.$nextTick(() => {
+ if (that.$refs.weight && that.$refs.weight.focus) {
+ that.$refs.weight.focus();
+ }
+ });
+ return;
+ }
+ that.formData.weight = weightValue.toString();
+ } else {
+ that.formData.weight = "";
+ }
if (that.sectionCode.length * 1 <= 0) {
that.$toast.fail("搴撲綅缂栫爜涓嶈兘涓虹┖锛�");
@@ -206,7 +273,8 @@
sectionCode: that.sectionCode,
userName: that.userInfo.loginAccount,
returnBarcode: that.formData.returnBarcode,
- returnQuantity: that.formData.returnQuantity
+ returnQuantity: that.formData.returnQuantity,
+ weight: that.formData.weight ? Number(that.formData.weight) : null
}, false)
.then(function (res) {
var json = res;
@@ -390,4 +458,4 @@
});
},
}
-})
\ No newline at end of file
+})
diff --git a/H5/PurchaseInventoryReturn.aspx b/H5/PurchaseInventoryReturn.aspx
index 8466328..6d4b208 100644
--- a/H5/PurchaseInventoryReturn.aspx
+++ b/H5/PurchaseInventoryReturn.aspx
@@ -21,6 +21,22 @@
border: none !important;
box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3) !important;
}
+ .weight-field {
+ background: linear-gradient(135deg, rgba(15, 157, 88, 0.12), rgba(15, 157, 88, 0.02));
+ border-left: 4px solid #0f9d58;
+ border-radius: 8px;
+ box-shadow: 0 2px 12px rgba(15, 157, 88, 0.18);
+ margin-bottom: 12px;
+ }
+ .weight-field .van-field__label,
+ .weight-field .van-field__control {
+ color: #0f9d58 !important;
+ font-weight: 600;
+ }
+ .weight-field input {
+ color: #0b7a45 !important;
+ font-weight: 600;
+ }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
@@ -56,6 +72,18 @@
placeholder=""
disabled
></van-field>
+ <van-field
+ ref="weight"
+ v-model="formData.weight"
+ label="鍏嬮噸"
+ clearable
+ placeholder="璇疯緭鍏ュ厠閲�"
+ type="text"
+ inputmode="decimal"
+ class="weight-field"
+ @input="handleWeightInput"
+ @blur="handleWeightBlur"
+ ></van-field>
<van-field
ref="barcode"
v-model="formData.barcode"
@@ -93,6 +121,7 @@
<van-button type="primary" size="small" @click="confirmReturn" class="return-button">鈿狅笍 楠岄��</van-button>
</van-col>
</van-row>
+
<van-field
v-model="formData.itemNo"
label="鐗╂枡缂栫爜"
@@ -179,7 +208,7 @@
</van-row>
</van-tab>
<%--<van-tab title="鏀舵枡鍘熷崟" class="mySolid font">
- <van-field
+ <van-field
v-model="itemInsFormData.billNo"
label="鍏ュ簱鍗曞彿"
placeholder="鍏ュ簱鍗曞彿"
--
Gitblit v1.9.3