WMS_PDA/pages/work/order/scatter-pick-goods-detail.vue

490 lines
10 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-pick-goods-detail-page">
<view class="normar_container">
<page-nav :title="title">
<template #right>
<view class="nav-right-complete" @click="handleComplete">完成</view>
</template>
</page-nav>
<view class="page-head">
<view class="page-head-item">
<view class="page-head-label">波次号</view>
<text class="page-head-value">{{ detailInfo.waveNo || '--' }}</text>
</view>
<view class="page-head-item page-head-item--right">
<view class="page-head-label">订单总数</view>
<text class="page-head-value">{{ orderTotal }}</text>
</view>
</view>
<view v-if="goodsList.length === 0" class="empty-state empty-state--content">
<u-icon name="list" size="86" color="#c0c4cc"></u-icon>
<text class="empty-text">暂无拣货商品</text>
</view>
<view v-else class="content-layout">
<view class="top-module">
<view class="top-card">
<view class="top-main">
<view class="goods-image-name-row">
<u-image class="goods-image" :src="currentGoods.imageUrl || ''" width="300rpx" height="300rpx" mode="aspectFill"></u-image>
<text class="goods-name">{{ currentGoods.skuName || '--' }}</text>
</view>
<view class="top-info">
<view class="goods-row"><view class="label">库位:</view><text class="value">{{ currentGoods.location || '--' }}</text></view>
<view class="goods-row"><view class="label">条码:</view><text class="value">{{ currentGoods.barcode || '--' }}</text></view>
<view class="goods-row goods-row--quantity">
<view class="label">数量:</view>
<text class="value">{{ currentGoods.needQty || 0 }}</text>
<view class="pick-list-title-btn" @click="togglePickListSection">拣货列表</view>
</view>
</view>
</view>
<view class="switch-row">
<u-button size="mini" @click="showPrevGoods" :disabled="!hasPrevGoods">上一个</u-button>
<text class="switch-index">{{ currentGoodsIndex + 1 }}/{{ goodsList.length }}</text>
<u-button type="primary" size="mini" :customStyle="{ backgroundColor: '#2979ff', borderColor: '#2979ff' }" @click="showNextGoods" :disabled="!hasNextGoods">下一个</u-button>
</view>
</view>
</view>
<scroll-view class="bottom-module" scroll-y>
<view class="bottom-module-title" v-show="showPickListSection">拣货列表</view>
<view class="pick-list-scroll" v-show="showPickListSection">
<view class="pick-list">
<view
v-for="(item, index) in goodsList"
:key="item.id"
class="pick-item-wrap"
@click="selectGoods(index)"
>
<view class="metric-card-btn" :class="{ 'metric-card-btn--active': index === currentGoodsIndex }">
<view class="order-corner"></view>
<view class="metric-diagonal"></view>
<text class="metric-order">{{ item.orderCount || 0 }}</text>
<text class="metric-product">{{ item.productQty || 0 }}</text>
</view>
</view>
</view>
</view>
<view class="safe-area-bottom"></view>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: '拣货商品详情',
currentGoodsIndex: 0,
showPickListSection: true,
detailInfo: {
recordId: '',
waveNo: '--',
orderTotal: 0,
pickerName: '--',
cartNo: '--',
status: 'pending',
unreviewedCount: 0
},
goodsList: []
};
},
computed: {
orderTotal() {
const total = Number(this.detailInfo?.orderTotal || 0);
if (!Number.isNaN(total) && total > 0) {
return total;
}
return this.goodsList.length;
},
currentGoods() {
return this.goodsList[this.currentGoodsIndex] || {};
},
hasPrevGoods() {
return this.currentGoodsIndex > 0;
},
hasNextGoods() {
return this.currentGoodsIndex < this.goodsList.length - 1;
}
},
onLoad(options) {
this.detailInfo = {
recordId: options?.recordId || '',
waveNo: options?.waveNo || '--',
orderTotal: Number(options?.orderTotal || 0),
pickerName: options?.pickerName || '--',
cartNo: options?.cartNo || '--',
status: options?.status || 'pending',
unreviewedCount: Number(options?.unreviewedCount || 0)
};
this.goodsList = this.buildMockGoodsList();
this.currentGoodsIndex = 0;
},
methods: {
togglePickListSection() {
this.showPickListSection = !this.showPickListSection;
},
handleComplete() {
uni.showToast({
title: '已完成',
icon: 'none'
});
},
getStatusText(status) {
const map = {
pending: '待拣货',
picking: '拣货中',
done: '已完成'
};
return map[status] || '待拣货';
},
buildMockGoodsList() {
return Array.from({ length: 5 }).map((_, index) => ({
id: `${this.detailInfo.recordId || 'record'}-${index + 1}`,
orderCount: (index % 4) + 1,
productQty: (index % 6) + 2,
skuCode: `SKU${String(index + 1).padStart(4, '0')}`,
skuName: `模拟商品${index + 1}`,
location: `A-${String(index + 1).padStart(2, '0')}`,
barcode: `6900000000${String(index + 1).padStart(3, '0')}`,
imageUrl: '',
needQty: (index % 3) + 1,
pickedQty: 0
}));
},
selectGoods(index) {
const next = Number(index);
if (Number.isNaN(next) || next < 0 || next >= this.goodsList.length) {
return;
}
this.currentGoodsIndex = next;
},
showPrevGoods() {
if (!this.hasPrevGoods) {
return;
}
this.currentGoodsIndex -= 1;
},
showNextGoods() {
if (!this.hasNextGoods) {
return;
}
this.currentGoodsIndex += 1;
}
}
};
</script>
<style lang="scss" scoped>
.scatter-pick-goods-detail-page {
min-height: 100vh;
background: #f8f9fa;
}
::v-deep .nav-title .right {
width: auto;
min-width: 90rpx;
display: flex;
justify-content: flex-end;
}
.nav-right-complete {
font-size: 32rpx;
line-height: 36rpx;
color: #ffffff;
padding: 8rpx 18rpx;
border-radius: 6rpx;
background: #2979ff;
}
.page-head {
margin: 20rpx 24rpx 0;
padding: 16rpx;
background: #fff;
border-radius: 12rpx;
display: flex;
align-items: center;
}
.page-head-item {
flex: 1;
display: flex;
flex-direction: column;
}
.page-head-item--right {
align-items: flex-end;
}
.page-head-label {
font-size: 28rpx;
line-height: 40rpx;
color: #909399;
display: inline-flex;
align-items: center;
white-space: nowrap !important;
word-break: keep-all;
overflow-wrap: normal;
overflow: hidden;
text-overflow: ellipsis;
}
.page-head-value {
margin-top: 4rpx;
font-size: 36rpx;
line-height: 46rpx;
font-weight: 600;
color: #303133;
}
.goods-row {
display: flex;
flex-wrap: nowrap;
width: 100%;
margin-top: 14rpx;
font-size: 32rpx;
line-height: 54rpx;
}
.goods-row:first-child {
margin-top: 0;
}
.goods-row--quantity {
align-items: center;
}
.goods-row--quantity .value {
flex: 0;
margin-right: 12rpx;
}
.label {
width: 180rpx;
min-width: 180rpx;
color: #909399;
display: inline-flex;
align-items: center;
white-space: nowrap !important;
word-break: keep-all;
overflow-wrap: normal;
overflow: hidden;
text-overflow: ellipsis;
flex-shrink: 0;
}
.value {
flex: 1;
color: #303133;
}
.goods-scroll {
height: calc(100vh - 350rpx - env(safe-area-inset-bottom));
padding: 0 24rpx;
box-sizing: border-box;
}
.content-layout {
display: flex;
flex-direction: column;
padding: 0 24rpx;
flex: 1;
min-height: 0;
box-sizing: border-box;
}
.top-module {
flex: 0 0 auto;
margin-top: 16rpx;
}
.top-card {
background: #fff;
border-radius: 12rpx;
padding: 16rpx;
border: 1rpx solid #ebeef5;
}
.top-main {
display: flex;
flex-direction: column;
align-items: stretch;
}
.goods-image-name-row {
display: flex;
align-items: center;
gap: 16rpx;
}
.goods-image {
flex-shrink: 0;
}
.goods-name {
flex: 1;
min-width: 0;
font-size: 38rpx;
line-height: 52rpx;
font-weight: 700;
color: #303133;
}
.top-info {
width: 100%;
margin-top: 22rpx;
}
.pick-list-title-btn {
margin-top: 0;
margin-left: auto;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
line-height: 36rpx;
font-weight: 600;
color: #ffffff;
background: #2979ff;
border-radius: 6rpx;
padding: 6rpx 14rpx;
}
.pick-list-scroll {
margin-top: 8rpx;
width: 100%;
}
.pick-list {
display: flex;
align-items: center;
width: 100%;
}
.pick-item-wrap {
display: flex;
align-items: center;
width: calc((100% - 64rpx) / 5);
margin-right: 16rpx;
}
.pick-item-wrap:nth-child(5n) {
margin-right: 0;
}
.metric-card-btn {
position: relative;
display: flex;
align-items: stretch;
justify-content: center;
width: 100%;
height: 72rpx;
padding: 0;
border-radius: 10rpx;
background: #f2f3f5;
border: 2rpx solid transparent;
overflow: hidden;
}
.metric-card-btn--active {
background: #eaf2ff;
border-color: #2979ff;
}
.order-corner {
position: absolute;
left: 0;
top: 0;
width: 0;
height: 0;
border-top: 16rpx solid #19be6b;
border-right: 16rpx solid transparent;
}
.metric-diagonal {
position: absolute;
left: -10rpx;
top: 50%;
width: calc(100% + 20rpx);
height: 2rpx;
background: #dcdfe6;
transform: rotate(-28deg);
transform-origin: center;
}
.metric-order {
position: absolute;
left: 8rpx;
top: 6rpx;
font-size: 30rpx;
line-height: 38rpx;
font-weight: 600;
color: #606266;
}
.metric-product {
position: absolute;
right: 8rpx;
bottom: 4rpx;
font-size: 38rpx;
line-height: 46rpx;
font-weight: 700;
color: #2979ff;
}
.switch-row {
margin-top: 14rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.switch-index {
font-size: 28rpx;
line-height: 38rpx;
color: #606266;
}
.bottom-module {
flex: 1;
min-height: 0;
margin-top: 12rpx;
overflow: hidden;
}
.bottom-module-title {
font-size: 32rpx;
line-height: 46rpx;
font-weight: 600;
color: #303133;
margin-bottom: 8rpx;
}
.empty-state {
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.empty-state--content {
height: calc(100vh - 350rpx - env(safe-area-inset-bottom));
margin: 0 24rpx;
}
.empty-text {
margin-top: 18rpx;
font-size: 32rpx;
color: #909399;
}
.safe-area-bottom {
height: calc(30rpx + env(safe-area-inset-bottom));
}
</style>