You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
346 lines
7.8 KiB
346 lines
7.8 KiB
<template>
|
|
<view class="dr" :style="{'--sb': statusBarHeight + 'px'}">
|
|
<view class="dr-bg"></view>
|
|
<view class="nav" :style="{paddingTop: statusBarHeight + 'px'}">
|
|
<view class="nav-back" @tap="goBack"><text class="nav-back-icon">‹</text></view>
|
|
<view class="nav-title">开奖结果</view>
|
|
</view>
|
|
|
|
<scroll-view scroll-y class="dr-scroll" :style="{paddingTop: (statusBarHeight + 44) + 'px'}">
|
|
<!-- 切换 -->
|
|
<view class="dr-tabs">
|
|
<view class="dr-tab" :class="{on: tab===0}" @tap="tab=0">最近开奖</view>
|
|
<view class="dr-tab" :class="{on: tab===1}" @tap="tab=1">我的中奖</view>
|
|
</view>
|
|
|
|
<block v-if="tab===0">
|
|
<view v-if="record" class="dr-card">
|
|
<view class="dr-period">第 {{record.periodNo}} 期</view>
|
|
<view class="dr-amount"><text>¥</text>{{Number(record.poolAmount||0).toFixed(2)}}</view>
|
|
<view class="dr-meta">
|
|
<text>参与 {{record.joinCount}} 人</text>
|
|
<text>·</text>
|
|
<text>中奖 {{record.winnerCount}} 人</text>
|
|
</view>
|
|
<view class="dr-time">开奖时间 {{record.drawTime}}</view>
|
|
</view>
|
|
<view v-else class="dr-empty">本商圈暂未开奖,敬请期待 🌌</view>
|
|
|
|
<view class="dr-winners" v-if="winners && winners.length">
|
|
<view class="dr-sec-title">中奖名单</view>
|
|
<view class="dr-winner" v-for="(w, i) in winners" :key="i">
|
|
<text class="dr-w-level" :class="'lv'+w.rewardLevel">{{w.levelName}}</text>
|
|
<text class="dr-w-name">{{w.userName || '神秘居民'}}</text>
|
|
<text class="dr-w-amount">¥{{Number(w.amount||0).toFixed(2)}}</text>
|
|
</view>
|
|
</view>
|
|
</block>
|
|
|
|
<block v-else>
|
|
<view v-if="myWinning && myWinning.length" class="dr-my">
|
|
<view class="dr-my-item" v-for="(w, i) in myWinning" :key="i">
|
|
<view class="dr-my-left">
|
|
<text class="dr-w-level" :class="'lv'+w.rewardLevel">{{w.levelName}}</text>
|
|
<text class="dr-my-period">第 {{w.periodNo}} 期</text>
|
|
</view>
|
|
<text class="dr-my-amount">¥{{Number(w.amount||0).toFixed(2)}}</text>
|
|
<view class="dr-my-btn" :class="{done: w.isReceived===1}" @tap="receive(w)">
|
|
{{w.isReceived===1 ? '已领取' : '领取'}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-else class="dr-empty">还没有中奖记录,继续攒券瓜分奖池</view>
|
|
</block>
|
|
<view style="height:60rpx;"></view>
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
statusBarHeight: 20,
|
|
tab: 0,
|
|
userId: '',
|
|
regionId: '',
|
|
record: null,
|
|
winners: [],
|
|
myWinning: []
|
|
}
|
|
},
|
|
onLoad() {
|
|
const sys = uni.getSystemInfoSync()
|
|
this.statusBarHeight = sys.statusBarHeight || 20
|
|
this.userId = uni.getStorageSync('id') || ''
|
|
try {
|
|
const area = uni.getStorageSync('area')
|
|
if (area) this.regionId = JSON.parse(area).id || ''
|
|
} catch (e) {}
|
|
if (!this.regionId) {
|
|
this.tui.toast('未获取到校区信息,开奖仅限本区域内进行')
|
|
return
|
|
}
|
|
this.loadResult()
|
|
this.loadMyWinning()
|
|
},
|
|
methods: {
|
|
loadResult() {
|
|
this.tui.request('/app/planet/draw/result', 'POST', {
|
|
userId: this.userId,
|
|
regionId: this.regionId
|
|
}).then((res) => {
|
|
if (res.code == 200 && res.result) {
|
|
this.record = res.result.record
|
|
this.winners = res.result.winners || []
|
|
}
|
|
})
|
|
},
|
|
loadMyWinning() {
|
|
this.tui.request('/app/planet/draw/myWinning', 'POST', {
|
|
userId: this.userId,
|
|
regionId: this.regionId
|
|
}, false, false, true).then((res) => {
|
|
if (res.code == 200) this.myWinning = res.result || []
|
|
})
|
|
},
|
|
receive(w) {
|
|
if (w.isReceived === 1) return
|
|
this.tui.request('/app/planet/draw/receive', 'POST', {
|
|
userId: this.userId,
|
|
regionId: this.regionId,
|
|
winnerId: w.id
|
|
}).then((res) => {
|
|
this.tui.toast(res.message, 1500, res.code == 200)
|
|
if (res.code == 200) this.loadMyWinning()
|
|
})
|
|
},
|
|
goBack() {
|
|
uni.navigateBack({ delta: 1 })
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.dr {
|
|
min-height: 100vh;
|
|
background: linear-gradient(155deg, #F3FFF4 0%, #EAF8FF 46%, #F7EEFF 100%);
|
|
color: #12342F;
|
|
}
|
|
|
|
.dr-bg {
|
|
position: fixed;
|
|
top: 0; left: 0; right: 0; height: 500rpx;
|
|
background:
|
|
radial-gradient(circle at 78% 12%, rgba(79,183,255,0.28), transparent 42%),
|
|
radial-gradient(circle at 12% 30%, rgba(53,214,166,0.22), transparent 40%);
|
|
pointer-events: none;
|
|
}
|
|
|
|
.nav {
|
|
position: fixed;
|
|
top: 0; left: 0; right: 0;
|
|
height: 44px;
|
|
z-index: 20;
|
|
display: flex;
|
|
align-items: flex-end;
|
|
justify-content: center;
|
|
background: linear-gradient(180deg, rgba(243,255,244,0.9), rgba(243,255,244,0));
|
|
}
|
|
|
|
.nav-back {
|
|
position: absolute;
|
|
left: 20rpx;
|
|
bottom: 0;
|
|
height: 44px;
|
|
width: 60rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.nav-back-icon {
|
|
color: #12342F;
|
|
font-size: 48rpx;
|
|
}
|
|
|
|
.nav-title {
|
|
color: #12342F;
|
|
font-size: 34rpx;
|
|
font-weight: 800;
|
|
padding-bottom: 6rpx;
|
|
}
|
|
|
|
.dr-scroll {
|
|
height: 100vh;
|
|
box-sizing: border-box;
|
|
padding: 0 32rpx;
|
|
}
|
|
|
|
.dr-tabs {
|
|
display: flex;
|
|
margin-top: 20rpx;
|
|
background: rgba(255,255,255,0.68);
|
|
border-radius: 36rpx;
|
|
padding: 6rpx;
|
|
border: 1rpx solid rgba(255,255,255,0.92);
|
|
box-shadow: 0 16rpx 34rpx rgba(53,214,166,0.1);
|
|
}
|
|
|
|
.dr-tab {
|
|
flex: 1;
|
|
height: 64rpx;
|
|
line-height: 64rpx;
|
|
text-align: center;
|
|
border-radius: 32rpx;
|
|
color: #42635E;
|
|
font-size: 26rpx;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.dr-tab.on {
|
|
background: linear-gradient(135deg, #35D6A6, #4FB7FF);
|
|
color: #FFFFFF;
|
|
font-weight: 900;
|
|
}
|
|
|
|
.dr-card {
|
|
margin-top: 28rpx;
|
|
padding: 40rpx;
|
|
border-radius: 42rpx;
|
|
background: linear-gradient(150deg, rgba(255,255,255,0.9), rgba(255,248,222,0.72));
|
|
border: 2rpx solid rgba(255,255,255,0.92);
|
|
text-align: center;
|
|
box-shadow: 0 24rpx 60rpx rgba(255,184,77,0.14);
|
|
}
|
|
|
|
.dr-period {
|
|
color: #7E9691;
|
|
font-size: 24rpx;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.dr-amount {
|
|
margin-top: 12rpx;
|
|
color: #22B889;
|
|
font-size: 72rpx;
|
|
font-weight: 800;
|
|
}
|
|
|
|
.dr-amount text {
|
|
font-size: 36rpx;
|
|
}
|
|
|
|
.dr-meta {
|
|
margin-top: 14rpx;
|
|
color: #42635E;
|
|
font-size: 24rpx;
|
|
}
|
|
|
|
.dr-meta text {
|
|
margin: 0 8rpx;
|
|
}
|
|
|
|
.dr-time {
|
|
margin-top: 10rpx;
|
|
color: #7E9691;
|
|
font-size: 22rpx;
|
|
}
|
|
|
|
.dr-empty {
|
|
margin-top: 120rpx;
|
|
text-align: center;
|
|
color: #7E9691;
|
|
font-size: 26rpx;
|
|
}
|
|
|
|
.dr-sec-title {
|
|
margin: 32rpx 0 18rpx;
|
|
color: #12342F;
|
|
font-size: 30rpx;
|
|
font-weight: 900;
|
|
}
|
|
|
|
.dr-winner {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 22rpx 24rpx;
|
|
margin-bottom: 14rpx;
|
|
border-radius: 28rpx;
|
|
background: rgba(255,255,255,0.72);
|
|
border: 1rpx solid rgba(255,255,255,0.9);
|
|
box-shadow: 0 12rpx 28rpx rgba(53,214,166,0.08);
|
|
}
|
|
|
|
.dr-w-level {
|
|
font-size: 22rpx;
|
|
padding: 2rpx 14rpx;
|
|
border-radius: 8rpx;
|
|
background: rgba(53,214,166,0.14);
|
|
color: #22B889;
|
|
}
|
|
|
|
.dr-w-level.lv1 { background: rgba(255,122,89,0.14); color: #FF7A59; }
|
|
.dr-w-level.lv2 { background: rgba(255,184,77,0.18); color: #C98716; }
|
|
|
|
.dr-w-name {
|
|
flex: 1;
|
|
margin-left: 18rpx;
|
|
color: #12342F;
|
|
font-size: 26rpx;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.dr-w-amount {
|
|
color: #22B889;
|
|
font-size: 28rpx;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.dr-my-item {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 26rpx 24rpx;
|
|
margin-top: 18rpx;
|
|
border-radius: 30rpx;
|
|
background: rgba(255,255,255,0.74);
|
|
border: 1rpx solid rgba(255,255,255,0.92);
|
|
box-shadow: 0 12rpx 30rpx rgba(53,214,166,0.08);
|
|
}
|
|
|
|
.dr-my-left {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.dr-my-period {
|
|
margin-top: 10rpx;
|
|
color: #7E9691;
|
|
font-size: 22rpx;
|
|
}
|
|
|
|
.dr-my-amount {
|
|
color: #22B889;
|
|
font-size: 32rpx;
|
|
font-weight: 800;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.dr-my-btn {
|
|
padding: 0 26rpx;
|
|
height: 60rpx;
|
|
line-height: 60rpx;
|
|
border-radius: 30rpx;
|
|
background: linear-gradient(135deg, #35D6A6, #4FB7FF);
|
|
color: #FFFFFF;
|
|
font-size: 24rpx;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.dr-my-btn.done {
|
|
background: rgba(18,52,47,0.08);
|
|
color: #9AA9A5;
|
|
}
|
|
</style>
|
|
|