diff --git a/pkg_user/views/gift/components/GiftCard.vue b/pkg_user/views/gift/components/GiftCard.vue index a4f8237..3f2e4a2 100644 --- a/pkg_user/views/gift/components/GiftCard.vue +++ b/pkg_user/views/gift/components/GiftCard.vue @@ -34,7 +34,7 @@ 礼包已被领取 - 去商城看看>> + 去商城看看>> @@ -90,7 +90,7 @@ export default { return !!cookie.get('login_status'); }, myGift() { - return this.card && this.card.giftProducts.filter(item => item.isCurrentUser === 1).length > 0 && this.card.giftProducts.filter(item => item.isCurrentUser === 1)[0] || this.card.giftProducts[0] + return this.card.giftProducts && this.card.giftProducts.filter(item => item.isCurrentUser === 1).length > 0 && this.card.giftProducts.filter(item => item.isCurrentUser === 1)[0] || this.card.giftProduct && this.card.giftProducts[0] } }, watch: { @@ -104,11 +104,10 @@ export default { deep: true }, // 修改后的监听器 - 'card': { + 'myGift': { handler(newVal) { - if (newVal.giftProducts && newVal.giftProducts[0] && newVal.giftProducts[0].isCurrentUser === 1) { - this.order = newVal.giftProducts[0].orderId - } + + this.order = newVal.orderId }, deep: true } diff --git a/pkg_user/views/gift/receive.vue b/pkg_user/views/gift/receive.vue index 442367c..6b3fce2 100644 --- a/pkg_user/views/gift/receive.vue +++ b/pkg_user/views/gift/receive.vue @@ -50,6 +50,8 @@ export default { getGiftCardDetail({ code: code }).then(res => { + console.log(res.data,'res.data'); + this.giftCard = res.data || {} }).catch(err => { this.giftCard = {