WMS_PDA/pages/work/storage/random-storage-shelf.vue

2339 lines
62 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="random-storage-page">
<view class="normar_container">
<page-nav title="上架作业" :showBack="true" @back="handleBack">
<template #right>
<view class="nav-more-btn" @click="openActionDrawer">
<u-icon name="more-dot-fill" size="40rpx" color="#303133"></u-icon>
</view>
</template>
</page-nav>
<view v-if="!hasInboundOrder" class="empty-wrap">
<view class="search-filter">
<view class="search-row">
<u-search
v-model="searchKeyword"
placeholder="扫描/输入入库单号"
shape="round"
:show-action="false"
:clearabled="true"
@search="handleSearchInboundOrder"
@clear="searchKeyword = ''"
></u-search>
<view class="search-scan-btn" @click="handleScanInboundOrder">
<u-icon name="scan" size="34rpx" color="#2979ff"></u-icon>
</view>
</view>
</view>
<view class="empty-card">
<u-icon name="scan" size="72rpx" color="#c0c4cc"></u-icon>
<text class="empty-title">开始上架</text>
<text class="empty-desc">扫描或输入入库单号开始上架</text>
</view>
</view>
<view v-else class="content-split">
<view class="summary-bar">
<view class="summary-bar__item">
<text class="summary-bar__item-num summary-bar__item-num--received">{{ selectedStock ? (selectedStock.received_qty || 0) : 0 }}</text>
<text class="summary-bar__item-label">已入</text>
</view>
<view class="summary-bar__item">
<text class="summary-bar__item-num summary-bar__item-num--total">{{ selectedStock ? (selectedStock.plan_qty || 0) : 0 }}</text>
<text class="summary-bar__item-label">总数</text>
</view>
</view>
<view class="detail-scan-panel">
<view class="detail-scan-panel__row">
<u-search
v-model="detailScanKeyword"
placeholder="扫描/输入商品条码、箱唛、托盘唛"
shape="round"
:show-action="false"
:clearabled="true"
@search="handleScanDetailQuery"
@clear="detailScanKeyword = ''"
></u-search>
<view class="detail-scan-panel__scan-btn" @click="handleScanDetailWithCamera">
<u-icon name="scan" size="34rpx" color="#2979ff"></u-icon>
</view>
</view>
</view>
<scroll-view class="content-top" scroll-y>
<view class="product-detail-area">
<view class="product-detail">
<view class="product-image-wrap" @click="previewImages">
<image
v-if="selectedStock && selectedStock.image_url"
class="product-image"
:src="selectedStock.image_url"
mode="aspectFit"
></image>
<view v-else class="product-image-placeholder">
<u-icon name="bag" size="96rpx" color="#c0c4cc"></u-icon>
<text class="product-image-text">{{ selectedStock ? selectedStock.item_name : '暂无图片' }}</text>
</view>
<view v-if="selectedStock && selectedStock.image_urls && selectedStock.image_urls.length > 1" class="image-count-badge">
<text class="image-count-text">{{ selectedStock.image_urls.length }}张</text>
</view>
</view>
<view class="product-info">
<text class="product-name">{{ selectedStock ? selectedStock.item_name : '--' }}</text>
<view class="product-info-row">
<text class="product-info-label">规格:</text>
<text class="product-info-value">{{ (selectedStock && selectedStock.spec) || '--' }}</text>
</view>
<view class="product-info-row">
<text class="product-info-label">条码:</text>
<text class="product-info-value">{{ selectedStock ? selectedStock.barcode : '--' }}</text>
</view>
<view class="product-info-row product-info-row-qty">
<text class="product-info-label">已入/总数:</text>
<text class="product-info-value product-info-value-qty">{{ selectedStock ? (selectedStock.received_qty || 0) : 0 }} / {{ selectedStock ? (selectedStock.plan_qty || 0) : 0 }}</text>
</view>
</view>
</view>
</view>
<view class="order-info-area">
<view class="order-info-row">
<view class="order-info-col order-info-col--left">
<view class="order-info-col__item order-info-col__item--blue">
<text class="order-info-label">入库编号</text>
</view>
<view class="order-info-col__item order-info-col__item--blue">
<text class="order-info-label">货主</text>
</view>
</view>
<view class="order-info-col order-info-col--middle">
<view class="order-info-col__item order-info-col__item--white">
<text class="order-info-value order-info-value--center" @click="copyInboundNo">{{ inboundOrderNo || '--' }}</text>
</view>
<view class="order-info-col__item order-info-col__item--white">
<text class="order-info-value order-info-value--center">{{ (selectedStock && selectedStock.owner) || entryOrderStoreRemask || '--' }}</text>
</view>
</view>
<view class="order-info-col order-info-col--right">
<view class="order-info-col__item order-info-col__item--blue">
<view class="shelf-btn" @click="showProgressDrawer = true">
<text class="shelf-btn__text">入库进度</text>
</view>
</view>
<view class="order-info-col__item order-info-col__item--green">
<view class="shelf-btn shelf-btn--green" @click="openContainerDrawer">
<text class="shelf-btn__text">容器列表</text>
</view>
</view>
</view>
</view>
</view>
</scroll-view>
<view class="content-bottom">
<view class="index-grid">
<view
v-for="(item, idx) in inboundItems"
:key="item.id"
class="index-cell"
:class="{ 'index-cell--active': idx === currentItemIndex, 'index-cell--picked': isItemComplete(item) }"
@click="selectInboundItem(idx)"
>
<text class="index-text">{{ idx + 1 }}</text>
<text class="index-sub">{{ item.planQty || 0 }}</text>
</view>
</view>
<view class="safe-bottom"></view>
</view>
</view>
</view>
<u-loading-page :loading="loading" bg-color="rgba(255,255,255,0.9)"></u-loading-page>
<!-- 详情抽屉(单条结果直接弹出) -->
<view v-if="showDetailDrawer" class="shelf-overlay" @click="closeDetailDrawer">
<view class="detail-drawer" @click.stop>
<view class="detail-drawer__header">
<text class="detail-drawer__title">明细信息</text>
<text class="detail-drawer__product-name">{{ selectedDetail ? selectedDetail.product_name : '--' }}</text>
</view>
<view class="detail-drawer__body">
<view class="detail-row">
<text class="detail-row__label">明细ID</text>
<text class="detail-row__value">{{ selectedDetail ? selectedDetail.detail_id : '--' }}</text>
</view>
<view class="detail-row">
<text class="detail-row__label">实收数量</text>
<text class="detail-row__value detail-row__value--highlight">{{ selectedDetail ? selectedDetail.actual_quantity : 0 }}</text>
</view>
<view class="detail-row">
<text class="detail-row__label">商品条码</text>
<text class="detail-row__value">{{ selectedDetail ? selectedDetail.barcode : '--' }}</text>
</view>
<!-- 库位搜索 -->
<view class="detail-row detail-row--space">
<text class="detail-row__label">上架库位</text>
<input
class="detail-row__input"
v-model="detailSpaceKeyword"
placeholder="扫码/输入 库位条码"
placeholder-style="color: #c0c4cc; font-size: 28rpx;"
@confirm="handleDetailSpaceSearch"
@click="setActiveScanField('space')"
/>
<view class="detail-row__scan-btn" @click="handleDetailSpaceScan">
<u-icon name="scan" size="34rpx" color="#2979ff"></u-icon>
</view>
</view>
<!-- 库位搜索结果列表 -->
<view v-if="detailSpaceList.length > 0" class="detail-space-list">
<view
v-for="spaceItem in detailSpaceList"
:key="spaceItem.id"
class="detail-space-item"
:class="{ 'detail-space-item--active': detailSpaceSelectedId === spaceItem.id }"
@click="selectDetailSpace(spaceItem)"
>
<text class="detail-space-item__code">{{ spaceItem.space_code || spaceItem.custom_barcode || spaceItem.id }}</text>
<text v-if="spaceItem.custom_name" class="detail-space-item__name">{{ spaceItem.custom_name }}</text>
</view>
</view>
<!-- 库位识别结果 -->
<view v-if="detailSpaceItem" class="detail-space-result">
<text class="detail-space-result__label">识别结果</text>
<view class="detail-space-result__card">
<text class="detail-space-result__code">{{ detailSpaceItem.space_code || detailSpaceItem.custom_barcode || detailSpaceItem.id }}</text>
<text v-if="detailSpaceItem.custom_name" class="detail-space-result__name">{{ detailSpaceItem.custom_name }}</text>
<text v-if="detailSpaceItem.custom_barcode" class="detail-space-result__barcode">条码:{{ detailSpaceItem.custom_barcode }}</text>
</view>
</view>
</view>
<view class="detail-drawer__footer">
<view class="detail-btn-save" @click="handleDetailSave">
<text class="detail-btn-save__text">保存</text>
</view>
<view class="detail-btn-cancel" @click="closeDetailDrawer">
<text class="detail-btn-cancel__text">关闭</text>
</view>
</view>
</view>
</view>
<!-- 容器列表 -->
<u-popup :show="showContainerDrawer" mode="bottom" border-radius="20" @close="closeContainerDrawer">
<view class="container-drawer">
<view class="container-drawer__header">
<text class="container-drawer__title">容器列表</text>
<text v-if="containerList.length" class="container-drawer__sub">共 {{ containerTotal }} 条</text>
</view>
<scroll-view class="container-drawer__body" scroll-y style="max-height: 520rpx;">
<view v-if="containerLoading" class="container-drawer__empty">
<text>加载中...</text>
</view>
<view v-else-if="containerList.length === 0" class="container-drawer__empty">
<text>暂无可用容器</text>
</view>
<view
v-else
v-for="container in containerList"
:key="container.detail_id"
class="scan-detail-select__item"
@click="openDetailDrawer(container)"
>
<view class="scan-detail-select__item-row">
<text class="scan-detail-select__item-label">商品:</text>
<text class="scan-detail-select__item-value">{{ container.product_name || '--' }}</text>
</view>
<view class="scan-detail-select__item-row">
<text class="scan-detail-select__item-label">实收数:</text>
<text class="scan-detail-select__item-value">{{ container.actual_quantity || 0 }}</text>
</view>
<view class="scan-detail-select__item-row">
<text class="scan-detail-select__item-label">明细ID:</text>
<text class="scan-detail-select__item-value">{{ container.detail_id || '--' }}</text>
</view>
</view>
</scroll-view>
<view class="container-drawer__footer">
<view class="container-drawer__close-btn" @click="closeContainerDrawer">
<text class="container-drawer__close-text">关闭</text>
</view>
</view>
</view>
</u-popup>
<!-- 入库进度 -->
<u-popup :show="showProgressDrawer" mode="bottom" border-radius="20" @close="showProgressDrawer = false">
<view class="container-drawer">
<view class="container-drawer__header">
<text class="container-drawer__title">入库进度</text>
<text class="container-drawer__sub" v-if="currentBindings.length">共 {{ currentBindings.length }} 条</text>
</view>
<scroll-view class="container-drawer__body" scroll-y style="max-height: 520rpx;">
<view v-if="currentBindings.length === 0" class="container-drawer__empty">
<text>暂无入库记录</text>
</view>
<view
v-else
v-for="binding in currentBindings"
:key="binding.binding_id || binding.detail_id"
class="scan-detail-select__item"
>
<view class="scan-detail-select__item-row">
<text class="scan-detail-select__item-label">编码</text>
<text class="scan-detail-select__item-value">{{ binding.detail_id || '--' }}</text>
</view>
<view class="scan-detail-select__item-row">
<text class="scan-detail-select__item-label">库位</text>
<text class="scan-detail-select__item-value" style="color: #2979ff; font-weight: 600;">{{ binding.space_name || '--' }}</text>
<text class="scan-detail-select__item-label">数量</text>
<text class="scan-detail-select__item-value">{{ binding.allocated_quantity || 0 }}</text>
</view>
</view>
</scroll-view>
<view class="container-drawer__footer">
<view class="container-drawer__close-btn" @click="showProgressDrawer = false">
<text class="container-drawer__close-text">关闭</text>
</view>
</view>
</view>
</u-popup>
<!-- 设置 -->
<u-popup :show="showSettingsDrawer" mode="bottom" border-radius="20" @close="closeSettingsDrawer">
<view class="settings-drawer">
<view class="settings-drawer__header">
<text class="settings-drawer__title">设置</text>
</view>
<view class="settings-drawer__body">
<view class="settings-drawer__row">
<text class="settings-drawer__label">自动激活输入框</text>
<u-switch v-model="autoFocusInput" @change="handleAutoFocusChange" active-color="#2979ff"></u-switch>
</view>
</view>
<view class="settings-drawer__footer">
<view class="settings-drawer__close-btn" @click="closeSettingsDrawer">
<text class="settings-drawer__close-text">关闭</text>
</view>
</view>
</view>
</u-popup>
<u-popup :show="showActionDrawer" mode="bottom" border-radius="20" @close="closeActionDrawer">
<view class="action-drawer">
<view class="action-drawer__header">
<text class="action-drawer__title">更多操作</text>
</view>
<view class="action-drawer__body">
<view class="action-drawer__item" :class="{ 'action-drawer__item--disabled': !hasInboundOrder }" @click="handleMenuCancelInbound">
<text class="action-drawer__item-text">取消入库</text>
</view>
<view class="action-drawer__item" :class="{ 'action-drawer__item--disabled': !hasInboundOrder }" @click="handleMenuInboundDone">
<text class="action-drawer__item-text action-drawer__item-text--primary">入库完成</text>
</view>
<view class="action-drawer__item" @click="openSettingsDrawer">
<text class="action-drawer__item-text">设置</text>
</view>
<view class="action-drawer__item" @click="closeActionDrawer">
<text class="action-drawer__item-text">关闭</text>
</view>
</view>
</view>
</u-popup>
<view v-if="showShelfDrawer" class="shelf-overlay" @click="handleShelfCancel">
<view class="shelf-drawer" @click.stop>
<view class="shelf-drawer__header">
<text class="shelf-drawer__title">上架</text>
<text class="shelf-drawer__product-name">{{ selectedStock ? selectedStock.item_name : '--' }}</text>
</view>
<view class="shelf-drawer__body">
<view class="shelf-form-row">
<text class="shelf-form-label">可上架数</text>
<text class="shelf-form-value">{{ shelfFormData.availableQty }}</text>
</view>
<view class="shelf-form-row">
<text class="shelf-form-label">库位</text>
<input
class="shelf-form-input"
v-model="shelfFormData.spaceCode"
placeholder="请输入/扫描库位"
placeholder-style="color: #c0c4cc; font-size: 30rpx;"
@click="setActiveScanField('space')"
/>
</view>
<view class="shelf-form-row">
<text class="shelf-form-label">数量</text>
<input
class="shelf-form-input"
v-model="shelfFormData.quantity"
type="number"
placeholder="请输入数量"
placeholder-style="color: #c0c4cc; font-size: 30rpx;"
/>
</view>
<view class="shelf-form-row">
<text class="shelf-form-label">生产日期</text>
<view class="shelf-form-date" @click="showDatePicker = true">
<text class="shelf-form-date__text" :class="{ 'shelf-form-date__text--placeholder': !shelfFormData.productionDate }">{{ shelfFormData.productionDate || '请选择日期' }}</text>
<u-icon name="arrow-down" size="28rpx" color="#909399"></u-icon>
</view>
</view>
</view>
<view class="shelf-drawer__footer">
<view class="shelf-btn-submit" @click="handleShelfSubmit">
<text class="shelf-btn-submit__text">上架</text>
</view>
<view class="shelf-btn-cancel" @click="handleShelfCancel">
<text class="shelf-btn-cancel__text">取消</text>
</view>
</view>
</view>
</view>
<u-datetime-picker
:show="showDatePicker"
v-model="datePickerValue"
mode="date"
:min-date="minDate"
:max-date="maxDate"
@confirm="handleDateConfirm"
@cancel="showDatePicker = false"
></u-datetime-picker>
</view>
</template>
<script>
import voice from '@/core/utils/voice';
export default {
data() {
return {
loading: false,
submitting: false,
allowDirectBack: false,
hasInboundOrder: false,
inboundOrderNo: '',
entryOrderId: 0,
entryOrderStoreRemask: '',
searchKeyword: '',
detailScanKeyword: '',
detailScanResult: null,
showDetailDrawer: false,
showContainerDrawer: false,
showProgressDrawer: false,
containerList: [],
containerTotal: 0,
containerLoading: false,
showSettingsDrawer: false,
autoFocusInput: false,
selectedDetail: null,
detailSpaceKeyword: '',
detailSpaceList: [],
detailSpaceSelectedId: null,
detailSpaceItem: null,
entryOrderCode: '',
inboundOrderData: null,
inboundItems: [],
summaryData: null,
currentItemIndex: 0,
activeScanField: 'detailScan',
showShelfDrawer: false,
showActionDrawer: false,
showDatePicker: false,
datePickerValue: Number(new Date()),
minDate: new Date(2000, 0, 1).getTime(),
maxDate: new Date(2099, 11, 31).getTime(),
shelfFormData: {
availableQty: 0,
spaceCode: '',
quantity: '',
productionDate: ''
},
selectedStock: null,
formData: {
productKeyword: '',
quantity: '',
spaceKeyword: '',
remark: ''
}
};
},
computed: {
currentBindings() {
const item = this.inboundItems[this.currentItemIndex];
return item?.bindings || [];
},
summaryReceived() {
if (this.summaryData) {
return this.summaryData.total_direct_inbound ?? this.summaryData.total_pda ?? 0;
}
return this.inboundItems.reduce((sum, item) => sum + (item.receivedQty || 0), 0);
},
summaryTotal() {
if (this.summaryData) {
return this.summaryData.total_planned ?? 0;
}
return this.inboundItems.reduce((sum, item) => sum + (item.planQty || 0), 0);
}
},
onLoad(options = {}) {
this.safeDispatchBroadcast('setCallbacks', {
onResult: this.handleBroadcastResult
});
this.safeDispatchBroadcast('start');
this.entryOrderCode = String(options.entryOrderCode || '').trim();
this.loadSettings();
if (this.entryOrderCode) {
this.searchKeyword = this.entryOrderCode;
this.handleInboundOrderScan(this.entryOrderCode);
}
},
onShow() {
this.safeDispatchBroadcast('setCallbacks', {
onResult: this.handleBroadcastResult
});
this.safeDispatchBroadcast('resume');
// 每次进入页面时如果数据已清空(如完成入库后)但有关键词,则重新加载
if (!this.hasInboundOrder && this.entryOrderCode && !this.loading) {
this.handleInboundOrderScan(this.entryOrderCode);
}
},
onHide() {
this.safeDispatchBroadcast('pause');
},
onBackPress() {
if (this.allowDirectBack) {
return false;
}
if (!this.hasInboundOrder) {
return false;
}
this.confirmExitTask(() => {
this.allowDirectBack = true;
uni.navigateBack({ delta: 1 });
});
return true;
},
onUnload() {
this.safeDispatchBroadcast('stop');
},
methods: {
speakVoice(text) {
voice.speak(text, { minInterval: 800 });
},
safeDispatchBroadcast(action, payload) {
try {
const task = this.$store.dispatch(`broadcast/${action}`, payload);
if (task && typeof task.catch === 'function') {
task.catch(error => {
console.warn(`[RandomStorageShelf] broadcast/${action} 调用失败:`, error);
});
}
} catch (error) {
console.warn(`[RandomStorageShelf] broadcast/${action} 调用异常:`, error);
}
},
handleBack() {
if (this.allowDirectBack) {
uni.navigateBack({ delta: 1 });
return;
}
if (this.hasInboundOrder) {
this.confirmExitTask(() => {
this.allowDirectBack = true;
uni.navigateBack({ delta: 1 });
});
return;
}
uni.navigateBack({ delta: 1 });
},
copyInboundNo() {
if (!this.inboundOrderNo) return;
uni.setClipboardData({
data: this.inboundOrderNo,
success: () => {
uni.showToast({ title: '已复制', icon: 'success' });
}
});
},
confirmExitTask(onConfirm) {
uni.showModal({
title: '提示',
content: '上架尚未完成,是否退出?',
success: (res) => {
if (!res.confirm) return;
if (typeof onConfirm === 'function') {
onConfirm();
}
}
});
},
openActionDrawer() {
this.showActionDrawer = true;
},
closeActionDrawer() {
this.showActionDrawer = false;
},
openContainerDrawer() {
this.showContainerDrawer = true;
this.loadContainerList();
},
closeContainerDrawer() {
this.showContainerDrawer = false;
},
async loadContainerList() {
if (!this.entryOrderId) return;
const stockId = Number(this.selectedStock?.stock_id || this.inboundItems[this.currentItemIndex]?.stockId || 0);
if (!stockId) return;
this.containerLoading = true;
try {
const res = await this.$http('storage.entry.containerList', {
entry_order_id: this.entryOrderId,
stock_id: stockId
});
const isSuccess = String(res?.flag || '').toLowerCase() === 'success' || String(res?.code || '') === '200';
if (!isSuccess) {
this.containerList = [];
this.containerTotal = 0;
return;
}
this.containerList = Array.isArray(res?.list) ? res.list : Array.isArray(res?.data?.list) ? res.data.list : [];
this.containerTotal = Number(res?.total || res?.data?.total || this.containerList.length);
} catch (error) {
this.containerList = [];
this.containerTotal = 0;
} finally {
this.containerLoading = false;
}
},
openSettingsDrawer() {
this.closeActionDrawer();
this.showSettingsDrawer = true;
},
closeSettingsDrawer() {
this.showSettingsDrawer = false;
},
loadSettings() {
try {
const raw = uni.getStorageSync('random_storage_settings');
const settings = raw && typeof raw === 'object' ? raw : {};
this.autoFocusInput = !!settings.autoFocusInput;
} catch (error) {
this.autoFocusInput = false;
}
},
saveSettings() {
try {
uni.setStorageSync('random_storage_settings', {
autoFocusInput: this.autoFocusInput
});
} catch (error) {
console.warn('[RandomStorageShelf] 保存设置失败:', error);
}
},
handleAutoFocusChange(value) {
this.autoFocusInput = !!value;
this.saveSettings();
},
autoFocusDetailInput() {
if (!this.autoFocusInput || !this.hasInboundOrder) return;
this.$nextTick(() => {
this.activeScanField = 'detailScan';
});
},
isItemComplete(item) {
if (!item || !item.planQty || item.planQty <= 0) return false;
return (Number(item.receivedQty || 0)) >= item.planQty;
},
handleMenuCancelInbound() {
if (!this.hasInboundOrder) {
uni.showToast({ title: '请先扫描入库单', icon: 'none' });
return;
}
this.closeActionDrawer();
this.handleCancelInbound();
},
handleMenuInboundDone() {
if (!this.hasInboundOrder) {
uni.showToast({ title: '请先扫描入库单', icon: 'none' });
return;
}
this.closeActionDrawer();
this.handleInboundDone();
},
handleShelf() {
const qty = this.selectedStock ? (this.selectedStock.remaining_qty || this.selectedStock.plan_qty || 0) : 0;
this.shelfFormData = {
availableQty: qty,
spaceCode: '',
quantity: String(qty || ''),
productionDate: ''
};
this.showShelfDrawer = true;
},
handleShelfCancel() {
this.showShelfDrawer = false;
this.showDatePicker = false;
},
handleDateConfirm(e) {
const date = new Date(e.value);
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, '0');
const d = String(date.getDate()).padStart(2, '0');
this.shelfFormData.productionDate = `${y}-${m}-${d}`;
this.showDatePicker = false;
},
async handleShelfSubmit() {
if (!this.shelfFormData.spaceCode) {
uni.showToast({ title: '请输入库位', icon: 'none' });
return;
}
const qty = Number(this.shelfFormData.quantity);
if (!qty || qty <= 0) {
uni.showToast({ title: '请输入有效数量', icon: 'none' });
return;
}
const currentItem = this.inboundItems[this.currentItemIndex];
if (!currentItem) {
uni.showToast({ title: '未选中商品', icon: 'none' });
return;
}
const stockId = currentItem.stockId;
if (!stockId) {
uni.showToast({ title: '商品ID无效', icon: 'none' });
return;
}
const spaceId = Number(this.shelfFormData.spaceCode);
const params = {
entry_order_code: this.inboundOrderNo,
stock_id: stockId,
quantity: qty,
inbound_type: 'pda'
};
if (Number.isFinite(spaceId)) {
params.space_id = spaceId;
}
uni.showLoading({ title: '上架中...' });
try {
const res = await this.$http('storage.directInbound.addItem', params);
uni.hideLoading();
if (res?.flag === 'failure') {
uni.showToast({ title: res?.message || '上架失败', icon: 'none' });
return;
}
uni.showToast({ title: '上架成功', icon: 'success' });
this.speakVoice('上架成功');
this.showShelfDrawer = false;
uni.setStorageSync('random_storage_need_refresh', Date.now());
} catch (error) {
uni.hideLoading();
const msg = String(error?.message || error?.msg || '上架失败');
uni.showToast({ title: msg, icon: 'none' });
}
},
handleMaintain() {
uni.showToast({ title: '维护信息功能开发中', icon: 'none' });
},
previewImages() {
const urls = this.selectedStock?.image_urls;
if (!urls || !urls.length) return;
uni.previewImage({
urls,
current: this.selectedStock?.image_url || urls[0]
});
},
normalizeKeyword(value) {
return String(value || '').replace(/\s+/g, '');
},
normalizeScanResult(scanResult) {
if (!scanResult) return '';
if (typeof scanResult === 'string') return this.normalizeKeyword(scanResult);
if (typeof scanResult.result === 'string') return this.normalizeKeyword(scanResult.result);
if (Array.isArray(scanResult.result)) {
const first = scanResult.result.find(item => item);
if (typeof first === 'string') return this.normalizeKeyword(first);
if (first && typeof first.data === 'string') return this.normalizeKeyword(first.data);
}
if (typeof scanResult.data === 'string') return this.normalizeKeyword(scanResult.data);
return '';
},
handleBroadcastResult(result) {
const scanText = this.normalizeScanResult(result);
if (!scanText) return;
if (!this.hasInboundOrder) {
this.searchKeyword = scanText;
this.handleSearchInboundOrder();
return;
}
if (this.activeScanField === 'space') {
if (this.showDetailDrawer) {
this.detailSpaceKeyword = scanText;
this.handleDetailSpaceSearch();
return;
}
if (this.showShelfDrawer) {
this.shelfFormData.spaceCode = scanText;
} else {
this.formData.spaceKeyword = scanText;
}
} else {
this.detailScanKeyword = scanText;
this.handleScanDetailQuery();
}
},
handleSearchInboundOrder() {
const code = this.normalizeKeyword(this.searchKeyword);
if (!code) {
uni.showToast({ title: '请输入入库单号', icon: 'none' });
return;
}
this.handleInboundOrderScan(code);
},
async handleScanDetailQuery() {
const barcode = this.normalizeKeyword(this.detailScanKeyword);
if (!barcode) {
uni.showToast({ title: '请输入或扫描条码', icon: 'none' });
return;
}
if (!this.entryOrderId) {
uni.showToast({ title: '当前入库单缺少ID,无法定位明细', icon: 'none' });
return;
}
try {
const res = await this.$http('storage.receiving.scanDetail', {
entry_order_id: this.entryOrderId,
barcode
});
const isSuccess = String(res?.flag || '').toLowerCase() === 'success' || String(res?.code || '') === '1' || String(res?.code || '') === '200';
if (!isSuccess) {
uni.showToast({ title: res?.message || '未找到匹配明细', icon: 'none' });
return;
}
const list = Array.isArray(res?.list) ? res.list : Array.isArray(res?.data?.list) ? res.data.list : Array.isArray(res?.data) ? res.data : [];
if (!list.length) {
uni.showToast({ title: '未找到匹配的收货明细', icon: 'none' });
return;
}
if (list.length === 1) {
this.openDetailDrawer(list[0]);
} else {
this.containerList = list;
this.containerTotal = list.length;
this.showContainerDrawer = true;
}
} catch (error) {
const msg = String(error?.message || error?.msg || '定位明细失败');
uni.showToast({ title: msg, icon: 'none' });
}
},
openDetailDrawer(detailItem) {
this.showContainerDrawer = false;
this.selectedDetail = detailItem;
this.detailSpaceKeyword = '';
this.detailSpaceList = [];
this.detailSpaceSelectedId = null;
this.detailSpaceItem = null;
this.showDetailDrawer = true;
this.activeScanField = 'space';
// 根据 stock.id 匹配入库单明细,自动跳转商品
const stockId = Number(detailItem?.stock?.id || 0);
if (stockId > 0) {
const matchedIndex = this.inboundItems.findIndex(item => Number(item.stockId) === stockId);
if (matchedIndex >= 0) {
this.selectInboundItem(matchedIndex);
}
}
},
closeDetailDrawer() {
this.showDetailDrawer = false;
this.activeScanField = 'detailScan';
},
async handleDetailSave() {
if (!this.selectedDetail) {
uni.showToast({ title: '缺少明细数据', icon: 'none' });
return;
}
if (!this.detailSpaceItem) {
uni.showToast({ title: '请先识别库位', icon: 'none' });
return;
}
const stockId = Number(this.selectedDetail?.stock?.id || 0);
if (!stockId) {
uni.showToast({ title: '商品ID无效', icon: 'none' });
return;
}
uni.showLoading({ title: '提交中...' });
try {
const res = await this.$http('storage.entry.addItem', {
entry_order_id: this.entryOrderId,
stock_id: stockId,
quantity: Number(this.selectedDetail?.actual_quantity || 0),
inbound_type: 'pda',
space_id: this.detailSpaceItem.id,
receiving_detail_id: this.selectedDetail?.detail_id || 0,
remark: ''
});
uni.hideLoading();
if (res?.flag === 'failure') {
uni.showToast({ title: res?.message || '提交失败', icon: 'none' });
return;
}
uni.showToast({ title: '入库成功', icon: 'success' });
this.speakVoice('入库成功');
this.closeDetailDrawer();
if (this.inboundOrderNo) {
this.handleInboundOrderScan(this.inboundOrderNo);
}
} catch (error) {
uni.hideLoading();
const msg = String(error?.message || error?.msg || '提交失败');
uni.showToast({ title: msg, icon: 'none' });
}
},
async handleDetailSpaceSearch() {
const keyword = this.normalizeKeyword(this.detailSpaceKeyword);
if (!keyword) return;
try {
const res = await this.$http('common.searchSpace', { keyword });
const isSuccess = String(res?.code || '') === '200';
if (!isSuccess) {
uni.showToast({ title: res?.message || '库位搜索失败', icon: 'none' });
return;
}
const list = Array.isArray(res?.data) ? res.data : Array.isArray(res?.list) ? res.list : [];
if (list.length === 1) {
this.selectDetailSpace(list[0]);
return;
}
if (list.length > 1) {
this.detailSpaceList = list;
return;
}
uni.showToast({ title: '未找到匹配库位', icon: 'none' });
} catch (error) {
const msg = String(error?.message || error?.msg || '库位查询失败');
uni.showToast({ title: msg, icon: 'none' });
}
},
handleDetailSpaceScan() {
this.setActiveScanField('space');
uni.scanCode({
onlyFromCamera: true,
scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
success: (res) => {
const scanText = this.normalizeScanResult(res);
if (!scanText) {
uni.showToast({ title: '未识别到有效条码', icon: 'none' });
return;
}
this.detailSpaceKeyword = scanText;
this.handleDetailSpaceSearch();
},
fail: (error) => {
const errMsg = String(error?.errMsg || '').toLowerCase();
if (errMsg.includes('cancel')) return;
uni.showToast({ title: '扫码失败,请重试', icon: 'none' });
}
});
},
selectDetailSpace(spaceItem) {
if (!spaceItem) return;
this.detailSpaceItem = spaceItem;
this.detailSpaceSelectedId = spaceItem?.id || null;
this.detailSpaceList = [];
this.detailSpaceKeyword = spaceItem?.space_code || spaceItem?.custom_barcode || '';
},
handleScanDetailWithCamera() {
uni.scanCode({
onlyFromCamera: true,
scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
success: (res) => {
const scanText = this.normalizeScanResult(res);
if (!scanText) {
uni.showToast({ title: '未识别到有效条码', icon: 'none' });
return;
}
this.detailScanKeyword = scanText;
this.handleScanDetailQuery();
},
fail: (error) => {
const errMsg = String(error?.errMsg || '').toLowerCase();
if (errMsg.includes('cancel')) return;
uni.showToast({ title: '扫码失败,请重试', icon: 'none' });
}
});
},
handleScanInboundOrder() {
uni.scanCode({
onlyFromCamera: true,
scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
success: (res) => {
const scanText = this.normalizeScanResult(res);
if (!scanText) {
uni.showToast({ title: '未识别到有效条码', icon: 'none' });
return;
}
this.searchKeyword = scanText;
this.handleSearchInboundOrder();
},
fail: (error) => {
const errMsg = String(error?.errMsg || '').toLowerCase();
if (errMsg.includes('cancel')) return;
uni.showToast({ title: '扫码失败,请重试', icon: 'none' });
}
});
},
async handleInboundOrderScan(code) {
// 先清除旧数据,避免页面缓存导致显示陈旧内容
this.handleClearOrder();
uni.showLoading({ title: '查询入库单...' });
try {
// 1. 先通过 storage.entry.list 按编码查找入库单,获取 ID
const listRes = await this.$http('storage.entry.list', {
where: {
entry_order_code: {
field: 'entry_order_code',
operator: 'eq',
type: 'string',
value: code
}
}
});
const listData = listRes?.data?.data || listRes?.data || {};
const entryList = Array.isArray(listData.list) ? listData.list : [];
if (!entryList.length) {
uni.hideLoading();
uni.showToast({ title: '未找到入库单', icon: 'none' });
this.speakVoice('无记录');
return;
}
const entryId = Number(entryList[0].id);
if (!entryId) {
uni.hideLoading();
uni.showToast({ title: '入库单ID无效', icon: 'none' });
return;
}
// 2. 通过 storage.entry.get 查询入库单详情
const res = await this.$http('storage.entry.get', { id: entryId });
if (res?.flag === 'failure') {
uni.hideLoading();
uni.showToast({ title: res?.message || '查询入库单详情失败', icon: 'none' });
this.speakVoice('无记录');
return;
}
const detailData = res?.data ?? res?.result;
if (!detailData) {
uni.hideLoading();
uni.showToast({ title: '未找到入库单数据', icon: 'none' });
this.speakVoice('无记录');
return;
}
const items = Array.isArray(detailData.items) ? detailData.items : [];
const entryOrder = detailData.entryOrder || {};
const summary = detailData.summary || null;
this.hasInboundOrder = true;
this.entryOrderId = entryId;
this.entryOrderStoreRemask = String(entryOrder?.store_remask || entryOrder?.store?.store_remask || '');
this.inboundOrderNo = entryOrder.entry_order_code || code;
this.inboundOrderData = detailData;
this.summaryData = summary;
this.inboundItems = this.normalizeInboundItems(items);
this.currentItemIndex = 0;
if (this.inboundItems.length > 0) {
this.selectInboundItem(0);
}
uni.hideLoading();
this.autoFocusDetailInput();
} catch (error) {
uni.hideLoading();
const msg = String(error?.message || error?.msg || '查询入库单失败');
uni.showToast({ title: msg, icon: 'none' });
}
},
normalizeInboundItems(items) {
if (!Array.isArray(items)) return [];
return items
.filter(item => item && typeof item === 'object')
.map((item, index) => {
const stock = item.stock || {};
const planQty = Number(item.planned ?? item.count ?? item.plan_qty ?? 0);
const receivedQty = Number(item.completed ?? item.received_quantity ?? item.direct_inbound_quantity ?? item.receivedQty ?? 0);
const remainingQty = Math.max(0, planQty - receivedQty);
return {
id: String(item.id || item.stock_id || `item-${index + 1}`),
stockId: Number(item.stock_id ?? stock.id ?? 0),
bindings: Array.isArray(item.bindings) ? item.bindings : [],
lineNo: index + 1,
skuCode: String(item.item_code || stock.item_code || item.skuCode || ''),
skuName: String(item.warehouse_item_name || stock.item_name || item.item_name || item.skuName || '--'),
barcode: String(
(Array.isArray(stock.barcodes) && stock.barcodes.length
? stock.barcodes.map(b => b.barcode).filter(Boolean).join(' | ')
: '') ||
item.item_code || stock.item_code || ''
),
spec: String(item.warehouse_item_spec || stock.sku_property || item.spec || item.specification || ''),
color: String(item.color || stock.color || ''),
weight: String(item.weight || stock.weight || ''),
image_url: this.pickFirstImageUrl(stock, item),
image_urls: this.pickImageUrls(stock, item),
shelf_status: String(item.shelf_status || stock.shelf_status || ''),
owner: String(item.owner || item.owner_name || stock.owner_name || ''),
maintain_info: String(item.maintain_info || item.maintain || stock.maintain_info || ''),
planQty: Number.isFinite(planQty) ? planQty : 0,
receivedQty: Number.isFinite(receivedQty) ? receivedQty : 0,
remainingQty: Number.isFinite(remainingQty) ? remainingQty : 0
};
});
},
pickImageUrls(stock, item) {
if (Array.isArray(stock.image_url) && stock.image_url.length) return stock.image_url.filter(Boolean);
const fromStock = Array.isArray(stock.image_urls) ? stock.image_urls : Array.isArray(stock.images) ? stock.images : [];
if (fromStock.length) return fromStock.filter(Boolean);
const fromItem = Array.isArray(item.image_urls) ? item.image_urls : Array.isArray(item.images) ? item.images : [];
if (fromItem.length) return fromItem.filter(Boolean);
const single = stock.image_url || item.image_url || item.pic || item.picture || '';
if (Array.isArray(single)) return single.filter(Boolean);
return single ? [single] : [];
},
pickFirstImageUrl(stock, item) {
const urls = this.pickImageUrls(stock, item);
return urls.length ? urls[0] : '';
},
handleClearOrder() {
this.hasInboundOrder = false;
this.inboundOrderNo = '';
this.entryOrderId = 0;
this.entryOrderStoreRemask = '';
this.searchKeyword = '';
this.detailScanKeyword = '';
this.detailScanResult = null;
this.showDetailDrawer = false;
this.showContainerDrawer = false;
this.showProgressDrawer = false;
this.containerList = [];
this.containerTotal = 0;
this.showSettingsDrawer = false;
this.selectedDetail = null;
this.detailSpaceKeyword = '';
this.detailSpaceList = [];
this.detailSpaceSelectedId = null;
this.detailSpaceItem = null;
this.entryOrderCode = '';
this.inboundOrderData = null;
this.inboundItems = [];
this.summaryData = null;
this.currentItemIndex = 0;
this.selectedStock = null;
this.formData = {
productKeyword: '',
quantity: '',
spaceKeyword: '',
remark: ''
};
this.activeScanField = 'detailScan';
},
handleCancelInbound() {
uni.showModal({
title: '提示',
content: '确定取消当前入库单吗?已入库的数据将保留。',
success: (res) => {
if (res.confirm) {
this.handleClearOrder();
}
}
});
},
handleInboundDone() {
uni.showModal({
title: '提示',
content: '入库完成后不可撤销,请确定上架完成?',
success: async (res) => {
if (!res.confirm) return;
uni.showLoading({ title: '提交中...' });
try {
const result = await this.$http('storage.entry.commit', { entry_order_id: this.entryOrderId });
uni.hideLoading();
const isFail = result?.flag === 'failure' || String(result?.code || '') === '500';
if (isFail) {
uni.showModal({
title: '提交失败',
content: result?.message || '入库完成提交失败,请稍后重试',
showCancel: false
});
return;
}
uni.showToast({ title: '入库完成', icon: 'success' });
this.speakVoice('入库完成');
uni.setStorageSync('random_storage_need_refresh', Date.now());
this.handleClearOrder();
setTimeout(() => uni.navigateBack({ delta: 1 }), 300);
} catch (error) {
uni.hideLoading();
const msg = String(error?.message || error?.msg || '提交失败');
uni.showToast({ title: msg, icon: 'none' });
}
}
});
},
selectInboundItem(index) {
this.currentItemIndex = index;
const items = this.inboundItems || [];
const item = items[index];
if (!item) return;
this.selectedStock = {
stock_id: Number(item.stockId || 0),
item_name: item.skuName || '--',
item_code: item.skuCode || '',
barcode: item.barcode || '',
spec: item.spec || '',
color: item.color || '',
weight: item.weight || '',
image_url: item.image_url || '',
image_urls: Array.isArray(item.image_urls) ? item.image_urls : (item.image_url ? [item.image_url] : []),
shelf_status: item.shelf_status || '',
owner: item.owner || '',
maintain_info: item.maintain_info || '',
plan_qty: Number.isFinite(item.planQty) ? item.planQty : 0,
received_qty: Number.isFinite(item.receivedQty) ? item.receivedQty : 0,
remaining_qty: Number.isFinite(item.remainingQty) ? item.remainingQty : 0
};
this.formData.productKeyword = item.skuName || '';
const fillQty = item.remainingQty > 0 ? item.remainingQty : item.planQty;
this.formData.quantity = String(Number.isFinite(fillQty) ? fillQty : '');
},
setActiveScanField(field) {
this.activeScanField = field;
},
handleFieldScan(field) {
this.activeScanField = field;
uni.scanCode({
onlyFromCamera: true,
scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
success: (res) => {
const scanResult = this.normalizeScanResult(res);
if (!scanResult) {
uni.showToast({ title: '未识别到有效条码', icon: 'none' });
return;
}
if (field === 'productKeyword') {
this.formData.productKeyword = scanResult;
this.handleProductSearch();
} else if (field === 'space') {
this.formData.spaceKeyword = scanResult;
}
},
fail: (error) => {
const errMsg = String(error?.errMsg || '').toLowerCase();
if (errMsg.includes('cancel')) return;
uni.showToast({ title: '扫码失败,请重试', icon: 'none' });
}
});
},
async handleProductSearch() {
const keyword = this.normalizeKeyword(this.formData?.productKeyword || '');
if (!keyword) return;
const items = this.inboundItems || [];
const matchedItem = items.find(item => {
if (!item) return false;
const barcode = this.normalizeKeyword(item.barcode || '');
const skuCode = this.normalizeKeyword(item.skuCode || '');
return barcode === keyword || skuCode === keyword || item.skuName === keyword;
});
if (matchedItem) {
this.selectedStock = {
stock_id: Number(matchedItem.stockId || 0),
item_name: matchedItem.skuName || '--',
item_code: matchedItem.skuCode || '',
barcode: matchedItem.barcode || '',
spec: matchedItem.spec || '',
color: matchedItem.color || '',
weight: matchedItem.weight || '',
image_url: matchedItem.image_url || '',
image_urls: Array.isArray(matchedItem.image_urls) ? matchedItem.image_urls : (matchedItem.image_url ? [matchedItem.image_url] : []),
shelf_status: matchedItem.shelf_status || '',
owner: matchedItem.owner || '',
maintain_info: matchedItem.maintain_info || '',
plan_qty: Number.isFinite(matchedItem.planQty) ? matchedItem.planQty : 0,
received_qty: Number.isFinite(matchedItem.receivedQty) ? matchedItem.receivedQty : 0,
remaining_qty: Number.isFinite(matchedItem.remainingQty) ? matchedItem.remainingQty : 0
};
this.formData.productKeyword = matchedItem.skuName || '';
const fillQty = matchedItem.remainingQty > 0 ? matchedItem.remainingQty : matchedItem.planQty;
this.formData.quantity = String(Number.isFinite(fillQty) ? fillQty : '');
uni.showToast({ title: '已匹配商品', icon: 'success' });
this.speakVoice('数据一致');
return;
}
uni.showToast({ title: '该商品不在入库单中', icon: 'none' });
this.speakVoice('无记录');
},
clearSelectedStock() {
this.selectedStock = null;
this.formData.productKeyword = '';
this.activeScanField = 'detailScan';
},
async handleSubmit() {
if (!this.selectedStock) {
uni.showToast({ title: '请先扫描商品条码', icon: 'none' });
return;
}
const qty = Number(this.formData.quantity);
if (!qty || qty <= 0) {
uni.showToast({ title: '请输入有效入库数量', icon: 'none' });
return;
}
this.submitting = true;
uni.showLoading({ title: '提交中...' });
try {
const params = {
entry_order_code: this.inboundOrderNo,
item_code: this.selectedStock.item_code,
quantity: qty,
space_code: this.normalizeKeyword(this.formData.spaceKeyword) || undefined,
remark: this.formData.remark || undefined
};
await this.$http('storage.directInbound.inbound', params);
uni.hideLoading();
uni.showToast({ title: '入库成功', icon: 'success' });
this.speakVoice('入库成功');
this.clearSelectedStock();
this.formData.quantity = '';
this.formData.spaceKeyword = '';
this.formData.remark = '';
} catch (error) {
uni.hideLoading();
const msg = String(error?.message || error?.msg || error?.errMsg || '入库失败');
uni.showToast({ title: msg, icon: 'none' });
} finally {
this.submitting = false;
}
}
}
};
</script>
<style lang="scss" scoped>
.random-storage-page {
height: 100vh;
background: #f8f9fa;
}
.normar_container {
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
.content-split {
flex: 1;
padding: 24rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
gap: 16rpx;
min-height: 0;
}
.content-top {
flex: 1;
min-height: 0;
box-sizing: border-box;
}
.content-bottom {
flex: 0 0 300rpx;
height: 300rpx;
background: #ffffff;
border-radius: 12rpx;
padding: 12rpx;
border: 1rpx solid #ebeef5;
box-sizing: border-box;
}
.nav-back-btn,
.search-scan-btn {
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
}
.nav-more-btn {
width: 64rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
}
.nav-more-btn:active {
opacity: 0.7;
}
.action-drawer {
padding: 20rpx 24rpx calc(24rpx + env(safe-area-inset-bottom));
background: #f8f9fa;
}
.action-drawer__header {
padding: 8rpx 0 18rpx;
text-align: center;
}
.action-drawer__title {
font-size: 30rpx;
font-weight: 600;
color: #303133;
}
.action-drawer__body {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.action-drawer__item {
background: #ffffff;
border-radius: 12rpx;
padding: 24rpx;
display: flex;
justify-content: center;
align-items: center;
}
.action-drawer__item:active {
opacity: 0.75;
}
.action-drawer__item--disabled {
opacity: 0.45;
}
.action-drawer__item-text {
font-size: 30rpx;
color: #303133;
}
.action-drawer__item-text--primary {
color: #2979ff;
font-weight: 600;
}
.nav-cancel-btn {
padding: 8rpx 18rpx;
display: flex;
align-items: center;
justify-content: center;
border: 1rpx solid #f56c6c;
border-radius: 6rpx;
}
.nav-cancel-btn__text {
font-size: 28rpx;
color: #f56c6c;
line-height: 1.4;
}
.nav-done-btn {
padding: 8rpx 18rpx;
display: flex;
align-items: center;
justify-content: center;
border: 1rpx solid #07c160;
border-radius: 6rpx;
background: #07c160;
}
.nav-done-btn__text {
font-size: 28rpx;
color: #ffffff;
line-height: 1.4;
}
.empty-wrap {
flex: 1;
display: flex;
flex-direction: column;
padding: 0;
}
.search-filter {
background: #ffffff;
padding: 20rpx 24rpx 16rpx;
border-bottom: 1rpx solid #f0f0f0;
}
.search-row {
display: flex;
align-items: center;
gap: 10rpx;
}
.search-row ::v-deep .u-search {
flex: 1;
min-width: 0;
}
.search-scan-btn {
flex-shrink: 0;
width: 56rpx;
height: 56rpx;
background: #f5f5f5;
border-radius: 50%;
}
.search-scan-btn:active,
.nav-back-btn:active,
.nav-cancel-btn:active,
.nav-done-btn:active,
.shelf-btn:active,
.shelf-btn-submit:active,
.shelf-btn-cancel:active,
.shelf-form-date:active {
opacity: 0.7;
}
.empty-card {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex: 1;
background: #ffffff;
border-radius: 16rpx;
padding: 80rpx 60rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
}
.empty-title {
font-size: 38rpx;
font-weight: 600;
color: #303133;
margin-top: 24rpx;
}
.empty-desc {
font-size: 30rpx;
color: #909399;
margin-top: 12rpx;
}
.summary-bar {
padding: 14rpx 24rpx;
background: #ffffff;
border-radius: 12rpx;
border: 1rpx solid #ebeef5;
display: flex;
align-items: center;
justify-content: space-around;
}
.summary-bar__item {
display: flex;
flex-direction: column;
align-items: center;
gap: 4rpx;
}
.summary-bar__item-num {
font-size: 36rpx;
font-weight: 600;
line-height: 1.2;
}
.summary-bar__item-num--received {
color: #f56c6c;
}
.summary-bar__item-num--total {
color: #303133;
}
.summary-bar__item-label {
font-size: 22rpx;
color: #909399;
}
.detail-scan-panel {
background: #ffffff;
padding: 12rpx 24rpx 16rpx;
border-bottom: 1rpx solid #f2f3f5;
}
.detail-scan-panel__row {
display: flex;
align-items: center;
gap: 10rpx;
}
.detail-scan-panel__row ::v-deep .u-search {
flex: 1;
min-width: 0;
}
.detail-scan-panel__scan-btn {
flex-shrink: 0;
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
background: #f5f5f5;
border-radius: 50%;
}
/* ===== 详情抽屉 ===== */
.detail-drawer {
width: 100%;
background: #ffffff;
border-radius: 24rpx 24rpx 0 0;
display: flex;
flex-direction: column;
overflow: hidden;
max-height: 75vh;
}
.detail-drawer__header {
display: flex;
align-items: center;
padding: 30rpx 32rpx 20rpx;
border-bottom: 1rpx solid #f2f3f5;
gap: 12rpx;
}
.detail-drawer__title {
font-size: 36rpx;
font-weight: 600;
color: #303133;
flex-shrink: 0;
}
.detail-drawer__product-name {
font-size: 34rpx;
color: #303133;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.detail-drawer__body {
padding: 24rpx 32rpx;
display: flex;
flex-direction: column;
gap: 24rpx;
overflow-y: auto;
flex: 1;
}
.detail-row {
display: flex;
align-items: center;
min-height: 64rpx;
}
.detail-row__label {
font-size: 30rpx;
color: #909399;
width: 140rpx;
flex-shrink: 0;
}
.detail-row__value {
font-size: 30rpx;
color: #303133;
flex: 1;
}
.detail-row__value--highlight {
color: #f56c6c;
font-weight: 600;
}
.detail-row__value--primary {
color: #2979ff;
font-weight: 600;
}
.detail-row--space {
gap: 8rpx;
}
.detail-row__input {
flex: 1;
height: 72rpx;
background: #f5f7fa;
border-radius: 8rpx;
padding: 0 20rpx;
font-size: 28rpx;
color: #303133;
box-sizing: border-box;
}
.detail-row__scan-btn {
flex-shrink: 0;
width: 56rpx;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
background: #f5f5f5;
border-radius: 50%;
}
.detail-row__scan-btn:active {
opacity: 0.7;
}
.detail-space-list {
display: flex;
flex-direction: column;
gap: 10rpx;
max-height: 240rpx;
overflow-y: auto;
}
.detail-space-item {
background: #f6f8fb;
border-radius: 8rpx;
padding: 14rpx 18rpx;
display: flex;
align-items: center;
gap: 12rpx;
}
.detail-space-item:active {
opacity: 0.75;
}
.detail-space-item--active {
background: #e8f4fd;
border: 2rpx solid #2979ff;
}
.detail-space-item__code {
font-size: 28rpx;
color: #303133;
font-weight: 600;
flex-shrink: 0;
}
.detail-space-item__name {
font-size: 24rpx;
color: #909399;
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.detail-drawer__footer {
display: flex;
padding: 20rpx 32rpx;
border-top: 1rpx solid #f2f3f5;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
}
/* ===== 库位识别结果卡 ===== */
.detail-space-result {
margin-top: 6rpx;
}
.detail-space-result__label {
font-size: 24rpx;
color: #909399;
margin-bottom: 8rpx;
display: block;
}
.detail-space-result__card {
background: #e8f4fd;
border-radius: 10rpx;
padding: 16rpx 18rpx;
border: 2rpx solid #2979ff;
display: flex;
flex-direction: column;
gap: 6rpx;
}
.detail-space-result__code {
font-size: 30rpx;
font-weight: 600;
color: #2979ff;
}
.detail-space-result__name {
font-size: 26rpx;
color: #303133;
}
.detail-space-result__barcode {
font-size: 24rpx;
color: #909399;
}
.detail-btn-save,
.detail-btn-cancel {
flex: 1;
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12rpx;
}
.detail-btn-save {
background: #2979ff;
}
.detail-btn-save:active {
opacity: 0.8;
}
.detail-btn-save__text {
font-size: 34rpx;
color: #ffffff;
font-weight: 600;
}
.detail-btn-cancel {
border: 2rpx solid #dcdfe6;
background: #ffffff;
}
.detail-btn-cancel:active {
opacity: 0.8;
}
.detail-btn-cancel__text {
font-size: 34rpx;
color: #606266;
}
/* ===== 容器列表抽屉 ===== */
.container-drawer {
padding: 30rpx 24rpx calc(20rpx + env(safe-area-inset-bottom));
background: #f8f9fa;
}
.container-drawer__header {
text-align: center;
margin-bottom: 20rpx;
}
.container-drawer__title {
font-size: 32rpx;
font-weight: 600;
color: #303133;
}
.container-drawer__sub {
font-size: 24rpx;
color: #909399;
margin-top: 4rpx;
display: block;
}
.container-drawer__body {
min-height: 200rpx;
max-height: 520rpx;
}
.container-drawer__empty {
text-align: center;
padding: 60rpx 0;
font-size: 28rpx;
color: #909399;
}
.container-drawer__footer {
margin-top: 10rpx;
}
.container-drawer__close-btn {
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12rpx;
background: #dcdfe6;
}
.container-drawer__close-btn:active {
opacity: 0.8;
}
.container-drawer__close-text {
font-size: 34rpx;
color: #606266;
}
/* ===== 共用列表项(容器/扫码选明细)===== */
.scan-detail-select__item {
background: #ffffff;
border-radius: 12rpx;
padding: 18rpx 20rpx;
margin-bottom: 12rpx;
box-shadow: 0 1rpx 6rpx rgba(0,0,0,0.04);
}
.scan-detail-select__item:active {
opacity: 0.75;
}
.scan-detail-select__item-row {
display: flex;
align-items: center;
gap: 8rpx;
font-size: 26rpx;
line-height: 1.6;
}
.scan-detail-select__item-label {
color: #909399;
flex-shrink: 0;
}
.scan-detail-select__item-value {
color: #303133;
flex: 1;
}
/* ===== 设置抽屉 ===== */
.settings-drawer {
padding: 30rpx 24rpx calc(20rpx + env(safe-area-inset-bottom));
background: #f8f9fa;
}
.settings-drawer__header {
text-align: center;
margin-bottom: 24rpx;
}
.settings-drawer__title {
font-size: 32rpx;
font-weight: 600;
color: #303133;
}
.settings-drawer__body {
margin-bottom: 20rpx;
}
.settings-drawer__row {
background: #ffffff;
border-radius: 12rpx;
padding: 24rpx 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.settings-drawer__label {
font-size: 30rpx;
color: #303133;
}
.settings-drawer__footer {
margin-top: 10rpx;
}
.settings-drawer__close-btn {
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12rpx;
background: #dcdfe6;
}
.settings-drawer__close-btn:active {
opacity: 0.8;
}
.settings-drawer__close-text {
font-size: 34rpx;
color: #606266;
}
.product-detail-area {
height: 75%;
background: #ffffff;
padding: 20rpx 24rpx;
box-sizing: border-box;
}
.product-detail {
display: flex;
height: 100%;
gap: 24rpx;
}
.product-image-wrap {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
background: #f8f9fa;
border-radius: 12rpx;
overflow: hidden;
position: relative;
}
.product-image {
width: 100%;
height: 100%;
}
.product-image-placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 16rpx;
}
.product-image-text {
font-size: 26rpx;
color: #c0c4cc;
text-align: center;
padding: 0 10rpx;
}
.image-count-badge {
position: absolute;
right: 8rpx;
bottom: 8rpx;
padding: 2rpx 10rpx;
border-radius: 999rpx;
background: rgba(0,0,0,0.55);
}
.image-count-text {
font-size: 20rpx;
color: #fff;
}
.product-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: flex-start;
gap: 14rpx;
}
.product-name {
font-size: 38rpx;
font-weight: 600;
color: #303133;
margin-bottom: 4rpx;
}
.product-info-row {
display: flex;
align-items: center;
gap: 6rpx;
}
.product-info-label,
.order-info-label,
.shelf-form-label {
font-size: 30rpx;
color: #303133;
flex-shrink: 0;
}
.product-info-value,
.order-info-value {
font-size: 30rpx;
color: #303133;
flex: 1;
}
.product-info-row-qty {
margin-top: 4rpx;
}
.product-info-value-qty {
color: #f56c6c;
font-weight: 600;
font-size: 32rpx;
}
.order-info-area {
background: #ffffff;
border-top: 1rpx solid #f2f3f5;
display: flex;
flex-direction: column;
justify-content: center;
}
.order-info-row {
display: flex;
align-items: stretch;
}
.order-info-col {
display: flex;
flex-direction: column;
overflow: hidden;
}
.order-info-col--left,
.order-info-col--right {
flex: 1;
}
.order-info-col--middle {
flex: 2;
}
.order-info-col__item {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 12rpx 8rpx;
}
.order-info-col__item--blue {
background: #b1cfff;
}
.order-info-col__item--white {
background: #ffffff;
}
.order-info-col__item--green {
background: #d4edda;
}
.order-info-value--center {
text-align: center;
}
.shelf-btn {
display: inline-flex;
align-items: center;
padding: 4rpx 0;
}
.shelf-btn__text {
font-size: 30rpx;
color: #2979ff;
line-height: 1.4;
}
.shelf-btn--green .shelf-btn__text,
.order-info-col__item--green .shelf-btn__text {
color: #07c160;
}
.index-grid {
display: flex;
flex-wrap: wrap;
gap: 8rpx;
height: 100%;
overflow-y: auto;
overflow-x: hidden;
align-content: flex-start;
}
.index-cell {
flex: 0 0 calc((100% - 32rpx) / 5);
width: calc((100% - 32rpx) / 5);
aspect-ratio: 1/1;
box-sizing: border-box;
border-radius: 12rpx;
background: #f5f7fa;
border: 1rpx solid #e4e7ed;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.index-cell:active {
opacity: 0.7;
}
.index-cell--active {
background: #eaf2ff;
border-color: #2979ff;
}
.index-cell--picked {
background: #f0f9eb;
border-color: #67c23a;
}
.index-text {
font-size: 34rpx;
font-weight: 600;
color: #2979ff;
line-height: 1.3;
}
.index-sub {
font-size: 22rpx;
color: #909399;
line-height: 1.3;
margin-top: 2rpx;
}
.index-cell--active .index-sub {
color: #2979ff;
}
.safe-bottom {
height: calc(20rpx + env(safe-area-inset-bottom));
}
.shelf-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.45);
z-index: 999;
display: flex;
align-items: flex-end;
justify-content: center;
}
.shelf-drawer {
width: 100%;
background: #ffffff;
border-radius: 24rpx 24rpx 0 0;
display: flex;
flex-direction: column;
height: 80vh;
overflow: hidden;
}
.shelf-drawer__header {
display: flex;
align-items: center;
padding: 30rpx 32rpx 20rpx;
border-bottom: 1rpx solid #f2f3f5;
gap: 12rpx;
}
.shelf-drawer__title {
font-size: 36rpx;
font-weight: 600;
color: #303133;
flex-shrink: 0;
}
.shelf-drawer__product-name {
font-size: 34rpx;
color: #303133;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.shelf-drawer__body {
padding: 24rpx 32rpx;
display: flex;
flex-direction: column;
gap: 28rpx;
overflow-y: auto;
flex: 1;
}
.shelf-form-row {
display: flex;
align-items: center;
min-height: 72rpx;
}
.shelf-form-label {
width: 160rpx;
}
.shelf-form-value {
font-size: 32rpx;
color: #f56c6c;
font-weight: 600;
}
.shelf-form-input {
flex: 1;
height: 72rpx;
background: #f5f7fa;
border-radius: 8rpx;
padding: 0 20rpx;
font-size: 30rpx;
color: #303133;
box-sizing: border-box;
}
.shelf-form-date {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
height: 72rpx;
background: #f5f7fa;
border-radius: 8rpx;
padding: 0 20rpx;
box-sizing: border-box;
}
.shelf-form-date__text {
font-size: 30rpx;
color: #303133;
}
.shelf-form-date__text--placeholder {
color: #c0c4cc;
}
.shelf-drawer__footer {
display: flex;
padding: 20rpx 32rpx;
gap: 20rpx;
border-top: 1rpx solid #f2f3f5;
padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
}
.shelf-btn-cancel,
.shelf-btn-submit {
flex: 1;
height: 88rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12rpx;
}
.shelf-btn-cancel {
border: 2rpx solid #dcdfe6;
background: #ffffff;
}
.shelf-btn-cancel__text {
font-size: 34rpx;
color: #606266;
}
.shelf-btn-submit {
background: #2979ff;
}
.shelf-btn-submit__text {
font-size: 34rpx;
color: #ffffff;
font-weight: 600;
}
</style>