From a1131357b9e38c86e734816bae42d2fafcd48222 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 23 三月 2026 11:01:41 +0800
Subject: [PATCH] fix: 客户3.22提出的修改需求

---
 src/pages/consumablesLogistics/stockManagement/add.vue |  119 ++++++++++++-----------------------------------------------
 1 files changed, 25 insertions(+), 94 deletions(-)

diff --git a/src/pages/consumablesLogistics/stockManagement/add.vue b/src/pages/consumablesLogistics/stockManagement/add.vue
index fb36b60..3c1f199 100644
--- a/src/pages/consumablesLogistics/stockManagement/add.vue
+++ b/src/pages/consumablesLogistics/stockManagement/add.vue
@@ -23,36 +23,15 @@
         </view>
       </view>
 
-      <view v-if="isQualified" class="form-section">
-        <view class="section-title">杩囩淇℃伅</view>
+      <view class="form-section">
+        <view class="section-title">鍏ュ簱淇℃伅</view>
         <view class="form-row">
-          <text class="form-label">杞︾墝鍙�</text>
-          <up-input v-model="form.licensePlateNo" placeholder="璇疯緭鍏ヨ溅鐗屽彿" />
+          <text class="form-label required">鏁伴噺</text>
+          <up-input v-model="form.qualitity" type="number" placeholder="璇疯緭鍏ユ暟閲�" />
         </view>
         <view class="form-row">
-          <text class="form-label">姣涢噸(鍚�)</text>
-          <up-input v-model="form.grossWeight" type="number" placeholder="璇疯緭鍏ユ瘺閲�" />
-        </view>
-        <view class="form-row">
-          <text class="form-label">鐨噸(鍚�)</text>
-          <up-input v-model="form.tareWeight" type="number" placeholder="璇疯緭鍏ョ毊閲�" />
-        </view>
-        <view class="form-row">
-          <text class="form-label">鍑�閲�(鍚�)</text>
-          <up-input v-model="form.netWeight" type="number" disabled placeholder="鑷姩璁$畻" />
-        </view>
-        <view class="form-row">
-          <text class="form-label">杩囩鏃ユ湡</text>
-          <view class="selector-trigger" @click="openWeighingDatePicker">
-            <text class="selector-text" :class="{ placeholder: !form.weighingDate }">
-              {{ form.weighingDate || "璇烽�夋嫨杩囩鏃ユ湡" }}
-            </text>
-            <up-icon name="calendar" size="16" color="#999"></up-icon>
-          </view>
-        </view>
-        <view class="form-row">
-          <text class="form-label">杩囩鍛�</text>
-          <up-input v-model="form.weighingOperator" placeholder="璇疯緭鍏ヨ繃纾呭憳" />
+          <text class="form-label required">閲囪喘鍛�</text>
+          <up-input v-model="form.purchaser" placeholder="璇疯緭鍏ラ噰璐憳" />
         </view>
       </view>
 
@@ -74,7 +53,7 @@
           <text class="popup-title">閫夋嫨浜у搧</text>
         </view>
         <view class="popup-search">
-          <up-input v-model="productQuery.productName" placeholder="浜у搧澶х被" clearable />
+          <up-input v-model="productQuery.productName" placeholder="浜у搧澶х被" disabled />
           <up-input v-model="productQuery.model" placeholder="鍨嬪彿鍚嶇О" clearable />
           <view class="popup-search-btn" @click="loadProductList">鎼滅储</view>
         </view>
@@ -96,25 +75,14 @@
       </view>
     </up-popup>
 
-    <up-popup :show="showWeighingDatePicker" mode="bottom" @close="showWeighingDatePicker = false">
-      <up-datetime-picker
-        :show="true"
-        v-model="weighingDateValue"
-        mode="datetime"
-        @confirm="onWeighingDateConfirm"
-        @cancel="showWeighingDatePicker = false"
-      />
-    </up-popup>
   </view>
 </template>
 
 <script setup>
-import { computed, reactive, ref, watch } from "vue";
+import { computed, reactive, ref } from "vue";
 import { onLoad } from "@dcloudio/uni-app";
