fix:待入库>0时可切换货位但不可切换仓库

This commit is contained in:
ShenQiLun 2026-06-29 11:15:12 +08:00
parent c3b3a83716
commit 42f445b44f

View File

@ -796,8 +796,8 @@
class="wh-tab" class="wh-tab"
v-for="(w, idx) in popupWarehouseList" v-for="(w, idx) in popupWarehouseList"
:key="w.id" :key="w.id"
:class="{ active: popupActiveWhIndex === idx }" :class="{ active: popupActiveWhIndex === idx, locked: warehouseLocked }"
@click="selectPopupWarehouse(idx)" @click="warehouseLocked ? null : selectPopupWarehouse(idx)"
> >
<text class="wh-tab-text">{{ w.name }}</text> <text class="wh-tab-text">{{ w.name }}</text>
</view> </view>
@ -1014,6 +1014,7 @@ export default {
popupRefreshing: false, popupRefreshing: false,
_pendingPreselectWh: null, _pendingPreselectWh: null,
_pendingPreselectLoc: null, _pendingPreselectLoc: null,
_warehouseLocked: false,
// //
showScanPopup: false, showScanPopup: false,
@ -1098,6 +1099,9 @@ export default {
}, },
computed: { computed: {
warehouseLocked() {
return !!(this._warehouseLocked)
},
conditionValue() { conditionValue() {
const map = { const map = {
'全新': '100~', '全新': '100~',
@ -1521,11 +1525,15 @@ export default {
// //
openWarehousePicker(tab) { openWarehousePicker(tab) {
if (this.pendingCount > 0) { if (this.pendingCount > 0) {
uni.showToast({ title: '已有待入库商品,请先提交入库再切换仓库', icon: 'none' }) //
return this.pickerTargetTab = tab
this.showWarehousePicker = true
this._warehouseLocked = true
} else {
this.pickerTargetTab = tab
this.showWarehousePicker = true
this._warehouseLocked = false
} }
this.pickerTargetTab = tab
this.showWarehousePicker = true
const savedData = tab === 'isbn' ? this.isbnWarehouseData : this.noIsbnWarehouseData const savedData = tab === 'isbn' ? this.isbnWarehouseData : this.noIsbnWarehouseData
this._pendingPreselectWh = savedData ? savedData.warehouseId : null this._pendingPreselectWh = savedData ? savedData.warehouseId : null
this._pendingPreselectLoc = savedData ? savedData.locationId : null this._pendingPreselectLoc = savedData ? savedData.locationId : null
@ -1685,21 +1693,36 @@ export default {
confirmWarehousePicker() { confirmWarehousePicker() {
if (!this.popupSelectedLoc) return if (!this.popupSelectedLoc) return
const wh = this.popupWarehouseList[this.popupActiveWhIndex] const wh = this.popupWarehouseList[this.popupActiveWhIndex]
const whData = { var whData
warehouseId: wh.id, if (this._warehouseLocked) {
warehouseName: wh.name, //
warehouseCode: wh.code, var oldData = this.pickerTargetTab === 'isbn' ? this.isbnWarehouseData : this.noIsbnWarehouseData
locationId: this.popupSelectedLoc.id, whData = {
locationCode: this.popupSelectedLoc.code, warehouseId: oldData ? oldData.warehouseId : wh.id,
locationName: this.popupSelectedLoc.name warehouseName: oldData ? oldData.warehouseName : wh.name,
warehouseCode: oldData ? oldData.warehouseCode : wh.code,
locationId: this.popupSelectedLoc.id,
locationCode: this.popupSelectedLoc.code,
locationName: this.popupSelectedLoc.name
}
} else {
whData = {
warehouseId: wh.id,
warehouseName: wh.name,
warehouseCode: wh.code,
locationId: this.popupSelectedLoc.id,
locationCode: this.popupSelectedLoc.code,
locationName: this.popupSelectedLoc.name
}
} }
const areaText = `${wh.name} - ${this.popupSelectedLoc.code}` const areaText = `${whData.warehouseName} - ${this.popupSelectedLoc.code}`
// ISBN ISBN // ISBN ISBN
this.isbnWarehouseData = whData this.isbnWarehouseData = JSON.parse(JSON.stringify(whData))
this.isbnSelectedArea = areaText this.isbnSelectedArea = areaText
this.noIsbnWarehouseData = whData this.noIsbnWarehouseData = JSON.parse(JSON.stringify(whData))
this.noIsbnSelectedArea = areaText this.noIsbnSelectedArea = areaText
this.showWarehousePicker = false this.showWarehousePicker = false
this._warehouseLocked = false
}, },
// //
@ -4704,6 +4727,11 @@ picker {
font-weight: 600; font-weight: 600;
} }
.wh-tab.locked {
opacity: 0.5;
pointer-events: none;
}
/* ========== 仓库货位搜索栏 ========== */ /* ========== 仓库货位搜索栏 ========== */
.wh-search-bar { .wh-search-bar {
display: flex; display: flex;