feat: 新增散单波次策略页面并完善订单拣货流程

This commit is contained in:
zm2000 2026-05-07 18:20:41 +08:00
parent 52e7d21a99
commit 2fb2b089eb
7 changed files with 710 additions and 190 deletions

View File

@ -217,6 +217,28 @@ export default {
auth: true,
method: "POST",
isSystemApi: true
},
items: {
path: "pick.items",
auth: true,
method: "POST",
isSystemApi: true
},
complete: {
path: "pick.complete",
auth: true,
method: "POST",
isSystemApi: true
}
},
order: {
wave: {
waveStrategyList: {
path: "order.wave.waveStrategyList",
auth: true,
method: "POST",
isSystemApi: true
}
}
},
print: {

View File

@ -155,6 +155,13 @@
{
"titleNView": false
}
},
{
"path" : "pages/work/order/scatter-wave-strategy",
"style" :
{
"titleNView": false
}
}
],

View File

@ -314,6 +314,7 @@
const menuName = String(item?.name || '').trim();
const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询'));
const isOrderPicking = menuName === '订单拣货' || (menuName.includes('订单') && menuName.includes('拣货'));
const isScatterWaveStrategy = menuName === '散单波次策略' || (menuName.includes('散单') && menuName.includes('波次'));
const rawPath = item?.component || item?.path || '';
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
const isRelocation = menuName === '移库作业' || normalizedPath === '/pages/work/storage/relocation';
@ -327,7 +328,9 @@
}
const targetPath = isGoodsQuery
? '/pages/work/product/query'
: (isOrderPicking ? '/pages/work/order/picking' : normalizedPath);
: (isOrderPicking
? '/pages/work/order/picking'
: (isScatterWaveStrategy ? '/pages/work/order/scatter-wave-strategy' : normalizedPath));
if (!targetPath) {
uni.showToast({

View File

@ -1148,6 +1148,7 @@
const menuName = String(item?.name || '').trim();
const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询'));
const isOrderPicking = menuName === '订单拣货' || (menuName.includes('订单') && menuName.includes('拣货'));
const isScatterWaveStrategy = menuName === '散单波次策略' || (menuName.includes('散单') && menuName.includes('波次'));
const rawPath = item?.component || item?.path || '';
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
const isRelocation = menuName === '移库作业' || normalizedPath === '/pages/work/storage/relocation';
@ -1161,7 +1162,9 @@
}
const targetPath = isGoodsQuery
? '/pages/work/product/query'
: (isOrderPicking ? '/pages/work/order/picking' : normalizedPath);
: (isOrderPicking
? '/pages/work/order/picking'
: (isScatterWaveStrategy ? '/pages/work/order/scatter-wave-strategy' : normalizedPath));
if (!targetPath) {
uni.showToast({

View File

@ -4,14 +4,8 @@
<page-nav :title="title"></page-nav>
<view class="summary-card">
<view class="summary-head">
<text class="order-no">{{ orderInfo.orderNo || '--' }}</text>
<text class="mode-tag">{{ pickModeText }}</text>
</view>
<view class="summary-row"><text class="label">客户:</text><text class="value">{{ orderInfo.customerName || '--' }}</text></view>
<view class="summary-row"><text class="label">波次:</text><text class="value">{{ orderInfo.waveNo || '--' }}</text></view>
<view class="summary-row"><text class="label">状态:</text><text class="value">{{ statusText }}</text></view>
<view class="summary-row"><text class="label">拣货进度:</text><text class="value">{{ orderInfo.pickedQty || 0 }}/{{ orderInfo.needQty || 0 }}</text></view>
<view class="summary-row"><text class="label">订单总数:</text><text class="value">{{ orderInfo.needQty || 0 }}</text></view>
</view>
<view class="section-title-row">
@ -22,21 +16,30 @@
</view>
</view>
<view class="detail-list">
<view class="detail-item" v-for="(line, detailIndex) in detailList" :key="line.lineId" @longpress.stop="handleLineLongPress(line, detailIndex)">
<view v-if="currentDetailList.length === 0" class="detail-empty">暂无拣货明细</view>
<view class="detail-item" v-for="line in currentDetailList" :key="line.lineId" @longpress.stop="handleLineLongPress(line, currentDetailIndex)">
<view class="detail-head">
<text class="sku-name">{{ line.skuName }}</text>
<view class="detail-head-right">
<text v-if="line.noBarcodeVerified" class="verify-tag">无条码核对</text>
<text v-if="line.locationErrorReported" class="error-tag">库位报错</text>
<text v-if="line.pickedQty >= line.needQty" class="picked-tag">已拣</text>
<text class="space">{{ line.space }}</text>
</view>
</view>
<view class="detail-row"><text class="label">SKU:</text><text class="value">{{ line.skuCode }}</text></view>
<view class="detail-row"><text class="label">条码:</text><text class="value">{{ line.barcode || '--' }}</text></view>
<view class="detail-row"><text class="label">篮号:</text><text class="value">{{ getBasketNoText(line) }}</text></view>
<view class="detail-row"><text class="label">应拣:</text><text class="value">{{ line.needQty }}</text></view>
<view class="detail-row"><text class="label">已拣:</text><text class="value">{{ line.pickedQty }}</text></view>
<view class="detail-main">
<u-image :src="line.imageUrl || ''" width="120rpx" height="120rpx" mode="aspectFill"></u-image>
<view class="detail-main-info">
<view class="detail-row"><text class="label">商品名称:</text><text class="value">{{ line.skuName || '--' }}</text></view>
<view class="detail-row"><text class="label">库位:</text><text class="value">{{ line.space || '--' }}</text></view>
<view class="detail-row"><text class="label">商品条码:</text><text class="value">{{ line.barcode || '--' }}</text></view>
<view class="detail-row"><text class="label">数量:</text><text class="value">{{ line.needQty }}</text></view>
</view>
</view>
</view>
<view class="switch-row" v-if="detailList.length > 0">
<u-button size="mini" @click="showPrevDetail" :disabled="!hasPrevDetail">上一个</u-button>
<text class="switch-index">{{ currentDetailIndex + 1 }}/{{ detailList.length }}</text>
<u-button size="mini" type="primary" :customStyle="{ backgroundColor: '#2979ff', borderColor: '#2979ff' }" @click="showNextDetail" :disabled="!hasNextDetail">下一个</u-button>
</view>
</view>
@ -50,6 +53,7 @@
<u-button
v-else-if="orderInfo.status === 'picking'"
type="success"
:loading="completing"
@click="completePicking"
>完成拣货</u-button>
<u-button v-else type="info" :disabled="true">已完成</u-button>
@ -90,9 +94,12 @@
data() {
return {
title: '拣货详情',
pickMode: 'F',
loading: false,
completing: false,
orderInfo: {
id: '',
orderId: 0,
orderItemId: 0,
orderNo: '',
customerName: '',
waveNo: '',
@ -101,6 +108,7 @@
pickedQty: 0
},
detailList: [],
currentDetailIndex: 0,
locationErrorPopupVisible: false,
currentActionLineIndex: -1,
locationErrorRemark: '',
@ -109,9 +117,6 @@
}
},
computed: {
pickModeText() {
return this.pickMode === 'E' ? 'E拣货(边拣边分)' : 'F拣货(先拣后分)';
},
statusText() {
const map = {
pending: '待拣货',
@ -125,6 +130,16 @@
return null;
}
return this.detailList[this.currentActionLineIndex] || null;
},
currentDetailList() {
const line = this.detailList[this.currentDetailIndex];
return line ? [line] : [];
},
hasPrevDetail() {
return this.currentDetailIndex > 0;
},
hasNextDetail() {
return this.currentDetailIndex < this.detailList.length - 1;
}
},
onLoad(options) {
@ -133,15 +148,10 @@
});
this.safeDispatchBroadcast('start');
if (options && options.mode) {
const mode = String(options.mode || '').toUpperCase();
if (mode === 'F' || mode === 'E') {
this.pickMode = mode;
}
}
this.orderInfo = {
id: options?.id || '',
orderId: Number(options?.orderId || 0),
orderItemId: Number(options?.orderItemId || 0),
orderNo: options?.orderNo || '--',
customerName: options?.customerName || '--',
waveNo: options?.waveNo || '--',
@ -149,8 +159,7 @@
needQty: Number(options?.needQty || 0),
pickedQty: Number(options?.pickedQty || 0)
};
this.detailList = this.buildMockDetails(this.orderInfo);
this.loadOrderDetail();
},
onShow() {
this.safeDispatchBroadcast('setCallbacks', {
@ -165,6 +174,157 @@
this.safeDispatchBroadcast('stop');
},
methods: {
getApiErrorMessage(error, fallback = '请求失败') {
const message = error?.message || error?.msg || error?.errMsg || error?.data?.message;
return String(message || fallback);
},
buildItemsQueryParams() {
return {
order_id: Number(this.orderInfo.orderId || 0),
order_item_id: Number(this.orderInfo.orderItemId || 0),
full_display: true
};
},
buildCompletePickingParams() {
return {
order_id: Number(this.orderInfo.orderId || 0),
order_item_id: Number(this.orderInfo.orderItemId || 0),
details: this.detailList.map(line => ({
id: line.lineId,
picked_qty: Number(line.pickedQty || 0),
need_qty: Number(line.needQty || 0)
}))
};
},
extractDetailPayload(response) {
const candidates = [
response?.data?.data,
response?.data,
response?.result,
response
];
for (let i = 0; i < candidates.length; i += 1) {
const current = candidates[i];
if (current && typeof current === 'object' && !Array.isArray(current)) {
return current;
}
}
return {};
},
extractDetailList(payload, response) {
const candidates = [
Array.isArray(payload) ? payload : null,
payload?.list,
payload?.details,
payload?.rows,
payload?.items,
payload?.data?.list,
payload?.data?.details,
payload?.summary?.list,
payload?.summary?.details,
response?.data?.list,
response?.data?.rows,
response?.data?.items,
response?.data?.data?.list,
response?.data?.data?.rows,
response?.data?.data?.items,
response?.list,
response?.rows,
response?.items
];
for (let i = 0; i < candidates.length; i += 1) {
if (Array.isArray(candidates[i])) {
return candidates[i];
}
}
return [];
},
extractItemsResponse(response) {
const payload = this.extractDetailPayload(response);
const list = this.extractDetailList(payload, response);
return {
payload,
list
};
},
syncOrderInfoFromPayload(payload) {
if (!payload || typeof payload !== 'object') {
return;
}
this.orderInfo.orderNo = payload.order_no || payload.orderNo || this.orderInfo.orderNo;
this.orderInfo.customerName = payload.customer_name || payload.customerName || this.orderInfo.customerName;
this.orderInfo.waveNo = payload.wave_no || payload.waveNo || this.orderInfo.waveNo;
const nextStatus = payload.picking_status || payload.status;
if (nextStatus) {
this.orderInfo.status = this.normalizeStatus(nextStatus);
}
},
async loadOrderDetail() {
const params = this.buildItemsQueryParams();
if (!params.order_id || !params.order_item_id) {
uni.showToast({
title: '缺少订单参数',
icon: 'none'
});
return;
}
this.loading = true;
try {
const response = await this.$http('pick.items', params);
const parsed = this.extractItemsResponse(response);
this.syncOrderInfoFromPayload(parsed.payload);
const list = parsed.list;
this.detailList = list.map((item, index) => this.normalizeDetailItem(item, index));
this.currentDetailIndex = 0;
this.recalculateOrderProgress();
} catch (error) {
this.detailList = [];
this.currentDetailIndex = 0;
this.recalculateOrderProgress();
uni.showToast({
title: this.getApiErrorMessage(error, '明细加载失败'),
icon: 'none'
});
} finally {
this.loading = false;
}
},
normalizeStatus(value) {
const text = String(value || '').toLowerCase();
if (!text) {
return 'pending';
}
if (['fin', 'finished', 'done', 'completed', 'complete', 'success'].includes(text)) {
return 'done';
}
if (['picking', 'pick', 'doing', 'processing', 'progress', 'part'].includes(text)) {
return 'picking';
}
return 'pending';
},
normalizeDetailItem(item, index) {
const source = item && typeof item === 'object' ? item : {};
const needQty = Number(source.need_qty || source.needQty || source.plan_qty || source.planQty || source.qty || source.total_qty || 0);
const pickedQty = Number(source.picked_qty || source.pickedQty || source.done_qty || source.doneQty || source.finish_qty || source.finishQty || source.scanned_qty || source.scannedQty || 0);
const basketNo = source.basket_no || source.basketNo || source.basket_code || source.bucket_no || '';
const space = source.space_name || source.spaceName || source.space || source.location || source.location_code || source.bin_code || source.slot || '--';
const skuCode = source.sku_code || source.skuCode || source.sku || source.product_code || source.goods_code || '--';
const skuName = source.sku_name || source.skuName || source.name || source.product_name || source.goods_name || '--';
const imageUrl = source.image || source.image_url || source.product_image || source.goods_image || source.pic || source.cover || '';
return {
lineId: source.line_id || source.lineId || source.detail_id || source.detailId || source.id || source.order_item_id || `${this.orderInfo.orderNo || 'detail'}-${index + 1}`,
skuName,
skuCode,
imageUrl,
barcode: source.barcode || source.code || source.ean || '',
basketNo,
space,
needQty,
pickedQty,
noBarcodeVerified: Boolean(source.no_barcode_verified || source.noBarcodeVerified),
locationErrorReported: Boolean(source.location_error_reported || source.locationErrorReported)
};
},
getBasketNoText(line) {
if (!line || typeof line !== 'object') {
return '--';
@ -408,6 +568,7 @@
pickedQty: Number(targetLine.needQty || 0)
};
this.$set(this.detailList, index, updatedLine);
this.currentDetailIndex = index;
this.recalculateOrderProgress();
this.emitOrderUpdate();
@ -462,66 +623,54 @@
if (this.orderInfo.status !== 'picking') {
return;
}
this.orderInfo.status = 'done';
this.detailList = this.detailList.map(line => ({
...line,
pickedQty: Number(line.needQty || 0)
}));
this.recalculateOrderProgress();
this.emitOrderUpdate();
uni.showToast({
title: '拣货完成',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack({
delta: 1
});
}, 300);
this.submitCompletePicking();
},
buildMockDetails(orderInfo) {
const total = Number(orderInfo.needQty || 0);
const picked = Number(orderInfo.pickedQty || 0);
const firstNeed = Math.max(Math.floor(total * 0.4), 1);
const secondNeed = Math.max(Math.floor(total * 0.35), 1);
const thirdNeed = Math.max(total - firstNeed - secondNeed, 1);
const firstPicked = Math.min(firstNeed, picked);
const secondPicked = Math.min(secondNeed, Math.max(picked - firstPicked, 0));
const thirdPicked = Math.min(thirdNeed, Math.max(picked - firstPicked - secondPicked, 0));
return [
{
lineId: `${orderInfo.orderNo}-1`,
skuName: '陶瓷马克杯 350ml',
skuCode: 'SKU-CP-350',
barcode: '6901001000011',
basketNo: 'A01',
space: 'A-01-03',
needQty: firstNeed,
pickedQty: firstPicked
},
{
lineId: `${orderInfo.orderNo}-2`,
skuName: '密封保鲜盒 2L',
skuCode: 'SKU-FB-2000',
barcode: '6901001000028',
basketNo: 'B02',
space: 'B-02-08',
needQty: secondNeed,
pickedQty: secondPicked
},
{
lineId: `${orderInfo.orderNo}-3`,
skuName: '厨房清洁布 5片装',
skuCode: 'SKU-KC-005',
barcode: '6901001000035',
basketNo: 'C03',
space: 'C-03-12',
needQty: thirdNeed,
pickedQty: thirdPicked
}
];
}
showPrevDetail() {
if (!this.hasPrevDetail) {
return;
}
this.currentDetailIndex -= 1;
},
showNextDetail() {
if (!this.hasNextDetail) {
return;
}
this.currentDetailIndex += 1;
},
async submitCompletePicking() {
if (this.completing) {
return;
}
this.completing = true;
try {
const params = this.buildCompletePickingParams();
await this.$http('pick.complete', params);
this.orderInfo.status = 'done';
this.detailList = this.detailList.map(line => ({
...line,
pickedQty: Number(line.needQty || 0)
}));
this.recalculateOrderProgress();
this.emitOrderUpdate();
uni.showToast({
title: '拣货完成',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack({
delta: 1
});
}, 300);
} catch (error) {
uni.showToast({
title: this.getApiErrorMessage(error, '完成拣货失败'),
icon: 'none'
});
} finally {
this.completing = false;
}
},
}
}
</script>
@ -552,14 +701,6 @@
color: #303133;
}
.mode-tag {
font-size: 22rpx;
color: #2979ff;
background: #edf4ff;
padding: 6rpx 12rpx;
border-radius: 16rpx;
}
.summary-row,
.detail-row {
display: flex;
@ -612,6 +753,16 @@
padding: 0 24rpx 160rpx;
}
.detail-empty {
background: #fff;
border-radius: 14rpx;
padding: 30rpx 20rpx;
text-align: center;
font-size: 24rpx;
color: #909399;
margin-bottom: 12rpx;
}
.detail-item {
background: #fff;
border-radius: 14rpx;
@ -619,6 +770,16 @@
margin-bottom: 12rpx;
}
.detail-main {
display: flex;
align-items: flex-start;
}
.detail-main-info {
flex: 1;
margin-left: 14rpx;
}
.detail-head {
display: flex;
justify-content: space-between;
@ -672,6 +833,18 @@
border-radius: 12rpx;
}
.switch-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8rpx 0 14rpx;
}
.switch-index {
font-size: 24rpx;
color: #606266;
}
.action-bar {
position: fixed;
left: 0;

View File

@ -25,25 +25,6 @@
</view>
</view>
</view>
<view class="mode-panel">
<text class="mode-title">拣货模式</text>
<view class="mode-switch-group">
<view
class="mode-switch-btn"
:class="{ 'mode-switch-btn--active': pickMode === 'F' }"
@click="switchPickMode('F')"
>
F拣货(先拣后分)
</view>
<view
class="mode-switch-btn"
:class="{ 'mode-switch-btn--active': pickMode === 'E' }"
@click="switchPickMode('E')"
>
E拣货(边拣边分)
</view>
</view>
</view>
<scroll-view class="status-tabs" scroll-x>
<view
v-for="item in statusTabs"
@ -55,6 +36,14 @@
{{ item.label }}
</view>
</scroll-view>
<view class="summary-panel">
<view class="summary-row"><text class="summary-label">波次号:</text><text class="summary-value">{{ headerSummary.waveNo || '--' }}</text></view>
<view class="summary-row"><text class="summary-label">总商品数量:</text><text class="summary-value">{{ headerSummary.quantityTotal }}</text></view>
<view class="summary-inline-row">
<view class="summary-inline-item"><text class="summary-label">待复核:</text><text class="summary-value">{{ headerSummary.pendingReviewCount }}</text></view>
<view class="summary-inline-item"><text class="summary-label">已复核:</text><text class="summary-value">{{ headerSummary.reviewedCount }}</text></view>
</view>
</view>
</view>
<scroll-view class="list-content" scroll-y>
@ -64,17 +53,13 @@
</view>
<view v-else class="list-wrap">
<view class="order-item" v-for="item in displayList" :key="item.id">
<view class="item-header">
<text class="order-no">{{ item.orderNo }}</text>
<text class="order-status" :class="`order-status--${item.status}`">{{ getStatusText(item.status) }}</text>
</view>
<view class="item-row"><text class="label">客户:</text><text class="value">{{ item.customerName || '--' }}</text></view>
<view class="item-row"><text class="label">波次:</text><text class="value">{{ item.waveNo || '--' }}</text></view>
<view class="item-row"><text class="label">SKU数:</text><text class="value">{{ item.skuCount }}</text></view>
<view class="item-row"><text class="label">应拣数量:</text><text class="value">{{ item.needQty }}</text></view>
<view class="item-row"><text class="label">已拣数量:</text><text class="value">{{ item.pickedQty }}</text></view>
<view class="item-row item-row--with-status"><text class="label">货主:</text><text class="value">{{ item.ownerName || '--' }}</text><text class="order-status" :class="`order-status--${normalizeStatus(item.pickingStatus)}`">{{ getPickingStatusText(item.pickingStatus) }}</text></view>
<view class="item-row"><text class="label">库位:</text><text class="value">{{ item.spaceName || '--' }}</text></view>
<view class="item-row"><text class="label">库位状态:</text><text class="value">{{ getSpaceStatusText(item.spaceStatus) }}</text></view>
<view class="item-row"><text class="label">商品数量:</text><text class="value">{{ item.quantity }}</text></view>
<view class="item-row"><text class="label">复核状态:</text><text class="value">{{ getReviewStatusText(item.reviewed, item.inspectionStatus) }}</text></view>
<view class="item-footer">
<text class="create-time">{{ item.createTime }}</text>
<view></view>
<u-button type="primary" size="mini" :customStyle="{ backgroundColor: '#2979ff', borderColor: '#2979ff' }" @click="goPicking(item)">进入拣货</u-button>
</view>
</view>
@ -94,8 +79,13 @@
return {
title: '订单拣货',
keyword: '',
pickMode: 'F',
fullDisplay: true,
headerSummary: {
waveNo: '--',
pendingReviewCount: 0,
reviewedCount: 0,
quantityTotal: 0
},
loading: false,
status: 'all',
pageSize: 10,
@ -131,12 +121,6 @@
if (options && options.status) {
this.status = options.status;
}
if (options && options.mode) {
const mode = String(options.mode || '').toUpperCase();
if (mode === 'F' || mode === 'E') {
this.pickMode = mode;
}
}
if (options && options.waybill_code) {
this.keyword = String(options.waybill_code || '').trim();
this.handleSearch({
@ -221,16 +205,48 @@
icon: 'none'
});
},
switchPickMode(mode) {
if (mode !== 'F' && mode !== 'E') {
return;
}
this.pickMode = mode;
},
getApiErrorMessage(error, fallback = '请求失败') {
const message = error?.message || error?.msg || error?.errMsg || error?.data?.message;
return String(message || fallback);
},
resetHeaderSummary() {
this.headerSummary = {
waveNo: '--',
pendingReviewCount: 0,
reviewedCount: 0,
quantityTotal: 0
};
},
extractHeaderSummary(response) {
const dataSource = (response?.data?.data && typeof response.data.data === 'object' && !Array.isArray(response.data.data))
? response.data.data
: ((response?.data && typeof response.data === 'object' && !Array.isArray(response.data))
? response.data
: ((response?.result && typeof response.result === 'object' && !Array.isArray(response.result))
? response.result
: ((response && typeof response === 'object' && !Array.isArray(response)) ? response : null)));
if (!dataSource) {
this.resetHeaderSummary();
return;
}
const summary = dataSource.summary && typeof dataSource.summary === 'object' && !Array.isArray(dataSource.summary)
? dataSource.summary
: {};
const toNumber = value => {
const num = Number(value);
return Number.isNaN(num) ? 0 : num;
};
this.headerSummary = {
waveNo: dataSource.wave_no || dataSource.waveNo || summary.wave_no || summary.waveNo || '--',
pendingReviewCount: toNumber(summary.pending_review_count ?? summary.pendingReviewCount ?? dataSource.pending_review_count ?? dataSource.pendingReviewCount),
reviewedCount: toNumber(summary.reviewed_count ?? summary.reviewedCount ?? dataSource.reviewed_count ?? dataSource.reviewedCount),
quantityTotal: toNumber(summary.quantity_total ?? summary.quantityTotal ?? dataSource.quantity_total ?? dataSource.quantityTotal)
};
},
normalizeStatus(value) {
const text = String(value || '').toLowerCase();
if (!text) {
@ -269,17 +285,34 @@
},
normalizeOrderItem(item, index) {
const source = item && typeof item === 'object' ? item : {};
const inspectionStatus = source.inspection_status || source.pick_status || source.status;
const summary = source.summary && typeof source.summary === 'object' ? source.summary : {};
const locationSpace = source.location_space && typeof source.location_space === 'object' ? source.location_space : {};
const storeWarehouse = source.store_warehouse && typeof source.store_warehouse === 'object' ? source.store_warehouse : {};
const detailList = Array.isArray(source.details)
? source.details
: (Array.isArray(summary.details) ? summary.details : []);
const pickingStatus = source.picking_status || source.pick_status || source.status || summary.picking_status;
const inspectionStatus = source.inspection_status || summary.inspection_status;
return {
id: source.id || source.order_id || source.pick_id || source.waybill_code || `pick_${index}`,
orderId: Number(source.order_id || source.orderId || 0),
orderItemId: Number(source.order_item_id || source.orderItemId || 0),
orderNo: source.order_no || source.order_code || source.waybill_code || source.waybillCode || '--',
customerName: source.customer_name || source.consignee || source.receiver_name || '--',
waveNo: source.wave_no || source.wave_code || source.batch_no || '--',
skuCount: Number(source.sku_count || source.item_count || source.goods_count || source.detail_count || 0),
needQty: Number(source.need_qty || source.pick_qty || source.total_qty || source.total_quantity || 0),
pickedQty: Number(source.picked_qty || source.done_qty || source.finish_qty || source.finished_qty || source.finished_qty || 0),
status: this.normalizeStatus(inspectionStatus),
createTime: source.created_at || source.create_time || source.createdAt || '--'
waveNo: source.wave_no || summary.wave_no || source.wave_code || source.batch_no || '--',
ownerName: storeWarehouse.store_remask || storeWarehouse.store_name || source.owner_name || source.ownerName || '--',
quantity: Number(source.quantity || summary.quantity || source.need_qty || summary.need_qty || 0),
spaceName: source.space_name || locationSpace.space_code || locationSpace.custom_name || summary.space_name || '--',
spaceStatus: locationSpace.space_status || source.space_status || '',
pickingStatus: pickingStatus || 'pending',
inspectionStatus: inspectionStatus || '',
reviewed: Boolean(source.reviewed),
skuCount: Number(summary.sku_count || source.sku_count || summary.item_count || source.item_count || source.goods_count || source.detail_count || 0),
needQty: Number(summary.need_qty || source.need_qty || summary.pick_qty || source.pick_qty || summary.total_qty || source.total_qty || source.total_quantity || 0),
pickedQty: Number(summary.picked_qty || source.picked_qty || summary.done_qty || source.done_qty || source.finish_qty || source.finished_qty || 0),
status: this.normalizeStatus(pickingStatus),
createTime: source.created_at || source.create_time || source.createdAt || '--',
detailList
};
},
applyFilteredList(resetPage = true) {
@ -296,6 +329,7 @@
const waybillCode = String(this.keyword || '').trim();
if (!waybillCode) {
this.fullList = [];
this.resetHeaderSummary();
this.applyFilteredList(true);
if (!silentTip) {
uni.showToast({
@ -312,12 +346,14 @@
waybill_code: waybillCode,
full_display: Boolean(this.fullDisplay)
});
this.extractHeaderSummary(response);
const orderList = this.extractOrderList(response)
.map((item, index) => this.normalizeOrderItem(item, index));
this.fullList = orderList;
this.applyFilteredList(resetPage);
} catch (error) {
this.fullList = [];
this.resetHeaderSummary();
this.applyFilteredList(true);
uni.showToast({
title: this.getApiErrorMessage(error, '查询失败'),
@ -353,16 +389,52 @@
};
return map[status] || '未知状态';
},
getPickingStatusText(status) {
return this.getStatusText(this.normalizeStatus(status));
},
getReviewStatusText(reviewed, inspectionStatus) {
if (reviewed === true) {
return '已复核';
}
const text = String(inspectionStatus || '').toLowerCase();
if (!text || ['pending', 'padding', 'wait', 'waiting', 'todo'].includes(text)) {
return '待复核';
}
if (['reviewed', 'done', 'completed', 'finish', 'finished', 'success'].includes(text)) {
return '已复核';
}
return text;
},
getSpaceStatusText(status) {
const text = String(status || '').toUpperCase();
const map = {
AVAILABLE: '可用',
DISABLED: '禁用',
LOCKED: '锁定'
};
return map[text] || (status || '--');
},
goPicking(item) {
const orderId = Number(item?.orderId || 0);
const orderItemId = Number(item?.orderItemId || 0);
if (!orderId || !orderItemId) {
uni.showToast({
title: '缺少订单参数',
icon: 'none'
});
return;
}
const params = [
`id=${encodeURIComponent(String(item.id || ''))}`,
`orderId=${encodeURIComponent(String(orderId))}`,
`orderItemId=${encodeURIComponent(String(orderItemId))}`,
`orderNo=${encodeURIComponent(String(item.orderNo || ''))}`,
`customerName=${encodeURIComponent(String(item.customerName || ''))}`,
`waveNo=${encodeURIComponent(String(item.waveNo || ''))}`,
`spaceName=${encodeURIComponent(String(item.spaceName || ''))}`,
`status=${encodeURIComponent(String(item.status || 'pending'))}`,
`needQty=${encodeURIComponent(String(item.needQty || 0))}`,
`pickedQty=${encodeURIComponent(String(item.pickedQty || 0))}`,
`mode=${encodeURIComponent(String(this.pickMode || 'F'))}`
`pickedQty=${encodeURIComponent(String(item.pickedQty || 0))}`
];
this.$tools.routerTo(`/pages/work/order/detail?${params.join('&')}`);
},
@ -404,9 +476,7 @@
this.$set(this.fullList, index, merged);
this.applyFilteredList(false);
},
getPickModeText() {
return this.pickMode === 'E' ? 'E拣货(边拣边分)' : 'F拣货(先拣后分)';
}
}
}
</script>
@ -437,46 +507,6 @@
padding: 16rpx 24rpx;
}
.mode-panel {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 24rpx 16rpx;
}
.mode-title {
font-size: 24rpx;
color: #606266;
padding-right: 16rpx;
}
.mode-switch-group {
flex: 1;
display: flex;
align-items: center;
background: #f6f7fb;
border-radius: 12rpx;
padding: 6rpx;
box-sizing: border-box;
}
.mode-switch-btn {
flex: 1;
height: 56rpx;
display: flex;
align-items: center;
justify-content: center;
font-size: 23rpx;
color: #606266;
border-radius: 10rpx;
}
.mode-switch-btn--active {
background: #fff;
color: #2979ff;
font-weight: 600;
}
.search-input-wrap {
display: flex;
align-items: center;
@ -543,6 +573,61 @@
background: #edf4ff;
}
.summary-panel {
margin: 0 24rpx 16rpx;
padding: 16rpx 20rpx;
background: #f8fbff;
border: 1rpx solid #e4efff;
border-radius: 12rpx;
}
.summary-row {
display: flex;
align-items: center;
font-size: 24rpx;
line-height: 38rpx;
}
.summary-label {
width: 180rpx;
font-size: 24rpx;
line-height: 38rpx;
color: #909399;
}
.summary-value {
flex: 1;
font-size: 24rpx;
line-height: 38rpx;
color: #303133;
font-weight: 500;
}
.summary-inline-row {
display: flex;
align-items: center;
justify-content: space-between;
}
.summary-inline-item {
flex: 1;
display: flex;
align-items: center;
}
.summary-inline-item + .summary-inline-item {
margin-left: 16rpx;
}
.summary-inline-item .summary-label {
width: 132rpx;
}
.summary-inline-item .summary-value {
flex: 0;
min-width: 40rpx;
}
.list-content {
height: 100rpx;
flex: 1;
@ -564,6 +649,14 @@
margin-bottom: 12rpx;
}
.item-header--status-only {
justify-content: flex-end;
}
.item-row--with-status .order-status {
margin-left: 12rpx;
}
.order-no {
font-size: 30rpx;
font-weight: 600;

View File

@ -0,0 +1,219 @@
<template>
<view class="scatter-wave-page">
<view class="normar_container">
<page-nav :title="title"></page-nav>
<scroll-view class="list-content" scroll-y>
<view v-if="loading" class="empty-wrap">
<text class="empty-text">加载中...</text>
</view>
<view v-else-if="strategyList.length === 0" class="empty-wrap">
<text class="empty-text">暂无策略</text>
</view>
<view v-else class="list-wrap">
<view class="content-card" v-for="item in strategyList" :key="item.id">
<view class="card-title">{{ item.strategyName }}</view>
<view class="card-row"><text class="label">货主:</text><text class="value">{{ item.ownerText }}</text></view>
<view class="card-row"><text class="label">订单小于SKU数:</text><text class="value">{{ item.orderMaxSku }}</text></view>
<view class="card-row"><text class="label">订单最小SKU数:</text><text class="value">{{ item.orderMinSku }}</text></view>
<view class="card-row"><text class="label">订单最大商品数:</text><text class="value">{{ item.orderMaxQty }}</text></view>
<view class="card-row"><text class="label">订单最小商品数:</text><text class="value">{{ item.orderMinQty }}</text></view>
<view class="card-row"><text class="label">订单快递限制:</text><text class="value">{{ item.expressLimitText }}</text></view>
<view class="card-row"><text class="label">订单平台限制:</text><text class="value">{{ item.platformLimitText }}</text></view>
<view class="card-row"><text class="label">按货主分组:</text><text class="value">{{ item.groupByOwnerText }}</text></view>
<view class="card-row"><text class="label">按快递分组:</text><text class="value">{{ item.groupByExpressText }}</text></view>
<view class="card-row"><text class="label">拣货类型:</text><text class="value">{{ item.pickTypeText }}</text></view>
</view>
</view>
<view class="safe-area-bottom"></view>
</scroll-view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: '散单波次策略',
loading: false,
strategyList: []
};
},
onLoad() {
this.loadStrategyList();
},
methods: {
getApiErrorMessage(error, fallback = '请求失败') {
const message = error?.message || error?.msg || error?.errMsg || error?.data?.message;
return String(message || fallback);
},
buildWaveStrategyListParams() {
return {};
},
extractWaveStrategyPayload(response) {
const candidates = [
response?.data?.data,
response?.data,
response?.result,
response
];
for (let i = 0; i < candidates.length; i += 1) {
const current = candidates[i];
if (current && typeof current === 'object' && !Array.isArray(current)) {
return current;
}
}
return {};
},
extractWaveStrategyList(payload, response) {
const candidates = [
payload?.list,
payload?.rows,
payload?.items,
payload?.data?.list,
response?.data?.list,
response?.data?.data?.list,
response?.list
];
for (let i = 0; i < candidates.length; i += 1) {
if (Array.isArray(candidates[i])) {
return candidates[i];
}
}
return [];
},
normalizeBooleanText(value) {
const normalized = Number(value) === 1 || value === true;
return normalized ? '是' : '否';
},
normalizeLimitText(value) {
if (Array.isArray(value)) {
return value.length ? value.join('、') : '不限';
}
if (value == null || value === '') {
return '不限';
}
if (typeof value === 'string') {
return value.trim() ? value : '不限';
}
return String(value);
},
normalizePickTypeText(item) {
const type = Number(item?.strategy_type || 0);
const mode = Number(item?.batch_mode || 0);
if (mode === 1) {
return '边拣边分';
}
if (type === 1) {
return '先拣后分';
}
return '未知';
},
normalizeWaveStrategyItem(item) {
const source = item && typeof item === 'object' ? item : {};
const ownerText = this.normalizeLimitText(source.allowed_owners);
return {
id: source.id || Math.random().toString(36).slice(2),
strategyName: source.strategy_name || '--',
ownerText,
orderMaxSku: Number(source.order_max_sku || 0),
orderMinSku: Number(source.order_min_sku || 0),
orderMaxQty: Number(source.order_max_qty || 0),
orderMinQty: Number(source.order_min_qty || 0),
expressLimitText: this.normalizeLimitText(source.allowed_expresses),
platformLimitText: this.normalizeLimitText(source.allowed_platforms),
groupByOwnerText: this.normalizeBooleanText(source.allow_cross_owner),
groupByExpressText: this.normalizeBooleanText(source.require_same_express),
pickTypeText: this.normalizePickTypeText(source)
};
},
parseWaveStrategyResponse(response) {
const payload = this.extractWaveStrategyPayload(response);
const list = this.extractWaveStrategyList(payload, response);
return list.map(item => this.normalizeWaveStrategyItem(item));
},
async loadStrategyList() {
this.loading = true;
try {
const params = this.buildWaveStrategyListParams();
const response = await this.$http('order.wave.waveStrategyList', params);
this.strategyList = this.parseWaveStrategyResponse(response);
} catch (error) {
this.strategyList = [];
uni.showToast({
title: this.getApiErrorMessage(error, '策略加载失败'),
icon: 'none'
});
} finally {
this.loading = false;
}
}
}
};
</script>
<style lang="scss" scoped>
.scatter-wave-page {
min-height: 100vh;
background: #f8f9fa;
}
.list-content {
height: 100rpx;
flex: 1;
padding-top: 20rpx;
box-sizing: border-box;
}
.list-wrap {
padding-bottom: 20rpx;
}
.content-card {
margin: 20rpx 24rpx;
padding: 20rpx;
background: #fff;
border-radius: 14rpx;
}
.card-title {
font-size: 30rpx;
font-weight: 600;
color: #303133;
margin-bottom: 14rpx;
}
.card-row {
display: flex;
align-items: flex-start;
font-size: 24rpx;
line-height: 38rpx;
}
.label {
width: 220rpx;
color: #909399;
}
.value {
flex: 1;
color: #303133;
}
.empty-wrap {
min-height: 400rpx;
display: flex;
align-items: center;
justify-content: center;
}
.empty-text {
font-size: 26rpx;
color: #909399;
}
.safe-area-bottom {
height: calc(20rpx + env(safe-area-inset-bottom));
}
</style>