修改散单拣货详情、拣货商品详情页
This commit is contained in:
parent
745a556a7e
commit
565d4ded5b
@ -276,6 +276,12 @@ export default {
|
|||||||
auth: true,
|
auth: true,
|
||||||
method: "POST",
|
method: "POST",
|
||||||
isSystemApi: true
|
isSystemApi: true
|
||||||
|
},
|
||||||
|
confirmRecheck: {
|
||||||
|
path: "order.recheckOrder.confirmRecheck",
|
||||||
|
auth: true,
|
||||||
|
method: "POST",
|
||||||
|
isSystemApi: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -3,18 +3,14 @@
|
|||||||
<view class="normar_container">
|
<view class="normar_container">
|
||||||
<page-nav :title="title">
|
<page-nav :title="title">
|
||||||
<template #right>
|
<template #right>
|
||||||
<view class="nav-right-complete" @click="handleComplete">完成</view>
|
<view class="nav-right-complete" @click="handleComplete">确认复核</view>
|
||||||
</template>
|
</template>
|
||||||
</page-nav>
|
</page-nav>
|
||||||
|
|
||||||
<view class="page-head">
|
<view class="page-head">
|
||||||
<view class="page-head-item">
|
<view class="page-head-item">
|
||||||
<view class="page-head-label">波次号</view>
|
<view class="page-head-label">{{ headMatchLabel }}</view>
|
||||||
<text class="page-head-value">{{ detailInfo.waveNo || '--' }}</text>
|
<text class="page-head-value">{{ headMatchValue }}</text>
|
||||||
</view>
|
|
||||||
<view class="page-head-item page-head-item--right">
|
|
||||||
<view class="page-head-label">订单总数</view>
|
|
||||||
<text class="page-head-value">{{ orderTotal }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -27,15 +23,60 @@
|
|||||||
<view class="top-card">
|
<view class="top-card">
|
||||||
<view class="top-main">
|
<view class="top-main">
|
||||||
<view class="goods-image-name-row">
|
<view class="goods-image-name-row">
|
||||||
<u-image class="goods-image" :src="currentGoods.imageUrl || ''" width="300rpx" height="300rpx" mode="aspectFill"></u-image>
|
<view class="goods-thumb" @click.stop="previewCurrentGoodsImage">
|
||||||
|
<u-image
|
||||||
|
v-if="getCurrentGoodsImageList().length <= 1"
|
||||||
|
class="goods-image"
|
||||||
|
:src="currentGoods.imageUrl || ''"
|
||||||
|
mode="aspectFill"
|
||||||
|
width="300rpx"
|
||||||
|
height="300rpx"
|
||||||
|
>
|
||||||
|
<template #error>
|
||||||
|
<view class="image-placeholder image-placeholder--large">
|
||||||
|
<u-icon name="photo" size="32" color="#c0c4cc"></u-icon>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</u-image>
|
||||||
|
<view v-else class="goods-image-grid">
|
||||||
|
<view
|
||||||
|
v-for="(img, imgIndex) in getCurrentGoodsImageGridList()"
|
||||||
|
:key="img.url + '-' + imgIndex"
|
||||||
|
class="grid-cell"
|
||||||
|
:class="{ 'grid-cell--empty': !img.url }"
|
||||||
|
>
|
||||||
|
<template v-if="img.url">
|
||||||
|
<u-image
|
||||||
|
class="grid-image"
|
||||||
|
:src="img.url"
|
||||||
|
mode="aspectFill"
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
>
|
||||||
|
<template #error>
|
||||||
|
<view class="image-placeholder image-placeholder--small">
|
||||||
|
<u-icon name="photo" size="24" color="#c0c4cc"></u-icon>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</u-image>
|
||||||
|
<view v-if="imgIndex === 3 && getCurrentGoodsExtraImageCount() > 0" class="more-mask">
|
||||||
|
<text class="more-text">+{{ getCurrentGoodsExtraImageCount() }}</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<view v-else class="image-placeholder image-placeholder--small image-placeholder--empty">
|
||||||
|
<u-icon name="photo" size="24" color="#c0c4cc"></u-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<text class="goods-name">{{ currentGoods.skuName || '--' }}</text>
|
<text class="goods-name">{{ currentGoods.skuName || '--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="top-info">
|
<view class="top-info">
|
||||||
<view class="goods-row"><view class="label">库位:</view><text class="value">{{ currentGoods.location || '--' }}</text></view>
|
<view class="goods-row" :class="{ 'goods-row--barcode-highlight': isCurrentBarcodeMatched }"><view class="label">条码:</view><text class="value">{{ currentGoods.barcode || '--' }}</text></view>
|
||||||
<view class="goods-row"><view class="label">条码:</view><text class="value">{{ currentGoods.barcode || '--' }}</text></view>
|
<view class="goods-row"><view class="label">规格:</view><text class="value">{{ currentGoods.location || '--' }}</text></view>
|
||||||
<view class="goods-row goods-row--quantity">
|
<view class="goods-row goods-row--quantity">
|
||||||
<view class="label">数量:</view>
|
<view class="label">数量:</view>
|
||||||
<text class="value">{{ currentGoods.needQty || 0 }}</text>
|
<text class="value">{{ currentGoods.planQty || 0 }}</text>
|
||||||
<view class="pick-list-title-btn" @click="togglePickListSection">拣货列表</view>
|
<view class="pick-list-title-btn" @click="togglePickListSection">拣货列表</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -58,11 +99,11 @@
|
|||||||
class="pick-item-wrap"
|
class="pick-item-wrap"
|
||||||
@click="selectGoods(index)"
|
@click="selectGoods(index)"
|
||||||
>
|
>
|
||||||
<view class="metric-card-btn" :class="{ 'metric-card-btn--active': index === currentGoodsIndex }">
|
<view class="metric-card-btn" :class="{ 'metric-card-btn--active': index === currentGoodsIndex, 'metric-card-btn--matched': isGoodsMatched(item) }">
|
||||||
<view class="order-corner"></view>
|
<view class="order-corner"></view>
|
||||||
<view class="metric-diagonal"></view>
|
<view class="metric-diagonal"></view>
|
||||||
<text class="metric-order">{{ item.orderCount || 0 }}</text>
|
<text class="metric-order">{{ item.lineNo || 0 }}</text>
|
||||||
<text class="metric-product">{{ item.productQty || 0 }}</text>
|
<text class="metric-product">{{ item.planQty || 0 }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -80,11 +121,17 @@
|
|||||||
return {
|
return {
|
||||||
title: '拣货商品详情',
|
title: '拣货商品详情',
|
||||||
currentGoodsIndex: 0,
|
currentGoodsIndex: 0,
|
||||||
|
confirmingRecheck: false,
|
||||||
|
matchedGoodsId: '',
|
||||||
|
matchedGoodsState: {},
|
||||||
showPickListSection: true,
|
showPickListSection: true,
|
||||||
detailInfo: {
|
detailInfo: {
|
||||||
recordId: '',
|
recordId: '',
|
||||||
|
orderId: 0,
|
||||||
waveNo: '--',
|
waveNo: '--',
|
||||||
orderTotal: 0,
|
waybillNo: '--',
|
||||||
|
matchType: '',
|
||||||
|
recheckStatus: '',
|
||||||
pickerName: '--',
|
pickerName: '--',
|
||||||
cartNo: '--',
|
cartNo: '--',
|
||||||
status: 'pending',
|
status: 'pending',
|
||||||
@ -94,12 +141,23 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
orderTotal() {
|
headMatchLabel() {
|
||||||
const total = Number(this.detailInfo?.orderTotal || 0);
|
if (this.detailInfo?.matchType === 'waybill') {
|
||||||
if (!Number.isNaN(total) && total > 0) {
|
return '快递单号';
|
||||||
return total;
|
|
||||||
}
|
}
|
||||||
return this.goodsList.length;
|
if (this.detailInfo?.matchType === 'cart') {
|
||||||
|
return '车号';
|
||||||
|
}
|
||||||
|
return '波次号';
|
||||||
|
},
|
||||||
|
headMatchValue() {
|
||||||
|
if (this.detailInfo?.matchType === 'waybill') {
|
||||||
|
return this.detailInfo?.waybillNo || '--';
|
||||||
|
}
|
||||||
|
if (this.detailInfo?.matchType === 'cart') {
|
||||||
|
return this.detailInfo?.cartNo || '--';
|
||||||
|
}
|
||||||
|
return this.detailInfo?.waveNo || '--';
|
||||||
},
|
},
|
||||||
currentGoods() {
|
currentGoods() {
|
||||||
return this.goodsList[this.currentGoodsIndex] || {};
|
return this.goodsList[this.currentGoodsIndex] || {};
|
||||||
@ -109,30 +167,331 @@
|
|||||||
},
|
},
|
||||||
hasNextGoods() {
|
hasNextGoods() {
|
||||||
return this.currentGoodsIndex < this.goodsList.length - 1;
|
return this.currentGoodsIndex < this.goodsList.length - 1;
|
||||||
|
},
|
||||||
|
isRecheckFinished() {
|
||||||
|
return String(this.detailInfo?.recheckStatus || '').toLowerCase() === 'fin';
|
||||||
|
},
|
||||||
|
isCurrentBarcodeMatched() {
|
||||||
|
const currentId = String(this.currentGoods?.id || '');
|
||||||
|
if (!currentId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !!this.matchedGoodsState[currentId];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
const matchType = String(options?.matchType || '').trim();
|
||||||
|
const recheckStatus = String(options?.recheckStatus || '').trim().toLowerCase();
|
||||||
this.detailInfo = {
|
this.detailInfo = {
|
||||||
recordId: options?.recordId || '',
|
recordId: options?.recordId || '',
|
||||||
|
orderId: Number(options?.orderId || options?.recordId || 0),
|
||||||
waveNo: options?.waveNo || '--',
|
waveNo: options?.waveNo || '--',
|
||||||
orderTotal: Number(options?.orderTotal || 0),
|
waybillNo: options?.waybillNo || '--',
|
||||||
|
matchType,
|
||||||
|
recheckStatus,
|
||||||
pickerName: options?.pickerName || '--',
|
pickerName: options?.pickerName || '--',
|
||||||
cartNo: options?.cartNo || '--',
|
cartNo: options?.cartNo || '--',
|
||||||
status: options?.status || 'pending',
|
status: options?.status || 'pending',
|
||||||
unreviewedCount: Number(options?.unreviewedCount || 0)
|
unreviewedCount: Number(options?.unreviewedCount || 0)
|
||||||
};
|
};
|
||||||
this.goodsList = this.buildMockGoodsList();
|
if (this.isRecheckFinished) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '该订单已复核完成,禁止再次进入',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cacheKey = String(options?.cacheKey || '').trim();
|
||||||
|
const cacheResult = this.getCachedScanOrderResult(cacheKey);
|
||||||
|
if (cacheResult.hasCache) {
|
||||||
|
this.goodsList = this.buildGoodsListByItems(cacheResult.items);
|
||||||
|
} else {
|
||||||
|
this.goodsList = this.buildMockGoodsList();
|
||||||
|
}
|
||||||
this.currentGoodsIndex = 0;
|
this.currentGoodsIndex = 0;
|
||||||
|
this.matchedGoodsState = {};
|
||||||
|
this.safeDispatchBroadcast('setCallbacks', {
|
||||||
|
onResult: this.handleBroadcastResult
|
||||||
|
});
|
||||||
|
this.safeDispatchBroadcast('start');
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
if (this.isRecheckFinished) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.safeDispatchBroadcast('setCallbacks', {
|
||||||
|
onResult: this.handleBroadcastResult
|
||||||
|
});
|
||||||
|
this.safeDispatchBroadcast('resume');
|
||||||
|
},
|
||||||
|
onHide() {
|
||||||
|
this.safeDispatchBroadcast('pause');
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
this.safeDispatchBroadcast('stop');
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
isGoodsMatched(item) {
|
||||||
|
const id = String(item?.id || '');
|
||||||
|
if (!id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !!this.matchedGoodsState[id];
|
||||||
|
},
|
||||||
|
safeDispatchBroadcast(action, payload) {
|
||||||
|
try {
|
||||||
|
const task = this.$store.dispatch(`broadcast/${action}`, payload);
|
||||||
|
if (task && typeof task.catch === 'function') {
|
||||||
|
task.catch(error => {
|
||||||
|
console.warn(`[ScatterPickGoodsDetail] broadcast/${action} 调用失败:`, error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn(`[ScatterPickGoodsDetail] broadcast/${action} 调用异常:`, error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
normalizeBarcode(value) {
|
||||||
|
return String(value || '').replace(/\s+/g, '').toUpperCase();
|
||||||
|
},
|
||||||
|
normalizeScanResult(scanResult) {
|
||||||
|
if (!scanResult) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof scanResult === 'string') {
|
||||||
|
return this.normalizeBarcode(scanResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof scanResult.result === 'string') {
|
||||||
|
return this.normalizeBarcode(scanResult.result);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(scanResult.result)) {
|
||||||
|
const firstResult = scanResult.result.find(item => item);
|
||||||
|
if (typeof firstResult === 'string') {
|
||||||
|
return this.normalizeBarcode(firstResult);
|
||||||
|
}
|
||||||
|
if (firstResult && typeof firstResult.data === 'string') {
|
||||||
|
return this.normalizeBarcode(firstResult.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof scanResult.data === 'string') {
|
||||||
|
return this.normalizeBarcode(scanResult.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
extractBarcodeCandidates(item) {
|
||||||
|
const sourceList = [
|
||||||
|
item?.barcode,
|
||||||
|
item?.skuCode
|
||||||
|
];
|
||||||
|
const result = [];
|
||||||
|
sourceList.forEach(source => {
|
||||||
|
const text = String(source || '').trim();
|
||||||
|
if (!text) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
text
|
||||||
|
.split(/[;,,|\s]+/)
|
||||||
|
.map(part => this.normalizeBarcode(part))
|
||||||
|
.filter(part => !!part)
|
||||||
|
.forEach(part => result.push(part));
|
||||||
|
});
|
||||||
|
return Array.from(new Set(result));
|
||||||
|
},
|
||||||
|
handleBroadcastResult(result) {
|
||||||
|
const scanCode = this.normalizeScanResult(result);
|
||||||
|
if (!scanCode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const matchIndex = this.goodsList.findIndex(item => {
|
||||||
|
const candidates = this.extractBarcodeCandidates(item);
|
||||||
|
return candidates.includes(scanCode);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (matchIndex < 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '条码不匹配',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.currentGoodsIndex = matchIndex;
|
||||||
|
this.matchedGoodsId = String(this.goodsList[matchIndex]?.id || '');
|
||||||
|
if (this.matchedGoodsId) {
|
||||||
|
if (typeof this.$set === 'function') {
|
||||||
|
this.$set(this.matchedGoodsState, this.matchedGoodsId, true);
|
||||||
|
} else {
|
||||||
|
this.matchedGoodsState[this.matchedGoodsId] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uni.showToast({
|
||||||
|
title: '条码匹配成功',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toPositiveNumber(value, fallback = 0) {
|
||||||
|
const num = Number(value);
|
||||||
|
if (Number.isFinite(num) && num >= 0) {
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
return fallback;
|
||||||
|
},
|
||||||
|
getCachedScanOrderResult(cacheKey) {
|
||||||
|
const key = String(cacheKey || '').trim();
|
||||||
|
if (!key) {
|
||||||
|
return {
|
||||||
|
hasCache: false,
|
||||||
|
items: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
let cached = null;
|
||||||
|
try {
|
||||||
|
cached = uni.getStorageSync(key);
|
||||||
|
uni.removeStorageSync(key);
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('[ScatterPickGoodsDetail] 读取 scanOrder 缓存失败:', error);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cached || typeof cached !== 'object') {
|
||||||
|
return {
|
||||||
|
hasCache: true,
|
||||||
|
items: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
hasCache: true,
|
||||||
|
items: Array.isArray(cached.items) ? cached.items : []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
buildGoodsListByItems(items) {
|
||||||
|
const sourceList = Array.isArray(items) ? items : [];
|
||||||
|
return sourceList.map((item, index) => {
|
||||||
|
const snapshot = item?.item_snapshot && typeof item.item_snapshot === 'object'
|
||||||
|
? item.item_snapshot
|
||||||
|
: {};
|
||||||
|
const snapshotImages = [
|
||||||
|
...(Array.isArray(snapshot?.images) ? snapshot.images : []),
|
||||||
|
...(Array.isArray(snapshot?.image_list) ? snapshot.image_list : [])
|
||||||
|
]
|
||||||
|
.map(url => String(url || '').trim())
|
||||||
|
.filter(url => !!url);
|
||||||
|
const itemImages = (Array.isArray(item?.images) ? item.images : [])
|
||||||
|
.map(url => String(url || '').trim())
|
||||||
|
.filter(url => !!url);
|
||||||
|
const snapshotSingleImage = String(snapshot?.image || snapshot?.pic || '').trim();
|
||||||
|
const images = snapshotImages.length
|
||||||
|
? snapshotImages
|
||||||
|
: (snapshotSingleImage ? [snapshotSingleImage] : itemImages);
|
||||||
|
const imageUrl = images.length > 0 ? String(images[0] || '') : '';
|
||||||
|
const planQty = this.toPositiveNumber(item?.plan_qty, 0);
|
||||||
|
|
||||||
|
return {
|
||||||
|
id: String(item?.id || `${this.detailInfo.recordId || 'record'}-${index + 1}`),
|
||||||
|
lineNo: this.toPositiveNumber(item?.order_line_no, index + 1),
|
||||||
|
planQty,
|
||||||
|
skuCode: String(item?.item_code || snapshot?.item_code || ''),
|
||||||
|
skuName: String(snapshot?.item_name || item?.item_name || '--'),
|
||||||
|
location: String(snapshot?.sku_property || item?.sku_property || '--'),
|
||||||
|
barcode: String(snapshot?.barcode || snapshot?.item_code || item?.item_code || '--'),
|
||||||
|
imageUrl,
|
||||||
|
images,
|
||||||
|
pickedQty: 0
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getCurrentGoodsImageList() {
|
||||||
|
const list = Array.isArray(this.currentGoods?.images) ? this.currentGoods.images : [];
|
||||||
|
const normalizedList = list
|
||||||
|
.map(url => String(url || '').trim())
|
||||||
|
.filter(url => !!url);
|
||||||
|
const currentUrl = String(this.currentGoods?.imageUrl || '').trim();
|
||||||
|
if (!normalizedList.length && currentUrl) {
|
||||||
|
return [currentUrl];
|
||||||
|
}
|
||||||
|
return normalizedList;
|
||||||
|
},
|
||||||
|
getCurrentGoodsImageThumbList() {
|
||||||
|
return this.getCurrentGoodsImageList().slice(0, 4);
|
||||||
|
},
|
||||||
|
getCurrentGoodsImageGridList() {
|
||||||
|
const list = this.getCurrentGoodsImageList().slice(0, 4);
|
||||||
|
while (list.length < 4) {
|
||||||
|
list.push('');
|
||||||
|
}
|
||||||
|
return list.map(url => ({ url }));
|
||||||
|
},
|
||||||
|
getCurrentGoodsExtraImageCount() {
|
||||||
|
const total = this.getCurrentGoodsImageList().length;
|
||||||
|
return total > 4 ? total - 4 : 0;
|
||||||
|
},
|
||||||
togglePickListSection() {
|
togglePickListSection() {
|
||||||
this.showPickListSection = !this.showPickListSection;
|
this.showPickListSection = !this.showPickListSection;
|
||||||
},
|
},
|
||||||
handleComplete() {
|
handleComplete() {
|
||||||
uni.showToast({
|
if (this.isRecheckFinished) {
|
||||||
title: '已完成',
|
uni.showToast({
|
||||||
icon: 'none'
|
title: '该订单已复核完成',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.confirmRecheck();
|
||||||
|
},
|
||||||
|
getApiErrorMessage(error, fallback = '确认复核失败') {
|
||||||
|
const message = error?.message || error?.msg || error?.errMsg || error?.data?.message;
|
||||||
|
return String(message || fallback);
|
||||||
|
},
|
||||||
|
async confirmRecheck() {
|
||||||
|
if (this.confirmingRecheck) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const orderId = Number(this.detailInfo?.orderId || 0);
|
||||||
|
if (!orderId) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '缺少订单ID',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.confirmingRecheck = true;
|
||||||
|
uni.showLoading({
|
||||||
|
title: '确认复核中...'
|
||||||
});
|
});
|
||||||
|
try {
|
||||||
|
await this.$http('order.recheckOrder.confirmRecheck', {
|
||||||
|
order_id: orderId
|
||||||
|
});
|
||||||
|
uni.showToast({
|
||||||
|
title: '已确认复核',
|
||||||
|
icon: 'success'
|
||||||
|
});
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
}, 1500);
|
||||||
|
} catch (error) {
|
||||||
|
uni.showToast({
|
||||||
|
title: this.getApiErrorMessage(error, '确认复核失败'),
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
this.confirmingRecheck = false;
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getStatusText(status) {
|
getStatusText(status) {
|
||||||
const map = {
|
const map = {
|
||||||
@ -145,17 +504,37 @@
|
|||||||
buildMockGoodsList() {
|
buildMockGoodsList() {
|
||||||
return Array.from({ length: 5 }).map((_, index) => ({
|
return Array.from({ length: 5 }).map((_, index) => ({
|
||||||
id: `${this.detailInfo.recordId || 'record'}-${index + 1}`,
|
id: `${this.detailInfo.recordId || 'record'}-${index + 1}`,
|
||||||
orderCount: (index % 4) + 1,
|
lineNo: (index % 4) + 1,
|
||||||
productQty: (index % 6) + 2,
|
planQty: (index % 6) + 2,
|
||||||
skuCode: `SKU${String(index + 1).padStart(4, '0')}`,
|
skuCode: `SKU${String(index + 1).padStart(4, '0')}`,
|
||||||
skuName: `模拟商品${index + 1}`,
|
skuName: `模拟商品${index + 1}`,
|
||||||
location: `A-${String(index + 1).padStart(2, '0')}`,
|
location: `A-${String(index + 1).padStart(2, '0')}`,
|
||||||
barcode: `6900000000${String(index + 1).padStart(3, '0')}`,
|
barcode: `6900000000${String(index + 1).padStart(3, '0')}`,
|
||||||
imageUrl: '',
|
imageUrl: '',
|
||||||
needQty: (index % 3) + 1,
|
images: [],
|
||||||
pickedQty: 0
|
pickedQty: 0
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
previewCurrentGoodsImage() {
|
||||||
|
const imageList = Array.isArray(this.currentGoods?.images)
|
||||||
|
? this.currentGoods.images.filter(url => String(url || '').trim())
|
||||||
|
: [];
|
||||||
|
const currentUrl = String(this.currentGoods?.imageUrl || '').trim();
|
||||||
|
const urls = imageList.length ? imageList : (currentUrl ? [currentUrl] : []);
|
||||||
|
|
||||||
|
if (!urls.length) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '暂无图片可预览',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.previewImage({
|
||||||
|
current: currentUrl || urls[0],
|
||||||
|
urls
|
||||||
|
});
|
||||||
|
},
|
||||||
selectGoods(index) {
|
selectGoods(index) {
|
||||||
const next = Number(index);
|
const next = Number(index);
|
||||||
if (Number.isNaN(next) || next < 0 || next >= this.goodsList.length) {
|
if (Number.isNaN(next) || next < 0 || next >= this.goodsList.length) {
|
||||||
@ -213,11 +592,8 @@
|
|||||||
.page-head-item {
|
.page-head-item {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
align-items: center;
|
||||||
}
|
min-width: 0;
|
||||||
|
|
||||||
.page-head-item--right {
|
|
||||||
align-items: flex-end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-head-label {
|
.page-head-label {
|
||||||
@ -226,19 +602,27 @@
|
|||||||
color: #909399;
|
color: #909399;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
flex-shrink: 0;
|
||||||
white-space: nowrap !important;
|
white-space: nowrap !important;
|
||||||
word-break: keep-all;
|
word-break: keep-all;
|
||||||
overflow-wrap: normal;
|
overflow-wrap: normal;
|
||||||
overflow: hidden;
|
}
|
||||||
text-overflow: ellipsis;
|
|
||||||
|
.page-head-label::after {
|
||||||
|
content: ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-head-value {
|
.page-head-value {
|
||||||
margin-top: 4rpx;
|
margin-left: 8rpx;
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
line-height: 46rpx;
|
line-height: 46rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
.goods-row {
|
.goods-row {
|
||||||
@ -250,6 +634,18 @@
|
|||||||
line-height: 54rpx;
|
line-height: 54rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.goods-row--barcode-highlight {
|
||||||
|
background: #f0fff4;
|
||||||
|
border: 1rpx solid #b7eb8f;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
padding: 0 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-row--barcode-highlight .label,
|
||||||
|
.goods-row--barcode-highlight .value {
|
||||||
|
color: #52c41a;
|
||||||
|
}
|
||||||
|
|
||||||
.goods-row:first-child {
|
.goods-row:first-child {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
@ -264,8 +660,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
width: 180rpx;
|
width: 110rpx;
|
||||||
min-width: 180rpx;
|
min-width: 110rpx;
|
||||||
color: #909399;
|
color: #909399;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -321,10 +717,91 @@
|
|||||||
gap: 16rpx;
|
gap: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.goods-image {
|
.goods-thumb {
|
||||||
|
width: 300rpx;
|
||||||
|
height: 300rpx;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.goods-image {
|
||||||
|
width: 300rpx;
|
||||||
|
height: 300rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #f5f7fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-image-grid {
|
||||||
|
width: 300rpx;
|
||||||
|
height: 300rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-cell {
|
||||||
|
position: relative;
|
||||||
|
width: 145rpx;
|
||||||
|
height: 145rpx;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #f5f7fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-cell--empty {
|
||||||
|
border: 1rpx dashed #dcdfe6;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 10rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-placeholder {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: #f5f7fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-placeholder--large {
|
||||||
|
height: 300rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-placeholder--small {
|
||||||
|
height: 145rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-placeholder--empty {
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.more-mask {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: rgba(0, 0, 0, 0.35);
|
||||||
|
}
|
||||||
|
|
||||||
|
.more-text {
|
||||||
|
font-size: 34rpx;
|
||||||
|
line-height: 1;
|
||||||
|
color: #ffffff;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
.goods-name {
|
.goods-name {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
@ -395,6 +872,11 @@
|
|||||||
border-color: #2979ff;
|
border-color: #2979ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.metric-card-btn--matched {
|
||||||
|
background: #f6ffed;
|
||||||
|
border-color: #52c41a;
|
||||||
|
}
|
||||||
|
|
||||||
.order-corner {
|
.order-corner {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
<scroll-view class="detail-scroll" scroll-y>
|
<scroll-view class="detail-scroll" scroll-y>
|
||||||
<view v-if="displayOrderList.length === 0" class="empty-state">
|
<view v-if="displayOrderList.length === 0" class="empty-state">
|
||||||
<u-icon name="list" size="86" color="#c0c4cc"></u-icon>
|
<u-icon name="list" size="86" color="#c0c4cc"></u-icon>
|
||||||
<text class="empty-text">暂无可拣货散单</text>
|
<text class="empty-text">暂无未复核订单</text>
|
||||||
</view>
|
</view>
|
||||||
<view v-else class="record-list">
|
<view v-else class="record-list">
|
||||||
<view v-for="item in displayOrderList" :key="item.id" class="record-item" @click="goPickGoodsDetail(item)">
|
<view v-for="item in displayOrderList" :key="item.id" class="record-item" @click="goPickGoodsDetail(item)">
|
||||||
@ -246,13 +246,7 @@
|
|||||||
buildScanOrderParams(keyword) {
|
buildScanOrderParams(keyword) {
|
||||||
const value = this.normalizeKeyword(keyword);
|
const value = this.normalizeKeyword(keyword);
|
||||||
return {
|
return {
|
||||||
keyword: value,
|
keyword: value
|
||||||
value,
|
|
||||||
waybill_no: value,
|
|
||||||
waybillCode: value,
|
|
||||||
waybill_code: value,
|
|
||||||
cart_code: value,
|
|
||||||
cartCode: value
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
extractScanOrderPayload(response) {
|
extractScanOrderPayload(response) {
|
||||||
@ -272,7 +266,25 @@
|
|||||||
},
|
},
|
||||||
normalizeScanOrderResult(payload) {
|
normalizeScanOrderResult(payload) {
|
||||||
const order = payload?.order && typeof payload.order === 'object' ? payload.order : {};
|
const order = payload?.order && typeof payload.order === 'object' ? payload.order : {};
|
||||||
const orderId = Number(payload?.order_id || order?.order_id || order?.id || 0);
|
const items = Array.isArray(payload?.items) ? payload.items : [];
|
||||||
|
const firstItem = items[0] && typeof items[0] === 'object' ? items[0] : {};
|
||||||
|
const orderId = Number(
|
||||||
|
payload?.order_id
|
||||||
|
|| payload?.orderId
|
||||||
|
|| order?.order_id
|
||||||
|
|| order?.orderId
|
||||||
|
|| order?.id
|
||||||
|
|| firstItem?.order_id
|
||||||
|
|| firstItem?.orderId
|
||||||
|
|| 0
|
||||||
|
);
|
||||||
|
const recheckStatus = String(
|
||||||
|
payload?.recheck_status
|
||||||
|
|| payload?.recheckStatus
|
||||||
|
|| order?.recheck_status
|
||||||
|
|| order?.recheckStatus
|
||||||
|
|| ''
|
||||||
|
).trim().toLowerCase();
|
||||||
const waybillNo = String(
|
const waybillNo = String(
|
||||||
payload?.waybill_no
|
payload?.waybill_no
|
||||||
|| order?.waybill_no
|
|| order?.waybill_no
|
||||||
@ -289,9 +301,10 @@
|
|||||||
matchType,
|
matchType,
|
||||||
cartMatchView,
|
cartMatchView,
|
||||||
orderId,
|
orderId,
|
||||||
|
recheckStatus,
|
||||||
waybillNo,
|
waybillNo,
|
||||||
order,
|
order,
|
||||||
items: Array.isArray(payload?.items) ? payload.items : [],
|
items,
|
||||||
expresses: Array.isArray(payload?.expresses) ? payload.expresses : [],
|
expresses: Array.isArray(payload?.expresses) ? payload.expresses : [],
|
||||||
logs: Array.isArray(payload?.logs) ? payload.logs : []
|
logs: Array.isArray(payload?.logs) ? payload.logs : []
|
||||||
};
|
};
|
||||||
@ -307,6 +320,20 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (String(result?.recheckStatus || '').toLowerCase() === 'fin') {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '该订单已复核完成,禁止再次进入',
|
||||||
|
showCancel: false,
|
||||||
|
success: () => {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (result?.matchType === 'cart') {
|
if (result?.matchType === 'cart') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '车号命中,已定位订单',
|
title: '车号命中,已定位订单',
|
||||||
@ -314,6 +341,17 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cacheKey = `scatter_scan_order_${Date.now()}_${orderId}`;
|
||||||
|
try {
|
||||||
|
uni.setStorageSync(cacheKey, {
|
||||||
|
items: Array.isArray(result?.items) ? result.items : [],
|
||||||
|
expresses: Array.isArray(result?.expresses) ? result.expresses : [],
|
||||||
|
logs: Array.isArray(result?.logs) ? result.logs : []
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('[ScatterPickingDetail] 缓存 scanOrder 结果失败:', error);
|
||||||
|
}
|
||||||
|
|
||||||
const params = [
|
const params = [
|
||||||
`recordId=${encodeURIComponent(String(orderId))}`,
|
`recordId=${encodeURIComponent(String(orderId))}`,
|
||||||
`orderId=${encodeURIComponent(String(orderId))}`,
|
`orderId=${encodeURIComponent(String(orderId))}`,
|
||||||
@ -321,9 +359,11 @@
|
|||||||
`pickerName=${encodeURIComponent(String(order?.picker_name || order?.pickerName || '--'))}`,
|
`pickerName=${encodeURIComponent(String(order?.picker_name || order?.pickerName || '--'))}`,
|
||||||
`cartNo=${encodeURIComponent(String(order?.cart_code || order?.cartCode || order?.cart_no || order?.cartNo || '--'))}`,
|
`cartNo=${encodeURIComponent(String(order?.cart_code || order?.cartCode || order?.cart_no || order?.cartNo || '--'))}`,
|
||||||
`status=${encodeURIComponent(String(order?.status || 'pending'))}`,
|
`status=${encodeURIComponent(String(order?.status || 'pending'))}`,
|
||||||
|
`recheckStatus=${encodeURIComponent(String(result?.recheckStatus || order?.recheck_status || ''))}`,
|
||||||
`unreviewedCount=${encodeURIComponent(String(order?.unreviewed_count || order?.unreviewedCount || 0))}`,
|
`unreviewedCount=${encodeURIComponent(String(order?.unreviewed_count || order?.unreviewedCount || 0))}`,
|
||||||
`waybillNo=${encodeURIComponent(String(result?.waybillNo || '--'))}`,
|
`waybillNo=${encodeURIComponent(String(result?.waybillNo || '--'))}`,
|
||||||
`matchType=${encodeURIComponent(String(result?.matchType || ''))}`
|
`matchType=${encodeURIComponent(String(result?.matchType || ''))}`,
|
||||||
|
`cacheKey=${encodeURIComponent(cacheKey)}`
|
||||||
];
|
];
|
||||||
this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`);
|
this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`);
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user