修改订单拣货、称重模块、复核列表、修改商品页面,重量单位统一为g
This commit is contained in:
parent
63d40b2f7f
commit
8ebf3108a8
@ -553,12 +553,18 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
// 监听拦截完成事件
|
||||
uni.$on('orderInterceptCompleted', this.handleInterceptCompleted);
|
||||
|
||||
// 从散单已复核列表点击跳转,调用 order.deliveryOrder.detail 获取订单详情
|
||||
// 从已复核列表点击跳转,调用详情接口获取订单详情
|
||||
const initDetailId = options?.orderId || '';
|
||||
const initTableType = options?.tableType || 'dispatch';
|
||||
const initWaveId = options?.waveId || '';
|
||||
const initMode = String(options?.mode || '').trim();
|
||||
if (initDetailId) {
|
||||
this.printMode = 'noPrint';
|
||||
this.fetchReviewedDetail(initDetailId, initTableType);
|
||||
} else if (initWaveId && initMode === 'group') {
|
||||
this.listType = 'group';
|
||||
this.printMode = 'noPrint';
|
||||
this.fetchGroupReviewedDetail(initWaveId);
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
@ -1886,6 +1892,148 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
this.selectedStationId = station.id;
|
||||
}
|
||||
},
|
||||
resolvePickerName(detail, logs = []) {
|
||||
const pickLog = Array.isArray(logs)
|
||||
? logs.find(log => String(log?.operation_code || '').toUpperCase() === 'ORDER_PICK_COMPLETE')
|
||||
: null;
|
||||
const pickedName = String(pickLog?.operator_name || pickLog?.picker_name || '').trim();
|
||||
if (pickedName) {
|
||||
return pickedName;
|
||||
}
|
||||
return String(detail?.operator_name || detail?.picker_name || detail?.pickerName || '').trim() || '--';
|
||||
},
|
||||
normalizeBarcodeValues(barcodes) {
|
||||
if (Array.isArray(barcodes)) {
|
||||
return barcodes
|
||||
.map(entry => {
|
||||
if (entry === null || entry === undefined) {
|
||||
return '';
|
||||
}
|
||||
if (typeof entry === 'string') {
|
||||
return entry.trim();
|
||||
}
|
||||
if (typeof entry === 'object') {
|
||||
const val = entry?.barcode || entry?.code || entry?.value || entry?.name || '';
|
||||
return String(val || '').trim();
|
||||
}
|
||||
return String(entry || '').trim();
|
||||
})
|
||||
.filter(Boolean);
|
||||
}
|
||||
if (typeof barcodes === 'string') {
|
||||
return barcodes.split(/[;,,\s]+/).map(item => item.trim()).filter(Boolean);
|
||||
}
|
||||
if (barcodes && typeof barcodes === 'object') {
|
||||
const val = barcodes?.barcode || barcodes?.code || barcodes?.value || '';
|
||||
return val ? [String(val).trim()] : [];
|
||||
}
|
||||
return [];
|
||||
},
|
||||
async fetchGroupReviewedDetail(waveId) {
|
||||
if (!waveId) {
|
||||
return;
|
||||
}
|
||||
uni.showLoading({ title: '加载详情...' });
|
||||
try {
|
||||
const response = await this.$http('order.deliveryOrder.list', {
|
||||
pagination: {
|
||||
page: 1,
|
||||
pageSize: 100
|
||||
},
|
||||
where: {
|
||||
wave_id: {
|
||||
operator: 'eq',
|
||||
value: Number(waveId)
|
||||
}
|
||||
},
|
||||
sort: {
|
||||
sortField: 'updated_at',
|
||||
sortOrder: 'DESC'
|
||||
}
|
||||
});
|
||||
const data = response?.data || response || {};
|
||||
const orders = Array.isArray(data?.list) ? data.list : [];
|
||||
if (!orders.length) {
|
||||
uni.showToast({ title: '未查询到波次订单', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
const firstOrder = orders[0] || {};
|
||||
const firstOrderId = Number(firstOrder?.id || 0);
|
||||
if (!firstOrderId) {
|
||||
uni.showToast({ title: '缺少波次订单ID', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
const firstResponse = await this.$http('order.deliveryOrder.detail', {
|
||||
id: firstOrderId,
|
||||
tableType: 'dispatch'
|
||||
});
|
||||
const firstPayload = firstResponse?.data || firstResponse || {};
|
||||
const firstDetail = firstPayload?.detail || firstPayload?.info || firstPayload || {};
|
||||
const responseItems = Array.isArray(firstPayload?.items) ? firstPayload.items
|
||||
: Array.isArray(firstDetail.items) ? firstDetail.items
|
||||
: Array.isArray(firstDetail.goods_items) ? firstDetail.goods_items
|
||||
: Array.isArray(firstDetail.stocks) ? firstDetail.stocks
|
||||
: [];
|
||||
const allItems = responseItems.map(item => ({
|
||||
...item,
|
||||
images: Array.isArray(item.image_url) ? item.image_url
|
||||
: Array.isArray(item.images) ? item.images
|
||||
: [],
|
||||
barcodes: this.normalizeBarcodeValues(item?.barcodes || item?.barcode || [])
|
||||
}));
|
||||
const logs = Array.isArray(firstPayload?.logs) ? firstPayload.logs : Array.isArray(firstDetail?.logs) ? firstDetail.logs : [];
|
||||
const pickerName = this.resolvePickerName(firstDetail, logs);
|
||||
// 尝试从日志中的 ORDER_PRINT 条目解析波次订单数量(message 中的 order_count)
|
||||
let waveOrderCount = Number(firstDetail.order_count ?? firstDetail.orderCount ?? 0);
|
||||
if ((!waveOrderCount || waveOrderCount === 0) && Array.isArray(logs) && logs.length > 0) {
|
||||
const printLog = logs.find(l => String(l?.operation_code || '').toUpperCase() === 'ORDER_PRINT');
|
||||
if (printLog && printLog.message) {
|
||||
const m = String(printLog.message).match(/order_count\s*=?\s*(\d+)/i);
|
||||
if (m && m[1]) {
|
||||
waveOrderCount = Number(m[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
const waybillNo = String(
|
||||
firstPayload?.waybill_codes?.[0]
|
||||
|| firstDetail.waybill_no
|
||||
|| firstDetail.waybillNo
|
||||
|| firstDetail.express_code
|
||||
|| firstPayload?.expresses?.[0]?.waybill_code
|
||||
|| '--'
|
||||
);
|
||||
const detailItem = {
|
||||
id: String(firstDetail.id || waveId || ''),
|
||||
orderId: Number(firstDetail.id || firstDetail.order_id || 0),
|
||||
waveNo: String(firstDetail.wave_no || firstDetail.waveNo || '--'),
|
||||
waveId: String(firstDetail.wave_id || firstDetail.waveId || waveId || ''),
|
||||
waybillNo,
|
||||
recheckStatus: 'fin',
|
||||
pickerName,
|
||||
orderCount: Number.isFinite(waveOrderCount) ? waveOrderCount : (Number(firstDetail.order_count ?? firstDetail.orderCount ?? 0) || 0),
|
||||
totalOrders: Number.isFinite(waveOrderCount) ? waveOrderCount : (Number(firstDetail.order_count ?? firstDetail.orderCount ?? 0) || 0),
|
||||
cartNo: String(firstDetail.basket_number || firstDetail.cart_code || firstDetail.cartCode || firstDetail.cart_no || firstDetail.cartNo || '--'),
|
||||
status: 'reviewed',
|
||||
unreviewedCount: 0,
|
||||
storeRemark: String(firstDetail.remark || firstDetail.store_remark || firstDetail.storeRemark || ''),
|
||||
storeName: String(firstDetail.store_name || firstDetail.storeName || '').trim(),
|
||||
waveIndex: String(firstDetail.wave_index || firstDetail.waveIndex || '').trim(),
|
||||
interceptStatus: String(firstDetail.intercept_status || firstDetail.interceptStatus || ''),
|
||||
boxNo: String(firstDetail.box_no || firstDetail.boxNo || ''),
|
||||
isPrinted: !!firstDetail.is_printed || !!firstDetail.isPrinted || firstDetail.print_status === 'fin',
|
||||
detailItems: allItems,
|
||||
stocks: allItems,
|
||||
orderIds: []
|
||||
};
|
||||
this.goPickGoodsDetail(detailItem);
|
||||
} catch (error) {
|
||||
console.error('[order-review] fetchGroupReviewedDetail error:', error);
|
||||
uni.showToast({ title: '加载团购订单详情失败', icon: 'none' });
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
async fetchReviewedDetail(id, tableType = 'dispatch') {
|
||||
uni.showLoading({ title: '加载详情...' });
|
||||
try {
|
||||
@ -1905,12 +2053,15 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
: Array.isArray(detail.goods_items) ? detail.goods_items
|
||||
: Array.isArray(detail.stocks) ? detail.stocks
|
||||
: [];
|
||||
const logs = Array.isArray(data?.logs) ? data.logs : Array.isArray(detail?.logs) ? detail.logs : [];
|
||||
const pickerName = this.resolvePickerName(detail, logs);
|
||||
// 统一商品图片字段名(接口返回 image_url 数组)
|
||||
const normalizedItems = responseItems.map(item => ({
|
||||
...item,
|
||||
images: Array.isArray(item.image_url) ? item.image_url
|
||||
: Array.isArray(item.images) ? item.images
|
||||
: []
|
||||
: [],
|
||||
barcodes: this.normalizeBarcodeValues(item?.barcodes || item?.barcode || [])
|
||||
}));
|
||||
// 提取运单号(优先 data.waybill_codes)
|
||||
const waybillNo = String(
|
||||
@ -1929,7 +2080,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
waveId: String(detail.wave_id || detail.waveId || ''),
|
||||
waybillNo,
|
||||
recheckStatus: 'fin',
|
||||
pickerName: String(detail.operator_name || detail.picker_name || detail.pickerName || '--'),
|
||||
pickerName,
|
||||
cartNo: String(detail.basket_number || detail.cart_code || detail.cartCode || detail.cart_no || detail.cartNo || '--'),
|
||||
status: 'reviewed',
|
||||
unreviewedCount: 0,
|
||||
@ -1989,7 +2140,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
const planQty = Number(stockItem?.plan_qty ?? rawItem?.plan_qty ?? 0);
|
||||
const scannedQty = Number(rawItem?.scanned_qty ?? rawItem?.finish_qty ?? rawItem?.scannedQty ?? 0);
|
||||
const stockName = stockItem ? String(stockItem.item_name || '').trim() : '';
|
||||
const stockBarcodes = stockItem ? (Array.isArray(stockItem.barcodes) ? stockItem.barcodes : []) : [];
|
||||
const barcodeSource = stockItem?.barcodes || rawItem?.barcodes || rawItem?.barcode || snapshot?.barcodes || snapshot?.barcode || [];
|
||||
const stockBarcodes = this.normalizeBarcodeValues(barcodeSource);
|
||||
|
||||
return {
|
||||
id: String(rawItem?.id || stockItem?.stock_id || `item-${index + 1}`),
|
||||
@ -2393,7 +2545,6 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
uni.showToast({ title: '请输入有效重量', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
const weighKg = this.weighWeight / 1000;
|
||||
const listType = String(this.detailInfo?.listType || '').trim();
|
||||
const orderId = Number(this.detailInfo?.orderId || this.detailInfo?.recordId || 0);
|
||||
const waybillNo = String(this.detailInfo?.waybillNo || '').trim();
|
||||
@ -2409,7 +2560,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
await this.$http('order.recheckOrder.updateExpressWeighingWeight', {
|
||||
order_id: 0,
|
||||
waybill_code: waybillNo,
|
||||
weighing_weight: weighKg
|
||||
weighing_weight: this.weighWeight
|
||||
});
|
||||
} else {
|
||||
if (!orderId) {
|
||||
@ -2419,7 +2570,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
}
|
||||
await this.$http('order.recheckOrder.updateExpressWeighingWeight', {
|
||||
order_id: orderId,
|
||||
weighing_weight: weighKg
|
||||
weighing_weight: this.weighWeight
|
||||
});
|
||||
}
|
||||
uni.hideLoading();
|
||||
|
||||
@ -14,7 +14,11 @@
|
||||
</view>
|
||||
</view>
|
||||
<text class="header-title">复核列表</text>
|
||||
<view class="header-right"></view>
|
||||
<view class="header-right">
|
||||
<view class="header-refresh-btn" @click="handleRefresh">
|
||||
<text class="header-refresh-btn__text">刷新</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -121,7 +125,8 @@
|
||||
v-for="(item, index) in listData"
|
||||
:key="'group-' + index"
|
||||
class="record-item"
|
||||
:class="{ 'record-item--reviewed': item.review_assignment_status === 'reviewed' }"
|
||||
:class="{ 'record-item--reviewed': item.review_assignment_status === 'reviewed', 'record-item--clickable': currentSubTab === 1 }"
|
||||
@click="currentSubTab === 1 && handleReviewedItemClick(item)"
|
||||
>
|
||||
<template v-if="currentSubTab === 1">
|
||||
<view class="record-main">
|
||||
@ -133,46 +138,9 @@
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="record-main">
|
||||
<view class="record-left">
|
||||
<view class="record-line">
|
||||
<text class="record-label">波次号:</text>
|
||||
<text class="record-value">{{ item.wave_no || '--' }}</text>
|
||||
</view>
|
||||
<view class="record-line">
|
||||
<text class="record-label">总单数:</text>
|
||||
<text class="record-value">{{ item.order_count || 0 }}</text>
|
||||
<text class="record-label" style="margin-left:20rpx">已复核:</text>
|
||||
<text class="record-value">{{ item.reviewed_count || 0 }}</text>
|
||||
</view>
|
||||
<view class="record-line record-line--split">
|
||||
<view class="record-half">
|
||||
<text class="record-half-label">未复核:</text>
|
||||
<text class="record-half-value">{{ item.unreviewed_count || 0 }}</text>
|
||||
</view>
|
||||
<view class="record-half">
|
||||
<text class="record-half-label">状态:</text>
|
||||
<text class="record-half-value">{{ reviewStatusText(item.review_assignment_status) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="record-right">
|
||||
<text
|
||||
class="record-status"
|
||||
:class="getWaveStatusClass(item.review_assignment_status)"
|
||||
>{{ reviewStatusText(item.review_assignment_status) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="record-footer">
|
||||
<text class="record-time">{{ item.create_time || '--' }}</text>
|
||||
<view v-if="item.review_assignment_status !== 'reviewed'" class="record-actions">
|
||||
<u-button
|
||||
type="primary"
|
||||
size="mini"
|
||||
:customStyle="{ backgroundColor: '#e74c3c', borderColor: '#e74c3c', fontSize: '26rpx', height: '60rpx', lineHeight: '60rpx', padding: '0 20rpx' }"
|
||||
@click="handleStartReview(item)"
|
||||
>
|
||||
开始复核
|
||||
</u-button>
|
||||
<view class="record-index-box">{{ String(index + 1).padStart(2, '0') }}</view>
|
||||
<view class="record-waybill">
|
||||
<text class="record-waybill-text">{{ item.wave_no || '--' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -213,7 +181,8 @@ export default {
|
||||
listData: [],
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
paginationTotal: 0
|
||||
paginationTotal: 0,
|
||||
_refreshing: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -225,9 +194,81 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.restoreTabState();
|
||||
this.safeDispatchBroadcast('setCallbacks', {
|
||||
onResult: this.handleBroadcastResult
|
||||
});
|
||||
this.safeDispatchBroadcast('start');
|
||||
this.fetchList();
|
||||
},
|
||||
onShow() {
|
||||
this.safeDispatchBroadcast('setCallbacks', {
|
||||
onResult: this.handleBroadcastResult
|
||||
});
|
||||
this.safeDispatchBroadcast('resume');
|
||||
},
|
||||
onHide() {
|
||||
this.safeDispatchBroadcast('pause');
|
||||
},
|
||||
onUnload() {
|
||||
this.safeDispatchBroadcast('stop');
|
||||
},
|
||||
methods: {
|
||||
restoreTabState() {
|
||||
try {
|
||||
const saved = uni.getStorageSync('reviewList_tab_state');
|
||||
if (saved) {
|
||||
if (saved.currentMode === 'scatter' || saved.currentMode === 'group') {
|
||||
this.currentMode = saved.currentMode;
|
||||
}
|
||||
if (saved.currentSubTab === 0 || saved.currentSubTab === 1) {
|
||||
this.currentSubTab = saved.currentSubTab;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('[orderReviewList] restoreTabState error:', e);
|
||||
}
|
||||
},
|
||||
saveTabState() {
|
||||
try {
|
||||
uni.setStorageSync('reviewList_tab_state', {
|
||||
currentMode: this.currentMode,
|
||||
currentSubTab: this.currentSubTab
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn('[orderReviewList] saveTabState error:', e);
|
||||
}
|
||||
},
|
||||
safeDispatchBroadcast(action, payload) {
|
||||
try {
|
||||
const task = this.$store.dispatch(`broadcast/${action}`, payload);
|
||||
if (task && typeof task.catch === 'function') {
|
||||
task.catch(error => {
|
||||
console.warn(`[orderReviewList] broadcast/${action} 调用失败:`, error);
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(`[orderReviewList] broadcast/${action} 调用异常:`, error);
|
||||
}
|
||||
},
|
||||
handleBroadcastResult(result) {
|
||||
if (this._refreshing) return;
|
||||
const rawCode = typeof result === 'string' ? result.trim()
|
||||
: (result && typeof result.result === 'string' ? result.result.trim()
|
||||
: (result && typeof result.data === 'string' ? result.data.trim()
|
||||
: ''));
|
||||
if (!rawCode) return;
|
||||
this.scanKeyword = '';
|
||||
this.doSearch(rawCode);
|
||||
},
|
||||
handleRefresh() {
|
||||
this.keyword = '';
|
||||
this.scanKeyword = '';
|
||||
this.currentPage = 1;
|
||||
this._refreshing = true;
|
||||
this.fetchList();
|
||||
setTimeout(() => { this._refreshing = false; }, 500);
|
||||
},
|
||||
handleBack() {
|
||||
uni.navigateBack({ delta: 1 });
|
||||
},
|
||||
@ -252,23 +293,32 @@ export default {
|
||||
handleScanConfirm() {
|
||||
const keyword = String(this.scanKeyword || '').trim();
|
||||
if (!keyword) return;
|
||||
this.scanKeyword = '';
|
||||
this.doSearch(keyword);
|
||||
},
|
||||
doSearch(keyword) {
|
||||
this.keyword = keyword;
|
||||
this.currentPage = 1;
|
||||
this.fetchList();
|
||||
// 查询后清空输入框,延时确保覆盖扫描枪后续输入
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => { this.scanKeyword = ''; }, 100);
|
||||
});
|
||||
},
|
||||
handleModeChange(mode) {
|
||||
if (this.currentMode === mode) return;
|
||||
this.currentMode = mode;
|
||||
this.currentPage = 1;
|
||||
this.saveTabState();
|
||||
this.fetchList();
|
||||
},
|
||||
handleSubTabChange(index) {
|
||||
if (this.currentSubTab === index) return;
|
||||
this.currentSubTab = index;
|
||||
this.currentPage = 1;
|
||||
this.keyword = '';
|
||||
this.scanKeyword = '';
|
||||
this.scanInputOpen = false;
|
||||
this.saveTabState();
|
||||
this.fetchList();
|
||||
},
|
||||
clearSearch() {
|
||||
@ -281,29 +331,39 @@ export default {
|
||||
if (this.currentSubTab === 1) {
|
||||
uni.showLoading({ title: '加载中...' });
|
||||
try {
|
||||
const today = new Date();
|
||||
const yesterday = new Date(today);
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
const fmtDate = (d) => {
|
||||
const y = d.getFullYear();
|
||||
const m = String(d.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(d.getDate()).padStart(2, '0');
|
||||
return `${y}-${m}-${day}`;
|
||||
};
|
||||
const pagination = {
|
||||
page: this.currentPage,
|
||||
pageSize: this.pageSize
|
||||
};
|
||||
const where = {
|
||||
create_at: {
|
||||
const keyword = String(this.keyword || '').trim();
|
||||
const where = {};
|
||||
if (keyword) {
|
||||
// 有扫描/输入的快递单号时,按 waybill_codes 精确查询
|
||||
where.waybill_codes = {
|
||||
operator: 'eq',
|
||||
type: 'text',
|
||||
value: keyword
|
||||
};
|
||||
} else {
|
||||
// 默认按创建时间范围查询近两天的数据
|
||||
const today = new Date();
|
||||
const yesterday = new Date(today);
|
||||
yesterday.setDate(yesterday.getDate() - 1);
|
||||
const fmtDate = (d) => {
|
||||
const y = d.getFullYear();
|
||||
const m = String(d.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(d.getDate()).padStart(2, '0');
|
||||
return `${y}-${m}-${day}`;
|
||||
};
|
||||
where.create_at = {
|
||||
operator: 'between',
|
||||
type: 'datetimerange',
|
||||
value: [
|
||||
`${fmtDate(yesterday)} 00:00:00`,
|
||||
`${fmtDate(today)} 23:59:59`
|
||||
]
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
const response = await this.$http('order.deliveryOrder.list', {
|
||||
pagination,
|
||||
where,
|
||||
@ -374,7 +434,12 @@ export default {
|
||||
: 'order.recheckOrder.recheckOrderList';
|
||||
const response = await this.$http(apiName, requestParams);
|
||||
const data = response?.data || response || {};
|
||||
this.listData = Array.isArray(data.list) ? data.list : [];
|
||||
let rawList = Array.isArray(data.list) ? data.list : [];
|
||||
// 团购模式待复核列表仅显示 wave_type 为 1 的数据
|
||||
if (this.currentMode === 'group' && this.currentSubTab === 0) {
|
||||
rawList = rawList.filter(item => Number(item.wave_type) === 1);
|
||||
}
|
||||
this.listData = rawList;
|
||||
const pag = data.pagination || {};
|
||||
this.paginationTotal = pag.total || 0;
|
||||
} catch (error) {
|
||||
@ -423,6 +488,17 @@ export default {
|
||||
}
|
||||
},
|
||||
handleReviewedItemClick(item) {
|
||||
if (this.currentMode === 'group') {
|
||||
const waveId = item?.wave_id || item?.waveId || item?.id || '';
|
||||
if (!waveId) {
|
||||
uni.showToast({ title: '缺少波次ID', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: `/pages/work/order/order-review?waveId=${waveId}&mode=group`
|
||||
});
|
||||
return;
|
||||
}
|
||||
const orderId = item.id || item.order_id || '';
|
||||
if (!orderId) {
|
||||
uni.showToast({ title: '缺少订单ID', icon: 'none' });
|
||||
@ -500,6 +576,26 @@ export default {
|
||||
min-width: 100rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header-refresh-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0 24rpx;
|
||||
height: 60rpx;
|
||||
background: #2979ff;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.header-refresh-btn:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.header-refresh-btn__text {
|
||||
font-size: 34rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* 扫码开关按钮(头部) */
|
||||
@ -509,7 +605,7 @@ export default {
|
||||
justify-content: center;
|
||||
width: 120rpx;
|
||||
height: 52rpx;
|
||||
background: #2979ff;
|
||||
background: #07c160;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
@ -668,7 +764,7 @@ export default {
|
||||
}
|
||||
|
||||
.record-item {
|
||||
padding: 20rpx 0;
|
||||
padding: 30rpx 0;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
@ -726,8 +822,8 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: -20rpx 0;
|
||||
padding: 20rpx 0;
|
||||
margin: -30rpx 0;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
|
||||
.record-waybill {
|
||||
@ -817,8 +913,8 @@ export default {
|
||||
|
||||
.record-wave-box {
|
||||
background: #e74c3c;
|
||||
margin: -20rpx 0;
|
||||
padding: 20rpx 0;
|
||||
margin: -30rpx 0;
|
||||
padding: 30rpx 0;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@ -64,9 +64,26 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="alloc-panel">
|
||||
<view class="pick-row pick-row--top"><text class="pick-label">分配篮号:</text><text class="pick-value">篮子总数:{{ boxList.length }}</text></view>
|
||||
<view class="pick-row pick-row--top">
|
||||
<text class="pick-label">分配篮号:</text>
|
||||
<view class="basket-toggle">
|
||||
<text class="basket-toggle__label">篮子总数:{{ boxList.length }}</text>
|
||||
<text class="basket-toggle__btn" @click="toggleBasketDisplayMode">{{ basketDisplayMode === 'grid' ? '列表' : '方格' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view class="alloc-scroll" scroll-y>
|
||||
<view class="alloc-wrap" v-if="selectedPickItem.boxAllocations && selectedPickItem.boxAllocations.length">
|
||||
<view v-if="basketDisplayMode === 'grid'" class="basket-box-grid">
|
||||
<view
|
||||
v-for="alloc in (selectedPickItem.boxAllocations || [])"
|
||||
:key="`${selectedPickItem.itemCode}-${alloc.boxId}`"
|
||||
class="basket-box-cell"
|
||||
>
|
||||
<text class="basket-box-cell__no">{{ alloc.boxNo }}</text>
|
||||
<text class="basket-box-cell__qty">{{ alloc.allocatedQty }}</text>
|
||||
</view>
|
||||
<view v-if="!selectedPickItem.boxAllocations || selectedPickItem.boxAllocations.length === 0" class="alloc-empty">暂无分配</view>
|
||||
</view>
|
||||
<view v-else-if="selectedPickItem.boxAllocations && selectedPickItem.boxAllocations.length" class="alloc-wrap">
|
||||
<view class="alloc-item" v-for="alloc in selectedPickItem.boxAllocations" :key="`${selectedPickItem.itemCode}-${alloc.boxId}`">
|
||||
<text class="alloc-text">{{ alloc.boxNo }}号篮: {{ alloc.allocatedQty }}</text>
|
||||
</view>
|
||||
@ -277,6 +294,8 @@ import voice from '@/core/utils/voice';
|
||||
wavePickSubmitQueue: [],
|
||||
isNetworkConnected: true,
|
||||
isFlushingWavePickSubmitQueue: false,
|
||||
basketDisplayStorageKey: 'order_picking_basket_display_mode_v1',
|
||||
basketDisplayMode: 'list',
|
||||
|
||||
taskInfo: {
|
||||
taskId: '',
|
||||
@ -356,6 +375,7 @@ import voice from '@/core/utils/voice';
|
||||
onLoad(options) {
|
||||
this.initWavePickSubmitNetworkStatus();
|
||||
this.bindNetworkStatusChange();
|
||||
this.restoreBasketDisplayMode();
|
||||
this.$store.dispatch('broadcast/setCallbacks', {
|
||||
onResult: this.handleBroadcastScan
|
||||
});
|
||||
@ -914,6 +934,24 @@ import voice from '@/core/utils/voice';
|
||||
icon: 'none'
|
||||
});
|
||||
},
|
||||
restoreBasketDisplayMode() {
|
||||
try {
|
||||
const saved = uni.getStorageSync(this.basketDisplayStorageKey);
|
||||
if (saved === 'grid' || saved === 'list') {
|
||||
this.basketDisplayMode = saved;
|
||||
}
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
},
|
||||
toggleBasketDisplayMode() {
|
||||
this.basketDisplayMode = this.basketDisplayMode === 'grid' ? 'list' : 'grid';
|
||||
try {
|
||||
uni.setStorageSync(this.basketDisplayStorageKey, this.basketDisplayMode);
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
},
|
||||
isPickItemPicked(item) {
|
||||
const key = this.getPickItemUniqueKey(item);
|
||||
return Boolean(key) && this.pickedItemKeys.includes(key);
|
||||
@ -2178,6 +2216,12 @@ import voice from '@/core/utils/voice';
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.pick-row--top .pick-label {
|
||||
flex: 1;
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pick-row--top .pick-value {
|
||||
flex: none;
|
||||
text-align: right;
|
||||
@ -2242,6 +2286,94 @@ import voice from '@/core/utils/voice';
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.basket-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.basket-toggle__label {
|
||||
font-size: 32rpx;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.basket-toggle__btn {
|
||||
font-size: 36rpx;
|
||||
color: #ffffff;
|
||||
background: #67c23a;
|
||||
border: 1rpx solid #529b2e;
|
||||
border-radius: 8rpx;
|
||||
padding: 4rpx 14rpx;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.basket-toggle__btn:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.basket-box-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.basket-box-cell {
|
||||
flex: 0 0 calc((100% - 32rpx) / 5);
|
||||
width: calc((100% - 32rpx) / 5);
|
||||
aspect-ratio: 1 / 1;
|
||||
box-sizing: border-box;
|
||||
border-radius: 12rpx;
|
||||
background: #f5f7fa;
|
||||
border: 1rpx solid #e4e7ed;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.basket-box-cell::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(to top left, transparent calc(60% - 0.5px), #dcdfe6 calc(60% - 0.5px), #dcdfe6 calc(60% + 0.5px), #67c23a calc(60% + 0.5px));
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.basket-box-cell--active {
|
||||
background: #fff3e0;
|
||||
border-color: #ff9800;
|
||||
border-width: 3rpx;
|
||||
box-shadow: 0 0 12rpx rgba(255, 152, 0, 0.35);
|
||||
}
|
||||
|
||||
.basket-box-cell__no {
|
||||
position: absolute;
|
||||
top: 6rpx;
|
||||
left: 8rpx;
|
||||
z-index: 1;
|
||||
font-size: 38rpx;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.basket-box-cell__qty {
|
||||
position: absolute;
|
||||
bottom: 6rpx;
|
||||
right: 8rpx;
|
||||
z-index: 1;
|
||||
font-size: 40rpx;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.alloc-safe-bottom {
|
||||
height: 8rpx;
|
||||
}
|
||||
|
||||
@ -170,8 +170,7 @@ import voice from '@/core/utils/voice';
|
||||
// 从运单信息中更新称重重量
|
||||
const firstExpress = (detailData.expresses || [])[0];
|
||||
if (firstExpress && firstExpress.weighing_weight !== undefined && firstExpress.weighing_weight !== null) {
|
||||
// 接口返回 kg,页面显示 g,乘以 1000 转换
|
||||
this.manualWeight = String(Math.round(firstExpress.weighing_weight * 1000));
|
||||
this.manualWeight = String(Math.round(firstExpress.weighing_weight));
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@ -282,7 +281,7 @@ import voice from '@/core/utils/voice';
|
||||
const payload = {
|
||||
order_id: 0,
|
||||
waybill_code: this.orderInfo.waybill_code,
|
||||
weighing_weight: Number((Number(this.manualWeight) / 1000).toFixed(3))
|
||||
weighing_weight: Number(Number(this.manualWeight).toFixed(3))
|
||||
};
|
||||
this.$http('order.recheckOrder.updateExpressWeighingWeight', payload, '', false)
|
||||
.then(res => {
|
||||
|
||||
@ -993,26 +993,14 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
const tagPrice = String(this.formData.tag_price || '').trim();
|
||||
if (!tagPrice) {
|
||||
this.showToastMessage('请输入标价');
|
||||
return;
|
||||
}
|
||||
const normalizedTagPrice = Number(tagPrice);
|
||||
let normalizedTagPrice = Number(this.formData.tag_price);
|
||||
if (!Number.isFinite(normalizedTagPrice) || normalizedTagPrice < 0) {
|
||||
this.showToastMessage('标价需大于等于0');
|
||||
return;
|
||||
normalizedTagPrice = 0;
|
||||
}
|
||||
|
||||
const retailPrice = String(this.formData.retail_price || '').trim();
|
||||
if (!retailPrice) {
|
||||
this.showToastMessage('请输入零售价');
|
||||
return;
|
||||
}
|
||||
const normalizedRetailPrice = Number(retailPrice);
|
||||
let normalizedRetailPrice = Number(this.formData.retail_price);
|
||||
if (!Number.isFinite(normalizedRetailPrice) || normalizedRetailPrice < 0) {
|
||||
this.showToastMessage('零售价需大于等于0');
|
||||
return;
|
||||
normalizedRetailPrice = 0;
|
||||
}
|
||||
|
||||
const grossWeight = String(this.formData.gross_weight || '').trim();
|
||||
@ -1061,8 +1049,8 @@ export default {
|
||||
net_weight: String(this.formData.net_weight || '').trim(),
|
||||
images: this.extractImageUrls(this.formData.images),
|
||||
stock_unit: stockUnit,
|
||||
tag_price: String(this.formData.tag_price || '').trim(),
|
||||
retail_price: String(this.formData.retail_price || '').trim()
|
||||
tag_price: String(normalizedTagPrice),
|
||||
retail_price: String(normalizedRetailPrice)
|
||||
};
|
||||
|
||||
if (recordId) {
|
||||
@ -1113,8 +1101,8 @@ export default {
|
||||
images: normalizedImages,
|
||||
image: normalizedImageUrls[0] || '',
|
||||
stock_unit: stockUnit,
|
||||
tag_price: String(this.formData.tag_price || '').trim(),
|
||||
retail_price: String(this.formData.retail_price || '').trim()
|
||||
tag_price: String(normalizedTagPrice),
|
||||
retail_price: String(normalizedRetailPrice)
|
||||
};
|
||||
|
||||
uni.$emit('product:detail:updated', {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user