kyy
2025-10-11 802b712e16c5f6a8ed50807b625b74d519ebc0de
1、采购验退新增克重
已修改2个文件
99 ■■■■■ 文件已修改
H5/Js/PurchaseInventoryReturn.js 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
H5/PurchaseInventoryReturn.aspx 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
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">
@@ -55,6 +71,18 @@
  label="仓库编码"
  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"
@@ -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="物料编码"