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/inventoryManagement/stockManagement/subtract.vue | 113 ++++++++------------------------------------------------
1 files changed, 17 insertions(+), 96 deletions(-)
diff --git a/src/pages/inventoryManagement/stockManagement/subtract.vue b/src/pages/inventoryManagement/stockManagement/subtract.vue
index d052011..7fb85e1 100644
--- a/src/pages/inventoryManagement/stockManagement/subtract.vue
+++ b/src/pages/inventoryManagement/stockManagement/subtract.vue
@@ -19,48 +19,10 @@
</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="璇疯緭鍏ヨ溅鐗屽彿" />
- </view>
- <view class="form-row">
- <text class="form-label">姣涢噸(鍚�)</text>
- <up-input
- v-model="form.grossWeight"
- type="digit"
- placeholder="璇疯緭鍏ユ瘺閲�"
- />
- </view>
- <view class="form-row">
- <text class="form-label">鐨噸(鍚�)</text>
- <up-input
- v-model="form.tareWeight"
- type="digit"
- placeholder="璇疯緭鍏ョ毊閲�"
- />
- </view>
- <view class="form-row">
- <text class="form-label">鍑�閲�(鍚�)</text>
- <up-input
- v-model="form.netWeight"
- type="digit"
- 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">鍑哄簱鏁伴噺</text>
+ <up-input v-model="form.stockOutNum" type="number" :placeholder="'鏈�澶�' + (form.unLockedQuantity ?? 0)" />
</view>
<view class="form-row">
<text class="form-label">澶囨敞</text>
@@ -72,24 +34,12 @@
<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 { ref, reactive, watch, computed } from 'vue'
+import { ref, reactive, 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'
@@ -113,19 +63,12 @@
createTime: '',
updateTime: '',
version: undefined,
- // 鍑哄簱/杩囩淇℃伅
- licensePlateNo: '',
- grossWeight: '',
- tareWeight: '',
- netWeight: '',
- weighingDate: '',
- weighingOperator: '',
+ // 鍑哄簱淇℃伅
+ stockOutNum: '',
remark: ''
})
const type = ref('0') // 鍥哄畾鍚堟牸搴撳瓨
-const showWeighingDatePicker = ref(false)
-const weighingDateValue = ref(Date.now())
onLoad((options) => {
type.value = '0'
@@ -143,44 +86,22 @@
}
})
-// 鍑�閲� = 姣涢噸 - 鐨噸
-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.id) {
uni.showToast({ title: '璁板綍淇℃伅缂哄け锛屾棤娉曞嚭搴�', icon: 'none' })
return
}
- const payload = { ...form }
+ const outNum = Number(form.stockOutNum)
+ const max = Number(form.unLockedQuantity ?? 0)
+ if (!outNum || outNum <= 0 || outNum > max) {
+ uni.showToast({ title: `璇疯緭鍏� 1~${max} 涔嬮棿鐨勬暟閲廯, icon: 'none' })
+ return
+ }
+ const payload = {
+ id: form.id,
+ stockOutNum: outNum,
+ remark: form.remark
+ }
subtractStockInventory(payload)
.then(() => {
uni.showToast({ title: '鍑哄簱鎴愬姛', icon: 'success' })
--
Gitblit v1.9.3