新增拦截登记、退件记录页面

This commit is contained in:
zm2000 2026-08-13 17:58:43 +08:00
parent edd932fa49
commit a1a68d9cb3
7 changed files with 719 additions and 4 deletions

View File

@ -476,6 +476,12 @@ export default {
method: "POST",
isSystemApi: true
},
interceptScan: {
path: "order.recheckOrder.interceptScan",
auth: true,
method: "POST",
isSystemApi: true
},
confirmIntercept: {
path: "order.recheckOrder.confirmIntercept",
auth: true,
@ -539,5 +545,14 @@ export default {
isSystemApi: true
}
}
},
/** 退件登记 ↓ **/
returnReceived: {
create: {
path: "returnReceived.create",
auth: true,
method: "POST",
isSystemApi: 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

@ -230,6 +230,13 @@
"titleNView": false
}
},
{
"path" : "pages/work/order/interceptionLog",
"style" :
{
"titleNView": false
}
},
{
"path" : "pages/work/order/bindPkgMat",
"style" :
@ -237,6 +244,13 @@
"titleNView": false
}
},
{
"path" : "pages/work/order/returnRecord",
"style" :
{
"titleNView": false
}
},
{
"path" : "pages/packing/labelReprint",
"style" :

View File

@ -319,6 +319,7 @@
const isScatterReviewShipping = menuName === '散单复核发货' || menuName === '订单复核' || (menuName.includes('散单') && menuName.includes('复核') && menuName.includes('发货'));
const isGrouponPickingDetail = menuName === '团购拣货详情' || (menuName.includes('团购') && menuName.includes('拣货') && menuName.includes('详情'));
const isLabelReprint = menuName === '面单补打' || (menuName.includes('面单') && menuName.includes('补打'));
const isBlockRegistration = menuName === '拦截登记';
const rawPath = item?.component || item?.path || '';
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库'));
@ -347,7 +348,9 @@
? '/pages/work/order/order-review'
: (isGrouponPickingDetail
? '/pages/work/order/groupon-picking-detail'
: (isLabelReprint ? '/pages/packing/labelReprint' : normalizedPath))))));
: (isLabelReprint
? '/pages/packing/labelReprint'
: (isBlockRegistration ? '/pages/work/order/interceptionLog' : normalizedPath)))))));
if (!targetPath) {
uni.showToast({

View File

@ -1189,6 +1189,7 @@
const isScatterReviewShipping = menuName === '散单复核发货' || menuName === '订单复核' || (menuName.includes('散单') && menuName.includes('复核') && menuName.includes('发货'));
const isGrouponPickingDetail = menuName === '团购拣货详情' || (menuName.includes('团购') && menuName.includes('拣货') && menuName.includes('详情'));
const isLabelReprint = menuName === '面单补打' || (menuName.includes('面单') && menuName.includes('补打'));
const isBlockRegistration = menuName === '拦截登记';
const rawPath = item?.component || item?.path || '';
const normalizedPath = rawPath ? (rawPath.startsWith('/') ? rawPath : `/${rawPath}`) : '';
const isRandomStorage = menuName === '随机入库' || (menuName.includes('随机') && menuName.includes('入库'));
@ -1219,7 +1220,9 @@
? '/pages/work/order/scatter-picking-detail'
: (isGrouponPickingDetail
? '/pages/work/order/groupon-picking-detail'
: (isLabelReprint ? '/pages/packing/labelReprint' : normalizedPath)))))));
: (isLabelReprint
? '/pages/packing/labelReprint'
: (isBlockRegistration ? '/pages/work/order/interceptionLog' : normalizedPath))))))));
if (!targetPath) {
uni.showToast({

View File

@ -0,0 +1,306 @@
<template>
<view class="block-registration-page">
<view class="normar_container">
<page-nav title="拦截登记">
<template #left>
<view
class="nav-manual-input"
:class="{ 'nav-manual-input--inactive': !showScanInput }"
@click="toggleScanInput"
>
<text class="nav-manual-input-text">{{ showScanInput ? '关闭手动输入' : '手动输入' }}</text>
</view>
</template>
<template #right>
<view class="nav-reset" @click="handleReset">
<text class="nav-reset-text">重置</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>
<!-- 信息展示 -->
<view class="info-list" :class="{ 'info-list--no-scan': !showScanInput }" v-show="showOrderInfo">
<view class="info-row">
<text class="info-label">快递号</text>
<text class="info-value">{{ orderInfo.waybill_code || '--' }}</text>
</view>
<view class="info-row">
<text class="info-label">状态</text>
<text class="info-value info-value--status">{{ interceptStatusText }}</text>
</view>
</view>
</view>
</view>
</template>
<script>
import voice from '@/core/utils/voice';
export default {
data() {
return {
scanInput: '',
scanFocused: false,
showScanInput: false,
orderInfo: {
waybill_code: ''
},
interceptStatus: '',
showOrderInfo: false
};
},
computed: {
interceptStatusText() {
const map = {
'': '未拦截',
'none': '未拦截',
'pending': '拦截中',
'intercepting': '拦截中',
'intercepted': '仓库已拦截',
'intercepted_at_warehouse': '仓库已拦截',
'intercept_success': '拦截成功',
'intercept_failed': '拦截失败',
'cancelled': '已取消'
};
const key = String(this.interceptStatus || '').trim();
return map[key] || key || '未拦截';
}
},
onLoad() {
this.$store.dispatch('broadcast/setCallbacks', {
onResult: this.onScanData
});
this.$store.dispatch('broadcast/start');
},
onShow() {
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 ? data.data.trim() : '';
console.log('[拦截登记] 广播扫描到快递单号:', scanText);
if (scanText) {
this.scanInput = scanText;
this.handleScanConfirm(scanText);
}
},
toggleScanInput() {
this.showScanInput = !this.showScanInput;
},
handleScanConfirm(value) {
const code = value || this.scanInput;
if (!code) return;
this.fetchInterceptScan(code);
},
handleCameraScan() {
// 调用相机扫码
uni.scanCode({
success: (res) => {
this.scanInput = res.result;
this.handleScanConfirm(res.result);
}
});
},
speakVoice(text) {
voice.speak(text, { minInterval: 800 });
},
// 拦截扫描:通过运单号查找运单记录。
// 非拦截订单会被拒绝并提示「非拦截订单」:运单记录不存在,或运单 is_intercept≠'Y' 且关联订单
// intercept_status 不在 requested/intercepting。
// 校验通过后标记退回与拦截(is_back='Y', is_intercept='Y'),处理关联的未完结售后工单
// (写入「库内拦截成功」步骤并置为 completed)。
// 若运单关联到订单,则将订单拦截状态更新为 intercepted_at_warehouse(step=4、outbound_status=fin)
// 并释放储位分配与订单锁(仅订单级状态更新,不标记订单下其他面单)。工单处理失败不阻断主流程。
async fetchInterceptScan(code) {
uni.showLoading({ title: '拦截登记中...' });
try {
const res = await this.$http('order.recheckOrder.interceptScan', { waybill_code: code }, '', false);
if (res && res.flag !== 'failure') {
const data = res.data || {};
const order = data.order && typeof data.order === 'object' ? data.order : {};
this.orderInfo = {
waybill_code: data.waybill_code || code
};
this.interceptStatus = String(order.intercept_status || 'intercepted_at_warehouse').trim();
this.showOrderInfo = true;
uni.showToast({ title: '拦截登记成功', icon: 'success' });
this.speakVoice('拦截成功');
} else {
uni.showToast({ title: res.msg || '拦截登记失败', icon: 'none' });
this.speakVoice('非拦截订单');
}
} catch (e) {
uni.showToast({ title: '网络异常', icon: 'none' });
this.speakVoice('网络异常');
} finally {
uni.hideLoading();
}
},
handleBack() {
uni.navigateBack();
},
handleReset() {
this.resetForm();
},
resetForm() {
this.scanInput = '';
this.orderInfo = { waybill_code: '' };
this.interceptStatus = '';
this.showOrderInfo = false;
this.scanFocused = true;
}
}
};
</script>
<style lang="scss" scoped>
.block-registration-page {
.normar_container {
min-height: 100vh;
background-color: #f5f5f5;
}
/* ===== 左侧手动输入按钮 ===== */
::v-deep .nav-title .left {
min-width: auto;
gap: 0;
}
::v-deep .nav-title .title {
padding-left: 40rpx;
}
::v-deep .nav-title .right {
width: auto;
min-width: 80rpx;
}
.nav-manual-input {
display: flex;
align-items: center;
justify-content: center;
width: 210rpx;
height: 52rpx;
background: #fa8c16;
border-radius: 8rpx;
&--inactive {
background: #2979ff;
}
.nav-manual-input-text {
font-size: 32rpx;
color: #ffffff;
white-space: nowrap;
}
}
/* ===== 重置按钮 ===== */
.nav-reset {
padding: 8rpx 0;
.nav-reset-text {
font-size: 32rpx;
color: #fff;
background-color: #2979ff;
padding: 8rpx 24rpx;
border-radius: 8rpx;
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;
}
}
}
/* ===== 信息展示列表 ===== */
.info-list {
background: #fff;
margin: 0 24rpx 16rpx;
&--no-scan {
margin-top: 20rpx;
}
border-radius: 12rpx;
overflow: hidden;
.info-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
&:first-child {
background-color: #ffedd5;
}
&:last-child {
border-bottom: none;
}
.info-label {
font-size: 32rpx;
color: #000;
width: 160rpx;
flex-shrink: 0;
text-align: center;
}
.info-value {
font-size: 32rpx;
color: #000;
flex: 1;
text-align: center;
&--status {
color: #f5222d;
}
}
}
}
}
</style>

