修改商品查询页面

This commit is contained in:
zm2000 2026-09-16 13:46:55 +08:00
parent 83408c968e
commit 1dc754ea30
2 changed files with 142 additions and 18 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

@ -122,7 +122,10 @@
</view>
</view>
</view>
<view v-if="queryMode === 'nonBatch'" class="storage-section" :id="`storage-section-${getStorageSectionKey(item, index, 'nonBatch')}`">
<view v-if="queryMode === 'nonBatch'" class="storage-section" :class="{
'storage-section--zebra': inventoryViewMode === 'space',
'storage-section--detail': inventoryViewMode === 'detail'
}" :id="`storage-section-${getStorageSectionKey(item, index, 'nonBatch')}`">
<view class="storage-head-fixed" :style="getLocalStorageHeadWrapStyle(getStorageSectionKey(item, index, 'nonBatch'), 9 + index)">
<view
class="storage-table storage-table--non-batch storage-table--head-table"
@ -150,8 +153,8 @@
class="storage-table__row storage-table__row--two-line"
>
<view class="storage-row-main">
<text class="storage-col storage-col--space">{{ getStorageSpaceText(storageItem) }}</text>
<text class="storage-col storage-col--qty storage-col--qty-stock">{{ getStorageQuantityText(storageItem) }}</text>
<text class="storage-col storage-col--space" @click.stop="handleStorageMainClick(item, storageItem)">{{ getStorageSpaceText(storageItem) }}</text>
<text class="storage-col storage-col--qty storage-col--qty-stock" @click.stop="handleStorageMainClick(item, storageItem)">{{ getStorageQuantityText(storageItem) }}</text>
<text
class="storage-col storage-col--qty"
:class="{
@ -179,7 +182,10 @@
</view>
</scroll-view>
</view>
<view v-if="queryMode === 'batch'" class="storage-section" :id="`storage-section-${getStorageSectionKey(item, index, 'batch')}`">
<view v-if="queryMode === 'batch'" class="storage-section" :class="{
'storage-section--zebra': inventoryViewMode === 'space',
'storage-section--detail': inventoryViewMode === 'detail'
}" :id="`storage-section-${getStorageSectionKey(item, index, 'batch')}`">
<view class="storage-head-fixed" :style="getLocalStorageHeadWrapStyle(getStorageSectionKey(item, index, 'batch'), 9 + index)">
<view
class="storage-table storage-table--batch storage-table--head-table"
@ -207,8 +213,8 @@
class="storage-table__row storage-table__row--two-line"
>
<view class="storage-row-main">
<text class="storage-col storage-col--space">{{ getStorageSpaceText(storageItem) }}</text>
<text class="storage-col storage-col--qty storage-col--qty-stock">{{ getStorageQuantityText(storageItem) }}</text>
<text class="storage-col storage-col--space" @click.stop="handleStorageMainClick(item, storageItem)">{{ getStorageSpaceText(storageItem) }}</text>
<text class="storage-col storage-col--qty storage-col--qty-stock" @click.stop="handleStorageMainClick(item, storageItem)">{{ getStorageQuantityText(storageItem) }}</text>
<text class="storage-col storage-col--qty storage-col--highlight storage-col--action" @click.stop="openRelocationPage(item, storageItem, 'available')">{{ getStorageAvailableText(storageItem) }}</text>
</view>
<view v-if="inventoryViewMode === 'detail'" class="storage-row-dates" @click.stop="openExpiryEdit(item, storageItem)">
@ -249,14 +255,27 @@
<text class="expiry-form-label">生产日期</text>
<view class="expiry-form-value">
<text class="expiry-form-text">{{ expiryEditProductDate || '请选择' }}</text>
<u-icon name="arrow-right" size="16" color="#c0c4cc"></u-icon>
<u-icon name="arrow-right" size="20" color="#c0c4cc"></u-icon>
</view>
</view>
<view class="expiry-form-item" @click="showExpiryDatePicker('expiry')">
<text class="expiry-form-label">到期日期</text>
<view class="expiry-form-value">
<text class="expiry-form-text">{{ expiryEditExpiryDate || '请选择' }}</text>
<u-icon name="arrow-right" size="16" color="#c0c4cc"></u-icon>
<u-icon name="arrow-right" size="20" color="#c0c4cc"></u-icon>
</view>
</view>
<view class="expiry-quick-section">
<text class="expiry-quick-title">保质期快捷定位到期日期</text>
<view class="expiry-quick-list">
<view
v-for="(option, quickIndex) in expiryQuickOptions"
:key="quickIndex"
class="expiry-quick-btn"
@click="quickSetExpiry(option.months)"
>
<text>{{ option.label }}</text>
</view>
</view>
</view>
</view>
@ -334,7 +353,16 @@
expiryDatePickerValue: '',
expiryDateMinDate: 0,
expiryDateMaxDate: 0,
expirySaving: false
expirySaving: false,
expiryQuickOptions: [
{ label: '1个月', months: 1 },
{ label: '3个月', months: 3 },
{ label: '6个月', months: 6 },
{ label: '1年', months: 12 },
{ label: '2年', months: 24 },
{ label: '3年', months: 36 },
{ label: '5年', months: 60 }
]
}
},
computed: {
@ -1760,6 +1788,13 @@
return this.formatStorageDate(value);
},
handleStorageMainClick(item, storageItem) {
if (this.inventoryViewMode !== 'detail') {
return;
}
this.openExpiryEdit(item, storageItem);
},
openExpiryEdit(productItem, storageItem) {
if (!storageItem || typeof storageItem !== 'object') {
return;
@ -1800,6 +1835,34 @@
}
this.expiryDatePickerVisible = false;
},
quickSetExpiry(months) {
const baseDate = this.expiryEditProductDate;
if (!baseDate) {
uni.showToast({
title: '请先选择生产日期',
icon: 'none'
});
return;
}
const baseTimestamp = this.parseDateToTimestamp(baseDate);
if (!Number.isFinite(baseTimestamp)) {
uni.showToast({
title: '生产日期无效',
icon: 'none'
});
return;
}
const date = new Date(baseTimestamp);
const day = date.getDate();
date.setDate(1);
date.setMonth(date.getMonth() + Number(months || 0));
const lastDayOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
date.setDate(Math.min(day, lastDayOfMonth));
this.expiryEditExpiryDate = this.$u.timeFormat(date.getTime(), 'yyyy-mm-dd');
},
async resolveStorageIdForNonBatch(storageItem, productItem) {
const stockId = this.getRelocationProductStockId(productItem) || this.getRelocationProductStockId(storageItem);
const spaceId = this.normalizePositiveId(
@ -1908,7 +1971,7 @@
uni.hideLoading();
if (res && Number(res.code) === 200) {
uni.showToast({
title: (res && res.message) || '保存成功',
title: '保存成功',
icon: 'success'
});
if (productionChanged) {
@ -1917,20 +1980,24 @@
if (expiryChanged) {
this.$set(storageItem, 'expiry_date', expiryDate);
}
this.speakQueryMessage('保存成功');
this.closeExpiryEdit();
} else {
const failMessage = (res && res.message) || '保存失败';
uni.showToast({
title: (res && res.message) || '保存失败',
title: failMessage,
icon: 'none'
});
this.speakQueryMessage(failMessage);
}
} catch (error) {
uni.hideLoading();
console.warn('[ProductQuery] 更新到期日期失败:', error);
uni.showToast({
title: '保存失败,请重试',
title: '保存失败',
icon: 'none'
});
this.speakQueryMessage('保存失败');
} finally {
this.expirySaving = false;
}
@ -2928,6 +2995,28 @@
position: relative;
}
// 库位模式下库存信息行斑马纹(白底 + 浅蓝底交替,对比更明显)
.storage-section--zebra .storage-scroll--body .storage-table__row:nth-child(even) {
background: #dde9fb;
}
.storage-section--zebra .storage-scroll--body .storage-table__row:nth-child(odd) {
background: #ffffff;
}
// 明细模式下库存记录组(库存值行 + 生产到期日期行)整体斑马纹,方便区分相邻记录
.storage-section--detail .storage-scroll--body .storage-table__row--two-line:nth-child(even) {
background: #dde9fb;
}
.storage-section--detail .storage-scroll--body .storage-table__row--two-line:nth-child(odd) {
background: #ffffff;
}
.storage-section--detail .storage-row-dates {
background: transparent;
}
.storage-head-fixed {
position: relative;
left: 0;
@ -3039,6 +3128,10 @@
text-overflow: ellipsis;
}
.storage-date-item:last-child {
text-align: right;
}
.storage-date-label {
color: #909399;
}
@ -3212,7 +3305,7 @@
}
.popup-title {
font-size: 34rpx;
font-size: 40rpx;
font-weight: 600;
color: #303133;
}
@ -3231,7 +3324,7 @@
}
.expiry-form-label {
font-size: 30rpx;
font-size: 36rpx;
color: #303133;
}
@ -3242,10 +3335,41 @@
}
.expiry-form-text {
font-size: 30rpx;
font-size: 36rpx;
color: #606266;
}
.expiry-quick-section {
margin-top: 20rpx;
padding-top: 16rpx;
border-top: 1rpx solid #f2f2f2;
}
.expiry-quick-title {
font-size: 30rpx;
color: #909399;
}
.expiry-quick-list {
display: flex;
flex-wrap: wrap;
gap: 30rpx;
margin-top: 16rpx;
}
.expiry-quick-btn {
padding: 14rpx 32rpx;
border: 1rpx solid #d9e4f5;
border-radius: 10rpx;
background: #f5f8ff;
font-size: 32rpx;
color: #2979ff;
&:active {
opacity: 0.7;
}
}
.popup-footer {
display: flex;
gap: 20rpx;
@ -3259,7 +3383,7 @@
align-items: center;
justify-content: center;
border-radius: 44rpx;
font-size: 30rpx;
font-size: 36rpx;
font-weight: 600;
&:active {