479 lines
11 KiB
Vue
479 lines
11 KiB
Vue
<template>
|
||
<view class="order-picking-page">
|
||
<view class="normar_container">
|
||
<view class="page-header">
|
||
<page-nav :title="title"></page-nav>
|
||
<view class="search-panel">
|
||
<view class="search-input-wrap">
|
||
<u-search
|
||
v-model="keyword"
|
||
placeholder="请输入订单号/客户名称"
|
||
:bg-color="'#f5f5f5'"
|
||
shape="round"
|
||
:show-action="false"
|
||
@search="handleSearch"
|
||
@clear="handleSearch"
|
||
></u-search>
|
||
<view class="search-actions">
|
||
<view class="scan-btn" @click="handleCameraScan">
|
||
<u-icon name="scan" size="38rpx" color="#2979ff"></u-icon>
|
||
</view>
|
||
<view class="search-divider"></view>
|
||
<view class="search-btn" @click="handleSearch">
|
||
<text class="search-btn__text">搜索</text>
|
||
</view>
|
||
</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"
|
||
:key="item.value"
|
||
class="status-tab"
|
||
:class="{ 'status-tab--active': status === item.value }"
|
||
@click="switchStatus(item.value)"
|
||
>
|
||
{{ item.label }}
|
||
</view>
|
||
</scroll-view>
|
||
</view>
|
||
|
||
<scroll-view class="list-content" scroll-y>
|
||
<view v-if="displayList.length === 0" class="empty-state">
|
||
<u-icon name="list" size="88" color="#c0c4cc"></u-icon>
|
||
<text class="empty-text">暂无订单</text>
|
||
</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-footer">
|
||
<text class="create-time">{{ item.createTime }}</text>
|
||
<u-button type="primary" size="mini" :customStyle="{ backgroundColor: '#2979ff', borderColor: '#2979ff' }" @click="goPicking(item)">进入拣货</u-button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="safe-area-bottom"></view>
|
||
</scroll-view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
title: '订单拣货',
|
||
keyword: '',
|
||
pickMode: 'F',
|
||
status: 'all',
|
||
onOrderPickingUpdated: null,
|
||
fullList: [
|
||
{
|
||
id: 'op-001',
|
||
orderNo: 'SO20260504001',
|
||
customerName: '广州天豹贸易',
|
||
waveNo: 'W2026050401',
|
||
skuCount: 6,
|
||
needQty: 56,
|
||
pickedQty: 0,
|
||
status: 'pending',
|
||
createTime: '2026-05-04 09:10'
|
||
},
|
||
{
|
||
id: 'op-002',
|
||
orderNo: 'SO20260504002',
|
||
customerName: '深圳辰星供应链',
|
||
waveNo: 'W2026050401',
|
||
skuCount: 9,
|
||
needQty: 120,
|
||
pickedQty: 68,
|
||
status: 'picking',
|
||
createTime: '2026-05-04 09:32'
|
||
},
|
||
{
|
||
id: 'op-003',
|
||
orderNo: 'SO20260503015',
|
||
customerName: '佛山云仓科技',
|
||
waveNo: 'W2026050303',
|
||
skuCount: 3,
|
||
needQty: 24,
|
||
pickedQty: 24,
|
||
status: 'done',
|
||
createTime: '2026-05-03 15:46'
|
||
}
|
||
],
|
||
displayList: []
|
||
}
|
||
},
|
||
computed: {
|
||
statusTabs() {
|
||
return [
|
||
{ label: '全部', value: 'all' },
|
||
{ label: '待拣货', value: 'pending' },
|
||
{ label: '拣货中', value: 'picking' },
|
||
{ label: '已完成', value: 'done' }
|
||
]
|
||
}
|
||
},
|
||
onLoad(options) {
|
||
this.onOrderPickingUpdated = payload => {
|
||
this.applyOrderUpdate(payload);
|
||
};
|
||
uni.$on('order:picking:updated', this.onOrderPickingUpdated);
|
||
|
||
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;
|
||
}
|
||
}
|
||
this.handleSearch();
|
||
},
|
||
onUnload() {
|
||
if (this.onOrderPickingUpdated) {
|
||
uni.$off('order:picking:updated', this.onOrderPickingUpdated);
|
||
this.onOrderPickingUpdated = null;
|
||
}
|
||
},
|
||
methods: {
|
||
switchPickMode(mode) {
|
||
if (mode !== 'F' && mode !== 'E') {
|
||
return;
|
||
}
|
||
this.pickMode = mode;
|
||
},
|
||
handleSearch() {
|
||
const keyword = String(this.keyword || '').trim().toLowerCase();
|
||
this.displayList = this.fullList.filter(item => {
|
||
const matchStatus = this.status === 'all' || item.status === this.status;
|
||
const matchKeyword = !keyword || String(item.orderNo).toLowerCase().includes(keyword) || String(item.customerName || '').toLowerCase().includes(keyword);
|
||
return matchStatus && matchKeyword;
|
||
});
|
||
},
|
||
switchStatus(nextStatus) {
|
||
this.status = nextStatus;
|
||
this.handleSearch();
|
||
},
|
||
handleCameraScan() {
|
||
uni.scanCode({
|
||
success: (res) => {
|
||
this.keyword = String(res.result || '').trim();
|
||
this.handleSearch();
|
||
},
|
||
fail: () => {}
|
||
});
|
||
},
|
||
getStatusText(status) {
|
||
const map = {
|
||
pending: '待拣货',
|
||
picking: '拣货中',
|
||
done: '已完成'
|
||
};
|
||
return map[status] || '未知状态';
|
||
},
|
||
goPicking(item) {
|
||
const params = [
|
||
`id=${encodeURIComponent(String(item.id || ''))}`,
|
||
`orderNo=${encodeURIComponent(String(item.orderNo || ''))}`,
|
||
`customerName=${encodeURIComponent(String(item.customerName || ''))}`,
|
||
`waveNo=${encodeURIComponent(String(item.waveNo || ''))}`,
|
||
`status=${encodeURIComponent(String(item.status || 'pending'))}`,
|
||
`needQty=${encodeURIComponent(String(item.needQty || 0))}`,
|
||
`pickedQty=${encodeURIComponent(String(item.pickedQty || 0))}`,
|
||
`mode=${encodeURIComponent(String(this.pickMode || 'F'))}`
|
||
];
|
||
this.$tools.routerTo(`/pages/work/order/detail?${params.join('&')}`);
|
||
},
|
||
applyOrderUpdate(payload) {
|
||
if (!payload || typeof payload !== 'object') {
|
||
return;
|
||
}
|
||
|
||
const targetId = String(payload.id || '');
|
||
const targetOrderNo = String(payload.orderNo || '');
|
||
const nextStatus = String(payload.status || '').trim();
|
||
const nextPickedQty = Number(payload.pickedQty);
|
||
|
||
const index = this.fullList.findIndex(item => {
|
||
if (!item || typeof item !== 'object') {
|
||
return false;
|
||
}
|
||
const matchId = targetId && String(item.id || '') === targetId;
|
||
const matchOrderNo = targetOrderNo && String(item.orderNo || '') === targetOrderNo;
|
||
return matchId || matchOrderNo;
|
||
});
|
||
|
||
if (index < 0) {
|
||
return;
|
||
}
|
||
|
||
const source = this.fullList[index];
|
||
const merged = {
|
||
...source
|
||
};
|
||
|
||
if (nextStatus) {
|
||
merged.status = nextStatus;
|
||
}
|
||
if (!Number.isNaN(nextPickedQty)) {
|
||
merged.pickedQty = Math.max(0, Math.min(nextPickedQty, Number(merged.needQty || 0)));
|
||
}
|
||
|
||
this.$set(this.fullList, index, merged);
|
||
this.handleSearch();
|
||
},
|
||
getPickModeText() {
|
||
return this.pickMode === 'E' ? 'E拣货(边拣边分)' : 'F拣货(先拣后分)';
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.order-picking-page {
|
||
min-height: 100vh;
|
||
background: #f8f9fa;
|
||
}
|
||
|
||
.page-header {
|
||
position: sticky;
|
||
top: 0;
|
||
z-index: 10;
|
||
background: #fff;
|
||
border-bottom: 1rpx solid #f2f2f2;
|
||
}
|
||
|
||
.search-panel {
|
||
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;
|
||
background: #fff;
|
||
border-radius: 26rpx;
|
||
padding: 8rpx 12rpx;
|
||
border: 1rpx solid #dbe7ff;
|
||
}
|
||
|
||
.search-actions {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-left: 12rpx;
|
||
}
|
||
|
||
.scan-btn {
|
||
width: 64rpx;
|
||
height: 64rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.search-divider {
|
||
width: 1rpx;
|
||
height: 34rpx;
|
||
background: #e6eaf2;
|
||
}
|
||
|
||
.search-btn {
|
||
padding: 0 20rpx;
|
||
height: 64rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.search-btn__text {
|
||
font-size: 26rpx;
|
||
color: #2979ff;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.status-tabs {
|
||
white-space: nowrap;
|
||
padding: 0 24rpx 16rpx;
|
||
}
|
||
|
||
.status-tab {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
height: 52rpx;
|
||
padding: 0 24rpx;
|
||
margin-right: 12rpx;
|
||
font-size: 24rpx;
|
||
color: #666;
|
||
background: #f6f7fb;
|
||
border-radius: 26rpx;
|
||
}
|
||
|
||
.status-tab--active {
|
||
color: #2979ff;
|
||
background: #edf4ff;
|
||
}
|
||
|
||
.list-content {
|
||
height: calc(100vh - 332rpx);
|
||
padding: 20rpx 24rpx 0;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.order-item {
|
||
background: #fff;
|
||
border-radius: 14rpx;
|
||
padding: 20rpx;
|
||
margin-bottom: 16rpx;
|
||
}
|
||
|
||
.item-header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 12rpx;
|
||
}
|
||
|
||
.order-no {
|
||
font-size: 30rpx;
|
||
font-weight: 600;
|
||
color: #303133;
|
||
}
|
||
|
||
.order-status {
|
||
font-size: 22rpx;
|
||
padding: 6rpx 14rpx;
|
||
border-radius: 18rpx;
|
||
}
|
||
|
||
.order-status--pending {
|
||
background: #fff4e8;
|
||
color: #fa8c16;
|
||
}
|
||
|
||
.order-status--picking {
|
||
background: #edf4ff;
|
||
color: #2979ff;
|
||
}
|
||
|
||
.order-status--done {
|
||
background: #eafaf0;
|
||
color: #19be6b;
|
||
}
|
||
|
||
.item-row {
|
||
display: flex;
|
||
align-items: center;
|
||
font-size: 24rpx;
|
||
line-height: 38rpx;
|
||
}
|
||
|
||
.label {
|
||
width: 128rpx;
|
||
color: #909399;
|
||
}
|
||
|
||
.value {
|
||
flex: 1;
|
||
color: #303133;
|
||
}
|
||
|
||
.item-footer {
|
||
margin-top: 16rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.create-time {
|
||
font-size: 22rpx;
|
||
color: #999;
|
||
}
|
||
|
||
.empty-state {
|
||
min-height: 540rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.empty-text {
|
||
margin-top: 12rpx;
|
||
font-size: 26rpx;
|
||
color: #999;
|
||
}
|
||
|
||
.safe-area-bottom {
|
||
height: calc(20rpx + env(safe-area-inset-bottom));
|
||
}
|
||
</style> |