新增领取快递面单页面、修改拣货记录页面

This commit is contained in:
zm2000 2026-08-20 17:53:30 +08:00
parent 3054caf08c
commit 9ec654692e
5 changed files with 675 additions and 45 deletions

View File

@ -333,6 +333,12 @@ export default {
method: "POST",
isSystemApi: true
},
waveClaimScan: {
path: "pick.waveClaimScan",
auth: true,
method: "POST",
isSystemApi: true
},
items: {
path: "pick.items",
auth: true,

4
env.js
View File

@ -1,4 +1,4 @@
// export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址
export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址
export const BASE_URL = 'http://qimen.wms.gztbyc.com' //生产环境接口地址
// export const BASE_URL = 'http://192.168.11.56:6060' //开发环境接口地址
export const API_URL = `${BASE_URL}/system` //后台接口域名
export const IMG_URL = 'https://ye4s.file.gzxunren.com' //全局网络图片地址变量,css背景图片地址变量在uni.scss

View File

@ -278,6 +278,13 @@
{
"titleNView": false
}
},
{
"path" : "pages/claim/shippingLabel",
"style" :
{
"titleNView": false
}
}
],

View File

@ -0,0 +1,380 @@
<template>
<view class="shipping-label-page">
<view class="normar_container">
<page-nav :title="title">
<template #right>
<view
class="nav-manual-input"
:class="{ 'nav-manual-input--inactive': !showScanInput }"
@click="toggleScanInput"
>
<text class="nav-manual-input-text">{{ showScanInput ? '关闭手动输入' : '手动输入' }}</text>
</view>
</template>
</page-nav>
<!-- 波次/面单号 手动输入区 -->
<view class="scan-section" v-show="showScanInput">
<view class="scan-input-wrap">
<u-input
v-model="scanInput"
placeholder="扫描/输入快递单号"
border="surround"
:customStyle="{ flex: 1 }"
:focus="scanFocused"
@confirm="handleScanConfirm"
></u-input>
<view class="scan-camera-btn" @click="handleCameraScan">
<u-icon name="camera" size="22" color="#2979ff"></u-icon>
</view>
</view>
</view>
<scroll-view class="detail-scroll" scroll-y>
<!-- 领料信息 -->
<view class="claim-info-section">
<view class="claim-info-header">
<text class="claim-info-header-text">领料信息:</text>
</view>
<view v-if="claimList.length" class="claim-info-body">
<view v-for="item in reversedClaimList" :key="item" class="info-row">
<text class="info-value">{{ item }}</text>
</view>
</view>
</view>
<view class="content-placeholder">
<u-icon name="file-text" size="86" color="#c0c4cc"></u-icon>
<text class="placeholder-text">暂无数据</text>
</view>
<view class="safe-area-bottom"></view>
</scroll-view>
<!-- 底部操作栏 -->
<view class="claim-footer">
<view class="claim-footer-total">
<text class="claim-footer-total-label">总数量</text>
<text class="claim-footer-total-value">{{ totalQuantity }}</text>
</view>
<view class="claim-footer-btn" @click="handleFinishClaim">
<text class="claim-footer-btn-text">返回结束领料</text>
</view>
</view>
</view>
</view>
</template>
<script>
import voice from '@/core/utils/voice';
export default {
data() {
return {
title: '面单波次领料',
showScanInput: false,
scanInput: '',
scanFocused: false,
totalQuantity: 0,
submitting: false,
claimList: []
};
},
computed: {
// 波次号倒序(最新扫描的排最上)
reversedClaimList() {
return this.claimList.slice().reverse();
}
},
onLoad() {
// 注册广播扫码回调并启动
this.$store.dispatch('broadcast/setCallbacks', {
onResult: this.onScanData
});
this.$store.dispatch('broadcast/start');
},
onShow() {
// 返回页面时重新恢复本页扫码回调(避免被其它页面覆盖后扫码失效),再恢复广播
this.$store.dispatch('broadcast/setCallbacks', {
onResult: this.onScanData
});
this.$store.dispatch('broadcast/resume');
},
onHide() {
this.$store.dispatch('broadcast/pause');
},
onUnload() {
this.$store.dispatch('broadcast/stop');
},
methods: {
// 广播扫码回调:扫码枪扫描结果
onScanData(data) {
const scanText = data && data.data ? String(data.data).trim() : '';
if (!scanText) return;
console.log('[面单波次领料] 广播扫描:', scanText);
this.scanInput = scanText;
this.submitWaveClaim(scanText);
},
toggleScanInput() {
this.showScanInput = !this.showScanInput;
},
handleScanConfirm(value) {
const code = value || this.scanInput;
if (!code) return;
this.submitWaveClaim(code);
},
// 扫描面单号领取整波(领料):pick.waveClaimScan
// - 按面单号定位订单后反查波次,仅支持大团购(pick_mode=5)与非抓取散单(source=0)整波领料
// - 抓取波次返回 400(data.no_claim_needed=true)无需领料;波次已全部领料返回 already_claimed
async submitWaveClaim(waybillNo) {
const code = String(waybillNo || '').trim();
if (!code) return;
if (this.submitting) return;
this.submitting = true;
uni.showLoading({ title: '领料中...', mask: true });
try {
const res = await this.$http('pick.waveClaimScan', {
waybill_no: code
}, '', false);
this.handleWaveClaimResponse(res);
} catch (error) {
const msg = String((error && (error.msg || error.message || error.errMsg)) || '领料失败');
uni.showToast({ title: msg, icon: 'none' });
if (this.isNotFoundError(error)) {
this.speakVoice('没有波次');
} else {
this.speakVoice('领取失败');
}
} finally {
this.submitting = false;
uni.hideLoading();
}
},
handleWaveClaimResponse(res) {
const data = (res && res.data && typeof res.data === 'object' && !Array.isArray(res.data)) ? res.data : {};
// 业务失败
if (res && res.flag === 'failure') {
if (data.no_claim_needed === true) {
uni.showToast({ title: '该波次为抓取波次,无需领料', icon: 'none' });
this.speakVoice('无需领料');
} else if (this.isNotFoundError(res)) {
// 404:未找到该面单号对应的订单,或波次不存在/不属于当前仓库
uni.showToast({ title: (res && (res.message || res.msg)) || '未找到该面单号对应的订单或波次', icon: 'none' });
this.speakVoice('没有波次');
} else {
uni.showToast({ title: (res && (res.message || res.msg)) || '领料失败', icon: 'none' });
this.speakVoice('领取失败');
}
return;
}
// 成功:合并顶层与 data(兼容不同返回结构)
const payload = { ...(res || {}), ...data };
if (payload.status === 'already_claimed') {
uni.showToast({ title: payload.tip || '该波次已领料', icon: 'none' });
this.speakVoice('失败,波次已领料');
} else {
// claimed:整波领料完成,追加波次号(去重)并累计总数量
const waveNo = String(payload.wave_no || '').trim();
if (waveNo && !this.claimList.includes(waveNo)) {
this.claimList.push(waveNo);
this.totalQuantity += 1;
}
uni.showToast({ title: payload.tip || '整波领料完成', icon: 'success' });
this.speakVoice('领取成功');
}
// 清空已提交的面单号输入
if (this.scanInput === String(payload.waybill_no || '')) {
this.scanInput = '';
}
},
// 识别 404:未找到面单号对应订单,或波次不存在/不属于当前仓库
isNotFoundError(res) {
if (!res || typeof res !== 'object') return false;
const code = res.code || res.statusCode || res.status || res.httpCode;
if (Number(code) === 404) return true;
const text = String((res && (res.message || res.msg)) || '').toLowerCase();
return text.indexOf('未找到') > -1 || text.indexOf('不存在') > -1 || text.indexOf('404') > -1;
},
speakVoice(text) {
if (voice && typeof voice.speak === 'function') {
voice.speak(text, { minInterval: 800 });
}
},
handleCameraScan() {
uni.scanCode({
success: (res) => {
this.scanInput = res.result;
this.handleScanConfirm(res.result);
}
});
},
handleFinishClaim() {
// TODO: 结束领料(可在此调用结束领料接口后再返回)
uni.navigateBack({
delta: 1,
fail: () => {}
});
}
}
};
</script>
<style lang="scss" scoped>
.shipping-label-page {
height: 100vh;
background: #f8f9fa;
}
.normar_container {
height: 100%;
display: flex;
flex-direction: column;
overflow: hidden;
}
.detail-scroll {
flex: 1;
height: 0;
}
.content-placeholder {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-top: 200rpx;
}
.placeholder-text {
margin-top: 24rpx;
font-size: 28rpx;
color: #909399;
}
/* ===== 领料信息 ===== */
.claim-info-section {
background: #fff;
margin: 20rpx 24rpx 0;
border-radius: 12rpx;
overflow: hidden;
.claim-info-header {
padding: 24rpx;
background-color: #ffedd5;
.claim-info-header-text {
font-size: 32rpx;
font-weight: bold;
color: #000;
}
}
.claim-info-body {
.info-row {
display: flex;
align-items: center;
justify-content: center;
padding: 24rpx;
border-bottom: 1rpx solid #f0f0f0;
&:last-child {
border-bottom: none;
}
.info-value {
font-size: 38rpx;
color: #000;
text-align: center;
}
}
}
}
::v-deep .nav-title .right {
width: auto;
min-width: 80rpx;
display: flex;
justify-content: flex-end;
}
.nav-manual-input {
display: flex;
align-items: center;
justify-content: center;
height: 52rpx;
padding: 0 20rpx;
background: #fa8c16;
border-radius: 8rpx;
&--inactive {
background: #2979ff;
}
.nav-manual-input-text {
font-size: 28rpx;
color: #ffffff;
white-space: nowrap;
}
}
/* ===== 手动输入搜索框 ===== */
.scan-section {
padding: 20rpx 24rpx;
background: #fff;
margin-bottom: 16rpx;
.scan-input-wrap {
display: flex;
align-items: center;
gap: 16rpx;
.scan-camera-btn {
width: 72rpx;
height: 72rpx;
display: flex;
align-items: center;
justify-content: center;
background: #f0f7ff;
border-radius: 8rpx;
flex-shrink: 0;
}
}
}
/* ===== 底部操作栏 ===== */
.claim-footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16rpx 24rpx calc(16rpx + env(safe-area-inset-bottom));
background: #fff;
border-top: 1rpx solid #f0f0f0;
.claim-footer-total {
display: flex;
align-items: baseline;
.claim-footer-total-label {
font-size: 28rpx;
color: #606266;
margin-right: 8rpx;
}
.claim-footer-total-value {
font-size: 48rpx;
font-weight: bold;
color: #fa8c16;
}
}
.claim-footer-btn {
padding: 16rpx 40rpx;
background: #2979ff;
border-radius: 8rpx;
.claim-footer-btn-text {
font-size: 30rpx;
color: #ffffff;
white-space: nowrap;
}
}
}
</style>

