Fix:收礼相关逻辑补充

This commit is contained in:
modendeveloper
2025-02-25 23:37:43 +08:00
parent 12fa155630
commit 6ac1b9d415
5 changed files with 127 additions and 45 deletions
+2 -1
View File
@@ -1427,8 +1427,9 @@ export default {
return return
} }
if(news === 2) { if(news === 2) {
const coupId = that.couponId ? that.couponId : (that.couponList.usable[0] && that.couponList.usable[0].id || '')
uni.navigateTo({ uni.navigateTo({
url: '/pkg_user/views/gift/gift?cartId=' + res.data.cartId + '&couponId=' + (that.couponId ? that.couponId : '') url: '/pkg_user/views/gift/gift?cartId=' + res.data.cartId + '&couponId=' + coupId
}) })
} }
if(news === 0) { if(news === 0) {
@@ -19,7 +19,7 @@
class="address-item" class="address-item"
> >
<view class="address-wrap" @click="handleSelect(item)"> <view class="address-wrap" @click="handleSelect(item)">
<view class="v12-font-28 v12-font-bold"> <view class="v12-font-28 v12-font-bold text">
收货地址 收货地址
</view> </view>
<view> <view>
@@ -110,6 +110,9 @@ export default {
</script> </script>
<style scoped> <style scoped>
.text{
white-space: nowrap;
}
.address-wrap{ .address-wrap{
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
@@ -118,7 +121,7 @@ export default {
.address-list { .address-list {
padding: 20rpx 20rpx 0rpx; padding: 20rpx 20rpx 0rpx;
width: 640rpx; width: 640rpx;
height: 800rpx; max-height: 800rpx;
overflow: auto; overflow: auto;
} }
@@ -146,6 +149,7 @@ export default {
font-size: 26rpx; font-size: 26rpx;
color: #888; color: #888;
display: flex; display: flex;
align-items: flex-end;
} }
.add-btn { .add-btn {
+72 -36
View File
@@ -1,5 +1,5 @@
<template> <template>
<view class="mask"> <view class="dialog-conent">
<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" v-if="!card.isReceive"> <view class="image-wrap" v-if="!card.isReceive">
@@ -13,31 +13,33 @@
<view class="auto-text-color" v-if="!card.isReceive"> <view class="auto-text-color" v-if="!card.isReceive">
{{ card.message || '礼笺轻启礼藏心意' }} {{ card.message || '礼笺轻启礼藏心意' }}
</view> </view>
<view v-if="isReceive || card.giftProducts[0].isReceive === 1" @click="toOrder" style="z-index: 89999">
<view class="address-btn v12-white v12-primary-text">
您已领取礼包
</view> </view>
<view class="v12-text-center v12-font-26 v12-white-text v12-mt-3">查看礼包详情>></view> <view class="btn-wrap">
</view> <view v-if="!isReceive && card.giftProducts[0].isCurrentUser !== 1" class="address-btn v12-white-text v12-primary" @click="setAddress(0)">
<view v-if="card.isReceive" @click="toHome" style="z-index: 89999">
<view class="address-btn v12-white v12-primary-text">
礼包已被领取
</view>
<view class="v12-text-center v12-font-26 v12-white-text v12-mt-3">去商城看看>></view>
</view>
<!-- 弹窗内容 -->
<view v-if="!isReceive && card.giftProducts[0].isReceive !== 1" class="address-btn v12-white v12-primary-text" @click="setAddress(0)">
填写地址并收下 填写地址并收下
</view> </view>
<button open-type="share" class="share-btn v12-white v12-primary-text v12-d-flex" v-if="card.canTransfer !== 0 && !isReceive && card.giftProducts[0].isReceive !== 1"> <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" >
点击转赠给好友 点击转赠给好友
<u-icon :name="webUrl + '/icon/share.png'" ></u-icon> <u-icon :name="webUrl + '/icon/share.png'" ></u-icon>
</button> </button>
<view class="tips">
<view class="tip-text v12-mr-1">
未领取礼包将于24小时后自动退回
</view> </view>
<u-icon @click="showTips" name="error-circle" color="#fff" size="24rpx"></u-icon> <view v-if="isReceive || card.giftProducts[0].isCurrentUser === 1" @click="toOrder" style="z-index: 89999">
<view class="address-btn v12-white-text v12-primary">
您已领取礼包
</view>
<view class="v12-text-center v12-font-26 v12-primary-text v12-mt-3">查看礼包详情>></view>
</view>
<view v-if="isReceive && card.giftProducts[0].isCurrentUser === 0" @click="toHome" style="z-index: 89999">
<view class="address-btn v12-white-text v12-primary">
礼包已被领取
</view>
<view class="v12-text-center v12-font-26 v12-primary-text v12-mt-3">去商城看看>></view>
</view>
<view class="tips">
<view class="tip-text v12-mr-1" @click="showTips">
未领取礼包将于24小时后自动退回
<u-icon name="error-circle" color="#666" size="24rpx"></u-icon>
</view> </view>
</view> </view>
<giftTips ref="giftTips" :richText="giftNotice"></giftTips> <giftTips ref="giftTips" :richText="giftNotice"></giftTips>
@@ -75,11 +77,15 @@ export default {
webUrl: this.$VUE_APP_RESOURCES_URL, webUrl: this.$VUE_APP_RESOURCES_URL,
// 组件数据 // 组件数据
giftNotice: '', giftNotice: '',
isReceive: false,
address: [], address: [],
order: '' order: ''
} }
}, },
computed: {
isReceive() {
return this.card.recipientsNum === this.card.receiveNum
}
},
watch: { watch: {
addr: { addr: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
@@ -89,6 +95,15 @@ export default {
} }
}, },
deep: true deep: true
},
// 修改后的监听器
'card': {
handler(newVal) {
if (newVal.giftProducts && newVal.giftProducts[0] && newVal.giftProducts[0].isCurrentUser === 1) {
this.order = newVal.giftProducts[0].orderId
}
},
deep: true
} }
}, },
methods: { methods: {
@@ -123,7 +138,7 @@ export default {
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.isReceive = true this.$emit('receive')
}).finally(() => { }).finally(() => {
uni.hideLoading() uni.hideLoading()
}) })
@@ -135,8 +150,6 @@ export default {
this.$refs.addressDialog.open() this.$refs.addressDialog.open()
} else { } else {
this.address = res.data this.address = res.data
console.log(flag);
if(flag) return if(flag) return
this.$refs.AddressList.open() this.$refs.AddressList.open()
} }
@@ -155,6 +168,19 @@ export default {
</script> </script>
<style scoped> <style scoped>
.dialog-conent{
height: 100vh;
display: flex;
flex-direction: column;
justify-content: space-evenly;
align-items: center
}
.btn-wrap{
position: relative;
display: flex;
justify-content: center;
align-content: center;
}
.bg-image{ .bg-image{
width: 586rpx; width: 586rpx;
height: 704rpx; height: 704rpx;
@@ -167,13 +193,19 @@ export default {
margin-top: 40rpx; margin-top: 40rpx;
position: absolute; position: absolute;
bottom: 50rpx; bottom: 50rpx;
width: 100%;
} }
.tip-text{ .tip-text{
font-family: Source Han Sans SC; font-family: Source Han Sans SC;
font-weight: 500; font-weight: 500;
font-size: 24rpx; font-size: 24rpx;
color: #fff; color: #666;
opacity: 0.6; opacity: 0.6;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
line-height: 36rpx; line-height: 36rpx;
} }
.wrap-box{ .wrap-box{
@@ -187,7 +219,7 @@ export default {
border-radius: 30rpx; border-radius: 30rpx;
position: absolute; position: absolute;
overflow: hidden; overflow: hidden;
top: -60px; top: -140rpx;
} }
.pro-image{ .pro-image{
width: 296rpx; width: 296rpx;
@@ -198,7 +230,7 @@ export default {
color: #fff; color: #fff;
font-size: 26rpx; font-size: 26rpx;
opacity: 0.8; opacity: 0.8;
margin-top: 50rpx; margin-top: 150rpx;
width: 400rpx; width: 400rpx;
text-align: center; text-align: center;
} }
@@ -208,33 +240,37 @@ export default {
font-size: 24rpx; font-size: 24rpx;
margin-top: 40rpx; margin-top: 40rpx;
z-index: 999; z-index: 999;
align-items: center;
border: 1rpx solid #C52733 ;
margin-left: 10rpx;
font-weight: bold;
}
.share-btn::before{
border: none;
}
.share-btn::after{
border: none ;
} }
.address-btn{ .address-btn{
width: fit-content; width: fit-content;
padding: 20rpx 30rpx; padding: 10rpx 30rpx;
border-radius: 100rpx; border-radius: 100rpx;
font-size: 32rpx; font-size: 32rpx;
font-weight: bold; font-weight: bold;
margin-top: 40rpx; /* margin-top: 40rpx; */
z-index: 999; z-index: 999;
} }
.gift-card-modal { .gift-card-modal {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 586rpx;
height: 704rpx; height: 704rpx;
/* background-color: #C52733; */
justify-content: center; justify-content: center;
z-index: 999; z-index: 999;
margin: auto; margin-top: 100rpx;
border-radius: 16rpx; border-radius: 16rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: start; justify-content: start;
position: relative;
} }
.gift-card-content { .gift-card-content {
+8 -1
View File
@@ -38,13 +38,20 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.popup-content { .popup-content {
width: 600rpx; width: 600rpx;
padding: 40rpx; height: 800rpx;
overflow: auto;
padding:0 40rpx 40rpx 40rpx;
box-sizing: border-box; box-sizing: border-box;
.title { .title {
padding-top: 40rpx;
padding-bottom: 20rpx;
font-size: 36rpx; font-size: 36rpx;
font-weight: bold; font-weight: bold;
text-align: center; text-align: center;
margin-bottom: 30rpx; margin-bottom: 30rpx;
position: sticky;
top: 0;
background: #fff;
} }
.close-btn { .close-btn {
+35 -1
View File
@@ -1,6 +1,15 @@
<template> <template>
<view> <view>
<GiftCard :card="giftCard" :addr="giftChooseAddress" /> <GiftCard v-if="!giftCard.expireTime" :card="giftCard" :addr="giftChooseAddress" @receive="getGiftCard" />
<view v-else>
<view class="no-img-wrap">
<view class="wrap-box">
<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-primary-text v12-primary-border go-btn">去商城看看</view>
</view>
</view>
</view>
</view> </view>
</template> </template>
@@ -13,6 +22,7 @@ export default {
}, },
data() { data() {
return { return {
webUrl: this.$VUE_APP_RESOURCES_URL,
giftCard: {}, giftCard: {},
giftChooseAddress: {} giftChooseAddress: {}
} }
@@ -49,6 +59,30 @@ export default {
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.wrap-box{
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 400rpx;
}
.go-btn{
border-radius: 200rpx;
padding: 8rpx 20rpx;
font-weight: bold;
margin-top: 60rpx;
width: fit-content;
}
.no-img-wrap{
height: 100vh;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
}
.no-img-wrap image{
width: 280rpx;
height: 280rpx;
}
.top-card{ .top-card{
width: 710rpx; width: 710rpx;
height: 280rpx; height: 280rpx;