修改商品查询、订单复核页面
This commit is contained in:
parent
6c80c0b65f
commit
70dd419632
@ -288,6 +288,12 @@ export default {
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
saveWarehouseStockBarcode: {
|
||||
path: "stock.warehouse.saveWarehouseStockBarcode",
|
||||
auth: true,
|
||||
method: "POST",
|
||||
isSystemApi: true
|
||||
},
|
||||
saveWarehouseStock: {
|
||||
path: "stock.warehouse.saveWarehouseStock",
|
||||
auth: true,
|
||||
|
||||
4
env.js
4
env.js
@ -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
|
||||
|
||||
@ -57,7 +57,7 @@
|
||||
>
|
||||
<view class="order-corner"></view>
|
||||
<view class="metric-diagonal"></view>
|
||||
<text class="metric-order">{{ item.lineNo || 0 }}</text>
|
||||
<text class="metric-order">{{ showBoxNoColumn ? (item.boxNo || '--') : (item.lineNo || 0) }}</text>
|
||||
<text class="metric-product">{{ item.planQty || 0 }}</text>
|
||||
<text class="metric-scanned">{{ item.scannedQty || 0 }}</text>
|
||||
</view>
|
||||
@ -82,6 +82,10 @@
|
||||
>
|
||||
<view class="list-card-row__top">
|
||||
<view class="list-card-qty-group">
|
||||
<view v-if="showBoxNoColumn" class="list-card-qty-item">
|
||||
<text class="list-card-label">蓝号</text>
|
||||
<text class="list-card-value">{{ item.boxNo || '--' }}</text>
|
||||
</view>
|
||||
<view class="list-card-qty-item">
|
||||
<text class="list-card-label">数量</text>
|
||||
<text class="list-card-value">{{ item.planQty || 0 }}</text>
|
||||
@ -249,6 +253,10 @@ import voice from '@/core/utils/voice';
|
||||
scannedPackageMaterial: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
pickMode: {
|
||||
type: [Number, String],
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -297,6 +305,11 @@ import voice from '@/core/utils/voice';
|
||||
isReadOnly() {
|
||||
return String(this.detailInfo?.recheckStatus || '').toLowerCase() === 'fin';
|
||||
},
|
||||
showBoxNoColumn() {
|
||||
// 散单模式 pick_mode=3 时显示蓝号列,顺序为 蓝号、数量、已扫
|
||||
// 以 pick_mode 为准(pick_mode=3 即散单模式),避免依赖 listType 取值差异
|
||||
return Number(this.pickMode) === 3;
|
||||
},
|
||||
isScannedComplete() {
|
||||
const plan = Number(this.currentGoods?.planQty || 0);
|
||||
const scanned = Number(this.currentGoods?.scannedQty || 0);
|
||||
@ -1133,7 +1146,7 @@ import voice from '@/core/utils/voice';
|
||||
padding: 20rpx 0 8rpx 16rpx;
|
||||
}
|
||||
|
||||
.list-card-qty-item:first-child {
|
||||
.list-card-qty-item:not(:last-child) {
|
||||
border-right: 1rpx solid #000000;
|
||||
}
|
||||
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
:scanQty="scanQuantity"
|
||||
:autoShip="autoShip"
|
||||
:scannedPackageMaterial="scannedPackageMaterial"
|
||||
:pickMode="pickMode"
|
||||
@updateScannedQty="handleUpdateScannedQty"
|
||||
@allScanned="handleDetailAllScanned"
|
||||
@resetScanQty="handleResetScanQty"
|
||||
@ -457,6 +458,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
goodsInfoList: [],
|
||||
orderList: [],
|
||||
listType: '', packingRequirements: '',
|
||||
pickMode: '',
|
||||
totalOrders: 0,
|
||||
taskId: '',
|
||||
scanPickerName: '',
|
||||
@ -1607,6 +1609,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
const matchType = String(payload?.match_type || payload?.matchType || '').trim();
|
||||
const taskId = String(payload?.task_id ?? payload?.taskId ?? '').trim();
|
||||
const pickerName = String(payload?.picker_name || payload?.pickerName || '').trim();
|
||||
const pickMode = payload?.pick_mode ?? payload?.pickMode ?? '';
|
||||
|
||||
// 扁平化订单列表模式(散单:运单号/波次号命中)
|
||||
const totalOrders = Number(payload?.total_orders ?? payload?.totalOrders ?? 0);
|
||||
@ -1617,6 +1620,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
return {
|
||||
listType: 'single',
|
||||
matchType,
|
||||
pickMode,
|
||||
list: list.map(item => this.normalizeScanOrderItem(item)),
|
||||
total: Number(payload?.total ?? payload?.count ?? list.length),
|
||||
totalOrders,
|
||||
@ -1665,6 +1669,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
return {
|
||||
listType: 'group',
|
||||
matchType,
|
||||
pickMode,
|
||||
waves: normalizedWaves,
|
||||
waybillNo: groupWaybillNo,
|
||||
waveId: currentWaveId,
|
||||
@ -1718,6 +1723,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
return {
|
||||
listType: 'detail',
|
||||
matchType,
|
||||
pickMode,
|
||||
cartMatchView,
|
||||
orderId,
|
||||
recheckStatus,
|
||||
@ -1775,6 +1781,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
this.listType = result?.listType || '';
|
||||
this.taskId = result?.taskId || '';
|
||||
this.scanPickerName = result?.pickerName || '';
|
||||
this.pickMode = result?.pickMode || '';
|
||||
const listType = this.listType;
|
||||
|
||||
// 散单模式(list_type=single):刷新当前页面列表
|
||||
@ -2310,10 +2317,12 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
const stockName = stockItem ? String(stockItem.item_name || '').trim() : '';
|
||||
const barcodeSource = stockItem?.barcodes || rawItem?.barcodes || rawItem?.barcode || snapshot?.barcodes || snapshot?.barcode || [];
|
||||
const stockBarcodes = this.normalizeBarcodeValues(barcodeSource);
|
||||
const boxNo = String(stockItem?.box_no ?? stockItem?.boxNo ?? rawItem?.box_no ?? rawItem?.boxNo ?? '').trim();
|
||||
|
||||
return {
|
||||
id: String(rawItem?.id || stockItem?.stock_id || `item-${index + 1}`),
|
||||
lineNo: Number(rawItem?.order_line_no) || (index + 1),
|
||||
boxNo,
|
||||
planQty: isNaN(planQty) ? 0 : planQty,
|
||||
scannedQty: isNaN(scannedQty) ? 0 : scannedQty,
|
||||
packageRequirement: String(rawItem?.packing_requirements || rawItem?.package_requirement || rawItem?.packageRequirement || rawItem?.packing_requirement || '').trim() || '--',
|
||||
|
||||
@ -203,6 +203,18 @@ export default {
|
||||
this.item = cached;
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
// 从编辑页返回时,重新读取缓存,确保展示最新数据(含商品条码)
|
||||
if (this.cacheKey) {
|
||||
const cached = uni.getStorageSync(this.cacheKey);
|
||||
if (cached && typeof cached === 'object') {
|
||||
this.item = {
|
||||
...(this.item || {}),
|
||||
...cached
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
onUnload() {
|
||||
if (this.onProductUpdated) {
|
||||
uni.$off('product:detail:updated', this.onProductUpdated);
|
||||
@ -226,7 +238,7 @@ export default {
|
||||
const editCacheKey = `product_edit_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
||||
uni.setStorageSync(editCacheKey, this.item);
|
||||
uni.navigateTo({
|
||||
url: `/pages/work/product/edit?cacheKey=${editCacheKey}`
|
||||
url: `/pages/work/product/edit?cacheKey=${editCacheKey}&detailCacheKey=${encodeURIComponent(this.cacheKey || '')}`
|
||||
});
|
||||
},
|
||||
getValueOrDash(value) {
|
||||
|
||||
@ -12,6 +12,9 @@
|
||||
<u-form-item label="商品编码">
|
||||
<u-input v-model="formData.goods_code" placeholder="请输入商品编码" clearable></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="商品条码">
|
||||
<u-input v-model="formData.barcodes" placeholder="多个条码用分号(;)分隔" clearable></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="品牌">
|
||||
<u-input v-model="formData.brand_name" placeholder="请输入品牌" clearable></u-input>
|
||||
</u-form-item>
|
||||
@ -104,6 +107,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
cacheKey: '',
|
||||
detailCacheKey: '',
|
||||
saving: false,
|
||||
canceling: false,
|
||||
keepVoiceOnExit: false,
|
||||
@ -120,6 +124,7 @@ export default {
|
||||
formData: {
|
||||
item_name: '',
|
||||
goods_code: '',
|
||||
barcodes: '',
|
||||
brand_name: '',
|
||||
sku_property: '',
|
||||
prohibited_type_id: null,
|
||||
@ -142,6 +147,11 @@ export default {
|
||||
onLoad(options) {
|
||||
this.keepVoiceOnExit = false;
|
||||
this.cacheKey = (options && options.cacheKey) || '';
|
||||
this.detailCacheKey = (options && options.detailCacheKey) || '';
|
||||
this.safeDispatchBroadcast('setCallbacks', {
|
||||
onResult: this.handleBroadcastResult
|
||||
});
|
||||
this.safeDispatchBroadcast('start');
|
||||
this.loadProhibitedTypes();
|
||||
this.loadStockUnits();
|
||||
if (!this.cacheKey) {
|
||||
@ -158,6 +168,7 @@ export default {
|
||||
};
|
||||
this.formData.item_name = String(cached.item_name || cached.product_name || cached.name || '');
|
||||
this.formData.goods_code = String(cached.goods_code || cached.item_code || '');
|
||||
this.formData.barcodes = this.normalizeBarcodeDisplay(cached);
|
||||
this.formData.brand_name = String(cached.brand_name || '');
|
||||
this.formData.sku_property = String(cached.sku_property || '');
|
||||
this.formData.prohibited_type_id = this.getProhibitedTypeId(cached);
|
||||
@ -174,6 +185,13 @@ export default {
|
||||
this.sessionUploadedFileIds = [];
|
||||
this.latestImagesLoadPromise = this.loadLatestImages();
|
||||
},
|
||||
onShow() {
|
||||
// 返回页面时重新注册广播回调并恢复扫描
|
||||
this.safeDispatchBroadcast('setCallbacks', {
|
||||
onResult: this.handleBroadcastResult
|
||||
});
|
||||
this.safeDispatchBroadcast('resume');
|
||||
},
|
||||
onBackPress() {
|
||||
if (this.bypassBackIntercept || this.saving) {
|
||||
// 已经在回退流程中,放行系统返回
|
||||
@ -192,6 +210,7 @@ export default {
|
||||
if (!this.keepVoiceOnExit) {
|
||||
this.stopProductEditSpeak();
|
||||
}
|
||||
this.safeDispatchBroadcast('stop');
|
||||
if (this.cacheKey) {
|
||||
uni.removeStorageSync(this.cacheKey);
|
||||
}
|
||||
@ -200,8 +219,54 @@ export default {
|
||||
if (!this.keepVoiceOnExit) {
|
||||
this.stopProductEditSpeak();
|
||||
}
|
||||
this.safeDispatchBroadcast('pause');
|
||||
},
|
||||
methods: {
|
||||
safeDispatchBroadcast(action, payload) {
|
||||
try {
|
||||
const task = this.$store.dispatch(`broadcast/${action}`, payload);
|
||||
if (task && typeof task.catch === 'function') {
|
||||
task.catch(error => {
|
||||
console.warn(`[ProductEdit] broadcast/${action} 调用失败:`, error);
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(`[ProductEdit] broadcast/${action} 调用异常:`, error);
|
||||
}
|
||||
},
|
||||
normalizeScanResult(scanResult) {
|
||||
if (!scanResult) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let value = '';
|
||||
if (typeof scanResult === 'string') {
|
||||
value = scanResult;
|
||||
} else if (typeof scanResult.result === 'string') {
|
||||
value = scanResult.result;
|
||||
} else if (Array.isArray(scanResult.result)) {
|
||||
const firstResult = scanResult.result.find(item => item);
|
||||
if (typeof firstResult === 'string') {
|
||||
value = firstResult;
|
||||
} else if (firstResult && typeof firstResult.data === 'string') {
|
||||
value = firstResult.data;
|
||||
}
|
||||
} else if (typeof scanResult.data === 'string') {
|
||||
value = scanResult.data;
|
||||
}
|
||||
|
||||
return String(value || '').replace(/\s+/g, '').trim();
|
||||
},
|
||||
handleBroadcastResult(result) {
|
||||
const scanResult = this.normalizeScanResult(result);
|
||||
if (!scanResult) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 广播扫描仅支持单个条码:直接替换当前值
|
||||
this.formData.barcodes = scanResult;
|
||||
this.showToastMessage(`已录入条码 ${scanResult}`, 'none', { speak: false });
|
||||
},
|
||||
normalizePositiveId(value) {
|
||||
const numericValue = Number(value);
|
||||
if (!Number.isFinite(numericValue)) {
|
||||
@ -211,6 +276,61 @@ export default {
|
||||
const normalized = Math.trunc(numericValue);
|
||||
return normalized > 0 ? normalized : null;
|
||||
},
|
||||
normalizeBarcodeDisplay(item) {
|
||||
if (!item || typeof item !== 'object') {
|
||||
return '';
|
||||
}
|
||||
|
||||
const source = item.barcodes || item.barcode || '';
|
||||
if (Array.isArray(source)) {
|
||||
return source
|
||||
.map(entry => {
|
||||
if (entry === null || entry === undefined) {
|
||||
return '';
|
||||
}
|
||||
if (typeof entry === 'string') {
|
||||
return entry.trim();
|
||||
}
|
||||
if (typeof entry === 'object') {
|
||||
return String(entry.barcode || entry.code || '').trim();
|
||||
}
|
||||
return '';
|
||||
})
|
||||
.filter(Boolean)
|
||||
.join(';');
|
||||
}
|
||||
|
||||
return String(source || '').trim();
|
||||
},
|
||||
parseBarcodeInput(value) {
|
||||
const raw = String(value || '');
|
||||
return raw
|
||||
.split(/[;,,\s]+/)
|
||||
.map(item => item.trim())
|
||||
.filter(Boolean);
|
||||
},
|
||||
extractSavedIdFromResponse(response) {
|
||||
if (!response || typeof response !== 'object') {
|
||||
return null;
|
||||
}
|
||||
|
||||
const data = response.data;
|
||||
const candidates = [
|
||||
data && typeof data === 'object' ? (data.id || data.stock_id) : null,
|
||||
typeof data === 'number' || typeof data === 'string' ? data : null,
|
||||
response.id,
|
||||
response.stock_id
|
||||
];
|
||||
|
||||
for (let i = 0; i < candidates.length; i++) {
|
||||
const normalized = this.normalizePositiveId(candidates[i]);
|
||||
if (normalized) {
|
||||
return normalized;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
normalizeSpeechText(message) {
|
||||
const rawText = String(message || '').trim();
|
||||
if (!rawText) {
|
||||
@ -1062,6 +1182,19 @@ export default {
|
||||
throw new Error((saveRes && saveRes.message) || '保存失败');
|
||||
}
|
||||
|
||||
// 保存商品条码:stock.warehouse.saveWarehouseStockBarcode
|
||||
const barcodeList = this.parseBarcodeInput(this.formData.barcodes);
|
||||
const targetStockId = recordId || this.extractSavedIdFromResponse(saveRes);
|
||||
if (targetStockId && barcodeList.length > 0) {
|
||||
const barcodeRes = await this.$http('stock.warehouse.saveWarehouseStockBarcode', {
|
||||
id: Number(targetStockId),
|
||||
barcodes: barcodeList
|
||||
});
|
||||
if (!barcodeRes || Number(barcodeRes.code) !== 200) {
|
||||
throw new Error((barcodeRes && barcodeRes.message) || '商品条码保存失败');
|
||||
}
|
||||
}
|
||||
|
||||
let latestItem = null;
|
||||
try {
|
||||
const refreshRes = await this.$http(
|
||||
@ -1088,6 +1221,8 @@ export default {
|
||||
name: itemName,
|
||||
goods_code: itemCode,
|
||||
item_code: itemCode,
|
||||
barcodes: barcodeList,
|
||||
barcode: barcodeList[0] || (this.rawItem && this.rawItem.barcode) || '',
|
||||
brand_name: String(this.formData.brand_name || '').trim(),
|
||||
sku_property: String(this.formData.sku_property || '').trim(),
|
||||
prohibited_type_id: this.formData.prohibited_type_id,
|
||||
@ -1110,6 +1245,11 @@ export default {
|
||||
timestamp: Date.now()
|
||||
});
|
||||
|
||||
// 同步更新详情页缓存,保证详情页返回后展示最新数据(含商品条码)
|
||||
if (this.detailCacheKey) {
|
||||
uni.setStorageSync(this.detailCacheKey, nextItem);
|
||||
}
|
||||
|
||||
uni.setStorageSync('product_query_need_refresh', Date.now());
|
||||
uni.$emit('product:query:updated', {
|
||||
item: nextItem,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user