修改商品查询、分拣缺货补货页面

This commit is contained in:
zm2000 2026-08-09 18:05:45 +08:00
parent 5aa29019b4
commit 205d48984b
4 changed files with 307 additions and 9 deletions

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

@ -446,6 +446,7 @@
}
.loading-state {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
@ -460,6 +461,7 @@
}
.empty-card {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;

View File

@ -145,6 +145,79 @@
<text class="label">净重(g):</text>
<text class="value">{{ item.net_weight || '--' }}</text>
</view>
<!-- 管理标识 -->
<view class="detail-section-title">管理标识</view>
<view class="info-row">
<text class="label">序列号管理:</text>
<text class="value">{{ getFlagValue(item, ['is_sn_mgmt', 'is_serial_management', 'serial_management', 'is_serial', 'manage_serial']) }}</text>
</view>
<view class="info-row">
<text class="label">保质期管理:</text>
<text class="value">{{ getFlagValue(item, ['is_shelf_life_mgmt', 'is_expiry_management', 'expiry_management', 'is_expiry', 'manage_expiry']) }}</text>
</view>
<view class="info-row">
<text class="label">批次管理:</text>
<text class="value">{{ getFlagValue(item, ['is_batch_mgmt', 'is_batch_management', 'batch_management', 'is_batch', 'manage_batch']) }}</text>
</view>
<!-- 尺寸信息 -->
<view class="detail-section-title">尺寸信息</view>
<view class="info-row">
<text class="label">长度(cm):</text>
<text class="value">{{ getValue(item, ['length', 'item_length', 'box_length']) }}</text>
</view>
<view class="info-row">
<text class="label">宽度(cm):</text>
<text class="value">{{ getValue(item, ['width', 'item_width', 'box_width']) }}</text>
</view>
<view class="info-row">
<text class="label">高度(cm):</text>
<text class="value">{{ getValue(item, ['height', 'item_height', 'box_height']) }}</text>
</view>
<view class="info-row">
<text class="label">体积(cm³):</text>
<text class="value">{{ getValue(item, ['volume', 'item_volume', 'box_volume']) }}</text>
</view>
<!-- 箱规信息 -->
<view class="detail-section-title">箱规信息</view>
<view class="info-row">
<text class="label">启用箱规:</text>
<text class="value">{{ getFlagValue(item, ['enable_box_spec', 'enable_box_rule', 'is_box_rule', 'box_rule_enabled', 'use_box_rule', 'enabled_box_rule']) }}</text>
</view>
<template v-if="isBoxSpecEnabled(item)">
<view class="info-row">
<text class="label">每箱数量:</text>
<text class="value">{{ getValue(item, ['quantity_per_box']) }}</text>
</view>
<view class="info-row">
<text class="label">箱毛重(g):</text>
<text class="value">{{ getValue(item, ['box_gross_weight']) }}</text>
</view>
<view class="info-row">
<text class="label">箱净重(g):</text>
<text class="value">{{ getValue(item, ['box_net_weight']) }}</text>
</view>
<view class="info-row">
<text class="label">箱长(cm):</text>
<text class="value">{{ getValue(item, ['box_length']) }}</text>
</view>
<view class="info-row">
<text class="label">箱宽(cm):</text>
<text class="value">{{ getValue(item, ['box_width']) }}</text>
</view>
<view class="info-row">
<text class="label">箱高(cm):</text>
<text class="value">{{ getValue(item, ['box_height']) }}</text>
</view>
<view class="info-row">
<text class="label">箱体积(m³):</text>
<text class="value">{{ getValue(item, ['box_volume']) }}</text>
</view>
</template>
<!-- 打包要求 -->
<view class="info-row info-row--multiline">
<text class="label">打包要求:</text>
<text class="value value--multiline">{{ getValue(item, ['packing_requirements', 'package_requirement', 'packing_requirement', 'package_requirements']) }}</text>
</view>
<view class="info-row">
<text class="label">创建时间:</text>
<text class="value">{{ item.create_at_display || '--' }}</text>
@ -244,6 +317,51 @@ export default {
getValueOrDash(value) {
return value === null || value === undefined || value === '' ? '--' : value;
},
isBoxSpecEnabled(item) {
if (!item || typeof item !== 'object') {
return false;
}
const val = item.enable_box_spec ?? item.enable_box_rule ?? item.is_box_rule ?? item.box_rule_enabled ?? item.use_box_rule ?? item.enabled_box_rule;
if (val === true || val === 1 || val === '1' || val === 'Y' || val === 'y' || val === '是' || String(val).toLowerCase() === 'true') {
return true;
}
return false;
},
getValue(item, fieldKeys) {
if (!item || typeof item !== 'object' || !Array.isArray(fieldKeys)) {
return '--';
}
for (const key of fieldKeys) {
const val = item[key];
if (val !== null && val !== undefined && val !== '') {
return val;
}
}
return '--';
},
getFlagValue(item, fieldKeys) {
const val = this.getValue(item, fieldKeys);
if (val === '--') {
return '--';
}
return this.toYesNoText(val);
},
toYesNoText(val) {
const str = String(val).trim().toLowerCase();
if (val === true || val === 1 || str === 'true' || str === 'yes' || str === 'y' || str === '是' || str === '启用' || str === '开启') {
return '是';
}
if (val === false || val === 0 || str === 'false' || str === 'no' || str === 'n' || str === '否' || str === '禁用' || str === '关闭') {
return '否';
}
return String(val);
},
getBarcodeText(item) {
if (!item || typeof item !== 'object') {
return '--';
@ -588,6 +706,13 @@ export default {
word-break: break-all;
}
.detail-section-title {
padding: 24rpx 0 12rpx;
font-size: 30rpx;
font-weight: bold;
color: #303133;
}
.info-row {
display: flex;
align-items: center;
@ -607,13 +732,32 @@ export default {
flex-shrink: 0;
}
.value {
flex: 1;
font-size: 35rpx;
color: #000;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
.info-row--multiline {
align-items: flex-start;
}
.value {
flex: 1;
font-size: 35rpx;
color: #000;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.value--multiline {
white-space: pre-wrap;
overflow: visible;
text-overflow: clip;
word-break: break-all;
line-height: 1.6;
}
/* 底部安全区:适配真机底部 home 指示条,避免最后一行被遮挡 */
.safe-area-bottom {
height: 20rpx;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.empty-state {

View File

@ -49,6 +49,61 @@
<u-form-item label="净重(g)">
<u-input v-model="formData.net_weight" type="digit" placeholder="请输入净重" clearable></u-input>
</u-form-item>
<!-- 管理标识 -->
<view class="form-section-title">管理标识</view>
<u-form-item label="序列号管理">
<u-switch v-model="formData.is_sn_mgmt" active-color="#2979ff"></u-switch>
</u-form-item>
<u-form-item label="保质期管理">
<u-switch v-model="formData.is_shelf_life_mgmt" active-color="#2979ff"></u-switch>
</u-form-item>
<u-form-item label="批次管理">
<u-switch v-model="formData.is_batch_mgmt" active-color="#2979ff"></u-switch>
</u-form-item>
<!-- 尺寸信息 -->
<view class="form-section-title">尺寸信息</view>
<u-form-item label="长度(cm)">
<u-input v-model="formData.length" type="digit" placeholder="请输入长度" clearable></u-input>
</u-form-item>
<u-form-item label="宽度(cm)">
<u-input v-model="formData.width" type="digit" placeholder="请输入宽度" clearable></u-input>
</u-form-item>
<u-form-item label="高度(cm)">
<u-input v-model="formData.height" type="digit" placeholder="请输入高度" clearable></u-input>
</u-form-item>
<u-form-item label="体积(cm³)">
<u-input v-model="formData.volume" type="digit" placeholder="请输入体积" clearable></u-input>
</u-form-item>
<!-- 箱规信息 -->
<view class="form-section-title">箱规信息</view>
<u-form-item label="启用箱规">
<u-switch v-model="formData.enable_box_spec" active-color="#2979ff"></u-switch>
</u-form-item>
<u-form-item v-if="formData.enable_box_spec" label="每箱数量" required>
<u-input v-model="formData.quantity_per_box" type="digit" placeholder="请输入每箱数量" clearable></u-input>
</u-form-item>
<u-form-item v-if="formData.enable_box_spec" label="箱毛重(g)">
<u-input v-model="formData.box_gross_weight" type="digit" placeholder="请输入箱毛重" clearable></u-input>
</u-form-item>
<u-form-item v-if="formData.enable_box_spec" label="箱净重(g)">
<u-input v-model="formData.box_net_weight" type="digit" placeholder="请输入箱净重" clearable></u-input>
</u-form-item>
<u-form-item v-if="formData.enable_box_spec" label="箱长(cm)">
<u-input v-model="formData.box_length" type="digit" placeholder="请输入箱长" clearable></u-input>
</u-form-item>
<u-form-item v-if="formData.enable_box_spec" label="箱宽(cm)">
<u-input v-model="formData.box_width" type="digit" placeholder="请输入箱宽" clearable></u-input>
</u-form-item>
<u-form-item v-if="formData.enable_box_spec" label="箱高(cm)">
<u-input v-model="formData.box_height" type="digit" placeholder="请输入箱高" clearable></u-input>
</u-form-item>
<u-form-item v-if="formData.enable_box_spec" label="箱体积(m³)">
<u-input v-model="formData.box_volume" type="digit" placeholder="请输入箱体积" clearable></u-input>
</u-form-item>
<!-- 打包要求 -->
<u-form-item label="打包要求">
<u-textarea v-model="formData.packing_requirements" placeholder="请输入打包要求" height="140" border="surround"></u-textarea>
</u-form-item>
<u-form-item label="商品图片">
<view class="product-image-upload-wrap">
<uploadImgCos
@ -131,6 +186,22 @@ export default {
prohibited_type_name: '',
gross_weight: '',
net_weight: '',
is_sn_mgmt: false,
is_shelf_life_mgmt: false,
is_batch_mgmt: false,
length: '',
width: '',
height: '',
volume: '',
enable_box_spec: false,
quantity_per_box: '1',
box_gross_weight: '',
box_net_weight: '',
box_length: '',
box_width: '',
box_height: '',
box_volume: '',
packing_requirements: '',
images: [],
stock_unit_value: '',
stock_unit: '',
@ -175,6 +246,23 @@ export default {
this.formData.prohibited_type_name = String((cached.prohibited && cached.prohibited.type_name) || '');
this.formData.gross_weight = this.normalizeInputValue(cached.gross_weight);
this.formData.net_weight = this.normalizeInputValue(cached.net_weight);
this.formData.is_sn_mgmt = this.toBooleanFlag(cached.is_sn_mgmt);
this.formData.is_shelf_life_mgmt = this.toBooleanFlag(cached.is_shelf_life_mgmt);
this.formData.is_batch_mgmt = this.toBooleanFlag(cached.is_batch_mgmt);
this.formData.length = this.normalizeInputValue(cached.length);
this.formData.width = this.normalizeInputValue(cached.width);
this.formData.height = this.normalizeInputValue(cached.height);
this.formData.volume = this.normalizeInputValue(cached.volume);
this.formData.enable_box_spec = this.toBooleanFlag(cached.enable_box_spec);
const cachedQuantityPerBox = this.normalizeInputValue(cached.quantity_per_box);
this.formData.quantity_per_box = cachedQuantityPerBox && Number(cachedQuantityPerBox) > 0 ? cachedQuantityPerBox : '1';
this.formData.box_gross_weight = this.normalizeInputValue(cached.box_gross_weight);
this.formData.box_net_weight = this.normalizeInputValue(cached.box_net_weight);
this.formData.box_length = this.normalizeInputValue(cached.box_length);
this.formData.box_width = this.normalizeInputValue(cached.box_width);
this.formData.box_height = this.normalizeInputValue(cached.box_height);
this.formData.box_volume = this.normalizeInputValue(cached.box_volume);
this.formData.packing_requirements = String(cached.packing_requirements || '');
this.formData.images = this.normalizeImageListForUpload(cached);
this.formData.stock_unit = String(cached.stock_unit || '');
this.formData.stock_unit_value = String(cached.stock_unit || '');
@ -891,6 +979,15 @@ export default {
}
return String(value);
},
toBooleanFlag(value) {
if (value === true || value === 1 || value === '1' || value === 'true' || value === 'Y' || value === 'y' || value === '是' || value === '启用') {
return true;
}
return false;
},
toApiFlag(value) {
return value ? 1 : 0;
},
normalizeImageListForUpload(item) {
if (!item || typeof item !== 'object') {
return [];
@ -1134,6 +1231,22 @@ export default {
return;
}
// 箱规校验:启用箱规时,每箱数量为必填项且必须大于0
const enableBoxSpec = this.toBooleanFlag(this.formData.enable_box_spec);
let normalizedQuantityPerBox = 0;
if (enableBoxSpec) {
const quantityText = String(this.formData.quantity_per_box || '').trim();
if (!quantityText) {
this.showToastMessage('每箱数量为必填项');
return;
}
normalizedQuantityPerBox = Number(quantityText);
if (!Number.isFinite(normalizedQuantityPerBox) || normalizedQuantityPerBox <= 0) {
this.showToastMessage('每箱数量必须大于0');
return;
}
}
this.saving = true;
try {
const storeId = this.resolveStoreId(this.rawItem || {});
@ -1167,6 +1280,22 @@ export default {
prohibited_type_name: String(this.formData.prohibited_type_name || '').trim(),
gross_weight: grossWeight,
net_weight: String(this.formData.net_weight || '').trim(),
is_sn_mgmt: this.toApiFlag(this.formData.is_sn_mgmt),
is_shelf_life_mgmt: this.toApiFlag(this.formData.is_shelf_life_mgmt),
is_batch_mgmt: this.toApiFlag(this.formData.is_batch_mgmt),
length: String(this.formData.length || ''),
width: String(this.formData.width || ''),
height: String(this.formData.height || ''),
volume: String(this.formData.volume || ''),
enable_box_spec: this.toApiFlag(this.formData.enable_box_spec),
quantity_per_box: enableBoxSpec ? normalizedQuantityPerBox : 0,
box_gross_weight: String(this.formData.box_gross_weight || ''),
box_net_weight: String(this.formData.box_net_weight || ''),
box_length: String(this.formData.box_length || ''),
box_width: String(this.formData.box_width || ''),
box_height: String(this.formData.box_height || ''),
box_volume: String(this.formData.box_volume || ''),
packing_requirements: String(this.formData.packing_requirements || '').trim(),
images: this.extractImageUrls(this.formData.images),
stock_unit: stockUnit,
tag_price: String(normalizedTagPrice),
@ -1233,6 +1362,22 @@ export default {
},
gross_weight: grossWeight,
net_weight: String(this.formData.net_weight || '').trim(),
is_sn_mgmt: this.toApiFlag(this.formData.is_sn_mgmt),
is_shelf_life_mgmt: this.toApiFlag(this.formData.is_shelf_life_mgmt),
is_batch_mgmt: this.toApiFlag(this.formData.is_batch_mgmt),
length: String(this.formData.length || ''),
width: String(this.formData.width || ''),
height: String(this.formData.height || ''),
volume: String(this.formData.volume || ''),
enable_box_spec: this.toApiFlag(this.formData.enable_box_spec),
quantity_per_box: enableBoxSpec ? normalizedQuantityPerBox : 0,
box_gross_weight: String(this.formData.box_gross_weight || ''),
box_net_weight: String(this.formData.box_net_weight || ''),
box_length: String(this.formData.box_length || ''),
box_width: String(this.formData.box_width || ''),
box_height: String(this.formData.box_height || ''),
box_volume: String(this.formData.box_volume || ''),
packing_requirements: String(this.formData.packing_requirements || '').trim(),
images: normalizedImages,
image: normalizedImageUrls[0] || '',
stock_unit: stockUnit,
@ -1302,6 +1447,13 @@ export default {
background: #fff;
}
.form-section-title {
padding: 24rpx 0 8rpx;
font-size: 30rpx;
font-weight: bold;
color: #303133;
}
.picker-display {
min-height: 72rpx;
padding: 0 6rpx;