288 lines
7.2 KiB
Vue
288 lines
7.2 KiB
Vue
<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> |