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

---
 pages/wareHouse/nuclearScale/createwriteoffform.vue |  153 ++++++++++++++++++++++++++++----------------------
 1 files changed, 85 insertions(+), 68 deletions(-)

diff --git a/pages/wareHouse/nuclearScale/createwriteoffform.vue b/pages/wareHouse/nuclearScale/createwriteoffform.vue
index 29fcb08..c76cee3 100644
--- a/pages/wareHouse/nuclearScale/createwriteoffform.vue
+++ b/pages/wareHouse/nuclearScale/createwriteoffform.vue
@@ -35,7 +35,7 @@
           <u-radio name="DT02">瀵间綋2.6</u-radio>
         </u-radio-group>
       </u-form-item>
-      <u-form-item
+      <!-- <u-form-item
         label="鏇挎崲浜岀淮鐮侊細"
         :border-bottom="false"
         prop="replace"
@@ -45,7 +45,7 @@
           <u-radio name="1">鏄�</u-radio>
           <u-radio name="0">鍚�</u-radio>
         </u-radio-group>
-      </u-form-item>
+      </u-form-item> -->
       <u-form-item
         label="杞︾墝鍙凤細"
         :border-bottom="false"
@@ -98,7 +98,7 @@
         :border-bottom="false"
         prop="shippingNoticeNo1"
         style="font-size: small"
-		:label-width="245"
+        :label-width="245"
       >
         <u-input v-model="form.shippingNoticeNo1" placeholder="" disabled />
       </u-form-item>
@@ -141,7 +141,7 @@
         :border-bottom="false"
         prop="shippingNoticeNo2"
         style="font-size: small"
-		:label-width="245"
+        :label-width="245"
       >
         <u-input v-model="form.shippingNoticeNo2" placeholder="" disabled />
       </u-form-item>
@@ -247,22 +247,25 @@
       @confirm="confirmSelection"
       @cancel="cancel"
     >
-    <scroll-view scroll-y="true" style="height: 100%; transform: translateZ(0); -webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;"></scroll-view>
-      <view class="popup-content">
-        <view class="popup-header">
-          <checkbox-group @change="checkboxChange">
-            <label
-              class="checkbox-item"
-              v-for="(item, index) in checkboxList"
-              :key="index"
-            >
-              <checkbox :value="item.value" :checked="item.checked" />
-              <text class="label">{{ item.label }}</text>
-            </label>
-          </checkbox-group>
-        </view>
+      <view class="popup-content" style="padding: 20rpx">
+        <scroll-view
+          scroll-y="true"
+          style="height: 400rpx; transform: translateZ(0)"
+        >
+          <view class="popup-header">
+            <checkbox-group @change="checkboxChange">
+              <label
+                class="checkbox-item"
+                v-for="(item, index) in checkboxList"
+                :key="index"
+              >
+                <checkbox :value="item.value" :checked="item.checked" />
+                <text class="label">{{ item.label }}</text>
+              </label>
+            </checkbox-group>
+          </view>
+        </scroll-view>
       </view>
-    <scroll-view/>
     </u-modal>
   </div>
 </template>
@@ -286,7 +289,7 @@
       show: false,
       num: 1,
       form: {
-        replace: "0",
+        // replace: "0",
         productType: "",
         licensePlate: "",
         customerName1: "",
@@ -305,13 +308,13 @@
             trigger: ["change"],
           },
         ],
