feat(order-picking): add picking mode and picking detail workflow
This commit is contained in:
parent
39543305a3
commit
7d81508255
14
pages.json
14
pages.json
@ -141,6 +141,20 @@
|
||||
{
|
||||
"titleNView": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/work/order/picking",
|
||||
"style" :
|
||||
{
|
||||
"titleNView": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/work/order/detail",
|
||||
"style" :
|
||||
{
|
||||
"titleNView": false
|
||||
}
|
||||
}
|
||||
|
||||
],
|
||||
|
||||
@ -313,6 +313,7 @@
|
||||
toPath(item) {
|
||||
const menuName = String(item?.name || '').trim();
|
||||
const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询'));
|
||||
const isOrderPicking = 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';
|
||||
@ -326,7 +327,7 @@
|
||||
}
|
||||
const targetPath = isGoodsQuery
|
||||
? '/pages/work/product/query'
|
||||
: normalizedPath;
|
||||
: (isOrderPicking ? '/pages/work/order/picking' : normalizedPath);
|
||||
|
||||
if (!targetPath) {
|
||||
uni.showToast({
|
||||
|
||||
@ -289,6 +289,26 @@
|
||||
},
|
||||
|
||||
methods: {
|
||||
async getLatestUserInfo() {
|
||||
try {
|
||||
const latestUser = await this.$store.dispatch('getUserInfo');
|
||||
if (latestUser && typeof latestUser === 'object') {
|
||||
this.userInfo = latestUser;
|
||||
return latestUser;
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('拉取最新用户信息失败,回退本地用户缓存:', error);
|
||||
}
|
||||
|
||||
const fallbackUser = this.$store.getters.user || this.userInfo || null;
|
||||
if (fallbackUser && typeof fallbackUser === 'object') {
|
||||
this.userInfo = fallbackUser;
|
||||
return fallbackUser;
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
createDefaultDragPreviewSnapshot() {
|
||||
return {
|
||||
name: '未命名菜单',
|
||||
@ -439,21 +459,7 @@
|
||||
},
|
||||
|
||||
async loadUserInfo() {
|
||||
// 等待用户信息加载
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
|
||||
if (!this.$store.getters.user) {
|
||||
console.log('等待用户信息...');
|
||||
setTimeout(() => this.loadUserInfo(), 100);
|
||||
return;
|
||||
}
|
||||
|
||||
const userData = this.$store.getters.user;
|
||||
if (userData) {
|
||||
this.isLoading = false;
|
||||
this.userInfo = userData;
|
||||
await this.refreshQuickActions();
|
||||
}
|
||||
await this.refreshQuickActions();
|
||||
},
|
||||
|
||||
// 刷新快捷入口
|
||||
@ -461,8 +467,16 @@
|
||||
this.isLoading = true;
|
||||
|
||||
try {
|
||||
const latestUser = await this.getLatestUserInfo();
|
||||
if (!latestUser) {
|
||||
console.log('用户信息不可用,快捷入口置空');
|
||||
this.quickActions = [];
|
||||
this.ensureCurrentPageInRange();
|
||||
return;
|
||||
}
|
||||
|
||||
// 1. 获取用户当前可用的菜单
|
||||
const userMenus = this.getUserMenus();
|
||||
const userMenus = this.getUserMenus(latestUser);
|
||||
const latestActions = this.processMenus(userMenus, null);
|
||||
|
||||
// 2. 从Vuex获取已固定的菜单
|
||||
@ -1040,8 +1054,8 @@
|
||||
},
|
||||
|
||||
// 获取用户菜单
|
||||
getUserMenus() {
|
||||
const user = this.$store.getters.user;
|
||||
getUserMenus(userData = null) {
|
||||
const user = userData || this.userInfo || this.$store.getters.user;
|
||||
if (!user) return [];
|
||||
|
||||
// 从用户信息中获取菜单
|
||||
@ -1133,6 +1147,7 @@
|
||||
toPath(item) {
|
||||
const menuName = String(item?.name || '').trim();
|
||||
const isGoodsQuery = menuName === '商品查询' || (menuName.includes('商品') && menuName.includes('查询'));
|
||||
const isOrderPicking = 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';
|
||||
@ -1146,7 +1161,7 @@
|
||||
}
|
||||
const targetPath = isGoodsQuery
|
||||
? '/pages/work/product/query'
|
||||
: normalizedPath;
|
||||
: (isOrderPicking ? '/pages/work/order/picking' : normalizedPath);
|
||||
|
||||
if (!targetPath) {
|
||||
uni.showToast({
|
||||
|
||||
288
pages/work/order/detail.vue
Normal file
288
pages/work/order/detail.vue
Normal file
@ -0,0 +1,288 @@
|
||||
<template>
|
||||
<view class="picking-detail-page">
|
||||
<view class="normar_container">
|
||||
<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>
|
||||
|
||||
<view class="section-title">拣货明细</view>
|
||||
<view class="detail-list">
|
||||
<view class="detail-item" v-for="line in detailList" :key="line.lineId">
|
||||
<view class="detail-head">
|
||||
<text class="sku-name">{{ line.skuName }}</text>
|
||||
<text class="space">{{ line.space }}</text>
|
||||
</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">{{ line.needQty }}</text></view>
|
||||
<view class="detail-row"><text class="label">已拣:</text><text class="value">{{ line.pickedQty }}</text></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="action-bar">
|
||||
<u-button
|
||||
v-if="orderInfo.status === 'pending'"
|
||||
type="primary"
|
||||
:customStyle="{ backgroundColor: '#2979ff', borderColor: '#2979ff' }"
|
||||
@click="startPicking"
|
||||
>开始拣货</u-button>
|
||||
<u-button
|
||||
v-else-if="orderInfo.status === 'picking'"
|
||||
type="success"
|
||||
@click="completePicking"
|
||||
>完成拣货</u-button>
|
||||
<u-button v-else type="info" :disabled="true">已完成</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
title: '拣货详情',
|
||||
pickMode: 'F',
|
||||
orderInfo: {
|
||||
id: '',
|
||||
orderNo: '',
|
||||
customerName: '',
|
||||
waveNo: '',
|
||||
status: 'pending',
|
||||
needQty: 0,
|
||||
pickedQty: 0
|
||||
},
|
||||
detailList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pickModeText() {
|
||||
return this.pickMode === 'E' ? 'E拣货(边拣边分)' : 'F拣货(先拣后分)';
|
||||
},
|
||||
statusText() {
|
||||
const map = {
|
||||
pending: '待拣货',
|
||||
picking: '拣货中',
|
||||
done: '已完成'
|
||||
};
|
||||
return map[this.orderInfo.status] || '未知状态';
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
if (options && options.mode) {
|
||||
const mode = String(options.mode || '').toUpperCase();
|
||||
if (mode === 'F' || mode === 'E') {
|
||||
this.pickMode = mode;
|
||||
}
|
||||
}
|
||||
|
||||
this.orderInfo = {
|
||||
id: options?.id || '',
|
||||
orderNo: options?.orderNo || '--',
|
||||
customerName: options?.customerName || '--',
|
||||
waveNo: options?.waveNo || '--',
|
||||
status: options?.status || 'pending',
|
||||
needQty: Number(options?.needQty || 0),
|
||||
pickedQty: Number(options?.pickedQty || 0)
|
||||
};
|
||||
|
||||
this.detailList = this.buildMockDetails(this.orderInfo);
|
||||
},
|
||||
methods: {
|
||||
emitOrderUpdate() {
|
||||
uni.$emit('order:picking:updated', {
|
||||
id: this.orderInfo.id,
|
||||
orderNo: this.orderInfo.orderNo,
|
||||
status: this.orderInfo.status,
|
||||
pickedQty: this.orderInfo.pickedQty,
|
||||
needQty: this.orderInfo.needQty
|
||||
});
|
||||
},
|
||||
startPicking() {
|
||||
if (this.orderInfo.status !== 'pending') {
|
||||
return;
|
||||
}
|
||||
this.orderInfo.status = 'picking';
|
||||
if (Number(this.orderInfo.needQty || 0) > 0 && Number(this.orderInfo.pickedQty || 0) <= 0) {
|
||||
this.orderInfo.pickedQty = 1;
|
||||
}
|
||||
this.detailList = this.buildMockDetails(this.orderInfo);
|
||||
this.emitOrderUpdate();
|
||||
uni.showToast({
|
||||
title: '已开始拣货',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
completePicking() {
|
||||
if (this.orderInfo.status !== 'picking') {
|
||||
return;
|
||||
}
|
||||
this.orderInfo.status = 'done';
|
||||
this.orderInfo.pickedQty = Number(this.orderInfo.needQty || 0);
|
||||
this.detailList = this.buildMockDetails(this.orderInfo);
|
||||
this.emitOrderUpdate();
|
||||
uni.showToast({
|
||||
title: '拣货完成',
|
||||
icon: 'success'
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
}, 300);
|
||||
},
|
||||
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',
|
||||
space: 'A-01-03',
|
||||
needQty: firstNeed,
|
||||
pickedQty: firstPicked
|
||||
},
|
||||
{
|
||||
lineId: `${orderInfo.orderNo}-2`,
|
||||
skuName: '密封保鲜盒 2L',
|
||||
skuCode: 'SKU-FB-2000',
|
||||
barcode: '6901001000028',
|
||||
space: 'B-02-08',
|
||||
needQty: secondNeed,
|
||||
pickedQty: secondPicked
|
||||
},
|
||||
{
|
||||
lineId: `${orderInfo.orderNo}-3`,
|
||||
skuName: '厨房清洁布 5片装',
|
||||
skuCode: 'SKU-KC-005',
|
||||
barcode: '6901001000035',
|
||||
space: 'C-03-12',
|
||||
needQty: thirdNeed,
|
||||
pickedQty: thirdPicked
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.picking-detail-page {
|
||||
min-height: 100vh;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
|
||||
.summary-card {
|
||||
margin: 20rpx 24rpx 0;
|
||||
padding: 20rpx;
|
||||
background: #fff;
|
||||
border-radius: 14rpx;
|
||||
}
|
||||
|
||||
.summary-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.order-no {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.mode-tag {
|
||||
font-size: 22rpx;
|
||||
color: #2979ff;
|
||||
background: #edf4ff;
|
||||
padding: 6rpx 12rpx;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.summary-row,
|
||||
.detail-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 24rpx;
|
||||
line-height: 38rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
width: 120rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.value {
|
||||
flex: 1;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
padding: 24rpx 24rpx 12rpx;
|
||||
}
|
||||
|
||||
.detail-list {
|
||||
padding: 0 24rpx 160rpx;
|
||||
}
|
||||
|
||||
.detail-item {
|
||||
background: #fff;
|
||||
border-radius: 14rpx;
|
||||
padding: 18rpx 20rpx;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.detail-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.sku-name {
|
||||
font-size: 26rpx;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.space {
|
||||
font-size: 22rpx;
|
||||
color: #606266;
|
||||
background: #f6f7fb;
|
||||
padding: 4rpx 10rpx;
|
||||
border-radius: 12rpx;
|
||||
}
|
||||
|
||||
.action-bar {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 16rpx 24rpx calc(16rpx + env(safe-area-inset-bottom));
|
||||
background: #fff;
|
||||
border-top: 1rpx solid #f0f0f0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
479
pages/work/order/picking.vue
Normal file
479
pages/work/order/picking.vue
Normal file
@ -0,0 +1,479 @@
|
||||
<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>
|
||||
Loading…
x
Reference in New Issue
Block a user