WMS_PDA/pages/work/order/scatter-picking-detail.vue

233 lines
5.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="scatter-picking-detail-page">
<view class="normar_container">
<page-nav :title="title">
<template #right>
<view class="nav-right-action" :class="{ 'nav-right-action--active': onlyMine }" @click="toggleOnlyMine">{{ onlyMine ? '查看全部' : '只看我的' }}</view>
</template>
</page-nav>
<scroll-view class="detail-scroll" scroll-y>
<view v-if="displayOrderList.length === 0" class="empty-state">
<u-icon name="list" size="86" color="#c0c4cc"></u-icon>
<text class="empty-text">暂无可拣货散单</text>
</view>
<view v-else class="record-list">
<view v-for="item in displayOrderList" :key="item.id" class="record-item" @click="goPickGoodsDetail(item)">
<view class="record-main">
<view class="record-left">
<view class="record-line"><text class="record-label">波次号:</text><text class="record-value">{{ item.waveNo || '--' }}</text></view>
<view class="record-line"><text class="record-label">拣货员:</text><text class="record-value">{{ item.pickerName || '--' }}</text></view>
<view class="record-line"><text class="record-label">车号:</text><text class="record-value">{{ item.cartNo || '--' }}</text></view>
</view>
<view class="record-right">
<text class="record-count">未复核 {{ item.unreviewedCount }}</text>
<text class="record-status">{{ getStatusText(item.status) }}</text>
</view>
</view>
</view>
</view>
<view class="safe-area-bottom"></view>
</scroll-view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: '拣货详情(未复核)',
grabCount: 0,
onlyMine: false,
currentUserId: '',
orderList: []
};
},
computed: {
displayOrderList() {
if (!this.onlyMine) {
return this.orderList;
}
return this.orderList.filter(item => item.isMine);
}
},
onLoad(options) {
this.currentUserId = String(this.$store?.getters?.user?.id || this.$store?.getters?.user?.user_id || '');
const hasGrabCountParam = options && Object.prototype.hasOwnProperty.call(options, 'grabCount');
const parsedGrabCount = Number(options?.grabCount || 0);
this.grabCount = hasGrabCountParam
? Math.max(0, parsedGrabCount)
: 5;
this.orderList = this.buildMockOrderList(this.grabCount);
},
methods: {
toggleOnlyMine() {
this.onlyMine = !this.onlyMine;
},
buildMockOrderList(count) {
const listCount = Math.max(0, Number(count || 0));
return Array.from({ length: listCount }).map((_, index) => {
const waveNo = `W${new Date().getFullYear()}${String(index + 1).padStart(4, '0')}`;
const orderNo = `SD${Date.now().toString().slice(-6)}${String(index + 1).padStart(2, '0')}`;
const assigneeId = this.currentUserId || `mock_user_${(index % 2) + 1}`;
const isMine = index % 2 === 0;
const pickerName = isMine ? '我' : `拣货员${(index % 3) + 1}`;
return {
id: `${orderNo}-${index + 1}`,
waveNo,
unreviewedCount: (index % 4) + 1,
pickerName,
cartNo: `A${String((index % 12) + 1).padStart(2, '0')}`,
orderNo,
waybillCode: `WB${String(index + 1).padStart(8, '0')}`,
quantity: (index % 5) + 1,
status: 'pending',
assigneeId,
isMine
};
});
},
getStatusText(status) {
const map = {
pending: '待拣货',
picking: '拣货中',
done: '已完成'
};
return map[status] || '待拣货';
},
goPickGoodsDetail(item) {
if (!item) {
return;
}
const params = [
`recordId=${encodeURIComponent(String(item.id || ''))}`,
`waveNo=${encodeURIComponent(String(item.waveNo || '--'))}`,
`pickerName=${encodeURIComponent(String(item.pickerName || '--'))}`,
`cartNo=${encodeURIComponent(String(item.cartNo || '--'))}`,
`status=${encodeURIComponent(String(item.status || 'pending'))}`,
`unreviewedCount=${encodeURIComponent(String(item.unreviewedCount || 0))}`
];
this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`);
}
}
};
</script>
<style lang="scss" scoped>
.scatter-picking-detail-page {
min-height: 100vh;
background: #f8f9fa;
}
::v-deep .nav-title .right {
width: auto;
min-width: 136rpx;
display: flex;
justify-content: flex-end;
}
.nav-right-action {
font-size: 32rpx;
line-height: 36rpx;
color: #ffffff;
padding: 8rpx 18rpx;
border-radius: 6rpx;
background: #2979ff;
}
.nav-right-action--active {
color: #ffffff;
background: #1f67e6;
}
.detail-scroll {
height: calc(100vh - 120rpx - env(safe-area-inset-bottom));
padding: 20rpx 24rpx 0;
box-sizing: border-box;
}
.record-list {
display: flex;
flex-direction: column;
gap: 14rpx;
}
.record-item {
background: #ffffff;
border-radius: 12rpx;
padding: 18rpx;
border: 1rpx solid #ebeef5;
}
.record-item:active {
opacity: 0.75;
}
.record-main {
display: flex;
justify-content: space-between;
align-items: flex-start;
}
.record-left {
flex: 1;
min-width: 0;
}
.record-line {
display: flex;
align-items: center;
font-size: 28rpx;
line-height: 40rpx;
}
.record-label {
width: 120rpx;
color: #909399;
}
.record-value {
flex: 1;
color: #303133;
}
.record-right {
min-width: 180rpx;
display: flex;
flex-direction: column;
align-items: flex-end;
margin-left: 16rpx;
}
.record-count {
font-size: 26rpx;
line-height: 34rpx;
color: #fa8c16;
}
.record-status {
margin-top: 8rpx;
font-size: 26rpx;
line-height: 34rpx;
color: #2979ff;
}
.empty-state {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.empty-text {
margin-top: 18rpx;
font-size: 28rpx;
color: #909399;
}
.safe-area-bottom {
height: calc(30rpx + env(safe-area-inset-bottom));
}
</style>