View File

@ -0,0 +1,374 @@
<template>
<view class="return-record-page">
<view class="normar_container">
<page-nav title="退件记录">
<template #left>
<view
class="nav-manual-input"
:class="{ 'nav-manual-input--inactive': !showScanInput }"
@click="toggleScanInput"
>
<text class="nav-manual-input-text">{{ showScanInput ? '关闭手动输入' : '手动输入' }}</text>
</view>
</template>
<template #right>
<view class="nav-reset" @click="handleReset">
<text class="nav-reset-text">重置</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>
<!-- 备注输入区 -->
<view class="remark-section">
<view class="remark-row">
<text class="remark-label">备注</text>
<u-input
v-model="remarkInput"
placeholder="请输入备注(可选)"
border="surround"
:customStyle="{ flex: 1 }"
></u-input>
</view>
</view>
<!-- 登记结果展示 -->
<view class="info-list" :class="{ 'info-list--no-scan': !showScanInput }" v-show="showResult">
<view class="info-row info-row--header">
<text class="info-label">快递号</text>
<text class="info-value info-value--waybill">{{ result.waybill_code || '--' }}</text>
</view>
<view class="info-row">
<text class="info-label">退回类型</text>
<text class="info-value">{{ isOriginal ? '原单退回' : '非原单退回' }}</text>
</view>
<view class="info-row" v-if="storeRemark">
<text class="info-label">货主备注</text>
<text class="info-value">{{ storeRemark }}</text>
</view>
<view class="info-row" v-if="result.remark">
<text class="info-label">备注</text>
<text class="info-value">{{ result.remark }}</text>
</view>
</view>
<!-- 30日幂等提示 -->
<view class="duplicated-tip" v-show="showResult && result.duplicated">
<text class="duplicated-tip-text">30日内已登记,本次沿用首次登记记录</text>
</view>
</view>
</view>
</template>
<script>
import voice from '@/core/utils/voice';
export default {
data() {
return {
scanInput: '',
scanFocused: false,
showScanInput: false,
remarkInput: '',
result: {},
showResult: false,
submitting: false
};
},
computed: {
// 是否原单退回
isOriginal() {
return !!(this.result && this.result.is_original_return);
},
// 货主合约货主备注名称(wms_store_warehouse.store_remask,非原单退回时为空)
storeRemark() {
return (this.result && this.result.store_remark) ? String(this.result.store_remark) : '';
}
},
onLoad() {
this.$store.dispatch('broadcast/setCallbacks', {
onResult: this.onScanData
});
this.$store.dispatch('broadcast/start');
},
onShow() {
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 ? data.data.trim() : '';
console.log('[退件记录] 广播扫描到数据:', scanText);
if (!scanText) return;
this.scanInput = scanText;
this.submitReturnRegister(scanText);
},
toggleScanInput() {
this.showScanInput = !this.showScanInput;
},
handleScanConfirm(value) {
const code = value || this.scanInput;
if (!code) return;
this.submitReturnRegister(code);
},
handleCameraScan() {
uni.scanCode({
success: (res) => {
this.scanInput = res.result;
this.handleScanConfirm(res.result);
}
});
},
speakVoice(text) {
voice.speak(text, { minInterval: 800 });
},
/**
* 退回包裹扫码登记
* 调用 returnReceived.create 登记退回收件运单号:
* - 30日内同仓库同单号幂等(以第一次为准,duplicated=true)
* - 反查 wms_order_express 判定是否原单退回,命中则回填 order_express_id/order_id/store_id 并标记 is_back='Y'
* - warehouse_id 由服务端注入 ctx.user.store_id,前端禁止传入
*/
async submitReturnRegister(code) {
const waybillCode = String(code || '').trim();
if (!waybillCode || this.submitting) return;
this.submitting = true;
uni.showLoading({ title: '登记中...', mask: true });
try {
const res = await this.$http('returnReceived.create', {
waybill_code: waybillCode,
remark: this.remarkInput.trim()
}, '', false);
if (res && res.flag !== 'failure') {
const payload = (res && res.data && typeof res.data === 'object' && !Array.isArray(res.data))
? res.data
: res;
this.result = payload || {};
this.showResult = true;
this.scanInput = '';
this.remarkInput = '';
if (this.result.duplicated) {
uni.showToast({ title: '30日内已登记', icon: 'none' });
this.speakVoice('已登记');
} else if (this.result.is_original_return) {
uni.showToast({ title: '原单退回登记成功', icon: 'success' });
this.speakVoice('登记成功');
} else {
uni.showToast({ title: '退件登记成功', icon: 'success' });
this.speakVoice('登记成功');
}
} else {
uni.showToast({ title: (res && (res.msg || res.message)) || '登记失败', icon: 'none' });
this.speakVoice('登记失败');
}
} catch (e) {
const msg = String((e && (e.msg || e.message)) || '网络异常');
uni.showToast({ title: msg, icon: 'none' });
this.speakVoice('登记失败');
} finally {
this.submitting = false;
uni.hideLoading();
}
},
handleReset() {
this.resetForm();
},
resetForm() {
this.scanInput = '';
this.remarkInput = '';
this.result = {};
this.showResult = false;
this.submitting = false;
this.scanFocused = true;
}
}
};
</script>
<style lang="scss" scoped>
.return-record-page {
.normar_container {
min-height: 100vh;
background-color: #f5f5f5;
}
/* ===== 左侧手动输入按钮 ===== */
::v-deep .nav-title .left {
min-width: auto;
gap: 0;
}
::v-deep .nav-title .title {
padding-left: 40rpx;
}
::v-deep .nav-title .right {
width: auto;
min-width: 80rpx;
}
.nav-manual-input {
display: flex;
align-items: center;
justify-content: center;
width: 210rpx;
height: 52rpx;
background: #fa8c16;
border-radius: 8rpx;
&--inactive {
background: #2979ff;
}
.nav-manual-input-text {
font-size: 32rpx;
color: #ffffff;
white-space: nowrap;
}
}
/* ===== 重置按钮 ===== */
.nav-reset {
padding: 8rpx 0;
.nav-reset-text {
font-size: 32rpx;
color: #fff;
background-color: #2979ff;
padding: 8rpx 24rpx;
border-radius: 8rpx;
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;
}
}
}
/* ===== 备注输入区 ===== */
.remark-section {
padding: 20rpx 24rpx;
background: #fff;
margin-bottom: 16rpx;
.remark-row {
display: flex;
align-items: center;
gap: 16rpx;
.remark-label {
font-size: 32rpx;
color: #000;
width: 120rpx;
flex-shrink: 0;
}
}
}
/* ===== 信息展示列表 ===== */
.info-list {
background: #fff;
margin: 0 24rpx 16rpx;
&--no-scan {
margin-top: 20rpx;
}
border-radius: 12rpx;
overflow: hidden;
.info-row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 24rpx;
border-bottom: 1rpx solid #f0f0f0;
&--header {
background-color: #ffedd5;
}
&:last-child {
border-bottom: none;
}
.info-label {
font-size: 32rpx;
color: #000;
width: 160rpx;
flex-shrink: 0;
text-align: center;
}
.info-value {
font-size: 32rpx;
color: #000;
flex: 1;
text-align: center;
&--waybill {
font-size: 36rpx;
}
}
}
}
/* ===== 30日幂等提示 ===== */
.duplicated-tip {
margin: 0 24rpx;
padding: 20rpx 24rpx;
display: flex;
align-items: center;
justify-content: center;
background: #f0f7ff;
border-radius: 12rpx;
border: 1rpx solid #b3d8ff;
.duplicated-tip-text {
font-size: 28rpx;
color: #2979ff;
text-align: center;
}
}
}
</style>