From 3ea1ff641e1c680a5a1727fb4034797bfe65d93e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 18 三月 2026 15:29:17 +0800
Subject: [PATCH] fix: 质量、耗材物流
---
src/pages/inventoryManagement/stockManagement/subtract.vue | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/pages/inventoryManagement/stockManagement/subtract.vue b/src/pages/inventoryManagement/stockManagement/subtract.vue
index 4970275..2452e04 100644
--- a/src/pages/inventoryManagement/stockManagement/subtract.vue
+++ b/src/pages/inventoryManagement/stockManagement/subtract.vue
@@ -87,12 +87,11 @@
</template>
<script setup>
-import { ref, reactive, watch } from 'vue'
+import { ref, reactive, watch, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import dayjs from 'dayjs'
import PageHeader from '@/components/PageHeader.vue'
import { subtractStockInventory } from '@/api/inventoryManagement/stockInventory.js'
-import { subtractStockUnInventory } from '@/api/inventoryManagement/stockUninventory.js'
const form = reactive({
id: undefined,
@@ -124,14 +123,18 @@
remark: ''
})
-const type = ref('0') // 0 鍚堟牸搴撳瓨锛�1 涓嶅悎鏍煎簱瀛�
+const type = ref('0') // 鍥哄畾鍚堟牸搴撳瓨
const showWeighingDatePicker = ref(false)
const weighingDateValue = ref(Date.now())
+const maxAllowedNetWeight = computed(() => {
+ const v = form.unLockedQuantity ?? form.qualitity
+ const n = Number(v)
+ return !isNaN(n) ? n : 0
+})
+
onLoad((options) => {
- if (options && options.type != null) {
- type.value = options.type
- }
+ type.value = '0'
const cached = uni.getStorageSync('stockSubtractRecord')
if (cached) {
try {
@@ -183,9 +186,13 @@
uni.showToast({ title: '璁板綍淇℃伅缂哄け锛屾棤娉曞嚭搴�', icon: 'none' })
return
}
+ const net = Number(form.netWeight)
+ if (!isNaN(net) && net > 0 && maxAllowedNetWeight.value > 0 && net > maxAllowedNetWeight.value) {
+ uni.showToast({ title: `鍑�閲嶄笉鑳藉ぇ浜庡彲鐢ㄥ簱瀛� ${maxAllowedNetWeight.value}`, icon: 'none' })
+ return
+ }
const payload = { ...form }
- const api = type.value === '0' ? subtractStockInventory : subtractStockUnInventory
- api(payload)
+ subtractStockInventory(payload)
.then(() => {
uni.showToast({ title: '鍑哄簱鎴愬姛', icon: 'success' })
setTimeout(() => {
--
Gitblit v1.9.3