Feat:抽奖2.0(查漏补缺)

This commit is contained in:
LinCyJang
2026-04-30 02:04:25 +08:00
parent 6cb403c5d5
commit c3c0483625
10 changed files with 515 additions and 201 deletions
+170 -56
View File
@@ -1,13 +1,13 @@
<template>
<view class="winners-page">
<view class="custom-header" :style="{ paddingTop: `${statusBarHeight}px` }">
<!-- <view class="custom-header" :style="{ paddingTop: `${statusBarHeight}px` }">
<view class="header-inner">
<view class="header-back" @click="goBack">
<text class="header-back-icon"></text>
<u-icon name="arrow-left" size="24" color="#333" class="header-back-icon"></u-icon>
</view>
<view class="header-title">中奖名单</view>
</view>
</view>
</view> -->
<view class="content-wrap" v-if="loaded">
<view v-if="!showHistory" class="draw-info-wrap" :style="{ backgroundImage: `url(${webUrl}/zhongjiang5.png)` }">
@@ -53,34 +53,53 @@
<view class="draw-time" style="margin-top: 60rpx">开奖时间{{ drawTime }}</view>
</view>
</view>
<view class="win-banner" v-if="hasWon === 1 && userWinList.length > 0" :style="{ backgroundImage: `url(${webUrl}/zhongjiangn.png)` }">
<view class="win-banner-subtitle">
您的抽奖码 <text class="code">{{ userWinList[0].ticketCode }}</text> 获得了
</view>
<view class="prize-card" v-for="(prize, index) in userWinList" :key="index">
<view class="prize-img-wrap">
<image class="prize-img" :src="prize.prizeImage" mode="aspectFill"></image>
<view class="win-banner" v-if="hasWon === 1 && userWinList.length > 0">
<view class="win-banner-bg-top" :style="{ backgroundImage: `url(${webUrl}/zhongjiangtop.png)` }"></view>
<view class="win-banner-bg-bottom" :style="{ backgroundImage: `url(${webUrl}/zhongjiangbottom.png)` }"></view>
<view class="win-banner-content">
<view class="win-banner-subtitle">
您的抽奖码 <text class="code">{{ userWinList[0].ticketCode }}</text> 获得了
</view>
<view class="prize-info">
<view class="prize-name-wrap">
<text class="prize-level">{{ prize.levelName }}</text>
<text class="prize-name">{{ prize.prizeName }}</text>
<view class="prize-card" v-for="(prize, index) in userWinList" :key="index">
<view class="prize-img-wrap">
<image class="prize-img" :src="prize.prizeImage" mode="aspectFill"></image>
</view>
<view class="prize-info">
<view class="prize-name-wrap">
<text class="prize-level">{{ prize.levelName }}</text>
<text class="prize-name">{{ prize.prizeName }}</text>
</view>
<view class="prize-desc">{{ prize.prizeDesc || "默认" }}</view>
</view>
<view class="prize-desc">{{ prize.prizeDesc || "默认" }}</view>
</view>
</view>
<button class="my-tickets-btn" @click="handleClaimNow">
<text class="btn-text">立即领取</text>
</button>
<view class="claim-tip">*请在7天内领取过期失效</view>
<button v-if="!showHistory" class="my-tickets-btn" @click="handleClaimNow">
<text class="btn-text">立即领取</text>
</button>
<button v-if="showHistory" class="my-tickets-btn" @click="navToMyTickets">
<text class="btn-text">我的抽奖码</text>
</button>
<view class="claim-tip">*请在7天内领取过期失效</view>
</view>
</view>
<!-- 把半圆提出来跟大卡片平级并且放在大卡片前面让大卡片的背景可以遮住它们的下半截 -->
<view class="badge-side-wrap">
<view class="badge-side left-side"></view>
<view class="badge-side right-side"></view>
</view>
<view class="winners-list-wrap">
<view class="list-title-badge" :style="{ backgroundImage: `url(${webUrl}/zhongjiang6.png)` }">
<text class="gift-icon" style="opacity: 0;">🎁</text>
<text class="title-text" style="opacity: 0;">中奖名单</text>
<view class="list-title-badge">
<!-- 主图背景 -->
<view class="badge-bg" :style="{ backgroundImage: `url(${webUrl}/zhongjiang6.png)` }"></view>
<!-- 内容区 -->
<view class="badge-content">
<text class="gift-icon" style="opacity: 0;">🎁</text>
<text class="title-text" style="opacity: 0;">中奖名单</text>
</view>
</view>
<view class="list-content">
@@ -108,7 +127,7 @@
<view class="coupon-popup" @click.stop>
<view class="popup-close" @click="closeCouponSuccessPopup">×</view>
<view class="popup-icon-wrap">
<text class="popup-icon">🎉</text>
<image class="popup-success-icon" :src="webUrl + '/home/qingzhu.png'" mode="aspectFit" />
</view>
<view class="popup-title">领取成功</view>
<view class="popup-desc">您的奖品已经领取成功请前往我的优惠券查看详情</view>
@@ -229,9 +248,17 @@ export default {
return prizeType === 3 || prize.prizeType === "coupon" || /券/.test(prizeName)
},
navToReceiveInfo(prize = {}) {
const query = `?source=lottery&ticketCode=${encodeURIComponent(prize.ticketCode || "")}&prizeName=${encodeURIComponent(prize.prizeName || "")}`
const query = [
`source=lottery`,
`lotteryRecordId=${encodeURIComponent(prize.lotteryRecordId || "")}`,
`ticketCode=${encodeURIComponent(prize.ticketCode || "")}`,
`prizeName=${encodeURIComponent(prize.prizeName || "")}`,
`prizeType=${encodeURIComponent(prize.prizeType || "")}`,
`prizeTypeName=${encodeURIComponent(prize.prizeTypeName || "")}`,
`prizeImage=${encodeURIComponent(prize.prizeImage || "")}`
].join("&")
uni.navigateTo({
url: `/pages/user/address/AddAddress/index${query}`
url: `/pkg-video/views/county-claim-address?${query}`
})
},
closeCouponSuccessPopup() {
@@ -276,11 +303,13 @@ export default {
},
mapUserWinList(ticketList = []) {
return ticketList.map(item => ({
lotteryRecordId: item.id || item.lotteryRecordId || item.ticketId || item.recordId || "",
levelName: item.levelName || item.prizeLevelName || "中奖奖品",
prizeName: item.prizeName || item.awardName || "神秘奖品",
prizeDesc: item.prizeDesc || item.remark || "默认",
ticketCode: item.ticketCode || item.code || "--",
prizeType: item.prizeType,
prizeTypeName: item.prizeTypeName || item.prizeCategoryName || "",
prizeImage: item.prizeImage || item.image || ""
}))
},
@@ -318,6 +347,10 @@ export default {
</script>
<style lang="less" scoped>
.popup-success-icon {
width: 92rpx;
height: 92rpx;
}
.winners-page {
min-height: 100vh;
background: #f4f6f8;
@@ -489,10 +522,35 @@ export default {
text-align: center;
margin-bottom: 62rpx;
position: relative;
background-size: 100%;
background-repeat: no-repeat;
background-color: transparent;
.win-banner-bg-top {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 120rpx; /* 根据顶部图实际比例微调 */
background-size: 100% 100%;
background-repeat: no-repeat;
z-index: 1;
}
.win-banner-bg-bottom {
position: absolute;
top: 118rpx; /* 让上下拼接处没有缝隙,可以覆盖 2rpx */
bottom: 0;
left: 0;
width: 100%;
background-size: 100% 100%;
background-repeat: no-repeat;
z-index: 1;
}
.win-banner-content {
position: relative;
z-index: 2;
}
.win-badge {
position: absolute;
top: -34rpx;
@@ -521,7 +579,7 @@ export default {
font-size: 28rpx;
color: #fff;
margin-bottom: 20rpx;
margin-top: 8rpx;
margin-top: 50rpx;
font-weight: 700;
.code {
@@ -589,8 +647,10 @@ export default {
}
.my-tickets-btn {
background: linear-gradient(180deg, #ffd33d 0%, #ffb300 100%);
border: 4rpx solid #1f1f1f;
background-size: 100% 100%;
background-repeat: no-repeat;
background-color: transparent;
border: none;
border-radius: 48rpx;
padding: 0;
height: 90rpx;
@@ -599,19 +659,21 @@ export default {
display: flex;
align-items: center;
justify-content: center;
box-shadow: inset 0 -8rpx 0 rgba(0, 0, 0, 0.12), 0 8rpx 0 #1f1f1f;
box-shadow: inset 0 -12rpx 0 #FAA100, inset 0 12rpx 0 #FAA100, inset -12rpx 0rpx 0rpx #FAA100, inset 12rpx 0rpx 0 #FAA100;
transition: all 0.1s;
background: #FDB400;
&:active {
transform: translateY(4rpx);
box-shadow: inset 0 -4rpx 0 rgba(0, 0, 0, 0.12), 0 4rpx 0 #1f1f1f;
box-shadow: inset 0 -4rpx 0 #FAA100;
}
.btn-text {
font-size: 50rpx;
font-size: 44rpx;
font-weight: 900;
color: #fff;
text-shadow: -2rpx -2rpx 0 #1f1f1f, 2rpx -2rpx 0 #1f1f1f, -2rpx 2rpx 0 #1f1f1f, 2rpx 2rpx 0 #1f1f1f, 0 4rpx 0 #1f1f1f;
color: #111;
text-shadow: -2rpx -2rpx 0 #fff, 2rpx -2rpx 0 #fff, -2rpx 2rpx 0 #fff, 2rpx 2rpx 0 #fff, 0 2rpx 0 #fff;
letter-spacing: 2rpx;
}
}
@@ -624,11 +686,41 @@ export default {
}
}
/* 新增:半圆挂在列表大卡片外部的相对容器上 */
.badge-side-wrap {
position: relative;
width: 100%;
height: 0; /* 占位 0,不影响后续流 */
z-index: 1; /* 在 winners-list-wrap 之前,所以会被它的 z-index 盖住,或自然被后面元素盖住 */
.badge-side {
position: absolute;
top: -18rpx; /* 调整此值以对齐中奖名单背景的垂直中线 */
width: 40rpx;
height: 38rpx;
background-color: #fdb400;
border: 4rpx solid #111;
}
.left-side {
left: calc(50% - 160rpx); /* 根据主图 280rpx 宽算,一半140rpx,加上突出的 20rpx */
border-radius: 40rpx 0 0 40rpx;
border-right: none;
}
.right-side {
right: calc(50% - 160rpx);
border-radius: 0 40rpx 40rpx 0;
border-left: none;
}
}
.winners-list-wrap {
background: #fff;
border-radius: 28rpx;
padding: 46rpx 24rpx 10rpx;
position: relative;
z-index: 2; /* 确保盖住上面的 badge-side-wrap */
box-shadow: 0 5rpx 0 #e6e8ec;
.list-title-badge {
@@ -638,20 +730,42 @@ export default {
transform: translateX(-50%);
display: flex;
align-items: center;
padding: 14rpx 34rpx;
background-size: 100% 100%;
background-repeat: no-repeat;
background-color: transparent;
justify-content: center;
width: 280rpx; /* 根据实际标题框宽度设定,让它包裹住背景图 */
height: 80rpx;
z-index: 3;
.gift-icon {
font-size: 28rpx;
margin-right: 8rpx;
/* 主背景图,层级2,盖住半圆的一部分 */
.badge-bg {
position: absolute;
top: -5rpx;
left: 0;
width: 100%;
height: 100%;
background-size: 100% 100%;
background-repeat: no-repeat;
z-index: 2;
}
.title-text {
font-size: 34rpx;
font-weight: 900;
color: #222;
/* 文字内容,层级3,位于最上层 */
.badge-content {
position: relative;
z-index: 3;
display: flex;
align-items: center;
padding: 0 34rpx;
height: 100%;
.gift-icon {
font-size: 28rpx;
margin-right: 8rpx;
}
.title-text {
font-size: 34rpx;
font-weight: 900;
color: #222;
}
}
}
@@ -671,7 +785,7 @@ export default {
flex: 1;
.item-prize {
font-size: 36rpx;
font-size: 28rpx;
color: #333;
margin-bottom: 8rpx;
line-height: 1.25;
@@ -686,7 +800,7 @@ export default {
}
.item-code {
font-size: 32rpx;
font-size: 28rpx;
color: #666;
font-weight: 700;
@@ -702,14 +816,14 @@ export default {
text-align: right;
.user-name {
font-size: 32rpx;
font-size: 28rpx;
color: #666;
font-weight: 700;
margin-bottom: 8rpx;
}
.user-phone {
font-size: 30rpx;
font-size: 28rpx;
color: #999;
font-weight: 600;
}
@@ -737,8 +851,8 @@ export default {
}
.coupon-popup {
width: 100%;
max-width: 620rpx;
width: 550rpx;
height: 560rpx;
background: #fff;
border-radius: 32rpx;
padding: 26rpx 34rpx 42rpx;
@@ -752,7 +866,7 @@ export default {
width: 40rpx;
height: 40rpx;
border-radius: 50%;
border: 2rpx solid #333;
border: 4rpx solid #333;
font-size: 40rpx;
font-weight: 700;
color: #333;
@@ -776,7 +890,7 @@ export default {
.popup-title {
text-align: center;
font-size: 60rpx;
font-size: 50rpx;
font-weight: 900;
color: #222;
margin-top: 12rpx;