From c938e3e5777cfbd02699918a32cd44fa8e97c565 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期一, 23 三月 2026 11:14:46 +0800
Subject: [PATCH] fix: 耗材出库调整
---
src/pages/consumablesLogistics/stockManagement/subtract.vue | 111 ++++---------------------------------------------------
1 files changed, 8 insertions(+), 103 deletions(-)
diff --git a/src/pages/consumablesLogistics/stockManagement/subtract.vue b/src/pages/consumablesLogistics/stockManagement/subtract.vue
index 5e688bf..e32405c 100644
--- a/src/pages/consumablesLogistics/stockManagement/subtract.vue
+++ b/src/pages/consumablesLogistics/stockManagement/subtract.vue
@@ -25,35 +25,6 @@
<text class="form-label required">鍑哄簱鏁伴噺</text>
<up-input v-model="form.stockOutNum" type="number" :placeholder="'鏈�澶�' + stockRecord.unLockedQuantity" />
</view>
- <view class="form-row" v-if="isQualified">
- <text class="form-label">杞︾墝鍙�</text>
- <up-input v-model="form.licensePlateNo" placeholder="璇疯緭鍏ヨ溅鐗屽彿" />
- </view>
- <view class="form-row" v-if="isQualified">
- <text class="form-label">姣涢噸(鍚�)</text>
- <up-input v-model="form.grossWeight" type="number" placeholder="璇疯緭鍏ユ瘺閲�" />
- </view>
- <view class="form-row" v-if="isQualified">
- <text class="form-label">鐨噸(鍚�)</text>
- <up-input v-model="form.tareWeight" type="number" placeholder="璇疯緭鍏ョ毊閲�" />
- </view>
- <view class="form-row" v-if="isQualified">
- <text class="form-label">鍑�閲�(鍚�)</text>
- <up-input v-model="form.netWeight" type="number" disabled placeholder="鑷姩璁$畻" />
- </view>
- <view class="form-row" v-if="isQualified">
- <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" v-if="isQualified">
- <text class="form-label">杩囩鍛�</text>
- <up-input v-model="form.weighingOperator" placeholder="璇疯緭鍏ヨ繃纾呭憳" />
- </view>
<view class="form-row">
<text class="form-label">澶囨敞</text>
<up-input v-model="form.remark" type="textarea" placeholder="閫夊~" />
@@ -64,64 +35,33 @@
<view class="bottom-bar">
<view class="btn-submit" @click="handleSubmit">鎻愪氦</view>
</view>
-
- <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 { subtractConsumablesIn } from "@/api/consumablesLogistics/consumablesIn.js";
-import { subtractConsumablesUnInventory } from "@/api/consumablesLogistics/consumablesUninventory.js";
const type = ref("0");
-const isQualified = computed(() => type.value === "0");
+const isQualified = computed(() => true);
-const stockRecord = reactive({
- id: "",
- productName: "",
- model: "",
- unLockedQuantity: 0,
-});
+const stockRecord = reactive({});
const form = reactive({
stockOutNum: "",
- licensePlateNo: "",
- grossWeight: "",
- tareWeight: "",
- netWeight: "",
- weighingDate: "",
- weighingOperator: "",
remark: "",
});
-const showWeighingDatePicker = ref(false);
-const weighingDateValue = ref(Date.now());
-
onLoad((options) => {
- if (options && options.type != null) {
- type.value = options.type;
- }
+ type.value = "0";
const cached = uni.getStorageSync("stockSubtractRecord");
if (cached) {
try {
const payload = typeof cached === "string" ? JSON.parse(cached) : cached;
const item = payload && payload.item != null ? payload.item : payload;
- stockRecord.id = item.id;
- stockRecord.productName = item.productName;
- stockRecord.model = item.model;
- stockRecord.unLockedQuantity = item.unLockedQuantity || 0;
+ Object.assign(stockRecord, item || {});
uni.removeStorageSync("stockSubtractRecord");
} catch (e) {
uni.removeStorageSync("stockSubtractRecord");
@@ -129,51 +69,16 @@
}
});
-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 = () => {
const outNum = Number(form.stockOutNum);
if (!outNum || outNum <= 0 || outNum > Number(stockRecord.unLockedQuantity)) {
uni.showToast({ title: `璇疯緭鍏� 1~${stockRecord.unLockedQuantity} 涔嬮棿鐨勬暟閲廯, icon: "none" });
return;
}
- const api = isQualified.value ? subtractConsumablesIn : subtractConsumablesUnInventory;
- api({
+ subtractConsumablesIn({
+ ...stockRecord,
id: stockRecord.id,
- stockOutNum: outNum,
- licensePlateNo: form.licensePlateNo,
- grossWeight: form.grossWeight,
- tareWeight: form.tareWeight,
- netWeight: form.netWeight,
- weighingDate: form.weighingDate,
- weighingOperator: form.weighingOperator,
+ qualitity: outNum,
remark: form.remark,
})
.then(() => {
--
Gitblit v1.9.3