修改订单复核、商品查询页面
This commit is contained in:
parent
205d48984b
commit
95651ccb19
@ -749,11 +749,18 @@ import voice from '@/core/utils/voice';
|
||||
.review-detail {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* u-popup 根元素默认带 flex:1(uview 全局样式),会参与本组件 flex 布局并与商品列表区平分空间,
|
||||
导致弹窗(v-if 渲染)弹出时底部合计行被顶到页面中间。这里让弹窗不参与 flex 分配(其内容为 fixed 定位,高度为 0,不占文档流)。 */
|
||||
::v-deep .u-popup {
|
||||
flex: none !important;
|
||||
}
|
||||
|
||||
.content-layout {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
|
||||
@ -127,8 +127,8 @@
|
||||
</u-popup>
|
||||
|
||||
<!-- 称重弹窗 -->
|
||||
<u-popup :show="showWeighPopup" mode="bottom" :closeable="true" border-radius="20" :z-index="10080" @close="handleWeighCancel">
|
||||
<view class="weigh-popup">
|
||||
<u-popup :show="showWeighPopup" mode="bottom" :closeable="true" :closeOnClickOverlay="false" border-radius="20" :z-index="10080" @close="handleWeighCancel">
|
||||
<view class="weigh-popup" :style="{ paddingBottom: keyboardHeight ? keyboardHeight + 'px' : '' }">
|
||||
<view class="weigh-popup-title weigh-popup-title--sm">称重</view>
|
||||
<view class="weigh-popup-body">
|
||||
<view class="weigh-section-label">重量信息</view>
|
||||
@ -144,6 +144,7 @@
|
||||
type="number"
|
||||
:value="weighWeight > 0 ? String(weighWeight) : ''"
|
||||
:focus="true"
|
||||
:adjust-position="false"
|
||||
placeholder="请输入重量(g)"
|
||||
placeholder-style="color:#c0c4cc;font-size:36rpx"
|
||||
@input="handleWeighInput"
|
||||
@ -161,8 +162,8 @@
|
||||
</u-popup>
|
||||
|
||||
<!-- 包材绑定弹窗 -->
|
||||
<u-popup :show="showPackageBindingPopup" mode="bottom" :closeable="true" border-radius="20" :z-index="10080" @close="handlePackageBindingSkip">
|
||||
<view class="package-popup">
|
||||
<u-popup :show="showPackageBindingPopup" mode="bottom" :closeable="true" :closeOnClickOverlay="false" border-radius="20" :z-index="10080" @close="handlePackageBindingSkip">
|
||||
<view class="package-popup" :style="{ paddingBottom: keyboardHeight ? keyboardHeight + 'px' : '' }">
|
||||
<view class="package-popup-title">包材绑定</view>
|
||||
<view class="package-popup-body">
|
||||
<view v-if="suggestedPkg" class="package-ref-row">
|
||||
@ -176,6 +177,7 @@
|
||||
class="package-input"
|
||||
v-model="packageInputCode"
|
||||
:focus="packageBindingActivated"
|
||||
:adjust-position="false"
|
||||
placeholder="扫描/输入包材条码"
|
||||
placeholder-style="color:#c0c4cc;font-size:32rpx"
|
||||
@confirm="handlePackageBindingInputConfirm"
|
||||
@ -191,7 +193,7 @@
|
||||
</u-popup>
|
||||
|
||||
<!-- 设置弹窗 -->
|
||||
<u-popup :show="showSettingsPopup" mode="center" :closeable="true" border-radius="16" :z-index="10080" @close="showSettingsPopup = false">
|
||||
<u-popup :show="showSettingsPopup" mode="center" :closeable="true" :closeOnClickOverlay="false" border-radius="16" :z-index="10080" @close="showSettingsPopup = false">
|
||||
<view class="settings-popup">
|
||||
<view class="settings-popup-title">复核设置</view>
|
||||
<view class="settings-row">
|
||||
@ -428,6 +430,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
showPrintModeDropdown: false,
|
||||
showSettingsPopup: false,
|
||||
showWeighPopup: false,
|
||||
keyboardHeight: 0,
|
||||
weighWeight: 0,
|
||||
weighAfterReview: false,
|
||||
weighCancelled: false,
|
||||
@ -573,6 +576,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
this.initKeyboardHeightListener();
|
||||
this.safeDispatchBroadcast('setCallbacks', {
|
||||
onResult: this.handleBroadcastResult
|
||||
});
|
||||
@ -615,6 +619,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
this.safeDispatchBroadcast('pause');
|
||||
},
|
||||
onUnload() {
|
||||
this.destroyKeyboardHeightListener();
|
||||
this.safeDispatchBroadcast('stop');
|
||||
uni.$off('orderInterceptCompleted', this.handleInterceptCompleted);
|
||||
if (this._debugMode) {
|
||||
@ -626,6 +631,43 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initKeyboardHeightListener() {
|
||||
// H5 端:监听 visualViewport 高度变化,差值即键盘高度(仅垫高弹窗内容,不整页上推)
|
||||
// #ifdef H5
|
||||
if (typeof window !== 'undefined' && window.visualViewport) {
|
||||
this._baseViewportHeight = window.visualViewport.height;
|
||||
this._onViewportResize = () => {
|
||||
const vh = window.visualViewport ? window.visualViewport.height : window.innerHeight;
|
||||
const diff = this._baseViewportHeight - vh;
|
||||
this.keyboardHeight = diff > 0 ? Math.round(diff) : 0;
|
||||
};
|
||||
window.visualViewport.addEventListener('resize', this._onViewportResize);
|
||||
}
|
||||
// #endif
|
||||
// App/小程序端:使用原生键盘高度回调
|
||||
// #ifndef H5
|
||||
this._keyboardHeightCb = (res) => {
|
||||
this.keyboardHeight = (res && res.height) || 0;
|
||||
};
|
||||
if (typeof uni.onKeyboardHeightChange === 'function') {
|
||||
uni.onKeyboardHeightChange(this._keyboardHeightCb);
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
destroyKeyboardHeightListener() {
|
||||
// #ifdef H5
|
||||
if (typeof window !== 'undefined' && window.visualViewport && this._onViewportResize) {
|
||||
window.visualViewport.removeEventListener('resize', this._onViewportResize);
|
||||
this._onViewportResize = null;
|
||||
}
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
if (this._keyboardHeightCb && typeof uni.offKeyboardHeightChange === 'function') {
|
||||
uni.offKeyboardHeightChange(this._keyboardHeightCb);
|
||||
this._keyboardHeightCb = null;
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
buildBatchListParams(page = this.currentPage) {
|
||||
const where = {
|
||||
source: 0,
|
||||
@ -3451,6 +3493,8 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.detail-area--empty {
|
||||
@ -3465,6 +3509,7 @@ import ReviewDetail from './order-review-comps/ReviewDetail.vue';
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
|
||||
@ -155,6 +155,26 @@
|
||||
<text class="label">保质期管理:</text>
|
||||
<text class="value">{{ getFlagValue(item, ['is_shelf_life_mgmt', 'is_expiry_management', 'expiry_management', 'is_expiry', 'manage_expiry']) }}</text>
|
||||
</view>
|
||||
<template v-if="isShelfLifeMgmtEnabled(item)">
|
||||
<view class="shelf-life-block">
|
||||
<view class="info-row">
|
||||
<text class="label">保质期天数:</text>
|
||||
<text class="value">{{ getValue(item, ['shelf_life_days', 'validity_days']) }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">入库最小天数:</text>
|
||||
<text class="value">{{ getValue(item, ['inbound_min_days', 'min_inbound_days']) }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">出库最小天数:</text>
|
||||
<text class="value">{{ getValue(item, ['outbound_min_days', 'min_outbound_days']) }}</text>
|
||||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">剩余有效期:</text>
|
||||
<text class="value">{{ getValue(item, ['remaining_threshold_days', 'remaining_validity_days']) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<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>
|
||||
@ -184,33 +204,35 @@
|
||||
<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 class="box-spec-block">
|
||||
<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>
|
||||
</view>
|
||||
</template>
|
||||
<!-- 打包要求 -->
|
||||
@ -328,6 +350,17 @@ export default {
|
||||
}
|
||||
return false;
|
||||
},
|
||||
isShelfLifeMgmtEnabled(item) {
|
||||
if (!item || typeof item !== 'object') {
|
||||
return false;
|
||||
}
|
||||
|
||||
const val = item.is_shelf_life_mgmt ?? item.is_expiry_management ?? item.expiry_management ?? item.is_expiry ?? item.manage_expiry;
|
||||
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 '--';
|
||||
@ -713,6 +746,22 @@ export default {
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.shelf-life-block {
|
||||
margin: 12rpx 0 16rpx;
|
||||
padding: 20rpx;
|
||||
border: 2rpx solid #dcdfe6;
|
||||
border-radius: 12rpx;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.box-spec-block {
|
||||
margin: 12rpx 0 16rpx;
|
||||
padding: 20rpx;
|
||||
border: 2rpx solid #dcdfe6;
|
||||
border-radius: 12rpx;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@ -57,6 +57,20 @@
|
||||
<u-form-item label="保质期管理">
|
||||
<u-switch v-model="formData.is_shelf_life_mgmt" active-color="#2979ff"></u-switch>
|
||||
</u-form-item>
|
||||
<view v-if="formData.is_shelf_life_mgmt" class="shelf-life-block">
|
||||
<u-form-item label="保质期天数" label-width="240rpx">
|
||||
<u-input v-model="formData.shelf_life_days" type="number" placeholder="请输入保质期天数" clearable></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="入库最小天数" label-width="240rpx">
|
||||
<u-input v-model="formData.inbound_min_days" type="number" placeholder="请输入入库最小天数" clearable></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="出库最小天数" label-width="240rpx">
|
||||
<u-input v-model="formData.outbound_min_days" type="number" placeholder="请输入出库最小天数" clearable></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="剩余有效期" label-width="240rpx">
|
||||
<u-input v-model="formData.remaining_threshold_days" type="number" placeholder="请输入剩余有效期" clearable></u-input>
|
||||
</u-form-item>
|
||||
</view>
|
||||
<u-form-item label="批次管理">
|
||||
<u-switch v-model="formData.is_batch_mgmt" active-color="#2979ff"></u-switch>
|
||||
</u-form-item>
|
||||
@ -79,27 +93,29 @@
|
||||
<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>
|
||||
<view v-if="formData.enable_box_spec" class="box-spec-block">
|
||||
<u-form-item label="每箱数量" required label-width="240rpx">
|
||||
<u-input v-model="formData.quantity_per_box" type="digit" placeholder="请输入每箱数量" clearable></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="箱毛重(g)" label-width="240rpx">
|
||||
<u-input v-model="formData.box_gross_weight" type="digit" placeholder="请输入箱毛重" clearable></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="箱净重(g)" label-width="240rpx">
|
||||
<u-input v-model="formData.box_net_weight" type="digit" placeholder="请输入箱净重" clearable></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="箱长(cm)" label-width="240rpx">
|
||||
<u-input v-model="formData.box_length" type="digit" placeholder="请输入箱长" clearable></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="箱宽(cm)" label-width="240rpx">
|
||||
<u-input v-model="formData.box_width" type="digit" placeholder="请输入箱宽" clearable></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="箱高(cm)" label-width="240rpx">
|
||||
<u-input v-model="formData.box_height" type="digit" placeholder="请输入箱高" clearable></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="箱体积(m³)" label-width="240rpx">
|
||||
<u-input v-model="formData.box_volume" type="digit" placeholder="请输入箱体积" clearable></u-input>
|
||||
</u-form-item>
|
||||
</view>
|
||||
<!-- 打包要求 -->
|
||||
<u-form-item label="打包要求">
|
||||
<u-textarea v-model="formData.packing_requirements" placeholder="请输入打包要求" height="140" border="surround"></u-textarea>
|
||||
@ -189,6 +205,10 @@ export default {
|
||||
is_sn_mgmt: false,
|
||||
is_shelf_life_mgmt: false,
|
||||
is_batch_mgmt: false,
|
||||
shelf_life_days: '',
|
||||
inbound_min_days: '',
|
||||
outbound_min_days: '',
|
||||
remaining_threshold_days: '',
|
||||
length: '',
|
||||
width: '',
|
||||
height: '',
|
||||
@ -249,6 +269,10 @@ export default {
|
||||
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.shelf_life_days = this.normalizeInputValue(cached.shelf_life_days);
|
||||
this.formData.inbound_min_days = this.normalizeInputValue(cached.inbound_min_days);
|
||||
this.formData.outbound_min_days = this.normalizeInputValue(cached.outbound_min_days);
|
||||
this.formData.remaining_threshold_days = this.normalizeInputValue(cached.remaining_threshold_days);
|
||||
this.formData.length = this.normalizeInputValue(cached.length);
|
||||
this.formData.width = this.normalizeInputValue(cached.width);
|
||||
this.formData.height = this.normalizeInputValue(cached.height);
|
||||
@ -988,6 +1012,9 @@ export default {
|
||||
toApiFlag(value) {
|
||||
return value ? 1 : 0;
|
||||
},
|
||||
toYesNoFlag(value) {
|
||||
return value ? 'Y' : 'N';
|
||||
},
|
||||
normalizeImageListForUpload(item) {
|
||||
if (!item || typeof item !== 'object') {
|
||||
return [];
|
||||
@ -1247,6 +1274,31 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// 保质期校验:启用保质期管理时,保质期天数、入库最小天数、出库最小天数、剩余有效期均为必填且必须大于0
|
||||
const shelfLifeMgmtEnabled = this.toBooleanFlag(this.formData.is_shelf_life_mgmt);
|
||||
if (shelfLifeMgmtEnabled) {
|
||||
const shelfLifeFields = [
|
||||
{ key: 'shelf_life_days', label: '保质期天数' },
|
||||
{ key: 'inbound_min_days', label: '入库最小天数' },
|
||||
{ key: 'outbound_min_days', label: '出库最小天数' },
|
||||
{ key: 'remaining_threshold_days', label: '剩余有效期' }
|
||||
];
|
||||
|
||||
for (let i = 0; i < shelfLifeFields.length; i++) {
|
||||
const field = shelfLifeFields[i];
|
||||
const valueText = String(this.formData[field.key] || '').trim();
|
||||
if (!valueText) {
|
||||
this.showToastMessage(`${field.label}不能为空`);
|
||||
return;
|
||||
}
|
||||
const numericValue = Number(valueText);
|
||||
if (!Number.isFinite(numericValue) || numericValue <= 0) {
|
||||
this.showToastMessage(`${field.label}必须大于0`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.saving = true;
|
||||
try {
|
||||
const storeId = this.resolveStoreId(this.rawItem || {});
|
||||
@ -1280,9 +1332,13 @@ 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),
|
||||
is_sn_mgmt: this.toYesNoFlag(this.formData.is_sn_mgmt),
|
||||
is_shelf_life_mgmt: this.toYesNoFlag(this.formData.is_shelf_life_mgmt),
|
||||
is_batch_mgmt: this.toYesNoFlag(this.formData.is_batch_mgmt),
|
||||
shelf_life_days: Number(this.formData.shelf_life_days) || 0,
|
||||
inbound_min_days: Number(this.formData.inbound_min_days) || 0,
|
||||
outbound_min_days: Number(this.formData.outbound_min_days) || 0,
|
||||
remaining_threshold_days: Number(this.formData.remaining_threshold_days) || 0,
|
||||
length: String(this.formData.length || ''),
|
||||
width: String(this.formData.width || ''),
|
||||
height: String(this.formData.height || ''),
|
||||
@ -1362,9 +1418,13 @@ 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),
|
||||
is_sn_mgmt: this.toYesNoFlag(this.formData.is_sn_mgmt),
|
||||
is_shelf_life_mgmt: this.toYesNoFlag(this.formData.is_shelf_life_mgmt),
|
||||
is_batch_mgmt: this.toYesNoFlag(this.formData.is_batch_mgmt),
|
||||
shelf_life_days: Number(this.formData.shelf_life_days) || 0,
|
||||
inbound_min_days: Number(this.formData.inbound_min_days) || 0,
|
||||
outbound_min_days: Number(this.formData.outbound_min_days) || 0,
|
||||
remaining_threshold_days: Number(this.formData.remaining_threshold_days) || 0,
|
||||
length: String(this.formData.length || ''),
|
||||
width: String(this.formData.width || ''),
|
||||
height: String(this.formData.height || ''),
|
||||
@ -1454,6 +1514,27 @@ export default {
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.shelf-life-block {
|
||||
margin: 12rpx 0 16rpx;
|
||||
padding: 8rpx 20rpx 20rpx;
|
||||
border: 2rpx solid #dcdfe6;
|
||||
border-radius: 12rpx;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.box-spec-block {
|
||||
margin: 12rpx 0 16rpx;
|
||||
padding: 8rpx 20rpx 20rpx;
|
||||
border: 2rpx solid #dcdfe6;
|
||||
border-radius: 12rpx;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
::v-deep .shelf-life-block .u-form-item__body,
|
||||
::v-deep .box-spec-block .u-form-item__body {
|
||||
padding: 8rpx 0;
|
||||
}
|
||||
|
||||
.picker-display {
|
||||
min-height: 72rpx;
|
||||
padding: 0 6rpx;
|
||||
|
||||
@ -1599,13 +1599,44 @@
|
||||
urls
|
||||
});
|
||||
},
|
||||
goProductDetail(item) {
|
||||
async goProductDetail(item) {
|
||||
if (!item || typeof item !== 'object') {
|
||||
return;
|
||||
}
|
||||
|
||||
// 进入详情前,按 id 精确拉取完整商品数据,避免列表合并/异步补充导致部分详情字段缺失
|
||||
const itemId = this.normalizePositiveId(item.id || item.stock_id);
|
||||
let detailItem = item;
|
||||
if (itemId) {
|
||||
try {
|
||||
const res = await this.$http('stock.warehouse.list', {
|
||||
with_stock: true,
|
||||
where: {
|
||||
id: {
|
||||
operator: 'eq',
|
||||
value: itemId,
|
||||
type: 'number'
|
||||
}
|
||||
},
|
||||
pagination: {
|
||||
page: 1,
|
||||
pageSize: 1
|
||||
}
|
||||
});
|
||||
if (res && Number(res.code) === 200) {
|
||||
const fetchedList = this.extractListFromResponse(res);
|
||||
if (fetchedList && fetchedList.length) {
|
||||
// 以完整商品数据为准,并保留列表项中的条码/图片等补充字段
|
||||
detailItem = { ...item, ...fetchedList[0] };
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn('[ProductQuery] 获取商品完整详情失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
const cacheKey = `product_detail_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
||||
uni.setStorageSync(cacheKey, item);
|
||||
uni.setStorageSync(cacheKey, detailItem);
|
||||
uni.navigateTo({
|
||||
url: `/pages/work/product/detail?cacheKey=${cacheKey}`
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user