-import dayjs from "dayjs";
 import PageHeader from "@/components/PageHeader.vue";
 import { createConsumablesIn } from "@/api/consumablesLogistics/consumablesIn.js";
-import { createConsumablesUnInventory } from "@/api/consumablesLogistics/consumablesUninventory.js";
 import { productModelList } from "@/api/basicData/productModel.js";
 
 const form = reactive({
@@ -124,33 +92,24 @@
   productModelName: "",
   unit: "",
   productType: undefined,
-  licensePlateNo: "",
-  grossWeight: "",
-  tareWeight: "",
-  netWeight: "",
-  weighingDate: "",
-  weighingOperator: "",
+  qualitity: "",
+  purchaser: "",
   remark: "",
 });
 
-const type = ref("0");
-const isQualified = computed(() => type.value === "0");
+const type = ref("0"); // 鍥哄畾鍚堟牸搴撳瓨
+const isQualified = computed(() => true);
 
 const showProductPopup = ref(false);
 const productQuery = reactive({
-  productName: "",
+  productName: "鑰楁潗",
   model: "",
 });
 const productList = ref([]);
 const productLoading = ref(false);
 
-const showWeighingDatePicker = ref(false);
-const weighingDateValue = ref(Date.now());
-
 onLoad((options) => {
-  if (options && options.type != null) {
-    type.value = options.type;
-  }
+  type.value = "0";
 });
 
 const openProductSelector = () => {
@@ -187,40 +146,17 @@
   showProductPopup.value = false;
 };
 
-const computeNetWeight = () => {
-  const gross = Number(form.grossWeight);
-  const tare = Number(form.tareWeight);
-  if (!isNaN(gross) && !isNaN(tare)) {
-    const net = Number((gross - tare).toFixed(2));
-    form.netWeight = net > 0 ? net : 0;
-  } else {
-    form.netWeight = "";
-  }
-};
-
-watch(
-  () => [form.grossWeight, form.tareWeight],
-  () => {
-    computeNetWeight();
-  }
-);
-
-const openWeighingDatePicker = () => {
-  weighingDateValue.value = form.weighingDate
-    ? dayjs(form.weighingDate, "YYYY-MM-DD HH:mm:ss").valueOf()
-    : Date.now();
-  showWeighingDatePicker.value = true;
-};
-
-const onWeighingDateConfirm = (e) => {
-  const ts = e?.value ?? weighingDateValue.value;
-  form.weighingDate = dayjs(ts).format("YYYY-MM-DD HH:mm:ss");
-  showWeighingDatePicker.value = false;
-};
-
 const handleSubmit = () => {
   if (!form.productName || !form.productModelId) {
     uni.showToast({ title: "璇烽�夋嫨浜у搧", icon: "none" });
+    return;
+  }
+  if (!form.qualitity || Number(form.qualitity) <= 0) {
+    uni.showToast({ title: "璇疯緭鍏ユ暟閲�", icon: "none" });
+    return;
+  }
+  if (!form.purchaser) {
+    uni.showToast({ title: "璇疯緭鍏ラ噰璐憳", icon: "none" });
     return;
   }
   const payload = {
@@ -230,16 +166,11 @@
     productModelName: form.productModelName,
     unit: form.unit,
     productType: form.productType,
-    licensePlateNo: form.licensePlateNo,
-    grossWeight: form.grossWeight,
-    tareWeight: form.tareWeight,
-    netWeight: form.netWeight,
-    weighingDate: form.weighingDate,
-    weighingOperator: form.weighingOperator,
+    qualitity: Number(form.qualitity),
+    purchaser: form.purchaser,
     remark: form.remark,
   };
-  const api = isQualified.value ? createConsumablesIn : createConsumablesUnInventory;
-  api(payload)
+  createConsumablesIn(payload)
     .then(() => {
       uni.showToast({ title: "鏂板鎴愬姛", icon: "success" });
       setTimeout(() => {

--
Gitblit v1.9.3