修改复核发货、散单、团单波次策略
This commit is contained in:
parent
9580129c48
commit
9672a315b6
4
env.js
4
env.js
@ -1,4 +1,4 @@
|
||||
// export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址
|
||||
export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址
|
||||
export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址
|
||||
// export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址
|
||||
export const API_URL = `${BASE_URL}/system` //后台接口域名
|
||||
export const IMG_URL = 'https://ye4s.file.gzxunren.com' //全局网络图片地址变量,css背景图片地址变量在uni.scss
|
||||
|
||||
@ -63,19 +63,18 @@
|
||||
|
||||
<view class="bottom-module">
|
||||
<view class="strategy-grid-container">
|
||||
<view class="strategy-grid-wrapper" @touchstart="handleGridTouchStart" @touchmove="handleGridTouchMove" @touchend="handleGridTouchEnd" @touchcancel="handleGridTouchEnd">
|
||||
<view class="strategy-grid-wrapper">
|
||||
<view class="grid-wrap">
|
||||
<view v-for="slot in currentPageSlots" :key="slot.key" class="pick-slot">
|
||||
<view v-for="item in strategyList" :key="`strategy-${item.id}`" class="pick-slot">
|
||||
<view
|
||||
v-if="slot.item"
|
||||
class="pick-card"
|
||||
:class="{ 'pick-card--active': currentStrategyId === slot.item.id }"
|
||||
@click="selectStrategy(slot.item)"
|
||||
:class="{ 'pick-card--active': currentStrategyId === item.id }"
|
||||
@click="selectStrategy(item)"
|
||||
>
|
||||
<view class="pick-card__top">
|
||||
<view class="pick-card__title-marquee">
|
||||
<u-notice-bar
|
||||
:text="slot.item.strategyName || '--'"
|
||||
:text="item.strategyName || '--'"
|
||||
mode="horizontal"
|
||||
bg-color="#19be6b"
|
||||
color="#ffffff"
|
||||
@ -89,30 +88,14 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="pick-card__main">
|
||||
<text class="pick-card__num">{{ slot.item.matchedOrderCountFiltered }}</text>
|
||||
<text class="pick-card__num">{{ item.matchedOrderCountFiltered }}</text>
|
||||
</view>
|
||||
<view class="pick-card__bottom">抓:{{ slot.item.nextFetchOrderCount }}</view>
|
||||
<view class="pick-card__bottom">抓:{{ item.nextFetchOrderCount }}</view>
|
||||
</view>
|
||||
<view v-else class="pick-card pick-card--empty"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="pagination-bar">
|
||||
<view class="pagination-btn" :class="{ 'pagination-btn--disabled': currentPage === 1 }" @click="prevPage">上一页</view>
|
||||
<view class="pagination-current">{{ currentPage }}/{{ totalPages }}</view>
|
||||
<input
|
||||
v-model="pageJumpInput"
|
||||
class="pagination-input"
|
||||
type="number"
|
||||
placeholder="页码"
|
||||
confirm-type="go"
|
||||
@confirm="jumpToPage"
|
||||
/>
|
||||
<view class="pagination-btn pagination-btn--primary" @click="jumpToPage">跳转</view>
|
||||
<view class="pagination-btn" :class="{ 'pagination-btn--disabled': currentPage === totalPages }" @click="nextPage">下一页</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
@ -143,18 +126,8 @@
|
||||
data() {
|
||||
return {
|
||||
title: '团购拣货策略',
|
||||
paginationTotal: null,
|
||||
loading: false,
|
||||
creatingTask: false,
|
||||
currentPage: 1,
|
||||
pageJumpInput: '',
|
||||
pageSize: 8,
|
||||
gridGesture: {
|
||||
startX: 0,
|
||||
startY: 0,
|
||||
deltaX: 0,
|
||||
deltaY: 0
|
||||
},
|
||||
limitPopup: {
|
||||
visible: false,
|
||||
title: '',
|
||||
@ -167,21 +140,6 @@
|
||||
computed: {
|
||||
currentStrategy() {
|
||||
return this.strategyList.find(item => String(item.id) === String(this.currentStrategyId)) || this.strategyList[0] || {};
|
||||
},
|
||||
totalPages() {
|
||||
const total = Number(this.paginationTotal || 0);
|
||||
const pageSize = Number(this.pageSize || 8);
|
||||
return Math.max(1, Math.ceil(total / pageSize));
|
||||
},
|
||||
currentPageSlots() {
|
||||
return Array.from({ length: this.pageSize }, (_, index) => {
|
||||
const item = this.strategyList[index] || null;
|
||||
return {
|
||||
index,
|
||||
item,
|
||||
key: item ? `strategy-${item.id}` : `empty-${this.currentPage}-${index}`
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@ -230,73 +188,6 @@
|
||||
closeLimitPopup() {
|
||||
this.limitPopup.visible = false;
|
||||
},
|
||||
syncPageJumpInput() {
|
||||
this.pageJumpInput = String(this.currentPage || 1);
|
||||
},
|
||||
ensureCurrentPageInRange() {
|
||||
if (this.currentPage > this.totalPages) {
|
||||
this.currentPage = this.totalPages;
|
||||
}
|
||||
if (this.currentPage < 1) {
|
||||
this.currentPage = 1;
|
||||
}
|
||||
this.syncPageJumpInput();
|
||||
},
|
||||
prevPage() {
|
||||
if (this.currentPage > 1) {
|
||||
this.currentPage -= 1;
|
||||
this.loadStrategyList();
|
||||
}
|
||||
this.syncPageJumpInput();
|
||||
},
|
||||
nextPage() {
|
||||
if (this.currentPage < this.totalPages) {
|
||||
this.currentPage += 1;
|
||||
this.loadStrategyList();
|
||||
}
|
||||
this.syncPageJumpInput();
|
||||
},
|
||||
jumpToPage() {
|
||||
const targetPage = Number(this.pageJumpInput);
|
||||
if (!Number.isInteger(targetPage) || targetPage < 1) {
|
||||
this.syncPageJumpInput();
|
||||
return;
|
||||
}
|
||||
this.currentPage = Math.min(targetPage, this.totalPages);
|
||||
this.loadStrategyList();
|
||||
this.syncPageJumpInput();
|
||||
},
|
||||
handleGridTouchStart(event) {
|
||||
const touch = event?.changedTouches?.[0] || event?.touches?.[0];
|
||||
if (!touch) {
|
||||
return;
|
||||
}
|
||||
this.gridGesture.startX = touch.clientX;
|
||||
this.gridGesture.startY = touch.clientY;
|
||||
this.gridGesture.deltaX = 0;
|
||||
this.gridGesture.deltaY = 0;
|
||||
},
|
||||
handleGridTouchMove(event) {
|
||||
const touch = event?.changedTouches?.[0] || event?.touches?.[0];
|
||||
if (!touch) {
|
||||
return;
|
||||
}
|
||||
this.gridGesture.deltaX = touch.clientX - this.gridGesture.startX;
|
||||
this.gridGesture.deltaY = touch.clientY - this.gridGesture.startY;
|
||||
},
|
||||
handleGridTouchEnd() {
|
||||
const absX = Math.abs(this.gridGesture.deltaX);
|
||||
const absY = Math.abs(this.gridGesture.deltaY);
|
||||
if (absX > 60 && absX > absY) {
|
||||
if (this.gridGesture.deltaX > 0) {
|
||||
this.prevPage();
|
||||
} else {
|
||||
this.nextPage();
|
||||
}
|
||||
}
|
||||
this.gridGesture.deltaX = 0;
|
||||
this.gridGesture.deltaY = 0;
|
||||
},
|
||||
getApiErrorMessage(error, fallback = '请求失败') {
|
||||
const message = error?.message || error?.msg || error?.errMsg || error?.data?.message;
|
||||
return String(message || fallback);
|
||||
@ -359,14 +250,11 @@
|
||||
strategy_type: 2
|
||||
},
|
||||
pagination: {
|
||||
page: Number(this.currentPage || 1),
|
||||
pageSize: Number(this.pageSize || 8)
|
||||
page: 1,
|
||||
pageSize: 1000
|
||||
}
|
||||
};
|
||||
},
|
||||
extractPagination(payload, response) {
|
||||
return payload?.pagination || payload?.page || response?.data?.pagination || response?.pagination || null;
|
||||
},
|
||||
extractWaveStrategyPayload(response) {
|
||||
const candidates = [
|
||||
response?.data?.data,
|
||||
@ -541,22 +429,13 @@
|
||||
try {
|
||||
const params = this.buildWaveStrategyListParams();
|
||||
const response = await this.$http('order.wave.waveStrategyList', params);
|
||||
const payload = this.extractWaveStrategyPayload(response);
|
||||
const pagination = this.extractPagination(payload, response);
|
||||
const parsedList = this.parseWaveStrategyResponse(response);
|
||||
this.paginationTotal = Number(pagination?.total ?? parsedList.length ?? 0);
|
||||
this.currentPage = Number((pagination?.page ?? this.currentPage) || 1);
|
||||
this.pageSize = Number((pagination?.pageSize ?? this.pageSize) || 8);
|
||||
parsedList.sort((a, b) => Number(b.matchedOrderCountFiltered) - Number(a.matchedOrderCountFiltered));
|
||||
this.strategyList = parsedList;
|
||||
this.currentStrategyId = this.strategyList[0]?.id || '';
|
||||
this.ensureCurrentPageInRange();
|
||||
this.syncPageJumpInput();
|
||||
} catch (error) {
|
||||
this.paginationTotal = null;
|
||||
this.currentStrategyId = '';
|
||||
this.strategyList = [];
|
||||
this.currentPage = 1;
|
||||
this.syncPageJumpInput();
|
||||
uni.showToast({
|
||||
title: this.getApiErrorMessage(error, '策略加载失败'),
|
||||
icon: 'none'
|
||||
@ -656,28 +535,28 @@
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.strategy-grid-wrapper {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
background: #ffffff;
|
||||
border-radius: 14rpx;
|
||||
padding: 10rpx;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.grid-wrap {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
height: 100%;
|
||||
align-content: flex-start;
|
||||
}
|
||||
|
||||
.pick-slot {
|
||||
width: 25%;
|
||||
height: 50%;
|
||||
height: 210rpx;
|
||||
padding: 4rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@ -810,20 +689,16 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
border: 2rpx solid transparent;
|
||||
border: 4rpx solid #2979ff;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pick-card--active {
|
||||
border-color: transparent;
|
||||
box-shadow: inset 0 0 0 6rpx #2979ff, 0 10rpx 24rpx rgba(41, 121, 255, 0.2);
|
||||
}
|
||||
|
||||
.pick-card--empty {
|
||||
background: #f8f9fb;
|
||||
border: 1rpx dashed #e7eaf0;
|
||||
box-shadow: none;
|
||||
border-color: #ff9900;
|
||||
border-width: 6rpx;
|
||||
background: #fff5e6;
|
||||
box-shadow: 0 10rpx 24rpx rgba(255, 153, 0, 0.2);
|
||||
}
|
||||
|
||||
.pick-card__top {
|
||||
@ -899,57 +774,6 @@
|
||||
padding: 2rpx 6rpx;
|
||||
}
|
||||
|
||||
.pagination-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
column-gap: 10rpx;
|
||||
margin-top: 10rpx;
|
||||
padding-top: 12rpx;
|
||||
}
|
||||
|
||||
.pagination-btn {
|
||||
min-width: 104rpx;
|
||||
height: 56rpx;
|
||||
padding: 0 16rpx;
|
||||
border-radius: 28rpx;
|
||||
background: #eef2f7;
|
||||
color: #3b4a5a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.pagination-btn--primary {
|
||||
background: #2979ff;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.pagination-btn--disabled {
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
.pagination-current {
|
||||
min-width: 92rpx;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.pagination-input {
|
||||
width: 96rpx;
|
||||
height: 56rpx;
|
||||
background: #ffffff;
|
||||
border: 1rpx solid #dcdfe6;
|
||||
border-radius: 28rpx;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #303133;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.empty-wrap {
|
||||
min-height: 460rpx;
|
||||
display: flex;
|
||||
|
||||
@ -322,7 +322,9 @@ import voice from '@/core/utils/voice';
|
||||
noBarcodeItemName: '',
|
||||
noBarcodePickedCount: 0,
|
||||
noBarcodeItemTotalQty: 0,
|
||||
showInterceptInfoPopup: false
|
||||
showInterceptInfoPopup: false,
|
||||
// 单品单件自动复核场景弹窗确认回调(弹窗关闭/确认后调用,继续自动复核发货)
|
||||
sharedBarcodeOnClose: null
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -752,6 +754,23 @@ import voice from '@/core/utils/voice';
|
||||
this.dismissedMultiMatchCodes = [];
|
||||
this.lastScanCode = '';
|
||||
this.lastScanTime = 0;
|
||||
this.sharedBarcodeOnClose = null;
|
||||
},
|
||||
/**
|
||||
* 外部调用:单品单件 D 前缀波次自动复核场景,库内有相同商品时弹出确认弹窗
|
||||
* 用户关闭/确认后执行 onConfirm 回调,继续自动复核发货
|
||||
*/
|
||||
showSharedBarcodePopup(item, onConfirm) {
|
||||
this.sharedBarcodeOnClose = typeof onConfirm === 'function' ? onConfirm : null;
|
||||
this.multiMatchFirst = item && typeof item === 'object' ? { ...item } : {};
|
||||
this.multiMatchGoodsIndex = -1;
|
||||
if (item && typeof item === 'object') {
|
||||
const idx = this.goodsList.findIndex(g => String(g?.id || '') === String(item.id || ''));
|
||||
if (idx >= 0) this.multiMatchGoodsIndex = idx;
|
||||
}
|
||||
this.pendingScanCode = '';
|
||||
this.showMultiMatchPopup = true;
|
||||
voice.speak('库内有相同商品');
|
||||
},
|
||||
/**
|
||||
* 多商品匹配时,选择第一个商品进行处理
|
||||
@ -764,9 +783,22 @@ import voice from '@/core/utils/voice';
|
||||
this.dismissedMultiMatchCodes.push(this.pendingScanCode);
|
||||
}
|
||||
this.pendingScanCode = '';
|
||||
// 自动复核场景:弹窗关闭后执行确认回调,继续自动复核发货
|
||||
const cb = this.sharedBarcodeOnClose;
|
||||
this.sharedBarcodeOnClose = null;
|
||||
if (cb) cb();
|
||||
},
|
||||
handleMultiMatchSelect(index) {
|
||||
this.showMultiMatchPopup = false;
|
||||
// 自动复核场景(单品单件 D 前缀波次):仅确认弹窗,不追加数量,直接继续自动复核发货
|
||||
if (this.sharedBarcodeOnClose) {
|
||||
const cb = this.sharedBarcodeOnClose;
|
||||
this.sharedBarcodeOnClose = null;
|
||||
this.pendingScanCode = '';
|
||||
this.multiMatchGoodsIndex = -1;
|
||||
if (cb) cb();
|
||||
return;
|
||||
}
|
||||
const code = this.pendingScanCode;
|
||||
this.pendingScanCode = '';
|
||||
if (!code) return;
|
||||
|
||||
@ -1380,25 +1380,53 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
return;
|
||||
}
|
||||
// 详情视图模式下,扫描传给 ReviewDetail 组件处理
|
||||
if (this.showDetailView && this.$refs.reviewDetail) {
|
||||
// 多商品匹配弹窗已打开时,忽略重复扫描,避免重复提示
|
||||
if (this.$refs.reviewDetail.showMultiMatchPopup) {
|
||||
return;
|
||||
}
|
||||
this.keyword = scanText;
|
||||
console.log('[OrderReview][handleBroadcastResult] 广播扫描值:', scanText);
|
||||
const matched = this.$refs.reviewDetail.handleScanCode(scanText);
|
||||
setTimeout(() => { this.keyword = ''; }, 300);
|
||||
if (!matched) {
|
||||
uni.showToast({ title: '条码不匹配', icon: 'none' });
|
||||
uni.vibrateShort({ type: 'medium' });
|
||||
}
|
||||
if (this.showDetailView) {
|
||||
this.dispatchScanToDetail(scanText);
|
||||
return;
|
||||
}
|
||||
// 列表视图下,广播输入作为打印台匹配
|
||||
this.keyword = scanText;
|
||||
this.handleSearch();
|
||||
},
|
||||
/**
|
||||
* 详情视图下扫描统一入口:把扫描/输入的条码传给 ReviewDetail 商品复核
|
||||
* 解决:D波次单品单件详情下 $refs.reviewDetail 未就绪时,扫描条码误落入列表搜索(requestScanOrder 搜索快递单号/波次号)流程
|
||||
* 详情视图已打开时绝不降级到列表搜索:组件未挂载则延迟重试,等待组件就绪后再走商品复核
|
||||
*/
|
||||
dispatchScanToDetail(scanText, retries = 10) {
|
||||
const detail = this.$refs.reviewDetail;
|
||||
if (detail) {
|
||||
// 已复核订单禁止扫描
|
||||
if (detail.isReadOnly) {
|
||||
uni.showToast({ title: '该订单已复核完成,仅可查看', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
// 多商品匹配弹窗已打开时,忽略重复扫描,避免重复提示
|
||||
if (detail.showMultiMatchPopup) {
|
||||
return;
|
||||
}
|
||||
this.keyword = scanText;
|
||||
const matched = detail.handleScanCode(scanText);
|
||||
setTimeout(() => { this.keyword = ''; }, 300);
|
||||
if (!matched) {
|
||||
uni.showToast({ title: '条码不匹配', icon: 'none' });
|
||||
uni.vibrateShort({ type: 'medium' });
|
||||
// 语音"无记录"已由 ReviewDetail.handleScanCode 内部播报,此处不再重复
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 详情视图已打开但组件尚未挂载(真机 v-if 渲染滞后):延迟重试,不降级到列表搜索
|
||||
if (retries <= 0) return;
|
||||
if (!this.showDetailView) {
|
||||
// 详情已关闭,交由列表搜索处理
|
||||
this.keyword = scanText;
|
||||
this.handleSearch();
|
||||
return;
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.dispatchScanToDetail(scanText, retries - 1);
|
||||
}, 150);
|
||||
},
|
||||
handleScanAsProductBarcode(barcode) {
|
||||
// 从订单列表中取第一个未复核的订单进入详情
|
||||
const target = this.orderList.find(item => {
|
||||
@ -1419,6 +1447,15 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
}
|
||||
this.goPickGoodsDetail(target);
|
||||
},
|
||||
/**
|
||||
* 按商品条码在订单列表中定位所属订单(散单单品单件 D前缀波次)
|
||||
* 条码来源与 goPickGoodsDetail 构建 goodsList / ReviewDetail.handleScanCode 保持一致:
|
||||
* - stock 支持对象或数组(遍历每个库存的 barcodes/barcode/item_code)
|
||||
* - 商品行本身 barcodes/barcode
|
||||
* - item_snapshot 的 barcodes/barcode/item_code
|
||||
* - item_code / sku_code / skuCode
|
||||
* 匹配含汉字时剥离汉字(与 ReviewDetail extractBarcodeCandidates 一致)
|
||||
*/
|
||||
findOrderByProductBarcode(barcode) {
|
||||
if (!barcode || !Array.isArray(this.orderList)) return null;
|
||||
const kw = String(barcode).trim().toLowerCase();
|
||||
@ -1429,28 +1466,41 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
const items = Array.isArray(order.detailItems) ? order.detailItems : [];
|
||||
for (const item of items) {
|
||||
if (!item || typeof item !== 'object') continue;
|
||||
// 检查 stock 中的 barcodes 数组
|
||||
const stock = item.stock && typeof item.stock === 'object' ? item.stock : null;
|
||||
if (stock && Array.isArray(stock.barcodes)) {
|
||||
if (stock.barcodes.some(b => String(b || '').trim().toLowerCase() === kw)) {
|
||||
const candidates = this.collectItemBarcodeCandidates(item);
|
||||
if (candidates.includes(kw)) {
|
||||
return order;
|
||||
}
|
||||
// 含汉字时剥离后比较(与 ReviewDetail extractBarcodeCandidates 一致)
|
||||
if (/[\u4e00-\u9fff]/.test(kw)) {
|
||||
const stripped = kw.replace(/[\u4e00-\u9fff]+/g, '');
|
||||
if (stripped && candidates.some(c => c.replace(/[\u4e00-\u9fff]+/g, '') === stripped)) {
|
||||
return order;
|
||||
}
|
||||
}
|
||||
// 检查 item_snapshot 中的条码
|
||||
const snapshot = item.item_snapshot && typeof item.item_snapshot === 'object' ? item.item_snapshot : null;
|
||||
if (snapshot) {
|
||||
const snapBarcode = String(snapshot.barcode || '').trim().toLowerCase();
|
||||
if (snapBarcode === kw) return order;
|
||||
const snapCode = String(snapshot.item_code || '').trim().toLowerCase();
|
||||
if (snapCode === kw) return order;
|
||||
}
|
||||
// 检查 item 直接字段
|
||||
const itemCode = String(item.item_code || '').trim().toLowerCase();
|
||||
if (itemCode === kw) return order;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
// 收集订单明细商品的条码候选(小写化去重),供 findOrderByProductBarcode 匹配
|
||||
collectItemBarcodeCandidates(item) {
|
||||
if (!item || typeof item !== 'object') return [];
|
||||
const result = [];
|
||||
const snapshot = item.item_snapshot && typeof item.item_snapshot === 'object' ? item.item_snapshot : null;
|
||||
const sources = [];
|
||||
if (item.stock && typeof item.stock === 'object') {
|
||||
sources.push(...(Array.isArray(item.stock) ? item.stock : [item.stock]));
|
||||
}
|
||||
sources.push(item);
|
||||
if (snapshot) sources.push(snapshot);
|
||||
sources.forEach(src => {
|
||||
if (!src || typeof src !== 'object') return;
|
||||
this.normalizeBarcodeValues(src?.barcodes || src?.barcode || [])
|
||||
.forEach(b => result.push(String(b || '').trim().toLowerCase()));
|
||||
const code = String(src?.item_code || src?.sku_code || src?.skuCode || '').trim().toLowerCase();
|
||||
if (code) result.push(code);
|
||||
});
|
||||
return Array.from(new Set(result.filter(Boolean)));
|
||||
},
|
||||
/**
|
||||
* D前缀波次:按快递面单号(waybillNo)在订单列表中定位所属订单
|
||||
* @param {string} waybillNo - 扫描到的快递面单号
|
||||
@ -1477,23 +1527,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
this.autoSelectFirst = true; // 输入搜索选第一个
|
||||
this.scanKeyword = text; // 记录本次扫描/输入的快递单号或波次号
|
||||
// 详情视图模式下,搜索框输入当作条码传给 ReviewDetail
|
||||
if (this.showDetailView && this.$refs.reviewDetail) {
|
||||
// 已复核订单禁止扫描
|
||||
if (this.$refs.reviewDetail.isReadOnly) {
|
||||
uni.showToast({ title: '该订单已复核完成,仅可查看', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
// 多商品匹配弹窗已打开时,忽略重复扫描,避免重复提示
|
||||
if (this.$refs.reviewDetail.showMultiMatchPopup) {
|
||||
return;
|
||||
}
|
||||
console.log('[OrderReview][handleSearch] 搜索框扫描值:', text);
|
||||
const matched = this.$refs.reviewDetail.handleScanCode(text);
|
||||
if (!matched) {
|
||||
uni.showToast({ title: '条码不匹配', icon: 'none' });
|
||||
uni.vibrateShort({ type: 'medium' });
|
||||
this.speakVoice('无记录');
|
||||
}
|
||||
if (this.showDetailView) {
|
||||
this.dispatchScanToDetail(text);
|
||||
return;
|
||||
}
|
||||
// D前缀波次:在订单列表中查找商品条码所属订单
|
||||
@ -1621,23 +1656,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
return;
|
||||
}
|
||||
// 详情视图模式下,扫码结果直接传给 ReviewDetail
|
||||
if (this.showDetailView && this.$refs.reviewDetail) {
|
||||
// 已复核订单禁止扫描
|
||||
if (this.$refs.reviewDetail.isReadOnly) {
|
||||
uni.showToast({ title: '该订单已复核完成,仅可查看', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
// 多商品匹配弹窗已打开时,忽略重复扫描,避免重复提示
|
||||
if (this.$refs.reviewDetail.showMultiMatchPopup) {
|
||||
return;
|
||||
}
|
||||
console.log('[OrderReview][handleCameraScan] 摄像头扫描值:', scanResult);
|
||||
const matched = this.$refs.reviewDetail.handleScanCode(scanResult);
|
||||
if (!matched) {
|
||||
uni.showToast({ title: '条码不匹配', icon: 'none' });
|
||||
uni.vibrateShort({ type: 'medium' });
|
||||
this.speakVoice('无记录');
|
||||
}
|
||||
if (this.showDetailView) {
|
||||
this.dispatchScanToDetail(scanResult);
|
||||
return;
|
||||
}
|
||||
this.keyword = scanResult;
|
||||
@ -2594,13 +2614,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
// 已复核订单不再触发自动复核/打印,仅展示只读详情
|
||||
if (this.isDprefixedWave && this.detailGoodsList.length > 0 && !item.isReviewed) {
|
||||
if (this.dprefixedBarcodeVerified) {
|
||||
this.detailGoodsList = this.detailGoodsList.map(g => ({
|
||||
...g,
|
||||
scannedQty: g.planQty
|
||||
}));
|
||||
this.$nextTick(() => {
|
||||
this.handleDetailAllScanned();
|
||||
});
|
||||
// 库内有相同商品时先弹确认框,确认后再自动复核发货
|
||||
this.completeDprefixedAutoReview();
|
||||
} else {
|
||||
// 非扫码进入:不自动标记,等待用户扫描商品条码
|
||||
uni.showToast({
|
||||
@ -2623,6 +2638,50 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
// D前缀波次单品单件:自动标记所有商品为已扫并触发复核发货
|
||||
// 若库内有相同商品(has_shared_barcode),先弹出"库内有相同商品"确认弹窗,确认后再自动复核发货
|
||||
completeDprefixedAutoReview() {
|
||||
if (!this.detailGoodsList.length) return;
|
||||
const sharedGoods = this.detailGoodsList.find(g => !!g?.has_shared_barcode);
|
||||
if (sharedGoods) {
|
||||
// 真机 App 下 v-if 子组件挂载可能滞后于 $nextTick,延迟重试确保 ReviewDetail 就绪后再打开弹窗
|
||||
this.openSharedBarcodePopupWhenReady(sharedGoods);
|
||||
return;
|
||||
}
|
||||
this.finishDprefixedAutoReview();
|
||||
},
|
||||
// 打开"库内有相同商品"弹窗;弹窗关闭/确认后继续自动复核发货
|
||||
openSharedBarcodePopupWhenReady(sharedGoods, retries = 6) {
|
||||
const detail = this.$refs.reviewDetail;
|
||||
if (detail) {
|
||||
if (detail.showMultiMatchPopup) {
|
||||
// 弹窗已打开,稍后重试
|
||||
if (retries <= 0) return;
|
||||
setTimeout(() => {
|
||||
this.openSharedBarcodePopupWhenReady(sharedGoods, retries - 1);
|
||||
}, 150);
|
||||
return;
|
||||
}
|
||||
detail.showSharedBarcodePopup(sharedGoods, () => {
|
||||
this.finishDprefixedAutoReview();
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (retries <= 0) return;
|
||||
setTimeout(() => {
|
||||
this.openSharedBarcodePopupWhenReady(sharedGoods, retries - 1);
|
||||
}, 150);
|
||||
},
|
||||
// 标记所有商品为已扫并触发复核发货
|
||||
finishDprefixedAutoReview() {
|
||||
this.detailGoodsList = this.detailGoodsList.map(g => ({
|
||||
...g,
|
||||
scannedQty: g.planQty
|
||||
}));
|
||||
this.$nextTick(() => {
|
||||
this.handleDetailAllScanned();
|
||||
});
|
||||
},
|
||||
backToList() {
|
||||
this.showDetailView = false;
|
||||
|
||||
@ -63,19 +63,18 @@
|
||||
|
||||
<view class="bottom-module">
|
||||
<view class="strategy-grid-container">
|
||||
<view class="strategy-grid-wrapper" @touchstart="handleGridTouchStart" @touchmove="handleGridTouchMove" @touchend="handleGridTouchEnd" @touchcancel="handleGridTouchEnd">
|
||||
<view class="strategy-grid-wrapper">
|
||||
<view class="grid-wrap">
|
||||
<view v-for="slot in currentPageSlots" :key="slot.key" class="pick-slot">
|
||||
<view v-for="item in strategyList" :key="`strategy-${item.id}`" class="pick-slot">
|
||||
<view
|
||||
v-if="slot.item"
|
||||
class="pick-card"
|
||||
:class="{ 'pick-card--active': currentStrategyId === slot.item.id }"
|
||||
@click="selectStrategy(slot.item)"
|
||||
:class="{ 'pick-card--active': currentStrategyId === item.id }"
|
||||
@click="selectStrategy(item)"
|
||||
>
|
||||
<view class="pick-card__top">
|
||||
<view class="pick-card__title-marquee">
|
||||
<u-notice-bar
|
||||
:text="slot.item.strategyName || '--'"
|
||||
:text="item.strategyName || '--'"
|
||||
mode="horizontal"
|
||||
bg-color="#19be6b"
|
||||
color="#ffffff"
|
||||
@ -89,30 +88,14 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="pick-card__main">
|
||||
<text class="pick-card__num">{{ slot.item.matchedOrderCountFiltered }}</text>
|
||||
<text class="pick-card__num">{{ item.matchedOrderCountFiltered }}</text>
|
||||
</view>
|
||||
<view class="pick-card__bottom">抓:{{ slot.item.nextFetchOrderCount }}</view>
|
||||
<view class="pick-card__bottom">抓:{{ item.nextFetchOrderCount }}</view>
|
||||
</view>
|
||||
<view v-else class="pick-card pick-card--empty"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="pagination-bar">
|
||||
<view class="pagination-btn" :class="{ 'pagination-btn--disabled': currentPage === 1 }" @click="prevPage">上一页</view>
|
||||
<view class="pagination-current">{{ currentPage }}/{{ totalPages }}</view>
|
||||
<input
|
||||
v-model="pageJumpInput"
|
||||
class="pagination-input"
|
||||
type="number"
|
||||
placeholder="页码"
|
||||
confirm-type="go"
|
||||
@confirm="jumpToPage"
|
||||
/>
|
||||
<view class="pagination-btn pagination-btn--primary" @click="jumpToPage">跳转</view>
|
||||
<view class="pagination-btn" :class="{ 'pagination-btn--disabled': currentPage === totalPages }" @click="nextPage">下一页</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
@ -143,18 +126,8 @@
|
||||
data() {
|
||||
return {
|
||||
title: '散单拣货策略',
|
||||
paginationTotal: null,
|
||||
loading: false,
|
||||
creatingTask: false,
|
||||
currentPage: 1,
|
||||
pageJumpInput: '',
|
||||
pageSize: 8,
|
||||
gridGesture: {
|
||||
startX: 0,
|
||||
startY: 0,
|
||||
deltaX: 0,
|
||||
deltaY: 0
|
||||
},
|
||||
limitPopup: {
|
||||
visible: false,
|
||||
title: '',
|
||||
@ -167,21 +140,6 @@
|
||||
computed: {
|
||||
currentStrategy() {
|
||||
return this.strategyList.find(item => String(item.id) === String(this.currentStrategyId)) || this.strategyList[0] || {};
|
||||
},
|
||||
totalPages() {
|
||||
const total = Number(this.paginationTotal || 0);
|
||||
const pageSize = Number(this.pageSize || 8);
|
||||
return Math.max(1, Math.ceil(total / pageSize));
|
||||
},
|
||||
currentPageSlots() {
|
||||
return Array.from({ length: this.pageSize }, (_, index) => {
|
||||
const item = this.strategyList[index] || null;
|
||||
return {
|
||||
index,
|
||||
item,
|
||||
key: item ? `strategy-${item.id}` : `empty-${this.currentPage}-${index}`
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@ -230,73 +188,6 @@
|
||||
closeLimitPopup() {
|
||||
this.limitPopup.visible = false;
|
||||
},
|
||||
syncPageJumpInput() {
|
||||
this.pageJumpInput = String(this.currentPage || 1);
|
||||
},
|
||||
ensureCurrentPageInRange() {
|
||||
if (this.currentPage > this.totalPages) {
|
||||
this.currentPage = this.totalPages;
|
||||
}
|
||||
if (this.currentPage < 1) {
|
||||
this.currentPage = 1;
|
||||
}
|
||||
this.syncPageJumpInput();
|
||||
},
|
||||
prevPage() {
|
||||
if (this.currentPage > 1) {
|
||||
this.currentPage -= 1;
|
||||
this.loadStrategyList();
|
||||
}
|
||||
this.syncPageJumpInput();
|
||||
},
|
||||
nextPage() {
|
||||
if (this.currentPage < this.totalPages) {
|
||||
this.currentPage += 1;
|
||||
this.loadStrategyList();
|
||||
}
|
||||
this.syncPageJumpInput();
|
||||
},
|
||||
jumpToPage() {
|
||||
const targetPage = Number(this.pageJumpInput);
|
||||
if (!Number.isInteger(targetPage) || targetPage < 1) {
|
||||
this.syncPageJumpInput();
|
||||
return;
|
||||
}
|
||||
this.currentPage = Math.min(targetPage, this.totalPages);
|
||||
this.loadStrategyList();
|
||||
this.syncPageJumpInput();
|
||||
},
|
||||
handleGridTouchStart(event) {
|
||||
const touch = event?.changedTouches?.[0] || event?.touches?.[0];
|
||||
if (!touch) {
|
||||
return;
|
||||
}
|
||||
this.gridGesture.startX = touch.clientX;
|
||||
this.gridGesture.startY = touch.clientY;
|
||||
this.gridGesture.deltaX = 0;
|
||||
this.gridGesture.deltaY = 0;
|
||||
},
|
||||
handleGridTouchMove(event) {
|
||||
const touch = event?.changedTouches?.[0] || event?.touches?.[0];
|
||||
if (!touch) {
|
||||
return;
|
||||
}
|
||||
this.gridGesture.deltaX = touch.clientX - this.gridGesture.startX;
|
||||
this.gridGesture.deltaY = touch.clientY - this.gridGesture.startY;
|
||||
},
|
||||
handleGridTouchEnd() {
|
||||
const absX = Math.abs(this.gridGesture.deltaX);
|
||||
const absY = Math.abs(this.gridGesture.deltaY);
|
||||
if (absX > 60 && absX > absY) {
|
||||
if (this.gridGesture.deltaX > 0) {
|
||||
this.prevPage();
|
||||
} else {
|
||||
this.nextPage();
|
||||
}
|
||||
}
|
||||
this.gridGesture.deltaX = 0;
|
||||
this.gridGesture.deltaY = 0;
|
||||
},
|
||||
getApiErrorMessage(error, fallback = '请求失败') {
|
||||
const message = error?.message || error?.msg || error?.errMsg || error?.data?.message;
|
||||
return String(message || fallback);
|
||||
@ -359,14 +250,11 @@
|
||||
strategy_type: 1
|
||||
},
|
||||
pagination: {
|
||||
page: Number(this.currentPage || 1),
|
||||
pageSize: Number(this.pageSize || 8)
|
||||
page: 1,
|
||||
pageSize: 1000
|
||||
}
|
||||
};
|
||||
},
|
||||
extractPagination(payload, response) {
|
||||
return payload?.pagination || payload?.page || response?.data?.pagination || response?.pagination || null;
|
||||
},
|
||||
extractWaveStrategyPayload(response) {
|
||||
const candidates = [
|
||||
response?.data?.data,
|
||||
@ -541,22 +429,13 @@
|
||||
try {
|
||||
const params = this.buildWaveStrategyListParams();
|
||||
const response = await this.$http('order.wave.waveStrategyList', params);
|
||||
const payload = this.extractWaveStrategyPayload(response);
|
||||
const pagination = this.extractPagination(payload, response);
|
||||
const parsedList = this.parseWaveStrategyResponse(response);
|
||||
this.paginationTotal = Number(pagination?.total ?? parsedList.length ?? 0);
|
||||
this.currentPage = Number((pagination?.page ?? this.currentPage) || 1);
|
||||
this.pageSize = Number((pagination?.pageSize ?? this.pageSize) || 8);
|
||||
parsedList.sort((a, b) => Number(b.matchedOrderCountFiltered) - Number(a.matchedOrderCountFiltered));
|
||||
this.strategyList = parsedList;
|
||||
this.currentStrategyId = this.strategyList[0]?.id || '';
|
||||
this.ensureCurrentPageInRange();
|
||||
this.syncPageJumpInput();
|
||||
} catch (error) {
|
||||
this.paginationTotal = null;
|
||||
this.currentStrategyId = '';
|
||||
this.strategyList = [];
|
||||
this.currentPage = 1;
|
||||
this.syncPageJumpInput();
|
||||
uni.showToast({
|
||||
title: this.getApiErrorMessage(error, '策略加载失败'),
|
||||
icon: 'none'
|
||||
@ -656,28 +535,28 @@
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.strategy-grid-wrapper {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: 100%;
|
||||
background: #ffffff;
|
||||
border-radius: 14rpx;
|
||||
padding: 10rpx;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.grid-wrap {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
height: 100%;
|
||||
align-content: flex-start;
|
||||
}
|
||||
|
||||
.pick-slot {
|
||||
width: 25%;
|
||||
height: 50%;
|
||||
height: 210rpx;
|
||||
padding: 4rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
@ -810,20 +689,16 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
border: 2rpx solid transparent;
|
||||
border: 4rpx solid #2979ff;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.pick-card--active {
|
||||
border-color: transparent;
|
||||
box-shadow: inset 0 0 0 6rpx #2979ff, 0 10rpx 24rpx rgba(41, 121, 255, 0.2);
|
||||
}
|
||||
|
||||
.pick-card--empty {
|
||||
background: #f8f9fb;
|
||||
border: 1rpx dashed #e7eaf0;
|
||||
box-shadow: none;
|
||||
border-color: #ff9900;
|
||||
border-width: 6rpx;
|
||||
background: #fff5e6;
|
||||
box-shadow: 0 10rpx 24rpx rgba(255, 153, 0, 0.2);
|
||||
}
|
||||
|
||||
.pick-card__top {
|
||||
@ -899,57 +774,6 @@
|
||||
padding: 2rpx 6rpx;
|
||||
}
|
||||
|
||||
.pagination-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
column-gap: 10rpx;
|
||||
margin-top: 10rpx;
|
||||
padding-top: 12rpx;
|
||||
}
|
||||
|
||||
.pagination-btn {
|
||||
min-width: 104rpx;
|
||||
height: 56rpx;
|
||||
padding: 0 16rpx;
|
||||
border-radius: 28rpx;
|
||||
background: #eef2f7;
|
||||
color: #3b4a5a;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.pagination-btn--primary {
|
||||
background: #2979ff;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.pagination-btn--disabled {
|
||||
opacity: 0.45;
|
||||
}
|
||||
|
||||
.pagination-current {
|
||||
min-width: 92rpx;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.pagination-input {
|
||||
width: 96rpx;
|
||||
height: 56rpx;
|
||||
background: #ffffff;
|
||||
border: 1rpx solid #dcdfe6;
|
||||
border-radius: 28rpx;
|
||||
text-align: center;
|
||||
font-size: 24rpx;
|
||||
color: #303133;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.empty-wrap {
|
||||
min-height: 460rpx;
|
||||
display: flex;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user