feat: 调整商品查询表头与收货箱数录入
This commit is contained in:
parent
154b2d7b2a
commit
0b529d9f28
@ -16,6 +16,7 @@ export default function http(
|
||||
let api = getApiPath(url);
|
||||
console.log(api);
|
||||
const token = uni.getStorageSync('token');
|
||||
console.log('[Request] token:', token);
|
||||
if (api.auth && !token) {
|
||||
store.dispatch('logout');
|
||||
uni.hideLoading();
|
||||
@ -27,6 +28,7 @@ export default function http(
|
||||
Request.interceptor.request((config, cancel) => {
|
||||
token && Request.setConfig(config => {
|
||||
config.header.authorization = `Bearer ${token}`
|
||||
console.log('[Request] Authorization:', config.header.authorization);
|
||||
})
|
||||
if (toastBefore !== '') {
|
||||
uni.showLoading({
|
||||
|
||||
@ -47,7 +47,37 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view class="list-content" scroll-y :scroll-top="restoreScrollTop" @scroll="handleListScroll">
|
||||
<view class="list-content-wrap">
|
||||
<view
|
||||
v-if="floatingStorageHeader.visible"
|
||||
class="floating-storage-head"
|
||||
:style="{ top: `${floatingStorageHeader.top}px` }"
|
||||
>
|
||||
<view
|
||||
:class="[
|
||||
'storage-table',
|
||||
floatingStorageHeader.mode === 'batch' ? 'storage-table--batch' : 'storage-table--non-batch',
|
||||
'storage-table--head-table'
|
||||
]"
|
||||
:style="getStorageHeadStyle(floatingStorageHeader.sectionKey)"
|
||||
>
|
||||
<view class="storage-table__head storage-table__row">
|
||||
<template v-if="floatingStorageHeader.mode === 'batch'">
|
||||
<text class="storage-col storage-col--batch">批次号</text>
|
||||
<text class="storage-col storage-col--space">库位</text>
|
||||
<text class="storage-col storage-col--qty">库存</text>
|
||||
<text class="storage-col storage-col--qty">可移库存</text>
|
||||
</template>
|
||||
<template v-else>
|
||||
<text class="storage-col storage-col--space">库位</text>
|
||||
<text class="storage-col storage-col--qty">库存</text>
|
||||
<text class="storage-col storage-col--qty">可移库存</text>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<scroll-view class="list-content" scroll-y :scroll-top="restoreScrollTop" @scroll="handleListScroll">
|
||||
<view v-if="!loading && list.length === 0" class="empty-state">
|
||||
<u-icon name="search" size="88" color="#c0c4cc"></u-icon>
|
||||
<text class="empty-text">暂无商品数据</text>
|
||||
@ -56,119 +86,143 @@
|
||||
|
||||
<view v-else class="list-wrap">
|
||||
<view class="goods-item" v-for="(item, index) in list" :key="item.id || index">
|
||||
<view class="item-title-row">
|
||||
<text class="goods-name">{{ item.item_name || item.product_name || item.name || '未命名商品' }}</text>
|
||||
</view>
|
||||
<view class="item-main-row">
|
||||
<view class="item-thumb" @click.stop="previewProductImage(item)">
|
||||
<u-image
|
||||
v-if="getImageList(item).length <= 1"
|
||||
class="goods-image"
|
||||
:src="getImageUrl(item)"
|
||||
mode="aspectFill"
|
||||
width="140rpx"
|
||||
height="140rpx"
|
||||
>
|
||||
<template #error>
|
||||
<view class="image-placeholder">
|
||||
<u-icon name="photo" size="32" color="#c0c4cc"></u-icon>
|
||||
</view>
|
||||
</template>
|
||||
</u-image>
|
||||
<view
|
||||
v-else
|
||||
class="goods-image-grid"
|
||||
>
|
||||
<view
|
||||
class="grid-cell"
|
||||
v-for="(img, imgIndex) in getImageThumbList(item)"
|
||||
:key="img + '-' + imgIndex"
|
||||
<view class="item-summary" :style="{ zIndex: 10 + index }">
|
||||
<view class="item-title-row">
|
||||
<text class="goods-name">{{ item.item_name || item.product_name || item.name || '未命名商品' }}</text>
|
||||
</view>
|
||||
<view class="item-main-row">
|
||||
<view class="item-thumb" @click.stop="previewProductImage(item)">
|
||||
<u-image
|
||||
v-if="getImageList(item).length <= 1"
|
||||
class="goods-image"
|
||||
:src="getImageUrl(item)"
|
||||
mode="aspectFill"
|
||||
width="140rpx"
|
||||
height="140rpx"
|
||||
>
|
||||
<u-image
|
||||
class="grid-image"
|
||||
:src="img"
|
||||
mode="aspectFill"
|
||||
width="68rpx"
|
||||
height="68rpx"
|
||||
<template #error>
|
||||
<view class="image-placeholder">
|
||||
<u-icon name="photo" size="32" color="#c0c4cc"></u-icon>
|
||||
</view>
|
||||
</template>
|
||||
</u-image>
|
||||
<view
|
||||
v-else
|
||||
class="goods-image-grid"
|
||||
>
|
||||
<view
|
||||
class="grid-cell"
|
||||
v-for="(img, imgIndex) in getImageThumbList(item)"
|
||||
:key="img + '-' + imgIndex"
|
||||
>
|
||||
<template #error>
|
||||
<view class="image-placeholder image-placeholder-small">
|
||||
<u-icon name="photo" size="24" color="#c0c4cc"></u-icon>
|
||||
</view>
|
||||
</template>
|
||||
</u-image>
|
||||
<view v-if="imgIndex === 3 && getExtraImageCount(item) > 0" class="more-mask">
|
||||
<text class="more-text">+{{ getExtraImageCount(item) }}</text>
|
||||
<u-image
|
||||
class="grid-image"
|
||||
:src="img"
|
||||
mode="aspectFill"
|
||||
width="68rpx"
|
||||
height="68rpx"
|
||||
>
|
||||
<template #error>
|
||||
<view class="image-placeholder image-placeholder-small">
|
||||
<u-icon name="photo" size="24" color="#c0c4cc"></u-icon>
|
||||
</view>
|
||||
</template>
|
||||
</u-image>
|
||||
<view v-if="imgIndex === 3 && getExtraImageCount(item) > 0" class="more-mask">
|
||||
<text class="more-text">+{{ getExtraImageCount(item) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-info">
|
||||
<view class="item-row">
|
||||
<text class="label">货主:</text>
|
||||
<text class="value">{{ getStoreOwnerText(item) }}</text>
|
||||
<view class="item-info">
|
||||
<view class="item-row">
|
||||
<text class="label">货主:</text>
|
||||
<text class="value">{{ getStoreOwnerText(item) }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="label">商品编码:</text>
|
||||
<text class="value">{{ item.goods_code || item.item_code || '--' }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="label">条码:</text>
|
||||
<text class="value">{{ getBarcodeText(item) }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="label">SKU规格:</text>
|
||||
<text class="value">{{ item.sku_property || '--' }}</text>
|
||||
</view>
|
||||
<view v-if="hasBatchNumber(item)" class="item-row">
|
||||
<text class="label">批次号:</text>
|
||||
<text class="value">{{ getBatchNumberText(item) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="label">商品编码:</text>
|
||||
<text class="value">{{ item.goods_code || item.item_code || '--' }}</text>
|
||||
<view class="item-arrow" @click.stop="goProductDetail(item)">
|
||||
<u-icon name="arrow-right" size="18" color="#c0c4cc" :custom-style="{ pointerEvents: 'none' }"></u-icon>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="label">条码:</text>
|
||||
<text class="value">{{ getBarcodeText(item) }}</text>
|
||||
</view>
|
||||
<view class="item-row">
|
||||
<text class="label">SKU规格:</text>
|
||||
<text class="value">{{ item.sku_property || '--' }}</text>
|
||||
</view>
|
||||
<view v-if="hasBatchNumber(item)" class="item-row">
|
||||
<text class="label">批次号:</text>
|
||||
<text class="value">{{ getBatchNumberText(item) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="item-arrow" @click.stop="goProductDetail(item)">
|
||||
<u-icon name="arrow-right" size="18" color="#c0c4cc" :custom-style="{ pointerEvents: 'none' }"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="queryMode === 'nonBatch' && getStorageList(item).length" class="storage-section">
|
||||
<scroll-view class="storage-scroll" scroll-x>
|
||||
<view class="storage-table storage-table--non-batch">
|
||||
<view class="storage-table__head storage-table__row">
|
||||
<text class="storage-col storage-col--space">库位</text>
|
||||
<text class="storage-col storage-col--qty">库存</text>
|
||||
<text class="storage-col storage-col--qty">可移库存</text>
|
||||
</view>
|
||||
<view v-if="queryMode === 'nonBatch' && getStorageList(item).length" class="storage-section" :id="`storage-section-${getStorageSectionKey(item, index, 'nonBatch')}`">
|
||||
<view class="storage-head-fixed" :style="{ zIndex: 9 + index }">
|
||||
<view
|
||||
v-for="(storageItem, storageIndex) in getStorageList(item)"
|
||||
:key="getStorageItemKey(storageItem, storageIndex)"
|
||||
class="storage-table__row"
|
||||
class="storage-table storage-table--non-batch storage-table--head-table"
|
||||
:style="getStorageHeadStyle(getStorageSectionKey(item, index, 'nonBatch'))"
|
||||
>
|
||||
<text class="storage-col storage-col--space">{{ getStorageSpaceText(storageItem) }}</text>
|
||||
<text class="storage-col storage-col--qty">{{ getStorageQuantityText(storageItem) }}</text>
|
||||
<text class="storage-col storage-col--qty storage-col--highlight">{{ getStorageAvailableText(storageItem) }}</text>
|
||||
<view class="storage-table__head storage-table__row">
|
||||
<text class="storage-col storage-col--space">库位</text>
|
||||
<text class="storage-col storage-col--qty">库存</text>
|
||||
<text class="storage-col storage-col--qty">可移库存</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view
|
||||
class="storage-scroll storage-scroll--body"
|
||||
scroll-x
|
||||
@scroll="handleStorageHorizontalScroll(getStorageSectionKey(item, index, 'nonBatch'), $event)"
|
||||
>
|
||||
<view class="storage-table storage-table--non-batch">
|
||||
<view
|
||||
v-for="(storageItem, storageIndex) in getStorageList(item)"
|
||||
:key="getStorageItemKey(storageItem, storageIndex)"
|
||||
class="storage-table__row"
|
||||
>
|
||||
<text class="storage-col storage-col--space">{{ getStorageSpaceText(storageItem) }}</text>
|
||||
<text class="storage-col storage-col--qty">{{ getStorageQuantityText(storageItem) }}</text>
|
||||
<text class="storage-col storage-col--qty storage-col--highlight">{{ getStorageAvailableText(storageItem) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view v-if="queryMode === 'batch' && getBatchStorageList(item).length" class="storage-section">
|
||||
<scroll-view class="storage-scroll" scroll-x>
|
||||
<view class="storage-table storage-table--batch">
|
||||
<view class="storage-table__head storage-table__row">
|
||||
<text class="storage-col storage-col--batch">批次号</text>
|
||||
<text class="storage-col storage-col--space">库位</text>
|
||||
<text class="storage-col storage-col--qty">库存</text>
|
||||
<text class="storage-col storage-col--qty">可移库存</text>
|
||||
</view>
|
||||
<view v-if="queryMode === 'batch' && getBatchStorageList(item).length" class="storage-section" :id="`storage-section-${getStorageSectionKey(item, index, 'batch')}`">
|
||||
<view class="storage-head-fixed" :style="{ zIndex: 9 + index }">
|
||||
<view
|
||||
v-for="(storageItem, storageIndex) in getBatchStorageList(item)"
|
||||
:key="getBatchStorageItemKey(item, storageItem, storageIndex)"
|
||||
class="storage-table__row"
|
||||
class="storage-table storage-table--batch storage-table--head-table"
|
||||
:style="getStorageHeadStyle(getStorageSectionKey(item, index, 'batch'))"
|
||||
>
|
||||
<text class="storage-col storage-col--batch">{{ getBatchNumberBySource(storageItem, item) }}</text>
|
||||
<text class="storage-col storage-col--space">{{ getStorageSpaceText(storageItem) }}</text>
|
||||
<text class="storage-col storage-col--qty">{{ getStorageQuantityText(storageItem) }}</text>
|
||||
<text class="storage-col storage-col--qty storage-col--highlight">{{ getStorageAvailableText(storageItem) }}</text>
|
||||
<view class="storage-table__head storage-table__row">
|
||||
<text class="storage-col storage-col--batch">批次号</text>
|
||||
<text class="storage-col storage-col--space">库位</text>
|
||||
<text class="storage-col storage-col--qty">库存</text>
|
||||
<text class="storage-col storage-col--qty">可移库存</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<scroll-view
|
||||
class="storage-scroll storage-scroll--body"
|
||||
scroll-x
|
||||
@scroll="handleStorageHorizontalScroll(getStorageSectionKey(item, index, 'batch'), $event)"
|
||||
>
|
||||
<view class="storage-table storage-table--batch">
|
||||
<view
|
||||
v-for="(storageItem, storageIndex) in getBatchStorageList(item)"
|
||||
:key="getBatchStorageItemKey(item, storageItem, storageIndex)"
|
||||
class="storage-table__row"
|
||||
>
|
||||
<text class="storage-col storage-col--batch">{{ getBatchNumberBySource(storageItem, item) }}</text>
|
||||
<text class="storage-col storage-col--space">{{ getStorageSpaceText(storageItem) }}</text>
|
||||
<text class="storage-col storage-col--qty">{{ getStorageQuantityText(storageItem) }}</text>
|
||||
<text class="storage-col storage-col--qty storage-col--highlight">{{ getStorageAvailableText(storageItem) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
@ -177,7 +231,8 @@
|
||||
<view v-if="!loading && list.length > 0" class="end-tip">没有更多了</view>
|
||||
|
||||
<view class="safe-area-bottom"></view>
|
||||
</scroll-view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-loading-page :loading="loading" bg-color="rgba(255,255,255,0.9)"></u-loading-page>
|
||||
@ -195,7 +250,17 @@
|
||||
list: [],
|
||||
rawList: [],
|
||||
restoreScrollTop: 0,
|
||||
listScrollTopCache: 0
|
||||
listScrollTopCache: 0,
|
||||
storageScrollLeftMap: {},
|
||||
storageSectionMetas: [],
|
||||
storageHeaderHeight: 0,
|
||||
pageHeaderHeight: 0,
|
||||
floatingStorageHeader: {
|
||||
visible: false,
|
||||
mode: 'nonBatch',
|
||||
sectionKey: '',
|
||||
top: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@ -215,6 +280,7 @@
|
||||
const top = cachedTop > 0 ? cachedTop : 0;
|
||||
this.restoreScrollTop = top;
|
||||
this.listScrollTopCache = top;
|
||||
this.refreshStorageSectionMetas();
|
||||
});
|
||||
},
|
||||
onHide() {
|
||||
@ -240,6 +306,116 @@
|
||||
handleListScroll(event) {
|
||||
const top = event && event.detail ? Number(event.detail.scrollTop || 0) : 0;
|
||||
this.listScrollTopCache = top;
|
||||
this.updateFloatingStorageHeader(top);
|
||||
},
|
||||
getStorageSectionKey(item, index, mode = 'nonBatch') {
|
||||
if (!item || typeof item !== 'object') {
|
||||
return `${mode}_${index}`;
|
||||
}
|
||||
|
||||
return `${mode}_${item.id || item.goods_code || item.item_code || item.barcode || index}`;
|
||||
},
|
||||
getStorageScrollLeft(sectionKey) {
|
||||
return Number(this.storageScrollLeftMap[sectionKey] || 0);
|
||||
},
|
||||
handleStorageHorizontalScroll(sectionKey, event) {
|
||||
const scrollLeft = event && event.detail ? Number(event.detail.scrollLeft || 0) : 0;
|
||||
if (this.getStorageScrollLeft(sectionKey) === scrollLeft) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$set(this.storageScrollLeftMap, sectionKey, scrollLeft);
|
||||
if (this.floatingStorageHeader.visible && this.floatingStorageHeader.sectionKey === sectionKey) {
|
||||
this.floatingStorageHeader = {
|
||||
...this.floatingStorageHeader,
|
||||
sectionKey
|
||||
};
|
||||
}
|
||||
},
|
||||
getStorageHeadStyle(sectionKey) {
|
||||
const scrollLeft = this.getStorageScrollLeft(sectionKey);
|
||||
return {
|
||||
transform: `translateX(-${scrollLeft}px)`
|
||||
};
|
||||
},
|
||||
refreshStorageSectionMetas() {
|
||||
this.$nextTick(() => {
|
||||
const query = uni.createSelectorQuery().in(this);
|
||||
query.select('.page-header').boundingClientRect();
|
||||
query.select('.list-content').boundingClientRect();
|
||||
query.select('.storage-head-fixed').boundingClientRect();
|
||||
query.selectAll('.item-summary').boundingClientRect();
|
||||
query.selectAll('.storage-section').boundingClientRect();
|
||||
query.exec(result => {
|
||||
const pageHeaderRect = result && result[0] ? result[0] : null;
|
||||
const listRect = result && result[1] ? result[1] : null;
|
||||
const headerRect = result && result[2] ? result[2] : null;
|
||||
const summaryRects = (result && result[3]) || [];
|
||||
const sectionRects = (result && result[4]) || [];
|
||||
this.pageHeaderHeight = pageHeaderRect && pageHeaderRect.height ? Number(pageHeaderRect.height) : 0;
|
||||
if (!listRect || !Array.isArray(sectionRects) || !sectionRects.length) {
|
||||
this.storageSectionMetas = [];
|
||||
this.storageHeaderHeight = headerRect && headerRect.height ? Number(headerRect.height) : 0;
|
||||
this.updateFloatingStorageHeader(this.listScrollTopCache);
|
||||
return;
|
||||
}
|
||||
|
||||
const headerHeight = headerRect && headerRect.height ? Number(headerRect.height) : 0;
|
||||
let sectionCursor = 0;
|
||||
const metas = [];
|
||||
(this.list || []).forEach((item, index) => {
|
||||
const hasStorage = this.queryMode === 'batch'
|
||||
? this.getBatchStorageList(item).length
|
||||
: this.getStorageList(item).length;
|
||||
if (!hasStorage) {
|
||||
return;
|
||||
}
|
||||
|
||||
const rect = sectionRects[sectionCursor++];
|
||||
if (!rect) {
|
||||
return;
|
||||
}
|
||||
|
||||
metas.push({
|
||||
key: this.getStorageSectionKey(item, index, this.queryMode),
|
||||
mode: this.queryMode,
|
||||
top: this.listScrollTopCache + Number(rect.top || 0) - Number(listRect.top || 0),
|
||||
height: Number(rect.height || 0),
|
||||
headerHeight,
|
||||
summaryHeight: Number((summaryRects[index] && summaryRects[index].height) || 0)
|
||||
});
|
||||
});
|
||||
|
||||
this.storageHeaderHeight = headerHeight;
|
||||
this.storageSectionMetas = metas;
|
||||
this.updateFloatingStorageHeader(this.listScrollTopCache);
|
||||
});
|
||||
});
|
||||
},
|
||||
updateFloatingStorageHeader(scrollTop = 0) {
|
||||
const passedMetas = this.storageSectionMetas.filter(meta => {
|
||||
const summaryHeight = Number(meta.summaryHeight || 0);
|
||||
const startTop = meta.top - summaryHeight;
|
||||
return scrollTop >= startTop;
|
||||
});
|
||||
const activeMeta = passedMetas.length ? passedMetas[passedMetas.length - 1] : null;
|
||||
|
||||
if (!activeMeta) {
|
||||
this.floatingStorageHeader = {
|
||||
visible: false,
|
||||
mode: this.queryMode,
|
||||
sectionKey: '',
|
||||
top: 0
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
this.floatingStorageHeader = {
|
||||
visible: true,
|
||||
mode: activeMeta.mode,
|
||||
sectionKey: activeMeta.key,
|
||||
top: this.pageHeaderHeight + Math.max(Number(activeMeta.summaryHeight || 0), 0)
|
||||
};
|
||||
},
|
||||
normalizeKeyword(value) {
|
||||
return String(value || '').replace(/\s+/g, '');
|
||||
@ -459,6 +635,7 @@
|
||||
: this.filterByNameContains(sourceList, keyword);
|
||||
|
||||
this.list = this.applyQueryModeFilter(filteredByKeyword);
|
||||
this.refreshStorageSectionMetas();
|
||||
},
|
||||
buildQueryParams(keyword) {
|
||||
return {
|
||||
@ -476,6 +653,7 @@
|
||||
const keyword = this.normalizeKeyword(this.keyword);
|
||||
if (!keyword) {
|
||||
this.list = this.applyQueryModeFilter(this.rawList);
|
||||
this.refreshStorageSectionMetas();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -663,6 +841,13 @@
|
||||
if (!keyword) {
|
||||
this.rawList = [];
|
||||
this.list = [];
|
||||
this.storageSectionMetas = [];
|
||||
this.floatingStorageHeader = {
|
||||
visible: false,
|
||||
mode: this.queryMode,
|
||||
sectionKey: '',
|
||||
top: 0
|
||||
};
|
||||
console.log('[ProductQuery] 搜索内容为空,结果已清空');
|
||||
return;
|
||||
}
|
||||
@ -867,14 +1052,37 @@
|
||||
}
|
||||
}
|
||||
|
||||
.list-content-wrap {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.list-content {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
height: auto;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.floating-storage-head {
|
||||
position: fixed;
|
||||
left: 24rpx;
|
||||
right: 24rpx;
|
||||
overflow: hidden;
|
||||
border: 1rpx solid #dfe7f5;
|
||||
border-bottom: 0;
|
||||
border-radius: 10rpx 10rpx 0 0;
|
||||
background: #edf4ff;
|
||||
box-sizing: border-box;
|
||||
z-index: 40;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.list-wrap {
|
||||
padding: 20rpx 8rpx;
|
||||
}
|
||||
@ -889,6 +1097,16 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.item-summary {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: #fff;
|
||||
padding-bottom: 10rpx;
|
||||
margin-bottom: 4rpx;
|
||||
border-radius: 12rpx 12rpx 0 0;
|
||||
box-shadow: 0 6rpx 14rpx rgba(15, 23, 42, 0.06);
|
||||
}
|
||||
|
||||
.item-main-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -1012,6 +1230,17 @@
|
||||
margin-top: 10rpx;
|
||||
padding-top: 10rpx;
|
||||
border-top: 1rpx solid #eef1f6;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.storage-head-fixed {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border: 1rpx solid #dfe7f5;
|
||||
border-bottom: 0;
|
||||
border-radius: 10rpx 10rpx 0 0;
|
||||
background: #edf4ff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.storage-scroll {
|
||||
@ -1023,6 +1252,11 @@
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.storage-scroll--body {
|
||||
border-top: 0;
|
||||
border-radius: 0 0 10rpx 10rpx;
|
||||
}
|
||||
|
||||
.storage-table {
|
||||
background: #f8faff;
|
||||
overflow: visible;
|
||||
@ -1031,6 +1265,11 @@
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.storage-table--head-table {
|
||||
background: #edf4ff;
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.storage-table--non-batch {
|
||||
min-width: 680rpx;
|
||||
}
|
||||
@ -1054,9 +1293,8 @@
|
||||
.storage-table__head {
|
||||
background: #edf4ff;
|
||||
border-bottom: 1rpx solid #dbe6f7;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 8;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
box-shadow: 0 2rpx 6rpx rgba(219, 230, 247, 0.65);
|
||||
}
|
||||
|
||||
|
||||
@ -102,7 +102,8 @@
|
||||
<view class="form-item">
|
||||
<u-form-item label="箱数" prop="box_quantity">
|
||||
<view class="input-with-unit">
|
||||
<u-input class="input-field" v-model="formData.box_quantity" placeholder="系统自动计算" type="number" readonly />
|
||||
<u-input class="input-field" v-model="formData.box_quantity" placeholder="默认自动计算,可手动输入" type="number" clearable
|
||||
@blur="handleBoxQuantityBlur" />
|
||||
<text class="unit-text">箱</text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
@ -333,6 +334,7 @@
|
||||
emitTimer: null,
|
||||
isInitializing: false,
|
||||
initialized: false,
|
||||
boxQuantityManuallyEdited: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@ -398,6 +400,7 @@
|
||||
}
|
||||
|
||||
this.formData = newFormData;
|
||||
this.boxQuantityManuallyEdited = false;
|
||||
|
||||
// 初始化商品图片
|
||||
if (data.product_snapshot?.images) {
|
||||
@ -406,8 +409,12 @@
|
||||
}));
|
||||
}
|
||||
|
||||
// 计算箱数但不触发 emitFormData
|
||||
this.calculateBoxQuantity(false);
|
||||
// 无已有箱数时默认自动计算;有值时保留原值,允许后续手动修改
|
||||
if (newFormData.box_quantity === null || newFormData.box_quantity === undefined || newFormData.box_quantity === '') {
|
||||
this.calculateBoxQuantity(false, {
|
||||
force: true
|
||||
});
|
||||
}
|
||||
try {
|
||||
console.log("清除")
|
||||
setTimeout(() => {
|
||||
@ -503,9 +510,32 @@
|
||||
this.calculateBoxQuantity(true);
|
||||
},
|
||||
|
||||
// 箱数输入处理
|
||||
handleBoxQuantityBlur() {
|
||||
const boxQuantity = String(this.formData.box_quantity || '').trim();
|
||||
if (!boxQuantity) {
|
||||
this.boxQuantityManuallyEdited = false;
|
||||
this.calculateBoxQuantity(true, {
|
||||
force: true
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.boxQuantityManuallyEdited = true;
|
||||
this.emitFormData();
|
||||
},
|
||||
|
||||
// 计算箱数
|
||||
calculateBoxQuantity(shouldEmit = true) {
|
||||
calculateBoxQuantity(shouldEmit = true, options = {}) {
|
||||
console.log("计算箱数", shouldEmit);
|
||||
const force = !!options.force;
|
||||
if (this.boxQuantityManuallyEdited && !force) {
|
||||
if (shouldEmit) {
|
||||
this.emitFormData();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
let actualQuantity = parseFloat(this.formData.actual_quantity);
|
||||
let boxesPerPallet = parseFloat(this.formData.boxes_per_pallet);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user