新增随机入库模块
This commit is contained in:
parent
4f09cb6141
commit
2aef552697
@ -163,6 +163,26 @@ export default {
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
}
|
||||
},
|
||||
directInbound: {
|
||||
getItems: {
|
||||
path: "storage.directInbound.getItems",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
inbound: {
|
||||
path: "storage.directInbound.inbound",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
complete: {
|
||||
path: "storage.directInbound.complete",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
}
|
||||
}
|
||||
},
|
||||
stock: {
|
||||
|
||||
@ -86,6 +86,13 @@
|
||||
"titleNView": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/work/storage/random-storage",
|
||||
"style" :
|
||||
{
|
||||
"titleNView": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/403",
|
||||
"style" :
|
||||
|
||||
@ -320,6 +320,7 @@
|
||||
const isGrouponPickingDetail = menuName === '团购拣货详情' || (menuName.includes('团购') && menuName.includes('拣货') && menuName.includes('详情'));
|
||||
const rawPath = item?.component || item?.path || '';
|
||||
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
||||
const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库'));
|
||||
const isRelocation = menuName === '移库作业' || normalizedPath === '/pages/work/storage/relocation';
|
||||
if (isRelocation) {
|
||||
uni.showToast({
|
||||
@ -329,6 +330,10 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (isRandomStorage) {
|
||||
this.$tools.routerTo('/pages/work/storage/random-storage');
|
||||
return;
|
||||
}
|
||||
const targetPath = isGoodsQuery
|
||||
? '/pages/work/product/query'
|
||||
: (isOrderPicking
|
||||
|
||||
@ -531,6 +531,7 @@
|
||||
'散单拣货详情',
|
||||
'团购拣货详情',
|
||||
'订单复核',
|
||||
'随机入库',
|
||||
'移库作业'
|
||||
];
|
||||
|
||||
@ -1163,6 +1164,7 @@
|
||||
const isGrouponPickingDetail = menuName === '团购拣货详情' || (menuName.includes('团购') && menuName.includes('拣货') && menuName.includes('详情'));
|
||||
const rawPath = item?.component || item?.path || '';
|
||||
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
||||
const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库'));
|
||||
const isRelocation = menuName === '移库作业' || normalizedPath === '/pages/work/storage/relocation';
|
||||
if (isRelocation) {
|
||||
uni.showToast({
|
||||
@ -1172,6 +1174,10 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (isRandomStorage) {
|
||||
this.$tools.routerTo('/pages/work/storage/random-storage');
|
||||
return;
|
||||
}
|
||||
const targetPath = isGoodsQuery
|
||||
? '/pages/work/product/query'
|
||||
: (isOrderPicking
|
||||
|
||||
845
pages/work/storage/random-storage.vue
Normal file
845
pages/work/storage/random-storage.vue
Normal file
@ -0,0 +1,845 @@
|
||||
<template>
|
||||
<view class="random-storage-page">
|
||||
<view class="normar_container">
|
||||
<page-nav title="随机入库">
|
||||
<template #left>
|
||||
<view v-if="hasInboundOrder" class="nav-cancel-btn" @click="handleCancelInbound">
|
||||
<text class="nav-cancel-btn__text">取消入库</text>
|
||||
</view>
|
||||
</template>
|
||||
<template #right>
|
||||
<view v-if="hasInboundOrder" class="nav-done-btn" @click="handleInboundDone">
|
||||
<text class="nav-done-btn__text">入库完成</text>
|
||||
</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">
|
||||
<scroll-view class="content-top" scroll-y>
|
||||
<view class="summary-bar">
|
||||
<text class="summary-label">已入总数/所有总数:</text>
|
||||
<text class="summary-value">{{ summaryReceived }}</text>
|
||||
<text class="summary-split">/</text>
|
||||
<text class="summary-total">{{ summaryTotal }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 商品详情区(占上部分80%) -->
|
||||
<view class="product-detail-area">
|
||||
<view class="product-detail">
|
||||
<!-- 左50%:商品图片 -->
|
||||
<view class="product-image-wrap">
|
||||
<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>
|
||||
<!-- 右50%:商品信息 -->
|
||||
<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.color) || '--' }}</text>
|
||||
</view>
|
||||
<view class="product-info-row">
|
||||
<text class="product-info-label">重量:</text>
|
||||
<text class="product-info-value">{{ (selectedStock && selectedStock.weight) || '--' }}</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) + '/' + (selectedStock.plan_qty || 0) : '0/0' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 订单信息区(占上部分20%) -->
|
||||
<view class="order-info-area">
|
||||
<view class="order-info-row">
|
||||
<view class="order-info-item">
|
||||
<text class="order-info-label">入库编号:</text>
|
||||
<text class="order-info-value">{{ inboundOrderNo || '--' }}</text>
|
||||
</view>
|
||||
<view class="order-info-item">
|
||||
<text class="order-info-label">上架:</text>
|
||||
<text class="order-info-value">{{ (selectedStock && selectedStock.shelf_status) || '--' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-info-row">
|
||||
<view class="order-info-item">
|
||||
<text class="order-info-label">货主:</text>
|
||||
<text class="order-info-value">{{ (selectedStock && selectedStock.owner) || '--' }}</text>
|
||||
</view>
|
||||
<view class="order-info-item">
|
||||
<text class="order-info-label">维护信息:</text>
|
||||
<text class="order-info-value">{{ (selectedStock && selectedStock.maintain_info) || '--' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="content-bottom">
|
||||
<view class="submit-btn-wrap">
|
||||
<u-button
|
||||
type="primary"
|
||||
:loading="submitting"
|
||||
:disabled="submitting"
|
||||
:customStyle="{ width: '100%', height: '88rpx', fontSize: '34rpx', borderRadius: '12rpx' }"
|
||||
@click="handleSubmit"
|
||||
>确认入库</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-loading-page :loading="loading" bg-color="rgba(255,255,255,0.9)"></u-loading-page>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import voice from '@/core/utils/voice';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
submitting: false,
|
||||
hasInboundOrder: false,
|
||||
inboundOrderNo: '',
|
||||
searchKeyword: '',
|
||||
inboundOrderData: null,
|
||||
inboundItems: [],
|
||||
summaryData: null,
|
||||
currentItemIndex: 0,
|
||||
activeScanField: 'productKeyword',
|
||||
selectedStock: null,
|
||||
formData: {
|
||||
productKeyword: '',
|
||||
quantity: '',
|
||||
spaceKeyword: '',
|
||||
remark: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
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() {
|
||||
this.safeDispatchBroadcast('setCallbacks', {
|
||||
onResult: this.handleBroadcastResult
|
||||
});
|
||||
this.safeDispatchBroadcast('start');
|
||||
},
|
||||
onShow() {
|
||||
this.safeDispatchBroadcast('setCallbacks', {
|
||||
onResult: this.handleBroadcastResult
|
||||
});
|
||||
this.safeDispatchBroadcast('resume');
|
||||
},
|
||||
onHide() {
|
||||
this.safeDispatchBroadcast('pause');
|
||||
},
|
||||
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(`[RandomStorage] broadcast/${action} 调用失败:`, error);
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(`[RandomStorage] broadcast/${action} 调用异常:`, error);
|
||||
}
|
||||
},
|
||||
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 === 'productKeyword') {
|
||||
this.formData.productKeyword = scanText;
|
||||
this.handleProductSearch();
|
||||
} else if (this.activeScanField === 'space') {
|
||||
this.formData.spaceKeyword = scanText;
|
||||
}
|
||||
},
|
||||
handleSearchInboundOrder() {
|
||||
const code = this.normalizeKeyword(this.searchKeyword);
|
||||
if (!code) {
|
||||
uni.showToast({ title: '请输入入库单号', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.handleInboundOrderScan(code);
|
||||
},
|
||||
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) {
|
||||
uni.showLoading({ title: '查询入库单...' });
|
||||
try {
|
||||
const res = await this.$http('storage.directInbound.getItems', { entry_order_code: code });
|
||||
if (res?.flag === 'failure') {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: res?.message || '未找到入库单', icon: 'none' });
|
||||
this.speakVoice('无记录');
|
||||
return;
|
||||
}
|
||||
const rawData = res?.data?.data ?? res?.data ?? res?.result;
|
||||
// 判断 rawData 是数组(直接返回的明细列表)还是对象(含 items 子字段)
|
||||
let items = [];
|
||||
let entryOrder = {};
|
||||
let summary = null;
|
||||
if (Array.isArray(rawData)) {
|
||||
items = rawData;
|
||||
} else if (rawData && typeof rawData === 'object') {
|
||||
items = rawData.items || rawData.entryOrderItems || [];
|
||||
entryOrder = rawData.entryOrder || {};
|
||||
summary = rawData.summary || null;
|
||||
}
|
||||
this.hasInboundOrder = true;
|
||||
this.inboundOrderNo = entryOrder.entry_order_code || code;
|
||||
this.inboundOrderData = rawData;
|
||||
this.summaryData = summary;
|
||||
this.inboundItems = this.normalizeInboundItems(items);
|
||||
this.currentItemIndex = 0;
|
||||
// 自动选中第一个商品
|
||||
if (this.inboundItems.length > 0) {
|
||||
this.selectInboundItem(0);
|
||||
}
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: `已加载入库单,共 ${this.inboundItems.length} 项`, icon: 'success' });
|
||||
this.speakVoice('数据一致');
|
||||
} 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 planQty = Number(item.count ?? item.plan_qty ?? 0);
|
||||
const receivedQty = Number(item.received_quantity ?? item.direct_inbound_quantity ?? item.receivedQty ?? 0);
|
||||
const remainingQty = Number(item.remaining_quantity ?? item.remainingQty ?? (Math.max(0, planQty - receivedQty)));
|
||||
return {
|
||||
id: String(item.id || item.stock_id || `item-${index + 1}`),
|
||||
lineNo: index + 1,
|
||||
skuCode: String(item.item_code || item.skuCode || ''),
|
||||
skuName: String(item.warehouse_item_name || item.item_name || item.skuName || '--'),
|
||||
barcode: String(item.item_code || item.barcode || ''),
|
||||
spec: String(item.warehouse_item_spec || item.spec || item.specification || ''),
|
||||
color: String(item.color || ''),
|
||||
weight: String(item.weight || ''),
|
||||
image_url: String(item.image_url || item.pic || item.picture || ''),
|
||||
shelf_status: String(item.shelf_status || ''),
|
||||
owner: String(item.owner || item.owner_name || ''),
|
||||
maintain_info: String(item.maintain_info || item.maintain || ''),
|
||||
planQty: Number.isFinite(planQty) ? planQty : 0,
|
||||
receivedQty: Number.isFinite(receivedQty) ? receivedQty : 0,
|
||||
remainingQty: Number.isFinite(remainingQty) ? remainingQty : 0
|
||||
};
|
||||
});
|
||||
},
|
||||
handleClearOrder() {
|
||||
this.hasInboundOrder = false;
|
||||
this.inboundOrderNo = '';
|
||||
this.searchKeyword = '';
|
||||
this.inboundOrderData = null;
|
||||
this.inboundItems = [];
|
||||
this.summaryData = null;
|
||||
this.currentItemIndex = 0;
|
||||
this.selectedStock = null;
|
||||
this.formData = {
|
||||
productKeyword: '',
|
||||
quantity: '',
|
||||
spaceKeyword: '',
|
||||
remark: ''
|
||||
};
|
||||
this.activeScanField = 'productKeyword';
|
||||
},
|
||||
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 {
|
||||
await this.$http('storage.directInbound.complete', { entry_order_code: this.inboundOrderNo });
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '入库完成', icon: 'success' });
|
||||
this.speakVoice('入库完成');
|
||||
this.handleClearOrder();
|
||||
} 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 = {
|
||||
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 || '',
|
||||
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' });
|
||||
}
|
||||
});
|
||||
},
|
||||
getStockBarcode(stock) {
|
||||
if (!stock) return '--';
|
||||
const barcodes = stock.barcodes || stock.barcode_list || [];
|
||||
if (Array.isArray(barcodes) && barcodes.length > 0) return barcodes.join(', ');
|
||||
return stock.barcode || stock.item_code || '--';
|
||||
},
|
||||
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 = {
|
||||
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 || '',
|
||||
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 = 'productKeyword';
|
||||
},
|
||||
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;
|
||||
}
|
||||
|
||||
::v-deep .nav-title .right {
|
||||
width: auto;
|
||||
min-width: 160rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
::v-deep .nav-title .left .left-back {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.content-split {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.content-top {
|
||||
flex: 7;
|
||||
padding: 0 0 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.content-bottom {
|
||||
flex: 3;
|
||||
background: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 24rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* ===== 导航按钮 ===== */
|
||||
.nav-cancel-btn {
|
||||
padding: 8rpx 18rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1rpx solid #f56c6c;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.nav-cancel-btn:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.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:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.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;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f5f5f5;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.search-scan-btn: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;
|
||||
}
|
||||
|
||||
/* ===== 商品详情区 ===== */
|
||||
.product-detail-area {
|
||||
height: 80%;
|
||||
background: #ffffff;
|
||||
padding: 20rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.product-detail {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
/* 左 50%:商品图片 */
|
||||
.product-image-wrap {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #f8f9fa;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
/* 右 50%:商品信息 */
|
||||
.product-info {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 14rpx;
|
||||
}
|
||||
|
||||
.product-name {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.product-info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.product-info-label {
|
||||
font-size: 26rpx;
|
||||
color: #909399;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.product-info-value {
|
||||
font-size: 26rpx;
|
||||
color: #303133;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.product-info-row-qty {
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
|
||||
.product-info-value-qty {
|
||||
color: #f56c6c;
|
||||
font-weight: 600;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
/* ===== 订单信息区 ===== */
|
||||
.order-info-area {
|
||||
height: 20%;
|
||||
background: #ffffff;
|
||||
border-top: 1rpx solid #f2f3f5;
|
||||
padding: 16rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
|
||||
.order-info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.order-info-item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4rpx;
|
||||
}
|
||||
|
||||
.order-info-label {
|
||||
font-size: 26rpx;
|
||||
color: #909399;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.order-info-value {
|
||||
font-size: 26rpx;
|
||||
color: #303133;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.submit-btn-wrap {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.summary-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
padding: 16rpx 0;
|
||||
padding-top: 0;
|
||||
background: #ffffff;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
font-size: 30rpx;
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.summary-value {
|
||||
color: #f56c6c;
|
||||
font-weight: 600;
|
||||
font-size: 32rpx;
|
||||
margin-left: 6rpx;
|
||||
}
|
||||
|
||||
.summary-split {
|
||||
color: #f56c6c;
|
||||
font-size: 30rpx;
|
||||
margin: 0 6rpx;
|
||||
}
|
||||
|
||||
.summary-total {
|
||||
color: #f56c6c;
|
||||
font-weight: 600;
|
||||
font-size: 32rpx;
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user