diff --git a/env.js b/env.js index b87b72a..c33f58a 100644 --- a/env.js +++ b/env.js @@ -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 diff --git a/pages/warehouse/locationInquiry.vue b/pages/warehouse/locationInquiry.vue index 146a8e3..4ed36a9 100644 --- a/pages/warehouse/locationInquiry.vue +++ b/pages/warehouse/locationInquiry.vue @@ -66,6 +66,9 @@ + + 1/{{ goodsImageCount(goods) }} + @@ -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 {