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 | 101 +++++++++-----------------------------------------
1 files changed, 18 insertions(+), 83 deletions(-)
diff --git a/src/pages/consumablesLogistics/stockManagement/add.vue b/src/pages/consumablesLogistics/stockManagement/add.vue
index 38f9711..3c1f199 100644
--- a/src/pages/consumablesLogistics/stockManagement/add.vue
+++ b/src/pages/consumablesLogistics/stockManagement/add.vue
@@ -24,35 +24,14 @@
</view>
<view class="form-section">
- <view class="section-title">杩囩淇℃伅</view>
+ <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>
@@ -96,22 +75,12 @@
</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 { productModelList } from "@/api/basicData/productModel.js";
@@ -123,12 +92,8 @@
productModelName: "",
unit: "",
productType: undefined,
- licensePlateNo: "",
- grossWeight: "",
- tareWeight: "",
- netWeight: "",
- weighingDate: "",
- weighingOperator: "",
+ qualitity: "",
+ purchaser: "",
remark: "",
});
@@ -142,9 +107,6 @@
});
const productList = ref([]);
const productLoading = ref(false);
-
-const showWeighingDatePicker = ref(false);
-const weighingDateValue = ref(Date.now());
onLoad((options) => {
type.value = "0";
@@ -184,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 = {
@@ -227,12 +166,8 @@
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,
};
createConsumablesIn(payload)
--
Gitblit v1.9.3