View File

@ -16,9 +16,9 @@
<text class="empty-text">暂无拣货记录</text>
</view>
<view v-else class="record-list">
<view v-for="item in displayOrderList" :key="item.id" class="record-item">
<view v-for="item in displayOrderList" :key="item.id" class="record-item" @click="handleRecordClick(item)">
<view class="record-single-line">
<text class="record-single-line__value">{{ item.waveNo || '--' }}</text>
<text class="record-single-line__value">{{ item.waveNoBase || '--' }}<text v-if="item.waveNoExtra" class="record-single-line__extra">{{ item.waveNoExtra }}</text></text>
<text class="record-single-line__dot"></text>
<text class="record-single-line__value">{{ item.pickUserName || '--' }}</text>
<text class="record-single-line__dot"></text>
@ -61,14 +61,6 @@
<text class="filter-popup__title">筛选条件</text>
</view>
<scroll-view scroll-y class="filter-popup__scroll">
<!-- 时间范围:开始时间 ~ 结束时间 一行展示 -->
<view class="filter-row">
<text class="filter-row__label">时间范围</text>
<view class="filter-row__control filter-row__control--range" @click="openDateRangePicker">
<text class="filter-row__value" :class="{ 'filter-row__value--placeholder': !hasDateRange }">{{ dateRangeText }}</text>
<u-icon name="arrow-right" size="24rpx" color="#909399"></u-icon>
</view>
</view>
<view v-for="item in filterConfig" :key="item.key" class="filter-row">
<text class="filter-row__label">{{ item.label }}</text>
<view class="filter-options">
@ -83,6 +75,14 @@
</view>
</view>
</view>
<!-- 时间范围:开始时间 ~ 结束时间 一行展示 -->
<view class="filter-row">
<text class="filter-row__label">时间范围</text>
<view class="filter-row__control filter-row__control--range" @click="openDateRangePicker">
<text class="filter-row__value" :class="{ 'filter-row__value--placeholder': !hasDateRange }">{{ dateRangeText }}</text>
<u-icon name="arrow-right" size="24rpx" color="#909399"></u-icon>
</view>
</view>
</scroll-view>
<view class="filter-popup__actions">
<view class="filter-popup__btn filter-popup__btn--reset" @click="handleResetFilter">
@ -94,6 +94,73 @@
</view>
</view>
</u-popup>
<u-popup :show="showDetailPopup" mode="bottom" :closeable="true" border-radius="20" @close="showDetailPopup = false">
<view class="detail-popup">
<view class="detail-popup__header">
<text class="detail-popup__title">拣货任务详情</text>
</view>
<scroll-view scroll-y class="detail-popup__scroll">
<view v-if="detailItem" class="detail-list">
<view class="detail-row">
<text class="detail-row__label">任务编号</text>
<text class="detail-row__value">{{ detailItem.taskNo || '--' }}</text>
</view>
<view class="detail-row detail-row--two-col">
<view class="detail-row__cell">
<text class="detail-row__label">车号</text>
<text class="detail-row__value">{{ detailItem.cartName || '--' }}</text>
</view>
<view class="detail-row__cell">
<text class="detail-row__label">拣货员</text>
<text class="detail-row__value">{{ detailItem.pickUserName || '--' }}</text>
</view>
</view>
<view class="detail-row">
<text class="detail-row__label">波次号</text>
<view class="detail-row__value detail-row__value--stacked">
<text v-for="(waveNo, wIndex) in detailItem.waveNoList" :key="`${waveNo}-${wIndex}`" class="detail-row__wave">{{ waveNo }}</text>
<text v-if="!detailItem.waveNoList || detailItem.waveNoList.length === 0" class="detail-row__wave">--</text>
</view>
</view>
<view class="detail-row detail-row--two-col">
<view class="detail-row__cell">
<text class="detail-row__label">波次数</text>
<text class="detail-row__value">{{ detailItem.waveCountText || '--' }}</text>
</view>
<view class="detail-row__cell">
<text class="detail-row__label">订单数</text>
<text class="detail-row__value">{{ detailItem.orderCountText || '--' }}</text>
</view>
</view>
<view class="detail-row detail-row--two-col">
<view class="detail-row__cell">
<text class="detail-row__label">任务状态</text>
<text class="detail-row__value">{{ detailItem.statusText || '--' }}</text>
</view>
<view class="detail-row__cell">
<text class="detail-row__label">复核状态</text>
<text class="detail-row__value">{{ detailItem.reviewStatusText || '--' }}</text>
</view>
</view>
<view class="detail-row detail-row--two-col">
<view class="detail-row__cell">
<text class="detail-row__label">拣货模式</text>
<text class="detail-row__value">{{ detailItem.pickModeText || '--' }}</text>
</view>
<view class="detail-row__cell">
<text class="detail-row__label">来源</text>
<text class="detail-row__value">{{ detailItem.sourceText || '--' }}</text>
</view>
</view>
<view class="detail-row">
<text class="detail-row__label">开始时间</text>
<text class="detail-row__value">{{ detailItem.startTimeText || '--' }}</text>
</view>
</view>
</scroll-view>
</view>
</u-popup>
</view>
</template>
@ -116,6 +183,28 @@
source: ''
},
filterConfig: [
{
key: 'pickMode',
label: '拣货模式',
type: 'select',
options: [
{ label: '小团购', value: 1 },
{ label: '单品单件', value: 2 },
{ label: '先拣后分', value: 3 },
{ label: '边拣边分', value: 4 },
{ label: '大团购', value: 5 }
]
},
{
key: 'source',
label: '来源',
type: 'select',
options: [
{ label: '默认', value: 0 },
{ label: 'PDA', value: 1 },
{ label: '后台', value: 2 }
]
},
{
key: 'taskStatus',
label: '任务状态',
@ -139,28 +228,6 @@
{ label: '复核通过', value: 3 },
{ label: '复核异常', value: 4 }
]
},
{
key: 'pickMode',
label: '拣货模式',
type: 'select',
options: [
{ label: '小团购', value: 1 },
{ label: '单品单件', value: 2 },
{ label: '先拣后分', value: 3 },
{ label: '边拣边分', value: 4 },
{ label: '大团购', value: 5 }
]
},
{
key: 'source',
label: '来源',
type: 'select',
options: [
{ label: '默认', value: 0 },
{ label: 'PDA', value: 1 },
{ label: '后台', value: 2 }
]
}
],
// 时间范围日历
@ -175,7 +242,11 @@
reviewStatus: '',
pickMode: '',
source: ''
}
},
// 详情抽屉
showDetailPopup: false,
detailItem: null
};
},
computed: {
@ -243,9 +314,9 @@
if (isSet(filter.pickMode)) {
params.pick_mode = Number(filter.pickMode);
}
// 来源(number)
// 来源(string)
if (isSet(filter.source)) {
params.source = Number(filter.source);
params.source = String(filter.source);
}
return params;
},
@ -317,13 +388,46 @@
const pickUserName = String(source.pick_user_name || source.pickUserName || source.operator_name || source.operatorName || '').trim();
const waveList = Array.isArray(source.wave_list) ? source.wave_list : [];
const firstWave = waveList[0] && typeof waveList[0] === 'object' ? waveList[0] : {};
const waveNo = String(firstWave.wave_no || source.wave_no || source.waveNo || '').trim() || String(source.batch_no || source.batchNo || '').trim();
const id = source.id ?? source.task_id ?? source.taskId ?? waveNo ?? `record-${this.currentPage}-${index + 1}`;
const baseWaveNo = String(firstWave.wave_no || source.wave_no || source.waveNo || '').trim() || String(source.batch_no || source.batchNo || '').trim();
const waveCount = Number(source.wave_count) || (Array.isArray(source.wave_list) ? source.wave_list.length : 0) || 1;
const waveNoExtra = baseWaveNo && waveCount > 1 ? `+${waveCount - 1}` : '';
const waveNo = baseWaveNo + waveNoExtra;
const id = source.id ?? source.task_id ?? source.taskId ?? baseWaveNo ?? `record-${this.currentPage}-${index + 1}`;
const taskNo = String(source.task_no || source.taskNo || '').trim();
const orderCount = Number(source.order_count ?? source.orderCount ?? 0);
const startTime = source.start_time || source.startTime || source.start_at || source.startAt || '';
const waveNoList = waveList
.map(w => (w && typeof w === 'object' ? String(w.wave_no || w.waveNo || '').trim() : ''))
.filter(Boolean);
if (!waveNoList.length) {
const batchNo = String(source.batch_no || source.batchNo || '').trim();
if (batchNo) {
waveNoList.push(batchNo);
}
}
return {
id: String(id || `record-${this.currentPage}-${index + 1}`),
cartName,
pickUserName,
waveNo
waveNo,
waveNoBase: baseWaveNo,
waveNoExtra,
taskNo,
waveCount,
orderCount: Number.isFinite(orderCount) ? orderCount : 0,
status: source.status,
reviewStatus: source.review_status,
pickMode: source.pick_mode,
sourceType: source.source,
startTime,
waveNoList,
waveCountText: String(waveCount),
orderCountText: String(Number.isFinite(orderCount) ? orderCount : 0),
statusText: this.resolveLabel('taskStatus', source.status),
reviewStatusText: this.resolveLabel('reviewStatus', source.review_status),
pickModeText: this.resolveLabel('pickMode', source.pick_mode),
sourceText: this.resolveLabel('source', source.source),
startTimeText: this.formatDateTime(startTime)
};
})
.filter(item => !!(item.waveNo || item.cartName || item.pickUserName));
@ -534,6 +638,38 @@
}
this.currentPage = targetPage;
this.loadTaskList(targetPage);
},
resolveLabel(key, value) {
if (value === null || value === undefined || value === '') {
return '';
}
const config = (this.filterConfig || []).find(item => item.key === key);
if (!config || !Array.isArray(config.options)) {
return '';
}
const target = String(value);
const opt = config.options.find(item => String(item.value) === target);
return opt ? opt.label : '';
},
formatDateTime(value) {
if (value === null || value === undefined || value === '') {
return '';
}
const date = new Date(String(value).trim());
if (Number.isNaN(date.getTime())) {
return String(value).trim();
}
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
const hour = String(date.getHours()).padStart(2, '0');
const minute = String(date.getMinutes()).padStart(2, '0');
const second = String(date.getSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
},
handleRecordClick(item) {
this.detailItem = item || null;
this.showDetailPopup = true;
}
}
};
@ -593,7 +729,7 @@
}
.filter-popup {
height: 70vh;
height: 85vh;
background: #ffffff;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
@ -627,7 +763,7 @@
.filter-row__label {
display: block;
font-size: 28rpx;
font-size: 36rpx;
color: #909399;
margin-bottom: 16rpx;
}
@ -643,7 +779,7 @@
}
.filter-row__value {
font-size: 28rpx;
font-size: 36rpx;
color: #303133;
}
@ -674,7 +810,7 @@
}
.filter-option__text {
font-size: 26rpx;
font-size: 36rpx;
color: #303133;
}
@ -709,7 +845,7 @@
}
.filter-popup__btn-text {
font-size: 30rpx;
font-size: 36rpx;
color: #303133;
}
@ -717,6 +853,99 @@
color: #ffffff;
}
.detail-popup {
height: 85vh;
background: #ffffff;
border-top-left-radius: 20rpx;
border-top-right-radius: 20rpx;
display: flex;
flex-direction: column;
}
.detail-popup__header {
padding: 30rpx 32rpx 20rpx;
border-bottom: 1rpx solid #f0f0f0;
flex-shrink: 0;
}
.detail-popup__title {
font-size: 32rpx;
font-weight: 600;
color: #303133;
}
.detail-popup__scroll {
flex: 1;
min-height: 0;
padding: 8rpx 32rpx;
box-sizing: border-box;
}
.detail-list {
padding: 8rpx 0 40rpx;
}
.detail-row {
display: flex;
align-items: flex-start;
justify-content: space-between;
padding: 24rpx 0;
border-bottom: 1rpx solid #f5f5f5;
}
.detail-row:last-child {
border-bottom: none;
}
.detail-row--two-col {
justify-content: flex-start;
}
.detail-row__cell {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
}
.detail-row__cell + .detail-row__cell {
margin-left: 24rpx;
}
.detail-row__cell .detail-row__value {
text-align: left;
}
.detail-row__label {
flex-shrink: 0;
font-size: 36rpx;
color: #909399;
margin-right: 24rpx;
}
.detail-row__value {
flex: 1;
font-size: 36rpx;
color: #303133;
text-align: left;
word-break: break-all;
overflow-wrap: break-word;
}
.detail-row__value--stacked {
display: flex;
flex-direction: column;
align-items: flex-start;
}
.detail-row__wave {
font-size: 36rpx;
color: #303133;
line-height: 1.6;
word-break: break-all;
overflow-wrap: break-word;
}
.detail-scroll {
flex: 1;
min-height: 0;
@ -763,6 +992,14 @@
white-space: normal;
}
.record-single-line__value:first-child {
margin-left: 24rpx;
}
.record-single-line__extra {
color: #ff4d4f;
}
.record-single-line__dot {
display: inline-block;
width: 8rpx;