feat: 新增团购拣货详情页面并完善拣货流程入口
This commit is contained in:
parent
32759f820c
commit
b3d545b1c8
@ -177,6 +177,13 @@
|
|||||||
"titleNView": false
|
"titleNView": false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path" : "pages/work/order/groupon-picking-detail",
|
||||||
|
"style" :
|
||||||
|
{
|
||||||
|
"titleNView": false
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/work/order/scatter-pick-goods-detail",
|
"path" : "pages/work/order/scatter-pick-goods-detail",
|
||||||
"style" :
|
"style" :
|
||||||
|
|||||||
@ -315,6 +315,7 @@
|
|||||||
const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询'));
|
const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询'));
|
||||||
const isOrderPicking = menuName === '订单拣货' || (menuName.includes('订单') && menuName.includes('拣货'));
|
const isOrderPicking = menuName === '订单拣货' || (menuName.includes('订单') && menuName.includes('拣货'));
|
||||||
const isScatterWaveStrategy = menuName === '散单波次策略' || (menuName.includes('散单') && menuName.includes('波次'));
|
const isScatterWaveStrategy = menuName === '散单波次策略' || (menuName.includes('散单') && menuName.includes('波次'));
|
||||||
|
const isGrouponPickingDetail = menuName === '团购拣货详情' || (menuName.includes('团购') && menuName.includes('拣货') && menuName.includes('详情'));
|
||||||
const rawPath = item?.component || item?.path || '';
|
const rawPath = item?.component || item?.path || '';
|
||||||
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
||||||
const isRelocation = menuName === '移库作业' || normalizedPath === '/pages/work/storage/relocation';
|
const isRelocation = menuName === '移库作业' || normalizedPath === '/pages/work/storage/relocation';
|
||||||
@ -330,7 +331,9 @@
|
|||||||
? '/pages/work/product/query'
|
? '/pages/work/product/query'
|
||||||
: (isOrderPicking
|
: (isOrderPicking
|
||||||
? '/pages/work/order/picking'
|
? '/pages/work/order/picking'
|
||||||
: (isScatterWaveStrategy ? '/pages/work/order/scatter-wave-strategy' : normalizedPath));
|
: (isScatterWaveStrategy
|
||||||
|
? '/pages/work/order/scatter-wave-strategy'
|
||||||
|
: (isGrouponPickingDetail ? '/pages/work/order/groupon-picking-detail' : normalizedPath)));
|
||||||
|
|
||||||
if (!targetPath) {
|
if (!targetPath) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
@ -1150,6 +1150,7 @@
|
|||||||
const isOrderPicking = menuName === '订单拣货' || (menuName.includes('订单') && menuName.includes('拣货'));
|
const isOrderPicking = menuName === '订单拣货' || (menuName.includes('订单') && menuName.includes('拣货'));
|
||||||
const isScatterWaveStrategy = menuName === '散单波次策略' || (menuName.includes('散单') && menuName.includes('波次'));
|
const isScatterWaveStrategy = menuName === '散单波次策略' || (menuName.includes('散单') && menuName.includes('波次'));
|
||||||
const isScatterPickingDetail = menuName === '散单拣货详情' || (menuName.includes('散单') && menuName.includes('拣货') && menuName.includes('详情'));
|
const isScatterPickingDetail = menuName === '散单拣货详情' || (menuName.includes('散单') && menuName.includes('拣货') && menuName.includes('详情'));
|
||||||
|
const isGrouponPickingDetail = menuName === '团购拣货详情' || (menuName.includes('团购') && menuName.includes('拣货') && menuName.includes('详情'));
|
||||||
const rawPath = item?.component || item?.path || '';
|
const rawPath = item?.component || item?.path || '';
|
||||||
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
|
||||||
const isRelocation = menuName === '移库作业' || normalizedPath === '/pages/work/storage/relocation';
|
const isRelocation = menuName === '移库作业' || normalizedPath === '/pages/work/storage/relocation';
|
||||||
@ -1167,7 +1168,9 @@
|
|||||||
? '/pages/work/order/picking'
|
? '/pages/work/order/picking'
|
||||||
: (isScatterWaveStrategy
|
: (isScatterWaveStrategy
|
||||||
? '/pages/work/order/scatter-wave-strategy'
|
? '/pages/work/order/scatter-wave-strategy'
|
||||||
: (isScatterPickingDetail ? '/pages/work/order/scatter-picking-detail' : normalizedPath)));
|
: (isScatterPickingDetail
|
||||||
|
? '/pages/work/order/scatter-picking-detail'
|
||||||
|
: (isGrouponPickingDetail ? '/pages/work/order/groupon-picking-detail' : normalizedPath))));
|
||||||
|
|
||||||
if (!targetPath) {
|
if (!targetPath) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|||||||
229
pages/work/order/groupon-picking-detail.vue
Normal file
229
pages/work/order/groupon-picking-detail.vue
Normal file
@ -0,0 +1,229 @@
|
|||||||
|
<template>
|
||||||
|
<view class="groupon-picking-detail-page">
|
||||||
|
<view class="normar_container">
|
||||||
|
<page-nav :title="title">
|
||||||
|
<template #right>
|
||||||
|
<view class="nav-right-action" :class="{ 'nav-right-action--active': onlyMine }" @click="toggleOnlyMine">{{ onlyMine ? '查看全部' : '只看我的' }}</view>
|
||||||
|
</template>
|
||||||
|
</page-nav>
|
||||||
|
|
||||||
|
<scroll-view class="detail-scroll" scroll-y>
|
||||||
|
<view v-if="displayOrderList.length === 0" class="empty-state">
|
||||||
|
<u-icon name="list" size="86" color="#c0c4cc"></u-icon>
|
||||||
|
<text class="empty-text">暂无可拣货团购单</text>
|
||||||
|
</view>
|
||||||
|
<view v-else class="record-list">
|
||||||
|
<view v-for="item in displayOrderList" :key="item.id" class="record-item">
|
||||||
|
<view class="record-main">
|
||||||
|
<view class="record-left">
|
||||||
|
<view class="record-line"><text class="record-label">波次号:</text><text class="record-value">{{ item.waveNo || '--' }}</text></view>
|
||||||
|
<view class="record-line"><text class="record-label">拣货员:</text><text class="record-value">{{ item.pickerName || '--' }}</text></view>
|
||||||
|
</view>
|
||||||
|
<view class="record-right">
|
||||||
|
<text class="record-count">未复核 {{ item.pendingCount }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="record-footer">
|
||||||
|
<u-button
|
||||||
|
type="primary"
|
||||||
|
size="mini"
|
||||||
|
:customStyle="{ backgroundColor: '#2979ff', borderColor: '#2979ff', fontSize: '26rpx', height: '64rpx', lineHeight: '64rpx', padding: '0 20rpx' }"
|
||||||
|
@click="showRecordDetail(item)"
|
||||||
|
>
|
||||||
|
打印面单
|
||||||
|
</u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="safe-area-bottom"></view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
title: '团购拣货详情',
|
||||||
|
onlyMine: false,
|
||||||
|
currentUserId: '',
|
||||||
|
grabCount: 0,
|
||||||
|
orderList: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
displayOrderList() {
|
||||||
|
if (!this.onlyMine) {
|
||||||
|
return this.orderList;
|
||||||
|
}
|
||||||
|
return this.orderList.filter(item => item.isMine);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad(options) {
|
||||||
|
this.currentUserId = String(this.$store?.getters?.user?.id || this.$store?.getters?.user?.user_id || '').trim();
|
||||||
|
const hasGrabCountParam = options && Object.prototype.hasOwnProperty.call(options, 'grabCount');
|
||||||
|
const parsedGrabCount = Number(options?.grabCount || 0);
|
||||||
|
this.grabCount = hasGrabCountParam ? Math.max(0, parsedGrabCount) : 6;
|
||||||
|
this.orderList = this.buildMockOrderList(this.grabCount);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
toggleOnlyMine() {
|
||||||
|
this.onlyMine = !this.onlyMine;
|
||||||
|
},
|
||||||
|
buildMockOrderList(count) {
|
||||||
|
const listCount = Math.max(0, Number(count || 0));
|
||||||
|
return Array.from({ length: listCount }).map((_, index) => {
|
||||||
|
const waveNo = `GW${new Date().getFullYear()}${String(index + 1).padStart(4, '0')}`;
|
||||||
|
const orderNo = `TG${Date.now().toString().slice(-6)}${String(index + 1).padStart(2, '0')}`;
|
||||||
|
const isMine = index % 2 === 0;
|
||||||
|
return {
|
||||||
|
id: `${orderNo}-${index + 1}`,
|
||||||
|
waveNo,
|
||||||
|
pickerName: isMine ? '我' : `拣货员${(index % 3) + 1}`,
|
||||||
|
pendingCount: (index % 5) + 1,
|
||||||
|
isMine
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
showRecordDetail(item) {
|
||||||
|
if (!item) return;
|
||||||
|
uni.showModal({
|
||||||
|
title: '打印面单',
|
||||||
|
showCancel: false,
|
||||||
|
content: [
|
||||||
|
`波次号:${item.waveNo || '--'}`,
|
||||||
|
`拣货员:${item.pickerName || '--'}`,
|
||||||
|
`未复核数量:${item.pendingCount || 0}`
|
||||||
|
].join('\n')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.groupon-picking-detail-page {
|
||||||
|
min-height: 100vh;
|
||||||
|
background: #f8f9fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
::v-deep .nav-title .right {
|
||||||
|
width: auto;
|
||||||
|
min-width: 136rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-right-action {
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 36rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
padding: 8rpx 18rpx;
|
||||||
|
border-radius: 6rpx;
|
||||||
|
background: #2979ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-right-action--active {
|
||||||
|
background: #1f67e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-scroll {
|
||||||
|
height: calc(100vh - 120rpx - env(safe-area-inset-bottom));
|
||||||
|
padding: 20rpx 24rpx 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 14rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-item {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
padding: 18rpx;
|
||||||
|
border: 1rpx solid #ebeef5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-main {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-left {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-line {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 32rpx;
|
||||||
|
line-height: 52rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-line + .record-line {
|
||||||
|
margin-top: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-label {
|
||||||
|
width: 170rpx;
|
||||||
|
min-width: 170rpx;
|
||||||
|
color: #909399;
|
||||||
|
white-space: nowrap;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-value {
|
||||||
|
flex: 1;
|
||||||
|
color: #303133;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-right {
|
||||||
|
min-width: 180rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-end;
|
||||||
|
margin-left: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-count {
|
||||||
|
font-size: 30rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
color: #fa8c16;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-status {
|
||||||
|
margin-top: 12rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
color: #2979ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.record-footer {
|
||||||
|
margin-top: 14rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
margin-top: 18rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #909399;
|
||||||
|
}
|
||||||
|
|
||||||
|
.safe-area-bottom {
|
||||||
|
height: calc(30rpx + env(safe-area-inset-bottom));
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<view class="empty-card">
|
<view class="empty-card">
|
||||||
<u-icon name="scan" size="72rpx" color="#2979ff"></u-icon>
|
<u-icon name="scan" size="72rpx" color="#2979ff"></u-icon>
|
||||||
<text class="empty-title">开始拣货</text>
|
<text class="empty-title">开始拣货</text>
|
||||||
<text class="empty-desc">扫描快递号或拣货单开始拣货</text>
|
<text class="empty-desc">扫描快递单号或波次号开始拣货</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -53,8 +53,31 @@
|
|||||||
<view v-else class="pick-card">
|
<view v-else class="pick-card">
|
||||||
<view class="detail-main">
|
<view class="detail-main">
|
||||||
<view class="detail-main-left">
|
<view class="detail-main-left">
|
||||||
|
<view
|
||||||
|
v-if="getSelectedImageList().length > 1"
|
||||||
|
class="goods-image-grid"
|
||||||
|
@click="previewSelectedItemImage"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
v-for="(img, imgIndex) in getSelectedImageThumbList()"
|
||||||
|
:key="img + '-' + imgIndex"
|
||||||
|
class="pick-grid-cell"
|
||||||
|
>
|
||||||
|
<u-image
|
||||||
|
class="pick-grid-image"
|
||||||
|
:src="img"
|
||||||
|
mode="aspectFill"
|
||||||
|
width="58rpx"
|
||||||
|
height="58rpx"
|
||||||
|
></u-image>
|
||||||
|
<view v-if="imgIndex === 3 && getSelectedImageExtraCount() > 0" class="pick-more-mask">
|
||||||
|
<text class="pick-more-text">+{{ getSelectedImageExtraCount() }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<u-image
|
<u-image
|
||||||
v-if="selectedItemImageUrl"
|
v-else-if="selectedItemImageUrl"
|
||||||
|
class="goods-image"
|
||||||
:src="selectedItemImageUrl"
|
:src="selectedItemImageUrl"
|
||||||
width="120rpx"
|
width="120rpx"
|
||||||
height="120rpx"
|
height="120rpx"
|
||||||
@ -63,7 +86,7 @@
|
|||||||
></u-image>
|
></u-image>
|
||||||
<view v-else class="pick-image-empty">{{ selectedItemImageLoading ? '图片加载中...' : '暂无商品图片' }}</view>
|
<view v-else class="pick-image-empty">{{ selectedItemImageLoading ? '图片加载中...' : '暂无商品图片' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="detail-main-right">
|
<view class="detail-main-right" @click="goProductQueryByCurrentBarcode">
|
||||||
<view class="pick-card__head">
|
<view class="pick-card__head">
|
||||||
<text class="pick-name">{{ selectedPickItem.itemName || '--' }}</text>
|
<text class="pick-name">{{ selectedPickItem.itemName || '--' }}</text>
|
||||||
</view>
|
</view>
|
||||||
@ -236,6 +259,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
|
this.$store.dispatch('broadcast/setCallbacks', {
|
||||||
|
onResult: this.handleBroadcastScan
|
||||||
|
});
|
||||||
|
this.$store.dispatch('broadcast/start');
|
||||||
|
|
||||||
const incomingTaskId = options?.taskId || options?.task_id || '';
|
const incomingTaskId = options?.taskId || options?.task_id || '';
|
||||||
if (incomingTaskId !== '') {
|
if (incomingTaskId !== '') {
|
||||||
this.taskId = String(incomingTaskId || '').trim();
|
this.taskId = String(incomingTaskId || '').trim();
|
||||||
@ -244,7 +272,191 @@
|
|||||||
}
|
}
|
||||||
this.requestCurrentWavePickTask();
|
this.requestCurrentWavePickTask();
|
||||||
},
|
},
|
||||||
|
onShow() {
|
||||||
|
this.$store.dispatch('broadcast/resume');
|
||||||
|
},
|
||||||
|
onHide() {
|
||||||
|
this.$store.dispatch('broadcast/stop');
|
||||||
|
},
|
||||||
|
onUnload() {
|
||||||
|
this.$store.dispatch('broadcast/stop');
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getSelectedImageList() {
|
||||||
|
if (Array.isArray(this.selectedItemImageUrls) && this.selectedItemImageUrls.length) {
|
||||||
|
return this.selectedItemImageUrls;
|
||||||
|
}
|
||||||
|
if (this.selectedItemImageUrl) {
|
||||||
|
return [this.selectedItemImageUrl];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
getSelectedImageThumbList() {
|
||||||
|
return this.getSelectedImageList().slice(0, 4);
|
||||||
|
},
|
||||||
|
getSelectedImageExtraCount() {
|
||||||
|
const total = this.getSelectedImageList().length;
|
||||||
|
return total > 4 ? total - 4 : 0;
|
||||||
|
},
|
||||||
|
normalizeScanResult(scanResult) {
|
||||||
|
if (!scanResult) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (typeof scanResult === 'string') {
|
||||||
|
return scanResult.trim();
|
||||||
|
}
|
||||||
|
if (typeof scanResult?.result === 'string') {
|
||||||
|
return scanResult.result.trim();
|
||||||
|
}
|
||||||
|
if (typeof scanResult?.data === 'string') {
|
||||||
|
return scanResult.data.trim();
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
handleScanKeywordEntry(rawKeyword) {
|
||||||
|
const scanText = this.normalizeScanResult(rawKeyword);
|
||||||
|
if (!scanText) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '未识别到有效条码',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.keyword = scanText;
|
||||||
|
if (!this.hasActiveTask) {
|
||||||
|
this.requestPickTaskByKeyword(scanText);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.handleSearch();
|
||||||
|
},
|
||||||
|
handleBroadcastScan(payload) {
|
||||||
|
const scanText = this.normalizeScanResult(payload);
|
||||||
|
if (!this.hasActiveTask) {
|
||||||
|
this.handleScanKeywordEntry(scanText);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
extractTaskIdCandidate(rawValue) {
|
||||||
|
if (rawValue === null || rawValue === undefined || rawValue === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const taskId = Number(rawValue);
|
||||||
|
if (!Number.isFinite(taskId) || taskId <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return taskId;
|
||||||
|
},
|
||||||
|
extractTaskIdFromPickQueryResponse(response) {
|
||||||
|
const payload = response?.data?.data || response?.data || response?.result || response || {};
|
||||||
|
const candidates = [
|
||||||
|
payload?.task_id,
|
||||||
|
payload?.taskId,
|
||||||
|
payload?.existing_task_id,
|
||||||
|
payload?.created_task_id,
|
||||||
|
payload?.existing?.task_id,
|
||||||
|
payload?.existing?.taskId,
|
||||||
|
payload?.created?.task_id,
|
||||||
|
payload?.created?.taskId,
|
||||||
|
payload?.task?.task_id,
|
||||||
|
payload?.task?.taskId
|
||||||
|
];
|
||||||
|
for (let i = 0; i < candidates.length; i += 1) {
|
||||||
|
const resolvedTaskId = this.extractTaskIdCandidate(candidates[i]);
|
||||||
|
if (resolvedTaskId) {
|
||||||
|
return resolvedTaskId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
extractPickTaskConflictInfo(error) {
|
||||||
|
const responseData = error?.data || error?.response?.data || {};
|
||||||
|
const payload = responseData?.data || responseData || {};
|
||||||
|
const message = String(
|
||||||
|
payload?.message ||
|
||||||
|
payload?.msg ||
|
||||||
|
responseData?.message ||
|
||||||
|
responseData?.msg ||
|
||||||
|
error?.message ||
|
||||||
|
''
|
||||||
|
).trim();
|
||||||
|
const code = String(payload?.code || responseData?.code || error?.code || '').toLowerCase();
|
||||||
|
const creatorName = String(
|
||||||
|
payload?.creator_name ||
|
||||||
|
payload?.owner_name ||
|
||||||
|
payload?.task_creator_name ||
|
||||||
|
payload?.creator?.real_name ||
|
||||||
|
payload?.creator?.name ||
|
||||||
|
''
|
||||||
|
).trim();
|
||||||
|
const taskId = this.extractTaskIdCandidate(
|
||||||
|
payload?.task_id ?? payload?.existing_task_id ?? payload?.task?.task_id ?? null
|
||||||
|
);
|
||||||
|
const identifyText = `${code} ${message}`.toLowerCase();
|
||||||
|
const isConflict = identifyText.includes('conflict') || identifyText.includes('owner') || identifyText.includes('创建人') || identifyText.includes('归属') || identifyText.includes('非当前用户') || identifyText.includes('非本人');
|
||||||
|
return {
|
||||||
|
isConflict,
|
||||||
|
creatorName,
|
||||||
|
taskId,
|
||||||
|
message
|
||||||
|
};
|
||||||
|
},
|
||||||
|
buildPickTaskConflictMessage(conflictInfo) {
|
||||||
|
const lines = ['该拣货任务已被其他人员占用'];
|
||||||
|
if (conflictInfo?.creatorName) {
|
||||||
|
lines.push(`创建人:${conflictInfo.creatorName}`);
|
||||||
|
}
|
||||||
|
if (conflictInfo?.taskId) {
|
||||||
|
lines.push(`任务ID:${conflictInfo.taskId}`);
|
||||||
|
}
|
||||||
|
if (conflictInfo?.message) {
|
||||||
|
lines.push(conflictInfo.message);
|
||||||
|
}
|
||||||
|
return lines.join('\n');
|
||||||
|
},
|
||||||
|
async requestPickTaskByKeyword(keyword) {
|
||||||
|
const normalizedKeyword = String(keyword || '').trim();
|
||||||
|
if (!normalizedKeyword) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请输入运单号或波次号',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showLoading({
|
||||||
|
title: '正在查询任务...'
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
const response = await this.$http('pick.query', {
|
||||||
|
keyword: normalizedKeyword
|
||||||
|
});
|
||||||
|
const taskId = this.extractTaskIdFromPickQueryResponse(response);
|
||||||
|
if (!taskId) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '未查询到可拣货任务',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.taskId = String(taskId);
|
||||||
|
this.keyword = '';
|
||||||
|
await this.requestWavePickTaskDetail();
|
||||||
|
} catch (error) {
|
||||||
|
const conflictInfo = this.extractPickTaskConflictInfo(error);
|
||||||
|
if (conflictInfo.isConflict) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '任务归属冲突',
|
||||||
|
content: this.buildPickTaskConflictMessage(conflictInfo),
|
||||||
|
showCancel: false
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.showToast({
|
||||||
|
title: this.getApiErrorMessage(error, '任务查询失败'),
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
} finally {
|
||||||
|
uni.hideLoading();
|
||||||
|
}
|
||||||
|
},
|
||||||
openActionSheet() {
|
openActionSheet() {
|
||||||
if (!this.hasActiveTask) {
|
if (!this.hasActiveTask) {
|
||||||
return;
|
return;
|
||||||
@ -364,10 +576,7 @@
|
|||||||
this.requestWavePickTaskDetail();
|
this.requestWavePickTaskDetail();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.showToast({
|
return;
|
||||||
title: '请扫描面单或拣货单进入拣货流程',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: this.getApiErrorMessage(error, '请扫描面单或拣货单进入拣货流程'),
|
title: this.getApiErrorMessage(error, '请扫描面单或拣货单进入拣货流程'),
|
||||||
@ -637,7 +846,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSearch() {
|
handleSearch() {
|
||||||
this.keyword = String(this.keyword || '').trim();
|
const normalizedKeyword = String(this.keyword || '').trim();
|
||||||
|
this.keyword = normalizedKeyword;
|
||||||
|
if (!this.hasActiveTask) {
|
||||||
|
this.requestPickTaskByKeyword(normalizedKeyword);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
selectPickItem(index) {
|
selectPickItem(index) {
|
||||||
this.selectedIndex = Number(index || 0);
|
this.selectedIndex = Number(index || 0);
|
||||||
@ -652,21 +865,32 @@
|
|||||||
const currentIndex = this.selectedItemImageUrl ? Math.max(urls.indexOf(this.selectedItemImageUrl), 0) : 0;
|
const currentIndex = this.selectedItemImageUrl ? Math.max(urls.indexOf(this.selectedItemImageUrl), 0) : 0;
|
||||||
this.$tools.previewImage(urls, currentIndex);
|
this.$tools.previewImage(urls, currentIndex);
|
||||||
},
|
},
|
||||||
|
goProductQueryByCurrentBarcode() {
|
||||||
|
if (this.selectedItemBarcodeLoading) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '条码加载中,请稍后',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const barcode = String(this.selectedItemBarcode || '').trim();
|
||||||
|
if (!barcode) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '当前商品暂无条码',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/work/product/query?keyword=${encodeURIComponent(barcode)}`
|
||||||
|
});
|
||||||
|
},
|
||||||
handleCameraScan() {
|
handleCameraScan() {
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
onlyFromCamera: true,
|
onlyFromCamera: true,
|
||||||
scanType: ['barCode', 'qrCode'],
|
scanType: ['barCode', 'qrCode'],
|
||||||
success: res => {
|
success: res => {
|
||||||
const scanText = String(res?.result || '').trim();
|
this.handleScanKeywordEntry(res);
|
||||||
if (!scanText) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '未识别到有效条码',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.keyword = scanText;
|
|
||||||
this.handleSearch();
|
|
||||||
},
|
},
|
||||||
fail: () => {
|
fail: () => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -899,9 +1123,57 @@
|
|||||||
min-width: 120rpx;
|
min-width: 120rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.goods-image {
|
||||||
|
border-radius: 10rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #f5f7fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.goods-image-grid {
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pick-grid-cell {
|
||||||
|
position: relative;
|
||||||
|
width: 58rpx;
|
||||||
|
height: 58rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #f5f7fa;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pick-grid-image {
|
||||||
|
border-radius: 8rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pick-more-mask {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0, 0, 0, 0.45);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pick-more-text {
|
||||||
|
font-size: 22rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
.detail-main-right {
|
.detail-main-right {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pick-image-empty {
|
.pick-image-empty {
|
||||||
|
|||||||
@ -284,12 +284,21 @@
|
|||||||
return this.pageHeaderHeight + summaryHeight + summaryGap + visualOffset;
|
return this.pageHeaderHeight + summaryHeight + summaryGap + visualOffset;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad(options) {
|
||||||
this.safeDispatchBroadcast('setCallbacks', {
|
this.safeDispatchBroadcast('setCallbacks', {
|
||||||
onResult: this.handleBroadcastResult
|
onResult: this.handleBroadcastResult
|
||||||
});
|
});
|
||||||
this.safeDispatchBroadcast('start');
|
this.safeDispatchBroadcast('start');
|
||||||
|
const routeKeyword = this.normalizeKeyword(options?.keyword || options?.barcode || options?.code || '');
|
||||||
|
if (routeKeyword) {
|
||||||
|
this.keyword = routeKeyword;
|
||||||
|
}
|
||||||
this.list = [];
|
this.list = [];
|
||||||
|
if (routeKeyword) {
|
||||||
|
this.handleSearch({
|
||||||
|
silentVoice: true
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.safeDispatchBroadcast('setCallbacks', {
|
this.safeDispatchBroadcast('setCallbacks', {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user