-        replace: [
-          {
-            required: true,
-            message: "璇烽�夋嫨鏄惁鏇挎崲浜岀淮鐮�",
-            trigger: ["change", "blur"],
-          },
-        ],
+        // replace: [
+        //   {
+        //     required: true,
+        //     message: "璇烽�夋嫨鏄惁鏇挎崲浜岀淮鐮�",
+        //     trigger: ["change", "blur"],
+        //   },
+        // ],
         licensePlate: [
           {
             required: true,
@@ -378,7 +381,7 @@
   onShow() {
     // 閲嶇疆琛ㄥ崟鏁版嵁
     this.form = {
-      replace: "0",
+      // replace: "0",
       productType: "",
       licensePlate: "",
       customerName1: "",
@@ -564,32 +567,34 @@
       const selectedIndex = e.target.value;
       const selectedCustomer = storage[selectedIndex];
 
-      // 妫�鏌ユ槸鍚﹂�夋嫨浜嗙浉鍚岀殑瀹㈡埛
-      if (code === "customerName1" && this.selClientIndex2 === selectedIndex) {
-        uni.showToast({
-          title: "涓嶈兘閫夋嫨鐩稿悓鐨勫鎴�",
-          icon: "none",
-        });
-        return;
-      }
-      if (code === "customerName2" && this.selClientIndex1 === selectedIndex) {
-        uni.showToast({
-          title: "涓嶈兘閫夋嫨鐩稿悓鐨勫鎴�",
-          icon: "none",
-        });
-        return;
-      }
+      // // 妫�鏌ユ槸鍚﹂�夋嫨浜嗙浉鍚岀殑瀹㈡埛
+      // if (code === "customerName1" && this.selClientIndex2 === selectedIndex) {
+      //   uni.showToast({
+      //     title: "涓嶈兘閫夋嫨鐩稿悓鐨勫鎴�",
+      //     icon: "none",
+      //   });
+      //   return;
+      // }
+      // if (code === "customerName2" && this.selClientIndex1 === selectedIndex) {
+      //   uni.showToast({
+      //     title: "涓嶈兘閫夋嫨鐩稿悓鐨勫鎴�",
+      //     icon: "none",
+      //   });
+      //   return;
+      // }
 
       if (code === "customerName2") {
         this.selClientIndex2 = selectedIndex;
         this.form.customerName2 = selectedCustomer.label;
         this.form.shippingNoticeNo2 = selectedCustomer.shippingNoticeNo;
+        this.form.customerNo2 = selectedCustomer.customerNo;
         this.id2 = selectedCustomer.id;
       }
       if (code === "customerName1") {
         this.selClientIndex1 = selectedIndex;
         this.form.customerName1 = selectedCustomer.label;
         this.form.shippingNoticeNo1 = selectedCustomer.shippingNoticeNo;
+        this.form.customerNo1 = selectedCustomer.customerNo;
         this.id1 = selectedCustomer.id;
       }
     },
@@ -658,9 +663,21 @@
       try {
         // 缁熶竴琛ㄥ崟楠岃瘉
         if (!(await this.validateForm())) return;
-
         // 鏋勫缓鎻愪氦鏁版嵁
-        const submitData = this.buildSubmitData().customerList;
+        //  const submitData = this.buildSubmitData().customerList;
+        const submitData = {
+        customerName1: this.form.customerName1,
+        shippingNoticeNo1: this.form.shippingNoticeNo1,
+        customerName2: this.form.customerName2,
+        shippingNoticeNo2: this.form.shippingNoticeNo2,
+        customerNo1: this.form.customerNo1,
+        customerNo2: this.form.customerNo2,
+        productType: this.form.productType,
+        licensePlate: this.form.licensePlate,
+        workshop: this.form.workshop,
+        weighingOperator: this.form.weighingOperator,
+        forkliftOperator: this.form.forkliftOperator,
+      }
         console.log("鎻愪氦鐨勬暟鎹�", submitData);
         this.isSubmitting = true;
         const res = await this.$u.api.NuclearScaleEntry.createMain(submitData);
@@ -705,36 +722,36 @@
         return false;
       }
 
-      // 瀹㈡埛鍚嶇О楠岃瘉
-      if (!this.form.customerName1 || !this.form.customerName2) {
-        throw { type: "validation", message: "璇峰厛閫夋嫨瀹㈡埛鍚嶇О" };
+      // 瀹㈡埛鍚嶇О楠岃瘉 - 淇敼涓鸿嚦灏戞湁涓�涓湁鍊�
+      if (!this.form.customerName1 && !this.form.customerName2) {
+        throw { type: "validation", message: "璇疯嚦灏戦�夋嫨涓�涓鎴峰悕绉�" };
       }
 
       return true;
     },
 
-    // 鏋勫缓鎻愪氦鏁版嵁
-    buildSubmitData() {
-      // 鍒涘缓瀹㈡埛鏁版嵁鐨勮緟鍔╁嚱鏁�
-      const createCustomerItem = (customerIndex) => ({
-        customerName: this.form[`customerName${customerIndex}`],
-        shippingNoticeNo: this.form[`shippingNoticeNo${customerIndex}`],
-        shippingNoticeId: this[`id${customerIndex}`],
-        replace: this.form.replace,
-        productType: this.form.productType,
-        licensePlate: this.form.licensePlate,
-        workshop: this.form.workshop,
-        weighingOperator: this.form.weighingOperator,
-        forkliftOperator: this.form.forkliftOperator,
-      });
+    // // 鏋勫缓鎻愪氦鏁版嵁
+    // buildSubmitData() {
+    //   // 鍒涘缓瀹㈡埛鏁版嵁鐨勮緟鍔╁嚱鏁�
+    //   const createCustomerItem = (customerIndex) => ({
+    //     customerName: this.form[`customerName${customerIndex}`],
+    //     shippingNoticeNo: this.form[`shippingNoticeNo${customerIndex}`],
+    //     shippingNoticeId: this[`id${customerIndex}`],
+    //     replace: this.form.replace,
+    //     productType: this.form.productType,
+    //     licensePlate: this.form.licensePlate,
+    //     workshop: this.form.workshop,
+    //     weighingOperator: this.form.weighingOperator,
+    //     forkliftOperator: this.form.forkliftOperator,
+    //   });
 
-      // 鏋勫缓瀹㈡埛鍒楄〃
-      const customerList = [1, 2].map(createCustomerItem);
+    //   // 鏋勫缓瀹㈡埛鍒楄〃
+    //   const customerList = [1, 2].map(createCustomerItem);
 
-      return {
-        customerList,
-      };
-    },
+    //   return {
+    //     customerList,
+    //   };
+    // },
   },
 };
 </script>

--
Gitblit v1.9.3