Fix:5595 【商城小程序】礼品集采中心收到礼品,在商城小程序-我的礼品卡-收到的,未显示商品信息

This commit is contained in:
LinCyJang
2026-08-02 11:02:10 +08:00
parent 76a877f2c2
commit eb3db99cb8
+54 -8
View File
@@ -138,7 +138,7 @@
class="gift-item"
>
<view
v-for="(cart, cartIndex) in item.giftInfos"
v-for="(cart, cartIndex) in item._renderGiftInfos"
:key="cartIndex"
class="gift-body"
@click="giftItemClickHanlde(item)"
@@ -146,20 +146,20 @@
>
<view class="gift-img">
<image
:src="cart.productInfo.image"
:src="cart._displayImage"
class="img"
/>
</view>
<view class="gift-good-info">
<view class="name more-t">
{{ cart.productInfo.storeName }}
{{ cart._displayName }}
</view>
<view v-if="cart.productInfo.attrInfo" class="attr-txt">
<view class="txt">{{ cart.productInfo.attrInfo.sku }}</view>
<view v-if="cart._displaySku" class="attr-txt">
<view class="txt">{{ cart._displaySku }}</view>
</view>
<view class="price-wrap">
<view v-if="cart._showPrice" class="price-wrap">
<view class="price">
<text class="prefix"></text>{{ cart.productInfo.attrInfo.price }}
<text class="prefix"></text>{{ cart._displayPrice }}
</view>
</view>
</view>
@@ -442,7 +442,8 @@ export default {
const { success, data } = res
if (success) {
const { list, hasMore } = this.getListResult(data, page)
this.receiveList = page === 1 ? list : this.receiveList.concat(list)
const formatList = list.map(item => this.normalizeReceiveGiftItem(item))
this.receiveList = page === 1 ? formatList : this.receiveList.concat(formatList)
this.receiveHasMore = hasMore
this.receivePage = page + 1
this.receiveInited = true
@@ -526,6 +527,51 @@ export default {
}
return status
},
normalizeReceiveGiftItem(item = {}) {
return {
...item,
_renderGiftInfos: this.getReceiveGiftInfos(item)
}
},
getReceiveGiftInfos(item = {}) {
if (item.customGiftInfo && typeof item.customGiftInfo === 'object') {
const customGift = this.formatCustomGiftInfo(item.customGiftInfo)
if (customGift) {
return [customGift]
}
}
const giftInfos = Array.isArray(item.giftInfos) ? item.giftInfos : []
return giftInfos.map(gift => this.formatDefaultGiftInfo(gift))
},
formatCustomGiftInfo(customGiftInfo = {}) {
const giftImage = typeof customGiftInfo.giftImage === 'string'
? customGiftInfo.giftImage.trim()
: ''
const giftValue = customGiftInfo.giftValue
const hasGiftValue = giftValue !== '' && giftValue !== null && giftValue !== undefined
return {
...customGiftInfo,
_isCustomGift: true,
_displayImage: giftImage,
_displayName: customGiftInfo.giftName || '',
_displaySku: customGiftInfo.specName || '',
_displayPrice: hasGiftValue ? giftValue : '',
_showPrice: Number(customGiftInfo.isShowValue) === 1 && hasGiftValue
}
},
formatDefaultGiftInfo(gift = {}) {
const productInfo = gift.productInfo || {}
const attrInfo = productInfo.attrInfo || {}
const price = attrInfo.price
return {
...gift,
_displayImage: productInfo.image || '',
_displayName: productInfo.storeName || '',
_displaySku: attrInfo.sku || '',
_displayPrice: price,
_showPrice: price !== '' && price !== null && price !== undefined
}
},
showTips() {
this.$refs.giftTips.showTips = true
},