Fix:5595 【商城小程序】礼品集采中心收到礼品,在商城小程序-我的礼品卡-收到的,未显示商品信息
This commit is contained in:
@@ -138,7 +138,7 @@
|
|||||||
class="gift-item"
|
class="gift-item"
|
||||||
>
|
>
|
||||||
<view
|
<view
|
||||||
v-for="(cart, cartIndex) in item.giftInfos"
|
v-for="(cart, cartIndex) in item._renderGiftInfos"
|
||||||
:key="cartIndex"
|
:key="cartIndex"
|
||||||
class="gift-body"
|
class="gift-body"
|
||||||
@click="giftItemClickHanlde(item)"
|
@click="giftItemClickHanlde(item)"
|
||||||
@@ -146,20 +146,20 @@
|
|||||||
>
|
>
|
||||||
<view class="gift-img">
|
<view class="gift-img">
|
||||||
<image
|
<image
|
||||||
:src="cart.productInfo.image"
|
:src="cart._displayImage"
|
||||||
class="img"
|
class="img"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="gift-good-info">
|
<view class="gift-good-info">
|
||||||
<view class="name more-t">
|
<view class="name more-t">
|
||||||
{{ cart.productInfo.storeName }}
|
{{ cart._displayName }}
|
||||||
</view>
|
</view>
|
||||||
<view v-if="cart.productInfo.attrInfo" class="attr-txt">
|
<view v-if="cart._displaySku" class="attr-txt">
|
||||||
<view class="txt">{{ cart.productInfo.attrInfo.sku }}</view>
|
<view class="txt">{{ cart._displaySku }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="price-wrap">
|
<view v-if="cart._showPrice" class="price-wrap">
|
||||||
<view class="price">
|
<view class="price">
|
||||||
<text class="prefix">¥</text>{{ cart.productInfo.attrInfo.price }}
|
<text class="prefix">¥</text>{{ cart._displayPrice }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -442,7 +442,8 @@ export default {
|
|||||||
const { success, data } = res
|
const { success, data } = res
|
||||||
if (success) {
|
if (success) {
|
||||||
const { list, hasMore } = this.getListResult(data, page)
|
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.receiveHasMore = hasMore
|
||||||
this.receivePage = page + 1
|
this.receivePage = page + 1
|
||||||
this.receiveInited = true
|
this.receiveInited = true
|
||||||
@@ -526,6 +527,51 @@ export default {
|
|||||||
}
|
}
|
||||||
return status
|
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() {
|
showTips() {
|
||||||
this.$refs.giftTips.showTips = true
|
this.$refs.giftTips.showTips = true
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user