Fix:收礼相关逻辑补充

This commit is contained in:
modendeveloper
2025-02-27 12:39:36 +08:00
parent e56dca5b92
commit e257419351
3 changed files with 21 additions and 11 deletions
+12 -8
View File
@@ -1,5 +1,5 @@
<template> <template>
<view class="dialog-conent" v-if="isLogin"> <view class="dialog-conent" v-show="isLogin">
<view class="gift-card-modal" > <view class="gift-card-modal" >
<image class="bg-image" :src="card.cover" mode="aspectFit|aspectFill|widthFix" lazy-load="false"></image> <image class="bg-image" :src="card.cover" mode="aspectFit|aspectFill|widthFix" lazy-load="false"></image>
<view class="image-wrap"> <view class="image-wrap">
@@ -16,25 +16,25 @@
</view> </view>
<view class="btn-wrap"> <view class="btn-wrap">
<button v-if="!isReceive && card.giftProducts[0].isCurrentUser !== 1" class="share-btn v12-white-text v12-primary" @click="setAddress(0)"> <button v-if="!isReceive && myGift.isCurrentUser !== 1" class="share-btn v12-white-text v12-primary" @click="setAddress(0)">
填写地址并收下 填写地址并收下
</button> </button>
<button v-if="card.canTransfer !== 0 && !isReceive && card.giftProducts[0].isCurrentUser !== 1" open-type="share" class="share-btn v12-white v12-primary-text v12-d-flex" > <button v-if="card.canTransfer !== 0 && !isReceive && myGift.isCurrentUser !== 1" open-type="share" class="share-btn v12-white v12-primary-text v12-d-flex" >
点击转赠给好友 点击转赠给好友
<u-icon :name="webUrl + '/icon/share.png'" ></u-icon> <u-icon :name="webUrl + '/icon/share.png'" ></u-icon>
</button> </button>
</view> </view>
<view v-if=" card && card.giftProducts[0] && card.giftProducts[0].isCurrentUser === 1" @click="toOrder" style="z-index: 10"> <view v-if="myGift.isCurrentUser === 1" @click="toOrder" style="z-index: 10">
<view class="address-btn v12-white-text v12-primary"> <view class="address-btn v12-white-text v12-primary">
您已领取礼包 您已领取礼包
</view> </view>
<view class="v12-text-center v12-font-26 v12-primary-text v12-mt-3">查看礼包详情>></view> <view class="v12-text-center v12-font-26 v12-primary-text v12-mt-3">查看礼包详情>></view>
</view> </view>
<view v-if="isReceive && card && card.giftProducts[0] && card.giftProducts[0].isCurrentUser === 0" @click="toHome" style="z-index: 10"> <view v-if="isReceive && myGift.isCurrentUser === 0" @click="toHome" style="z-index: 10">
<view class="address-btn v12-white-text v12-primary"> <view class="address-btn v12-white-text v12-primary">
礼包已被领取 礼包已被领取
</view> </view>
<view class="v12-text-center v12-font-26 v12-primary-text v12-mt-3">去商城看看>></view> <view @click="toHome" class="v12-text-center v12-font-26 v12-primary-text v12-mt-3" style="z-index: 10">去商城看看>></view>
</view> </view>
<view class="tips"> <view class="tips">
<view class="tip-text v12-mr-1" @click="showTips"> <view class="tip-text v12-mr-1" @click="showTips">
@@ -88,6 +88,9 @@ export default {
}, },
isLogin() { isLogin() {
return !!cookie.get('login_status'); 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]
} }
}, },
watch: { watch: {
@@ -137,14 +140,15 @@ export default {
// 领取礼包 // 领取礼包
getGiftCardReceive({ getGiftCardReceive({
code: this.card.code, code: this.card.code,
recipientsNum : 1,
addressId: e addressId: e
}).then(res => { }).then(res => {
this.$refs.addressDialog.close() this.$refs.addressDialog.close()
this.$refs.AddressList.close() this.$refs.AddressList.close()
this.order = res.data.orderId this.order = res.data.orderId
this.$emit('receive', this.order) this.$emit('receive', this.card.code)
}).finally(() => {
uni.hideLoading() uni.hideLoading()
}).finally(() => {
}) })
}, },
setAddress(flag) { setAddress(flag) {
+1
View File
@@ -281,6 +281,7 @@ export default {
from: 'routine', from: 'routine',
cartId: this.cartId, cartId: this.cartId,
couponId: this.couponId, couponId: this.couponId,
recipientsNum: this.goodsInfo.cartNum,
templateId: this.templateId, templateId: this.templateId,
message : this.message || '礼笺轻启,礼藏心意', message : this.message || '礼笺轻启,礼藏心意',
cover: this.selectedCover, cover: this.selectedCover,
+8 -3
View File
@@ -1,12 +1,12 @@
<template> <template>
<view> <view>
<GiftCard v-if="!giftCard.expireTime" :card="giftCard" :addr="giftChooseAddress" @receive="getGiftCard($event)" /> <GiftCard v-if="!giftCard.isExpire" :card="giftCard" :addr="giftChooseAddress" @receive="getGiftCard($event)" />
<view v-else> <view v-else>
<view class="no-img-wrap"> <view class="no-img-wrap">
<view class="wrap-box"> <view class="wrap-box" >
<image :src="webUrl + '/icon/no-gift.png'" mode="widthFix"></image> <image :src="webUrl + '/icon/no-gift.png'" mode="widthFix"></image>
<view class="v12-font-28 v12-dark1-text v12-mt-8">礼包超过24小时未领取,订单已取消</view> <view class="v12-font-28 v12-dark1-text v12-mt-8">礼包超过24小时未领取,订单已取消</view>
<view class="v12-font-28 v12-primary-text v12-primary-border go-btn">去商城看看</view> <view @click="toHome" class="v12-font-28 v12-primary-text v12-primary-border go-btn">去商城看看</view>
</view> </view>
</view> </view>
</view> </view>
@@ -41,6 +41,11 @@ export default {
} }
}, },
methods: { methods: {
toHome() {
uni.switchTab({
url: '/pages/home/index'
})
},
getGiftCard(code) { getGiftCard(code) {
getGiftCardDetail({ getGiftCardDetail({
code: code code: code