修改库位查询页面

This commit is contained in:
zm2000 2026-09-14 18:01:56 +08:00
parent 6913373362
commit 4d271c47f0
2 changed files with 42 additions and 11 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

@ -66,6 +66,9 @@
</view>
</template>
</u-image>
<view v-if="goodsImageCount(goods) > 1" class="goods-card__badge">
<text class="goods-card__badge-text">1/{{ goodsImageCount(goods) }}</text>
</view>
</view>
<view class="goods-card__info">
<view class="line line--compact">
@ -260,31 +263,37 @@ export default {
goodsImages(goods) {
if (!goods || typeof goods !== 'object') return [];
const stock = goods.stock && typeof goods.stock === 'object' ? goods.stock : {};
const normalizeUrl = (u) => {
if (!u) return '';
if (typeof u === 'string') return u.trim();
if (typeof u === 'object') return String(u.url || u.path || u.image_url || u.fileUrl || u.successUrl || '').trim();
return '';
};
const singles = [
goods.image, goods.image_url, goods.img, goods.pic, goods.photo, goods.cover, goods.cover_url,
stock.image, stock.image_url, stock.img, stock.pic, stock.photo, stock.cover, stock.cover_url
];
for (const s of singles) {
if (Array.isArray(s)) {
const first = s.find(u => u);
if (first) return [String(first)];
// 数组字段(如 stock.image_url 返回多张图)需保留全部,而不是只取第一张
const urls = s.map(normalizeUrl).filter(Boolean);
if (urls.length) return urls;
} else if (s) {
return [String(s)];
return [String(s).trim()].filter(Boolean);
}
}
const arrays = [goods.images, goods.pics, goods.image_urls, stock.images, stock.pics, stock.image_urls];
for (const arr of arrays) {
if (!Array.isArray(arr) || !arr.length) continue;
const urls = arr.map(u => {
if (!u) return '';
if (typeof u === 'string') return u.trim();
if (typeof u === 'object') return String(u.url || u.path || u.image_url || u.fileUrl || u.successUrl || '').trim();
return '';
}).filter(Boolean);
const urls = arr.map(normalizeUrl).filter(Boolean);
if (urls.length) return urls;
}
return [];
},
// 商品图片数量:用于缩略图角标显示「N张」
goodsImageCount(goods) {
return this.goodsImages(goods).length;
},
previewGoodsImage(goods) {
const images = this.goodsImages(goods);
if (!images.length) return;
@ -754,6 +763,28 @@ export default {
overflow: hidden;
background: #f5f6f7;
margin-right: 12rpx;
position: relative;
}
.goods-card__badge {
position: absolute;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
border-radius: 10rpx 0 10rpx 0;
padding: 2rpx 10rpx;
display: flex;
align-items: center;
justify-content: center;
z-index: 2;
pointer-events: none;
}
.goods-card__badge-text {
font-size: 20rpx;
color: #fff;
font-weight: 500;
line-height: 1;
}
.goods-card__image {