修改订单商品详情页
This commit is contained in:
parent
0c22b24489
commit
4692f0d12d
@ -346,6 +346,18 @@ export default {
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
updateExpressWeighingWeight: {
|
||||
path: "order.updateExpressWeighingWeight",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
confirmIntercept: {
|
||||
path: "order.recheckOrder.confirmIntercept",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -113,6 +113,7 @@
|
||||
<view v-for="item in displayOrderList" :key="item.id" class="record-item" @click="goPickGoodsDetail(item)">
|
||||
<view class="record-main record-main--row">
|
||||
<text class="record-value" :class="getReviewStatusText(item) === '已复核' ? 'record-value--reviewed' : 'record-value--unreviewed'">{{ getReviewStatusText(item) }}</text>
|
||||
<text v-if="item.waveIndex" class="record-value record-value--wave-index">[{{ item.waveIndex }}]</text>
|
||||
<text class="record-value record-value--id">{{ listType === 'single' ? (item.waybillNo || '--') : (item.waveNo || '--') }}</text>
|
||||
<view class="record-print-col">
|
||||
<text v-if="getPrintStatusText(item) === '已打印'" class="record-value record-value--printed">已打印</text>
|
||||
@ -289,6 +290,10 @@
|
||||
: 5;
|
||||
this.initializeOrderList();
|
||||
this.loadPrintStations();
|
||||
|
||||
// 监听复核完成事件,更新订单列表状态
|
||||
uni.$on('orderReviewCompleted', this.handleReviewCompleted);
|
||||
uni.$on('orderInterceptCompleted', this.handleInterceptCompleted);
|
||||
},
|
||||
onShow() {
|
||||
this.safeDispatchBroadcast('setCallbacks', {
|
||||
@ -301,6 +306,8 @@
|
||||
},
|
||||
onUnload() {
|
||||
this.safeDispatchBroadcast('stop');
|
||||
uni.$off('orderReviewCompleted', this.handleReviewCompleted);
|
||||
uni.$off('orderInterceptCompleted', this.handleInterceptCompleted);
|
||||
},
|
||||
methods: {
|
||||
buildBatchListParams(page = this.currentPage) {
|
||||
@ -777,6 +784,7 @@
|
||||
const waveStocks = Array.isArray(wave?.stocks) ? wave.stocks : [];
|
||||
return {
|
||||
waveNo: String(wave?.wave_no || wave?.waveNo || '').trim(),
|
||||
waveIndex: String(wave?.wave_index || wave?.waveIndex || '').trim(),
|
||||
waveId: wave?.wave_id ?? wave?.waveId ?? wave?.id ?? '',
|
||||
cartNo: String(wave?.cart_code || wave?.cartCode || wave?.cart_no || wave?.cartNo || '').trim(),
|
||||
pickerName: String(wave?.picker_name || wave?.pickerName || '').trim(),
|
||||
@ -793,10 +801,14 @@
|
||||
});
|
||||
const calcTotalOrders = normalizedWaves.reduce((sum, w) => sum + w.totalOrders, 0);
|
||||
const calcUnreviewed = normalizedWaves.reduce((sum, w) => sum + w.unreviewedCount, 0);
|
||||
const groupWaybillNo = String(
|
||||
payload?.waybill_no || payload?.waybillNo || ''
|
||||
).trim();
|
||||
return {
|
||||
listType: 'group',
|
||||
matchType,
|
||||
waves: normalizedWaves,
|
||||
waybillNo: groupWaybillNo,
|
||||
total: Number(payload?.total ?? payload?.count ?? waves.length),
|
||||
totalOrders: calcTotalOrders,
|
||||
totalUnreviewedCount: calcUnreviewed,
|
||||
@ -836,6 +848,13 @@
|
||||
const cartMatchView = payload?.cart_match_view && typeof payload.cart_match_view === 'object'
|
||||
? payload.cart_match_view
|
||||
: null;
|
||||
const storeRemark = String(
|
||||
payload?.list?.[0]?.store_remark
|
||||
|| payload?.store_remark
|
||||
|| order?.store_remark
|
||||
|| order?.storeRemark
|
||||
|| ''
|
||||
).trim();
|
||||
|
||||
return {
|
||||
listType: 'detail',
|
||||
@ -847,6 +866,7 @@
|
||||
order,
|
||||
items,
|
||||
pickerName,
|
||||
storeRemark,
|
||||
expresses: Array.isArray(payload?.expresses) ? payload.expresses : [],
|
||||
logs: Array.isArray(payload?.logs) ? payload.logs : []
|
||||
};
|
||||
@ -858,6 +878,7 @@
|
||||
orderId: item?.order_id ?? item?.orderId ?? item?.id ?? '',
|
||||
waybillNo: String(item?.waybill_no || item?.waybillCode || item?.waybill_code || '').trim(),
|
||||
waveNo: String(item?.wave_no || item?.waveNo || '').trim(),
|
||||
waveIndex: String(item?.wave_index || item?.waveIndex || '').trim(),
|
||||
pickerName: String(item?.picker_name || item?.pickerName || '').trim(),
|
||||
cartNo: String(item?.cart_code || item?.cartCode || item?.cart_no || item?.cartNo || '').trim(),
|
||||
status: String(item?.status || 'pending'),
|
||||
@ -866,6 +887,7 @@
|
||||
isPrinted: !!item?.is_printed || !!item?.isPrinted,
|
||||
interceptStatus: String(item?.intercept_status || item?.interceptStatus || '').trim(),
|
||||
totalOrders: Number(item?.total_orders ?? item?.totalOrders ?? 0),
|
||||
storeRemark: String(item?.store_remark || item?.storeRemark || '').trim(),
|
||||
detail: item?.detail && typeof item.detail === 'object' ? item.detail : null,
|
||||
items: Array.isArray(item?.items) ? item.items
|
||||
: Array.isArray(item?.goods_items) ? item.goods_items
|
||||
@ -899,6 +921,7 @@
|
||||
id: String(item?.id || item?.orderId || `scan-${Date.now()}-${index}`),
|
||||
waveNo: item?.waveNo || '--',
|
||||
waybillNo: item?.waybillNo || '',
|
||||
waveIndex: item?.waveIndex || '',
|
||||
pickerName: item?.pickerName || '--',
|
||||
cartNo: item?.cartNo || '--',
|
||||
unreviewedCount: item?.recheckStatus === 'fin' ? 0 : 1,
|
||||
@ -909,6 +932,7 @@
|
||||
isPrinted: !!item?.isPrinted,
|
||||
interceptStatus: String(item?.interceptStatus || '').trim(),
|
||||
totalOrders: Number(item?.totalOrders ?? 0),
|
||||
storeRemark: item?.storeRemark || '',
|
||||
detailItems: Array.isArray(item?.items) ? item.items : []
|
||||
}));
|
||||
this.paginationTotal = result?.total ?? flatList.length;
|
||||
@ -925,12 +949,17 @@
|
||||
// 团单模式(list_type=group):按波次嵌套展示
|
||||
if (listType === 'group') {
|
||||
const waves = Array.isArray(result?.waves) ? result.waves : [];
|
||||
const groupWaybillNo = result?.waybillNo || '';
|
||||
this.orderList = waves.map((wave, wi) => {
|
||||
const subList = Array.isArray(wave?.list) ? wave.list : [];
|
||||
const waveUnreviewed = Number(wave?.unreviewedCount ?? 0);
|
||||
const rawWaveId = wave?.waveId ?? wave?.id ?? '';
|
||||
return {
|
||||
id: String(wave?.waveId || wave?.waveNo || `wave-${Date.now()}-${wi}`),
|
||||
id: String(rawWaveId || wave?.waveNo || `wave-${Date.now()}-${wi}`),
|
||||
waveId: rawWaveId,
|
||||
waveNo: wave?.waveNo || '--',
|
||||
waveIndex: String(wave?.wave_index || wave?.waveIndex || '').trim(),
|
||||
waybillNo: groupWaybillNo,
|
||||
pickerName: wave?.pickerName || '--',
|
||||
cartNo: wave?.cartNo || '--',
|
||||
unreviewedCount: waveUnreviewed > 0 ? waveUnreviewed : subList.length,
|
||||
@ -1000,6 +1029,13 @@
|
||||
console.warn('[ScatterPickingDetail] 缓存 scanOrder 结果失败:', error);
|
||||
}
|
||||
|
||||
const storeRemark = result?.storeRemark || '';
|
||||
const waveIndex = String(
|
||||
result?.waveIndex
|
||||
|| order?.wave_index
|
||||
|| order?.waveIndex
|
||||
|| ''
|
||||
).trim();
|
||||
const params = [
|
||||
`recordId=${encodeURIComponent(String(orderId))}`,
|
||||
`orderId=${encodeURIComponent(String(orderId))}`,
|
||||
@ -1011,6 +1047,8 @@
|
||||
`unreviewedCount=${encodeURIComponent(String(order?.unreviewed_count || order?.unreviewedCount || 0))}`,
|
||||
`waybillNo=${encodeURIComponent(String(result?.waybillNo || '--'))}`,
|
||||
`matchType=${encodeURIComponent(String(result?.matchType || ''))}`,
|
||||
`storeRemark=${encodeURIComponent(storeRemark)}`,
|
||||
`waveIndex=${encodeURIComponent(waveIndex)}`,
|
||||
`cacheKey=${encodeURIComponent(cacheKey)}`
|
||||
];
|
||||
this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`);
|
||||
@ -1153,8 +1191,15 @@
|
||||
} catch (error) {
|
||||
console.warn('[OrderReview] 缓存商品明细失败:', error);
|
||||
}
|
||||
const storeRemark = String(item?.storeRemark || this.orderList?.[0]?.storeRemark || '').trim();
|
||||
const waveIndex = String(item?.waveIndex || '').trim();
|
||||
const orderIds = Array.isArray(item?.orderIds) ? item.orderIds : [];
|
||||
const waveId = String(item?.waveId ?? item?.id ?? '').trim();
|
||||
const interceptStatus = String(item?.interceptStatus || '').trim();
|
||||
const params = [
|
||||
`recordId=${encodeURIComponent(String(item.id || ''))}`,
|
||||
`orderId=${encodeURIComponent(String(item.id || ''))}`,
|
||||
`waveId=${encodeURIComponent(waveId)}`,
|
||||
`waveNo=${encodeURIComponent(String(item.waveNo || '--'))}`,
|
||||
`waybillNo=${encodeURIComponent(String(item.waybillNo || '--'))}`,
|
||||
`pickerName=${encodeURIComponent(String(this.scanPickerName || item.pickerName || '--'))}`,
|
||||
@ -1162,6 +1207,10 @@
|
||||
`status=${encodeURIComponent(String(item.status || 'pending'))}`,
|
||||
`unreviewedCount=${encodeURIComponent(String(item.unreviewedCount || 0))}`,
|
||||
`listType=${encodeURIComponent(this.listType)}`,
|
||||
`storeRemark=${encodeURIComponent(storeRemark)}`,
|
||||
`waveIndex=${encodeURIComponent(waveIndex)}`,
|
||||
`interceptStatus=${encodeURIComponent(interceptStatus)}`,
|
||||
`orderIds=${encodeURIComponent(JSON.stringify(orderIds))}`,
|
||||
`cacheKey=${encodeURIComponent(cacheKey)}`
|
||||
];
|
||||
this.$tools.routerTo(`/pages/work/order/scatter-pick-goods-detail?${params.join('&')}`);
|
||||
@ -1338,6 +1387,60 @@
|
||||
uni.showToast({ title: message, icon: 'none' });
|
||||
}
|
||||
},
|
||||
handleInterceptCompleted(data) {
|
||||
if (!data) return;
|
||||
const { orderId } = data;
|
||||
if (!Array.isArray(this.orderList) || this.orderList.length === 0) return;
|
||||
this.orderList = this.orderList.map(item => {
|
||||
const itemId = Number(item.id || item.orderId || 0);
|
||||
if (itemId === Number(orderId)) {
|
||||
return { ...item, interceptStatus: 'intercepted_at_warehouse' };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
},
|
||||
handleReviewCompleted(data) {
|
||||
if (!data) return;
|
||||
const { orderId, waveNo, listType } = data;
|
||||
if (!Array.isArray(this.orderList) || this.orderList.length === 0) return;
|
||||
|
||||
if (this.listType === 'single') {
|
||||
// 散单模式:根据 orderId 匹配并标记为已复核
|
||||
let updated = false;
|
||||
this.orderList = this.orderList.map(item => {
|
||||
const itemId = Number(item.id || item.orderId || 0);
|
||||
if (itemId > 0 && itemId === Number(orderId)) {
|
||||
updated = true;
|
||||
return { ...item, isReviewed: true, unreviewedCount: 0 };
|
||||
}
|
||||
// 也尝试用运单号或 waveNo 匹配
|
||||
if (!updated && waveNo && item.waveNo === waveNo) {
|
||||
updated = true;
|
||||
return { ...item, isReviewed: true, unreviewedCount: 0 };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
} else if (this.listType === 'group') {
|
||||
// 团单模式:找到对应波次,减少 unreviewedCount
|
||||
let updated = false;
|
||||
this.orderList = this.orderList.map(item => {
|
||||
if (item.waveNo === waveNo || String(item.id) === String(orderId)) {
|
||||
const currentCount = Number(item.unreviewedCount || 0);
|
||||
const newCount = Math.max(0, currentCount - 1);
|
||||
updated = true;
|
||||
return { ...item, unreviewedCount: newCount };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
}
|
||||
|
||||
// 重新计算总未复核数
|
||||
if (this.listType === 'single') {
|
||||
this.totalUnreviewedCount = this.orderList.filter(item => !item.isReviewed).length;
|
||||
} else if (this.listType === 'group') {
|
||||
this.totalUnreviewedCount = this.orderList.filter(item => (item.unreviewedCount || 0) > 0).length;
|
||||
}
|
||||
},
|
||||
handlePageChange(page) {
|
||||
const targetPage = Math.max(1, Number(page || 1));
|
||||
if (targetPage === this.currentPage) {
|
||||
@ -1760,6 +1863,21 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.record-value--wave-index {
|
||||
flex-shrink: 0;
|
||||
font-size: 24rpx;
|
||||
color: #2979ff;
|
||||
background: #f0f7ff;
|
||||
border: 1rpx solid #b3d8ff;
|
||||
border-radius: 6rpx;
|
||||
padding: 0 8rpx;
|
||||
margin-right: 8rpx;
|
||||
line-height: 34rpx;
|
||||
height: 34rpx;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.record-left {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
<view class="normar_container">
|
||||
<page-nav :title="title">
|
||||
<template #right>
|
||||
<view class="nav-right-complete" :class="{ 'nav-right-complete--disabled': !canConfirmRecheck }" @click="canConfirmRecheck && handleComplete()">确认复核</view>
|
||||
<view v-if="isIntercepted" class="nav-right-complete nav-right-complete--intercept" @click="handleIntercept">确认拦截</view>
|
||||
<view v-else class="nav-right-complete" :class="{ 'nav-right-complete--disabled': !canConfirmRecheck }" @click="canConfirmRecheck && handleComplete()">确认复核</view>
|
||||
</template>
|
||||
</page-nav>
|
||||
|
||||
@ -11,6 +12,10 @@
|
||||
<view class="page-head-row page-head-row--top">
|
||||
<text class="page-head-value">{{ detailInfo.listType === 'single' ? detailInfo.waybillNo : detailInfo.waveNo }}</text>
|
||||
</view>
|
||||
<view class="page-head-row page-head-row--wave">
|
||||
<text class="page-head-label">{{ detailInfo.listType === 'group' ? '运单:' : '波次:' }}</text>
|
||||
<text class="page-head-wave">{{ detailInfo.listType === 'group' ? (detailInfo.waybillNo || '--') : (detailInfo.waveNo || '--') }}</text>
|
||||
</view>
|
||||
<view class="page-head-row page-head-row--bottom">
|
||||
<text class="page-head-picker">拣货人:{{ detailInfo.pickerName }}</text>
|
||||
<view class="page-head-actions">
|
||||
@ -35,8 +40,8 @@
|
||||
class="goods-image"
|
||||
:src="currentGoods.imageUrl || ''"
|
||||
mode="aspectFill"
|
||||
width="300rpx"
|
||||
height="300rpx"
|
||||
width="240rpx"
|
||||
height="240rpx"
|
||||
>
|
||||
<template #error>
|
||||
<view class="image-placeholder image-placeholder--large">
|
||||
@ -79,9 +84,17 @@
|
||||
</view>
|
||||
<view class="top-info">
|
||||
<view class="goods-row" :class="{ 'goods-row--barcode-highlight': isCurrentBarcodeMatched }"><view class="label">条码:</view><text class="value">{{ currentGoods.barcode || '--' }}</text></view>
|
||||
<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.planQty || 0 }}</text></view>
|
||||
<view class="goods-row"><view class="label">已扫:</view><text class="value">{{ currentGoods.scannedQty || 0 }}</text></view>
|
||||
<view class="goods-row"><view class="label">货主:</view><text class="value">{{ detailInfo.storeRemark || '--' }}</text></view>
|
||||
<view class="goods-row goods-row--qty" :class="{ 'goods-row--scanned-complete': isScannedComplete }">
|
||||
<view class="qty-item"><view class="label">已扫:</view><text class="value">{{ currentGoods.scannedQty || 0 }}</text></view>
|
||||
<view class="qty-divider"></view>
|
||||
<view class="qty-item"><view class="label">蓝号:</view><text class="value">{{ detailInfo.waveIndex || '--' }}</text></view>
|
||||
</view>
|
||||
<view class="goods-row goods-row--qty">
|
||||
<view class="qty-item"><view class="label">总数:</view><text class="value">{{ currentGoods.planQty || 0 }}</text></view>
|
||||
<view class="qty-divider"></view>
|
||||
<view class="qty-item"><view class="label">规格:</view><text class="value">{{ currentGoods.location || '--' }}</text></view>
|
||||
</view>
|
||||
<view class="goods-row"><view class="label label--package">打包要求:</view><text class="value">{{ currentGoods.packageRequirement }}</text></view>
|
||||
<view class="goods-row goods-row--pick-btn"><view class="pick-list-title-btn" @click="togglePickListSection">商品列表</view></view>
|
||||
</view>
|
||||
@ -119,8 +132,37 @@
|
||||
</view>
|
||||
<view class="bottom-summary">
|
||||
<text class="bottom-summary-text">合计:<text class="bottom-summary-value">{{ totalPlanQty }}</text></text>
|
||||
<text class="bottom-summary-scan">已扫:<text class="bottom-summary-value">{{ totalScannedQty }}</text><text class="bottom-summary-split">/</text><text class="bottom-summary-total">{{ totalPlanQty }}</text>件</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-popup :show="showWeighPopup" mode="center" :closeable="true" border-radius="20" :z-index="10090" @close="showWeighPopup = false">
|
||||
<view class="weigh-popup">
|
||||
<view class="weigh-popup-title">称重</view>
|
||||
<view class="weigh-popup-body">
|
||||
<view class="weigh-row">
|
||||
<text class="weigh-label">重量 <text class="weigh-required">*</text></text>
|
||||
<view class="weigh-control">
|
||||
<view class="weigh-btn weigh-btn--minus" @click="weighDecrement">-</view>
|
||||
<input
|
||||
class="weigh-input"
|
||||
type="digit"
|
||||
:value="weighWeight > 0 ? String(weighWeight) : ''"
|
||||
placeholder="请输入重量"
|
||||
placeholder-style="color:#c0c4cc;font-size:28rpx"
|
||||
@input="handleWeighInput"
|
||||
/>
|
||||
<view class="weigh-btn weigh-btn--plus" @click="weighIncrement">+</view>
|
||||
<text class="weigh-unit">kg</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="weigh-popup-footer">
|
||||
<view class="weigh-footer-btn weigh-footer-btn--cancel" @click="showWeighPopup = false">取消</view>
|
||||
<view class="weigh-footer-btn weigh-footer-btn--save" @click="handleWeighSave">保存</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -134,9 +176,12 @@
|
||||
matchedGoodsId: '',
|
||||
matchedGoodsState: {},
|
||||
showPickListSection: true,
|
||||
showWeighPopup: false,
|
||||
weighWeight: 0,
|
||||
detailInfo: {
|
||||
recordId: '',
|
||||
orderId: 0,
|
||||
waveId: '',
|
||||
waveNo: '--',
|
||||
waybillNo: '--',
|
||||
matchType: '',
|
||||
@ -144,11 +189,31 @@
|
||||
pickerName: '--',
|
||||
cartNo: '--',
|
||||
status: 'pending',
|
||||
unreviewedCount: 0
|
||||
unreviewedCount: 0,
|
||||
storeRemark: '',
|
||||
waveIndex: '',
|
||||
orderIds: [],
|
||||
interceptStatus: ''
|
||||
},
|
||||
goodsList: []
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
goodsList: {
|
||||
handler() {
|
||||
const total = this.totalPlanQty;
|
||||
const scanned = this.totalScannedQty;
|
||||
if (total > 0 && scanned >= total) {
|
||||
uni.showToast({
|
||||
title: '全部商品已扫描完成,可点击确认复核',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
headMatchLabel() {
|
||||
if (this.detailInfo?.matchType === 'waybill') {
|
||||
@ -180,6 +245,10 @@
|
||||
isRecheckFinished() {
|
||||
return String(this.detailInfo?.recheckStatus || '').toLowerCase() === 'fin';
|
||||
},
|
||||
isIntercepted() {
|
||||
const status = String(this.detailInfo?.interceptStatus || '').trim().toLowerCase();
|
||||
return !!status && status !== 'none' && status !== '';
|
||||
},
|
||||
isCurrentBarcodeMatched() {
|
||||
const currentId = String(this.currentGoods?.id || '');
|
||||
if (!currentId) {
|
||||
@ -190,6 +259,14 @@
|
||||
totalPlanQty() {
|
||||
return this.goodsList.reduce((sum, item) => sum + (item.planQty || 0), 0);
|
||||
},
|
||||
totalScannedQty() {
|
||||
return this.goodsList.reduce((sum, item) => sum + (item.scannedQty || 0), 0);
|
||||
},
|
||||
isScannedComplete() {
|
||||
const plan = Number(this.currentGoods?.planQty || 0);
|
||||
const scanned = Number(this.currentGoods?.scannedQty || 0);
|
||||
return plan > 0 && scanned >= plan;
|
||||
},
|
||||
isAllMatched() {
|
||||
return this.goodsList.every(item => {
|
||||
const id = String(item?.id || '');
|
||||
@ -205,20 +282,42 @@
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
const safeDecode = (val) => {
|
||||
if (!val) return '';
|
||||
try {
|
||||
return decodeURIComponent(String(val));
|
||||
} catch (e) {
|
||||
return String(val);
|
||||
}
|
||||
};
|
||||
const matchType = String(options?.matchType || '').trim();
|
||||
const recheckStatus = String(options?.recheckStatus || '').trim().toLowerCase();
|
||||
let parsedOrderIds = [];
|
||||
try {
|
||||
const raw = String(options?.orderIds || '').trim();
|
||||
if (raw) {
|
||||
parsedOrderIds = JSON.parse(decodeURIComponent(raw));
|
||||
}
|
||||
} catch (e) {
|
||||
parsedOrderIds = [];
|
||||
}
|
||||
this.detailInfo = {
|
||||
recordId: options?.recordId || '',
|
||||
orderId: Number(options?.orderId || options?.recordId || 0),
|
||||
waveNo: options?.waveNo || '--',
|
||||
waybillNo: options?.waybillNo || '--',
|
||||
waveId: String(options?.waveId || '').trim(),
|
||||
waveNo: safeDecode(options?.waveNo) || '--',
|
||||
waybillNo: safeDecode(options?.waybillNo) || '--',
|
||||
matchType,
|
||||
recheckStatus,
|
||||
pickerName: options?.pickerName || '--',
|
||||
cartNo: options?.cartNo || '--',
|
||||
pickerName: safeDecode(options?.pickerName) || '--',
|
||||
cartNo: safeDecode(options?.cartNo) || '--',
|
||||
status: options?.status || 'pending',
|
||||
unreviewedCount: Number(options?.unreviewedCount || 0),
|
||||
listType: String(options?.listType || '').trim()
|
||||
listType: String(options?.listType || '').trim(),
|
||||
storeRemark: safeDecode(options?.storeRemark),
|
||||
waveIndex: String(options?.waveIndex || '').trim(),
|
||||
orderIds: Array.isArray(parsedOrderIds) ? parsedOrderIds : [],
|
||||
interceptStatus: String(options?.interceptStatus || '').trim()
|
||||
};
|
||||
if (this.isRecheckFinished) {
|
||||
uni.showToast({
|
||||
@ -366,6 +465,21 @@
|
||||
const maxQty = matchedItem?.planQty || 0;
|
||||
const currentScanned = matchedItem?.scannedQty || 0;
|
||||
|
||||
// 总数小于3时,不弹输入框,扫一次已扫+1
|
||||
if (maxQty < 3) {
|
||||
const newScanned = Math.min(currentScanned + 1, maxQty);
|
||||
if (typeof this.$set === 'function') {
|
||||
this.$set(this.goodsList, matchIndex, {
|
||||
...matchedItem,
|
||||
scannedQty: newScanned
|
||||
});
|
||||
} else {
|
||||
this.goodsList[matchIndex].scannedQty = newScanned;
|
||||
}
|
||||
uni.showToast({ title: `已扫:${newScanned}/${maxQty}`, icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showModal({
|
||||
title: `扫描成功:${itemName}`,
|
||||
content: `请输入数量(共 ${maxQty},已扫 ${currentScanned}):`,
|
||||
@ -506,6 +620,36 @@
|
||||
togglePickListSection() {
|
||||
this.showPickListSection = !this.showPickListSection;
|
||||
},
|
||||
async handleIntercept() {
|
||||
const orderId = Number(this.detailInfo?.orderId || 0);
|
||||
if (!orderId) {
|
||||
uni.showToast({ title: '缺少订单ID', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
uni.showModal({
|
||||
title: '确认拦截',
|
||||
content: `⚠️确认对订单 ID ${orderId} 执行拦截操作?`,
|
||||
success: async (res) => {
|
||||
if (!res.confirm) return;
|
||||
uni.showLoading({ title: '拦截中...' });
|
||||
try {
|
||||
await this.$http('order.recheckOrder.confirmIntercept', {
|
||||
order_id: orderId
|
||||
});
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '已确认拦截', icon: 'success' });
|
||||
uni.$emit('orderInterceptCompleted', { orderId });
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ delta: 1 });
|
||||
}, 1500);
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
const message = String(error?.message || error?.msg || error?.errMsg || '拦截失败');
|
||||
uni.showToast({ title: message, icon: 'none' });
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleComplete() {
|
||||
if (this.isRecheckFinished) {
|
||||
uni.showToast({ title: '该订单已复核完成', icon: 'none' });
|
||||
@ -547,6 +691,12 @@
|
||||
title: '已确认复核',
|
||||
icon: 'success'
|
||||
});
|
||||
// 通知订单复核页面更新列表状态
|
||||
uni.$emit('orderReviewCompleted', {
|
||||
orderId: this.detailInfo.orderId,
|
||||
waveNo: this.detailInfo.waveNo,
|
||||
listType: this.detailInfo.listType
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
@ -562,11 +712,157 @@
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
handleReprint() {
|
||||
uni.showToast({ title: '面单补打', icon: 'none' });
|
||||
buildPrintRequestCode() {
|
||||
const timePart = Date.now().toString(36);
|
||||
const randomPart = Math.random().toString(36).slice(2, 10);
|
||||
return `PRINT_${timePart}_${randomPart}`;
|
||||
},
|
||||
extractPrintRecordList(response) {
|
||||
const list = response?.data?.list || response?.data?.data?.list;
|
||||
return Array.isArray(list) ? list : [];
|
||||
},
|
||||
normalizePrintStations(list) {
|
||||
return list
|
||||
.map(item => {
|
||||
const source = item && typeof item === 'object' ? item : {};
|
||||
const id = String(source.id ?? source.print_station_id ?? source.printStationId ?? '').trim();
|
||||
const name = String(source.name || source.station_name || source.print_station_name || '').trim();
|
||||
return { id, name };
|
||||
})
|
||||
.filter(item => !!item.id && !!item.name);
|
||||
},
|
||||
async handleReprint() {
|
||||
const listType = String(this.detailInfo?.listType || '').trim();
|
||||
|
||||
// 根据 listType 构建 order_ids 参数
|
||||
let orderIdsParam;
|
||||
if (listType === 'group') {
|
||||
// 团单模式:使用 data.list[X].order_ids
|
||||
orderIdsParam = this.detailInfo.orderIds;
|
||||
if (!Array.isArray(orderIdsParam) || orderIdsParam.length === 0) {
|
||||
uni.showToast({ title: '缺少波次订单ID列表', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// 散单/详情模式:使用 data.list[X].order_id
|
||||
const orderId = Number(this.detailInfo?.orderId || 0);
|
||||
if (!orderId) {
|
||||
uni.showToast({ title: '缺少订单ID', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
orderIdsParam = [orderId];
|
||||
}
|
||||
|
||||
uni.showLoading({ title: '处理打印中...' });
|
||||
try {
|
||||
// 1. 获取打印数据
|
||||
const printDataResponse = await this.$http('order.print.getOrderPrintData', { order_ids: orderIdsParam });
|
||||
const printDataPayload = printDataResponse?.data?.data || printDataResponse?.data || printDataResponse?.result || {};
|
||||
const waveGroups = Array.isArray(printDataPayload?.waveGroups)
|
||||
? printDataPayload.waveGroups
|
||||
: (printDataPayload && typeof printDataPayload === 'object' ? [printDataPayload] : []);
|
||||
if (!waveGroups.length) {
|
||||
throw new Error('未获取到可打印数据');
|
||||
}
|
||||
|
||||
// 2. 获取打印台列表,使用第一个可用打印台
|
||||
const stationResponse = await this.$http('print.getList', { page: 1, pageSize: 20, where: {} });
|
||||
const stationList = this.normalizePrintStations(this.extractPrintRecordList(stationResponse));
|
||||
if (!stationList.length) {
|
||||
throw new Error('无可用的打印台');
|
||||
}
|
||||
const printStation = stationList[0];
|
||||
|
||||
// 3. 发送打印
|
||||
const requestCode = this.buildPrintRequestCode();
|
||||
const sendParams = {
|
||||
type: 'express',
|
||||
printStationId: printStation.id,
|
||||
requestCode,
|
||||
data: { waveGroups }
|
||||
};
|
||||
const sendResponse = await this.$http('print.send', sendParams);
|
||||
const success = sendResponse?.flag !== 'failure' && sendResponse?.code !== '500' && sendResponse?.code !== 500;
|
||||
if (!success) {
|
||||
throw new Error(sendResponse?.message || sendResponse?.msg || '打印发送失败');
|
||||
}
|
||||
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '面单补打已发送', icon: 'success' });
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
const message = String(error?.message || error?.msg || error?.errMsg || '打印失败');
|
||||
uni.showToast({ title: message, icon: 'none' });
|
||||
}
|
||||
},
|
||||
handleWeigh() {
|
||||
uni.showToast({ title: '称重', icon: 'none' });
|
||||
this.weighWeight = 0;
|
||||
this.showWeighPopup = true;
|
||||
},
|
||||
weighIncrement() {
|
||||
this.weighWeight = Math.round((this.weighWeight + 0.1) * 10) / 10;
|
||||
},
|
||||
weighDecrement() {
|
||||
const val = Math.round((this.weighWeight - 0.1) * 10) / 10;
|
||||
this.weighWeight = val < 0 ? 0 : val;
|
||||
},
|
||||
handleWeighInput(e) {
|
||||
const raw = String(e?.detail?.value || '').trim();
|
||||
if (raw === '') {
|
||||
this.weighWeight = 0;
|
||||
return;
|
||||
}
|
||||
const num = parseFloat(raw);
|
||||
if (Number.isFinite(num) && num >= 0) {
|
||||
this.weighWeight = Math.round(num * 1000) / 1000;
|
||||
} else {
|
||||
this.weighWeight = 0;
|
||||
}
|
||||
},
|
||||
async handleWeighSave() {
|
||||
if (this.weighWeight <= 0) {
|
||||
uni.showToast({ title: '请输入重量', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
const listType = String(this.detailInfo?.listType || '').trim();
|
||||
const weighingWeight = this.weighWeight;
|
||||
|
||||
uni.showLoading({ title: '提交称重中...' });
|
||||
try {
|
||||
if (listType === 'group') {
|
||||
// 团单模式:传 order_id(值为波次ID,数值型)
|
||||
const waveId = Number(this.detailInfo.waveId || 0);
|
||||
if (!waveId) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '缺少波次ID', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
await this.$http('order.recheckOrder.updateExpressWeighingWeight', {
|
||||
order_id: waveId,
|
||||
weighing_weight: weighingWeight
|
||||
});
|
||||
} else {
|
||||
// 散单/详情模式:传 order_id
|
||||
const orderId = Number(this.detailInfo?.orderId || 0);
|
||||
if (!orderId) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '缺少订单ID', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
await this.$http('order.recheckOrder.updateExpressWeighingWeight', {
|
||||
order_id: orderId,
|
||||
weighing_weight: weighingWeight
|
||||
});
|
||||
}
|
||||
uni.hideLoading();
|
||||
uni.showToast({ title: '称重完成', icon: 'success' });
|
||||
this.showWeighPopup = false;
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
const message = String(error?.message || error?.msg || error?.errMsg || '称重提交失败');
|
||||
uni.showToast({ title: message, icon: 'none' });
|
||||
}
|
||||
},
|
||||
getStatusText(status) {
|
||||
const map = {
|
||||
@ -662,6 +958,10 @@
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.nav-right-complete--intercept {
|
||||
background: #f56c6c;
|
||||
}
|
||||
|
||||
.page-head {
|
||||
margin: 20rpx 24rpx 0;
|
||||
padding: 16rpx;
|
||||
@ -678,10 +978,31 @@
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.page-head-row--wave {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.page-head-row--bottom {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.page-head-label {
|
||||
font-size: 28rpx;
|
||||
color: #909399;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.page-head-wave {
|
||||
font-size: 28rpx;
|
||||
color: #303133;
|
||||
font-weight: 500;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.page-head-value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
@ -709,11 +1030,11 @@
|
||||
}
|
||||
|
||||
.page-head-btn {
|
||||
font-size: 26rpx;
|
||||
font-size: 30rpx;
|
||||
color: #ffffff;
|
||||
padding: 6rpx 16rpx;
|
||||
padding: 12rpx 24rpx;
|
||||
border: none;
|
||||
border-radius: 8rpx;
|
||||
border-radius: 10rpx;
|
||||
background: #fa8c16;
|
||||
white-space: nowrap;
|
||||
}
|
||||
@ -767,6 +1088,22 @@
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
.goods-row--scanned-complete {
|
||||
background: #f0fff4;
|
||||
border: 1rpx solid #b7eb8f;
|
||||
border-radius: 8rpx;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.goods-row--scanned-complete .qty-item .label,
|
||||
.goods-row--scanned-complete .qty-item .value {
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
.goods-row--scanned-complete .qty-divider {
|
||||
background: #b7eb8f;
|
||||
}
|
||||
|
||||
.goods-row:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
@ -780,6 +1117,39 @@
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.goods-row--qty {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.goods-row--qty .qty-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.goods-row--qty .qty-item .label {
|
||||
width: auto;
|
||||
min-width: auto;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.goods-row--qty .qty-item .value {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.qty-divider {
|
||||
width: 1rpx;
|
||||
height: 28rpx;
|
||||
background: #dcdfe6;
|
||||
margin: 0 16rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.label {
|
||||
width: 110rpx;
|
||||
min-width: 110rpx;
|
||||
@ -844,14 +1214,14 @@
|
||||
}
|
||||
|
||||
.goods-thumb {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
width: 240rpx;
|
||||
height: 240rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.goods-image {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
width: 240rpx;
|
||||
height: 240rpx;
|
||||
flex-shrink: 0;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
@ -859,8 +1229,8 @@
|
||||
}
|
||||
|
||||
.goods-image-grid {
|
||||
width: 300rpx;
|
||||
height: 300rpx;
|
||||
width: 240rpx;
|
||||
height: 240rpx;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
@ -869,8 +1239,8 @@
|
||||
|
||||
.grid-cell {
|
||||
position: relative;
|
||||
width: 145rpx;
|
||||
height: 145rpx;
|
||||
width: 116rpx;
|
||||
height: 116rpx;
|
||||
border-radius: 10rpx;
|
||||
overflow: hidden;
|
||||
background: #f5f7fa;
|
||||
@ -898,11 +1268,11 @@
|
||||
}
|
||||
|
||||
.image-placeholder--large {
|
||||
height: 300rpx;
|
||||
height: 240rpx;
|
||||
}
|
||||
|
||||
.image-placeholder--small {
|
||||
height: 145rpx;
|
||||
height: 116rpx;
|
||||
}
|
||||
|
||||
.image-placeholder--empty {
|
||||
@ -953,13 +1323,13 @@
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32rpx;
|
||||
line-height: 36rpx;
|
||||
font-weight: 600;
|
||||
font-size: 30rpx;
|
||||
line-height: 1.2;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
background: #2979ff;
|
||||
border-radius: 6rpx;
|
||||
padding: 6rpx 14rpx;
|
||||
border-radius: 10rpx;
|
||||
padding: 12rpx 24rpx;
|
||||
}
|
||||
|
||||
.pick-list-scroll {
|
||||
@ -1091,8 +1461,10 @@
|
||||
padding-bottom: calc(16rpx + env(safe-area-inset-bottom));
|
||||
background: #ffffff;
|
||||
border-top: 1rpx solid #ebeef5;
|
||||
text-align: left;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.bottom-summary-text {
|
||||
@ -1100,6 +1472,22 @@
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.bottom-summary-scan {
|
||||
font-size: 28rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.bottom-summary-split {
|
||||
font-size: 28rpx;
|
||||
color: #909399;
|
||||
margin: 0 2rpx;
|
||||
}
|
||||
|
||||
.bottom-summary-total {
|
||||
font-size: 28rpx;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.bottom-summary-value {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
@ -1128,4 +1516,128 @@
|
||||
.safe-area-bottom {
|
||||
height: calc(30rpx + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.weigh-popup {
|
||||
width: 560rpx;
|
||||
padding: 24rpx 36rpx 36rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.weigh-popup-title {
|
||||
font-size: 34rpx;
|
||||
font-weight: 400;
|
||||
color: #303133;
|
||||
text-align: left;
|
||||
line-height: 1;
|
||||
padding-top: 8rpx;
|
||||
margin-bottom: 28rpx;
|
||||
}
|
||||
|
||||
.weigh-popup-body {
|
||||
margin: 20rpx 0 48rpx;
|
||||
}
|
||||
|
||||
.weigh-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
.weigh-label {
|
||||
font-size: 30rpx;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
.weigh-required {
|
||||
color: #f56c6c;
|
||||
}
|
||||
|
||||
.weigh-control {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
.weigh-btn {
|
||||
width: 60rpx;
|
||||
height: 76rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 36rpx;
|
||||
font-weight: 400;
|
||||
color: #606266;
|
||||
background: #f5f7fa;
|
||||
border: 2rpx solid #dcdfe6;
|
||||
user-select: none;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.weigh-btn--minus {
|
||||
border-radius: 10rpx 0 0 10rpx;
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.weigh-btn--plus {
|
||||
border-radius: 0 10rpx 10rpx 0;
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.weigh-btn:active {
|
||||
background: #e8eaed;
|
||||
}
|
||||
|
||||
.weigh-input {
|
||||
width: 200rpx;
|
||||
height: 76rpx;
|
||||
font-size: 36rpx;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
text-align: center;
|
||||
background: #ffffff;
|
||||
border: 2rpx solid #dcdfe6;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.weigh-unit {
|
||||
font-size: 30rpx;
|
||||
color: #909399;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.weigh-popup-footer {
|
||||
display: flex;
|
||||
gap: 24rpx;
|
||||
}
|
||||
|
||||
.weigh-footer-btn {
|
||||
flex: 1;
|
||||
height: 72rpx;
|
||||
border-radius: 10rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.weigh-footer-btn:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.weigh-footer-btn--cancel {
|
||||
background: #f4f4f5;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.weigh-footer-btn--save {
|
||||
background: #2979ff;
|
||||
color: #ffffff;
|
||||
}
|
||||
</style>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user