From 7609c865e80fea169c5c393c55631628aef2f6ed Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期三, 24 九月 2025 17:15:04 +0800
Subject: [PATCH] 核磅录入创建核磅单的创建逻辑修改/重复扫码相同数据添加多条问题修复

---
 pages/storeManagement/MaterialRequisition/index.vue |   60 +++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/pages/storeManagement/MaterialRequisition/index.vue b/pages/storeManagement/MaterialRequisition/index.vue
index 3e6da75..3473d3e 100644
--- a/pages/storeManagement/MaterialRequisition/index.vue
+++ b/pages/storeManagement/MaterialRequisition/index.vue
@@ -51,7 +51,7 @@
                   <view class="_label-name">鍑�閲嶏細</view>
                 </view>
                 <view class="_content">
-                  {{ item.NW }}
+                  {{ item.KW }}
                 </view>
               </view>
             </view>
@@ -74,9 +74,7 @@
                   <text class="item-one">鎵规鍙凤細</text>
                 </view>
                 <view class="packing-registration-param-item-right">
-                  <text class="item-one item-two">{{
-                    detailedList.BN
-                  }}</text>
+                  <text class="item-one item-two">{{ detailedList.BN }}</text>
                 </view>
               </view>
               <view class="packing-registration-param-item param-extra">
@@ -84,9 +82,7 @@
                   <text class="item-one">鍝佺墝锛�</text>
                 </view>
                 <view class="packing-registration-param-item-right">
-                  <text class="item-one item-two">{{
-                    detailedList.BR
-                  }}</text>
+                  <text class="item-one item-two">{{ detailedList.BR }}</text>
                 </view>
               </view>
               <view class="packing-registration-param-item param-extra">
@@ -94,9 +90,7 @@
                   <text class="item-one">鍑�閲嶏細</text>
                 </view>
                 <view class="packing-registration-param-item-right">
-                  <text class="item-one item-two">{{
-                    detailedList.NW
-                  }}</text>
+                  <text class="item-one item-two">{{ detailedList.KW }}</text>
                 </view>
               </view>
             </view>
@@ -127,7 +121,7 @@
         whiteSpace: "nowrap",
       },
       hasScanSnList: [],
-		showModal: false, // 鎺у埗寮圭獥鏄剧ず闅愯棌鐨勫彉閲�
+      showModal: false, // 鎺у埗寮圭獥鏄剧ず闅愯棌鐨勫彉閲�
       detailedList: {},
     };
   },
@@ -135,9 +129,8 @@
   onShow() {
     let that = this;
     uni.$off("scan"); // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒
-	  uni.$on("scan", function (data) {
-		this.detailedList = {},
-      console.log("onscan");
+    uni.$on("scan", function (data) {
+      (this.detailedList = {}), console.log("onscan");
       //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲�
       console.log("椤甸潰鎵爜缁撴灉锛�", data.code);
       if (data.code) {
@@ -150,23 +143,32 @@
     });
   },
   methods: {
-	    // 鍥炴樉鎵爜鐨勪俊鎭�
+    cancel() {
+      // 澶勭悊鍙栨秷閫昏緫
+      this.showModal = false;
+    },
+    // 鍥炴樉鎵爜鐨勪俊鎭�
     saveForm(val) {
-		this.detailedList = val;
-        this.showModal = true;
-	  },
-	confirm() {
-    //   // 澶勭悊纭閫昏緫
-    //   this.$u.api.materialRequisition
-    //     .materialRequisition({
-    //       ...this.detailedList,
-    //     })
-    //     .then((res) => {
-    //       this.hasScanSnList.push(this.detailedList);
-    //       console.log("璁板綍", this.hasScanSnList);
-    //       this.$u.toast("棰嗘枡鎴愬姛");
-		//     });
+      this.detailedList = val;
+      this.showModal = true;
+    },
+    confirm() {
+      // 澶勭悊纭閫昏緫
+      this.$u.api.materialRequisition
+        .materialRequisition({
+          ...this.detailedList,
+        })
+        .then((res) => {
           this.hasScanSnList.push(this.detailedList);
+          console.log("璁板綍", this.hasScanSnList);
+          this.$u.toast("棰嗘枡鎴愬姛");
+        })
+        .catch((err) => {
+          uni.showToast({
+            title: res.msg || "缃戠粶閿欒锛岄鏂欏け璐�",
+            icon: "none",
+          });
+        });
     },
   },
 };

--
Gitblit v1.9.3