283 lines
6.5 KiB
Vue
283 lines
6.5 KiB
Vue
|
|
<template>
|
|||
|
|
<view class="container">
|
|||
|
|
<custom-navbar title="我的礼品" :show-back="true" title-color="#000" background-color="#FFFFFF"></custom-navbar>
|
|||
|
|
<!-- Tab 内容区域 -->
|
|||
|
|
<view class="tab-nav">
|
|||
|
|
<view v-for="tab in tabs" :key="tab.id" class="tab-item" :class="{ active: queryData.issue === tab.id }"
|
|||
|
|
@click="switchTab(tab.id)">
|
|||
|
|
{{ tab.name }}
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
<CommonList ref="groupRef" apiUrl="/user/lottery/record"
|
|||
|
|
:listScrollHeight="`calc(100vh - ${statusBarHeight + 220}rpx)`">
|
|||
|
|
<template #listData="{ list }">
|
|||
|
|
<view class="scoll-lists">
|
|||
|
|
<view class="scoll-lists-item" v-for="(item, index) in list" :key="index" @click="goDetail(item)">
|
|||
|
|
<view class="flex-row-start">
|
|||
|
|
<!-- 左侧行李箱图片 -->
|
|||
|
|
<image class="prize-img" :src="item.prize_img"></image>
|
|||
|
|
|
|||
|
|
<!-- 右侧信息区域 -->
|
|||
|
|
<view class="prize-info">
|
|||
|
|
<!-- 奖品名称 -->
|
|||
|
|
<view class="prize-title">{{ item.prize_name }}</view>
|
|||
|
|
<!-- 邀请时间 -->
|
|||
|
|
<view class="invite-time">中奖时间:{{ item.lottery_time }}</view>
|
|||
|
|
<!-- 兑奖方式标签 -->
|
|||
|
|
<view class="award-type">兑奖方式:{{ item.type==2?"线上发放":"邮寄"}}</view>
|
|||
|
|
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
<!-- 底部:截止时间 + 地址按钮 -->
|
|||
|
|
<view class="bottom-bar">
|
|||
|
|
<view class="expire-time">{{ item.claim_deadline }}前兑换</view>
|
|||
|
|
<view class="address-btn flex-row-center-center" v-if="item.type==3 && item.issue !=3 ">
|
|||
|
|
<image class="address-btn-img" src="/static/images/icons/lottery-address.png" v-if="!item.claim_address || !item.claim_address.length"></image>
|
|||
|
|
<text>{{ (item.claim_address && item.claim_address.length) || item.issue!=1?"看兑奖地址":"填写发货地址" }}</text>
|
|||
|
|
</view>
|
|||
|
|
<view class="address-btn flex-row-center-center" v-if="item.type==2 && item.issue==1">
|
|||
|
|
<text>去领取</text>
|
|||
|
|
</view>
|
|||
|
|
<view class="address-btn flex-row-center-center" v-if="item.type==2 && item.issue==2">
|
|||
|
|
<text>已发放</text>
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
</view>
|
|||
|
|
</view>
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<!-- 空数据状态 -->
|
|||
|
|
<template #empty>
|
|||
|
|
<noData></noData>
|
|||
|
|
</template>
|
|||
|
|
</CommonList>
|
|||
|
|
</view>
|
|||
|
|
|
|||
|
|
</template>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
import CommonList from "@/components/common/CommonList.vue";
|
|||
|
|
import request from "@/utils/request";
|
|||
|
|
export default {
|
|||
|
|
components: {
|
|||
|
|
CommonList,
|
|||
|
|
},
|
|||
|
|
data() {
|
|||
|
|
return {
|
|||
|
|
queryData: {
|
|||
|
|
issue: 1,
|
|||
|
|
},
|
|||
|
|
tabs: [{
|
|||
|
|
id: 1,
|
|||
|
|
name: "待发放",
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 2,
|
|||
|
|
name: "已发放",
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: 3,
|
|||
|
|
name: "已失效",
|
|||
|
|
},
|
|||
|
|
],
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
async onLoad(options) {
|
|||
|
|
if (options.activity_id) {
|
|||
|
|
this.queryData.activity_id = options.activity_id
|
|||
|
|
}
|
|||
|
|
this.statusBarHeight = this.getRpxStatusBarHeight();
|
|||
|
|
this.$nextTick(() => {
|
|||
|
|
this.search();
|
|||
|
|
});
|
|||
|
|
},
|
|||
|
|
onShow() {
|
|||
|
|
if(this.queryData.activity_id){
|
|||
|
|
this.search();
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
methods: {
|
|||
|
|
saveSuccess(){
|
|||
|
|
setTimeout(()=>{
|
|||
|
|
uni.showToast({
|
|||
|
|
title: "提交成功",
|
|||
|
|
icon: "none",
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
},1000)
|
|||
|
|
},
|
|||
|
|
// 切换 Tab 的方法
|
|||
|
|
switchTab(tabId) {
|
|||
|
|
this.queryData.issue = tabId;
|
|||
|
|
this.search();
|
|||
|
|
},
|
|||
|
|
search() {
|
|||
|
|
this.$refs.groupRef.manualRefresh(this.queryData);
|
|||
|
|
},
|
|||
|
|
goDetail(item) {
|
|||
|
|
uni.navigateTo({
|
|||
|
|
url: `/pages/lottery/winDetail?id=${item.id}`
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
<style lang="less">
|
|||
|
|
.container {
|
|||
|
|
.tab-nav {
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
padding: 0 80rpx;
|
|||
|
|
background: #fff;
|
|||
|
|
|
|||
|
|
.tab-item {
|
|||
|
|
padding: 30rpx 0rpx 40rpx 0rpx;
|
|||
|
|
cursor: pointer;
|
|||
|
|
font-weight: 500;
|
|||
|
|
font-size: 30rpx;
|
|||
|
|
color: #333333;
|
|||
|
|
line-height: 42rpx;
|
|||
|
|
text-align: left;
|
|||
|
|
font-style: normal;
|
|||
|
|
/* 预先设置透明边框,防止切换时布局跳动 */
|
|||
|
|
|
|||
|
|
&.active {
|
|||
|
|
color: #e8101e;
|
|||
|
|
font-weight: 500;
|
|||
|
|
position: relative;
|
|||
|
|
|
|||
|
|
&:after {
|
|||
|
|
content: "";
|
|||
|
|
position: absolute;
|
|||
|
|
bottom: 27rpx; // 定位在底部边框的下方
|
|||
|
|
left: 50%;
|
|||
|
|
transform: translateX(-50%); // 水平居中
|
|||
|
|
|
|||
|
|
/* 激活时显示红色边框 */
|
|||
|
|
width: 34rpx;
|
|||
|
|
height: 6rpx;
|
|||
|
|
background: linear-gradient(306deg, #e8101e 0%, #fc563b 100%);
|
|||
|
|
border-radius: 3rpx;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.scoll-lists {
|
|||
|
|
.scoll-lists-item {
|
|||
|
|
padding: 20rpx 20rpx 12rpx 20rpx;
|
|||
|
|
background: #FFFFFF;
|
|||
|
|
border-radius: 20rpx;
|
|||
|
|
margin-bottom: 20rpx;
|
|||
|
|
|
|||
|
|
// 左侧图片
|
|||
|
|
.prize-img {
|
|||
|
|
width: 140rpx;
|
|||
|
|
height: 140rpx;
|
|||
|
|
border-radius: 20rpx;
|
|||
|
|
aspect-ratio: 1/1; // 保持图片比例
|
|||
|
|
object-fit: contain;
|
|||
|
|
margin-right: 24rpx;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 右侧信息区域
|
|||
|
|
.prize-info {
|
|||
|
|
flex: 1;
|
|||
|
|
|
|||
|
|
// 奖品名称
|
|||
|
|
.prize-title {
|
|||
|
|
margin-bottom: 10rpx;
|
|||
|
|
font-weight: 500;
|
|||
|
|
font-size: 28rpx;
|
|||
|
|
color: #333333;
|
|||
|
|
line-height: 40rpx;
|
|||
|
|
text-align: left;
|
|||
|
|
font-style: normal;
|
|||
|
|
max-width: 500rpx;
|
|||
|
|
white-space: nowrap;
|
|||
|
|
overflow: hidden;
|
|||
|
|
text-overflow: ellipsis;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 邀请时间
|
|||
|
|
.invite-time {
|
|||
|
|
font-weight: 400;
|
|||
|
|
font-size: 24rpx;
|
|||
|
|
color: #666666;
|
|||
|
|
line-height: 33rpx;
|
|||
|
|
text-align: left;
|
|||
|
|
font-style: normal;
|
|||
|
|
margin-bottom: 28rpx;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 兑奖方式标签
|
|||
|
|
.award-type {
|
|||
|
|
padding: 0 8rpx;
|
|||
|
|
height: 37rpx;
|
|||
|
|
border-radius: 10rpx;
|
|||
|
|
border: 1rpx solid rgba(210, 87, 85, 0.5);
|
|||
|
|
font-weight: 400;
|
|||
|
|
font-size: 20rpx;
|
|||
|
|
color: #DB2B28;
|
|||
|
|
line-height: 37rpx;
|
|||
|
|
text-align: left;
|
|||
|
|
font-style: normal;
|
|||
|
|
width: fit-content;
|
|||
|
|
transform: translateY(-12rpx);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 底部栏(截止时间 + 按钮)
|
|||
|
|
.bottom-bar {
|
|||
|
|
padding-top: 22rpx;
|
|||
|
|
border-top: 1rpx solid #F1F1F1;
|
|||
|
|
margin-top: 22rpx;
|
|||
|
|
display: flex;
|
|||
|
|
justify-content: space-between;
|
|||
|
|
align-items: center;
|
|||
|
|
|
|||
|
|
// 截止时间
|
|||
|
|
.expire-time {
|
|||
|
|
font-weight: 400;
|
|||
|
|
font-size: 24rpx;
|
|||
|
|
color: #666666;
|
|||
|
|
line-height: 33rpx;
|
|||
|
|
text-align: left;
|
|||
|
|
font-style: normal;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 填写地址按钮
|
|||
|
|
.address-btn {
|
|||
|
|
height: 47rpx;
|
|||
|
|
padding: 0 20rpx;
|
|||
|
|
background: #F43642;
|
|||
|
|
border-radius: 24rpx;
|
|||
|
|
font-weight: 400;
|
|||
|
|
font-size: 24rpx;
|
|||
|
|
color: #FFFFFF;
|
|||
|
|
text-align: left;
|
|||
|
|
font-style: normal;
|
|||
|
|
.address-btn-img{
|
|||
|
|
width: 25rpx;
|
|||
|
|
height: 25rpx;
|
|||
|
|
margin-right: 8rpx;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
.common-list {
|
|||
|
|
background: #f5f5f5!important;
|
|||
|
|
padding-bottom: 0rpx!important;
|
|||
|
|
|
|||
|
|
::v-deep .list-container {
|
|||
|
|
padding: 0 20rpx!important;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
</style>
|