sadjv3_user/my/hongbao/youhuijuan.vue

295 lines
6.8 KiB
Vue
Raw Normal View History

2024-06-05 19:16:02 +08:00
<template>
<view>
2024-06-12 15:52:21 +08:00
<view class="flex align-center justify-between you-nav">
2024-06-05 19:16:02 +08:00
<view v-for="(item,index) in tab" :key="index" class="text-center box"
:class="tabIndex == index?'tanColor':''" @click="bindTab(item.state)">
<view style="z-index: 9;">{{item.name}}</view>
<view class="" :class="tabIndex == index?'line':''"></view>
</view>
</view>
<view v-if="tabIndex == 0">
2024-06-12 15:52:21 +08:00
<view class="youhui-weiyong youhui-list" v-for="(item,index) in hongbao" :key="index">
<view class="youhui-view-left">
<view class="youhui-view-left-yuan">
<span class="youhui-view-left-num">{{item.money}}</span>
<span class="youhui-view-left-text"></span>
2024-06-05 19:16:02 +08:00
</view>
2024-06-12 15:52:21 +08:00
<view class="youhui-view-left-bottom">
{{item.minMoney}}元可用
</view>
</view>
<view class="youhui-view-right">
<view class="youhui-view-right-top">
<view class="youhui-view-right-title">{{item.couponName}}</view>
<view class="youhui-view-right-time">{{item.endDate}}</view>
</view>
<view class="youhui-view-right-btn" @tap="shiYong()">立即使用</view>
2024-06-05 19:16:02 +08:00
</view>
</view>
</view>
<view v-if="tabIndex == 1">
2024-06-12 15:52:21 +08:00
<view class="youhui-yiyong youhui-list" v-for="(item,index) in hongbao" :key="index">
<view class="youhui-view-left">
<view class="youhui-view-left-yuan">
<span class="youhui-view-left-num">{{item.money}}</span>
<span class="youhui-view-left-text"></span>
</view>
<view class="youhui-view-left-bottom">
{{item.minMoney}}元可用
2024-06-05 19:16:02 +08:00
</view>
</view>
2024-06-12 15:52:21 +08:00
<view class="youhui-view-right" style="justify-content: space-around;">
<view class="youhui-view-right-top">
<view class="youhui-view-right-title">{{item.couponName}}</view>
<view class="youhui-view-right-time">{{item.endDate}}</view>
</view>
<image class="youhui-img" src="../../static/youhuijuan/chapter.png"></image>
2024-06-05 19:16:02 +08:00
</view>
</view>
</view>
<view v-if="tabIndex == 2">
2024-06-12 15:52:21 +08:00
<view class="youhui-yiyong youhui-list" v-for="(item,index) in hongbao" :key="index">
<view class="youhui-view-left">
<view class="youhui-view-left-yuan">
<span class="youhui-view-left-num">{{item.money}}</span>
<span class="youhui-view-left-text"></span>
</view>
<view class="youhui-view-left-bottom">
{{item.minMoney}}元可用
2024-06-05 19:16:02 +08:00
</view>
</view>
2024-06-12 15:52:21 +08:00
<view class="youhui-view-right" style="justify-content: space-around;">
<view class="youhui-view-right-top">
<view class="youhui-view-right-title">{{item.couponName}}</view>
<view class="youhui-view-right-time">{{item.endDate}}</view>
</view>
<image class="youhui-img" src="../../static/youhuijuan/chapter1.png"></image>
2024-06-05 19:16:02 +08:00
</view>
</view>
</view>
<empty v-if="hongbao.length==0"></empty>
</view>
</template>
<script>
import empty from '@/components/empty.vue'
export default {
components:{
empty
},
data() {
return {
tab: [{
name: '可使用',
state: 0
}, {
name: '已使用',
state: 1
}, {
name: '已失效',
state: 2
}],
tabIndex: 0,
hongbao: [],
page: 1,
size: 10,
loadingType: 0,
scrollTop: false,
contentText: {
contentdown: '上拉显示更多',
contentrefresh: '正在加载...',
contentnomore: '没有更多数据了'
}
}
},
onLoad() {
this.getMyList();
},
methods: {
shiYong(){
uni.switchTab({
url:'/pages/index/index'
})
},
getMyList() {
this.loadingType = 1;
uni.showLoading({
title: '加载中...'
});
this.$Request.getT('/app/coupon/selectCouponUserList?page='+this.page+'&limit='+this.size+'&status=' + this.tabIndex).then(res => {
if (res.code == 0) {
if (this.page == 1) {
this.hongbao = [];
}
res.data.list.forEach(d => {
this.hongbao.push(d);
});
if (res.data.list.length === this.size) {
this.loadingType = 0;
} else {
this.loadingType = 3;
}
} else {
this.loadingType = 2;
}
uni.hideLoading();
});
},
bindTab(index) {
this.tabIndex = index
this.hongbao = [];
this.page = 1;
this.getMyList();
}
},
onPageScroll: function(e) {
this.scrollTop = e.scrollTop > 200;
},
onReachBottom: function() {
this.page = this.page + 1;
this.getMyList('');
},
onPullDownRefresh: function() {
this.page = 1;
this.getMyList('Refresh');
}
}
</script>
2024-06-12 15:52:21 +08:00
<style scoped>
.youhui-img{
width: 111.81rpx;
height: 111.81rpx;
}
.youhui-view-right-btn{
width: 158rpx;
height: 64rpx;
background: linear-gradient(-90deg, #019C88, #2DC48E);
border-radius: 32rpx;
text-align: center;
line-height: 64rpx;
font-weight: 400;
font-size: 28rpx;
color: #FFFFFF;
text-shadow: 0rpx 2rpx 4rpx rgba(0,119,104,0.44);
margin-left: 10px;
}
.youhui-view-right-time{
font-weight: 400;
font-size: 22rpx;
color: #999999;
}
.youhui-view-right-title{
font-weight: 400;
font-size: 32rpx;
color: #333333;
}
.youhui-view-right-top{
display: flex;
flex-direction: column;
align-items: center;
}
.youhui-view-right{
width: 502.08rpx;
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.youhui-view-left-bottom{
font-weight: 400;
font-size: 22rpx;
color: #FFFFFF;
}
.youhui-view-left-yuan{
display: flex;
flex-direction: row;
align-items: baseline;
color: #FFFFFF;
}
.youhui-view-left-num{
font-weight: bold;
font-size: 89rpx;
}
.youhui-view-left-text{
font-weight: bold;
font-size:24.31rpx;
}
.youhui-view-left{
width: 199rpx;
height: 242rpx;
display: flex;
flex-direction:column;
align-items: center;
justify-content: center;
}
.youhui-yiyong{
background-image: url('../../static/youhuijuan/coupons7.png');
}
.youhui-weiyong{
background-image: url('../../static/youhuijuan/coupons1.png');
}
.youhui-list{
width: 95%;
display: flex;
flex-direction: row;
height: 242rpx;
border-radius: 21rpx;
background-size: 100%;
margin: 20px auto;
2024-06-24 11:29:11 +08:00
justify-content: space-between;
2024-06-12 15:52:21 +08:00
}
.you-nav{
background: #FFFFFF;
padding: 14px 25px 0px 25px;
}
2024-06-05 19:16:02 +08:00
page {
background: #F5F5F5;
}
.bg {
background: #FFFFFF;
}
.box {
width: 128upx;
height: 60upx;
2024-06-12 15:52:21 +08:00
color: #666;
2024-06-05 19:16:02 +08:00
text-align: center;
2024-06-12 15:52:21 +08:00
font-weight: bold;
font-size: 34rpx;
2024-06-05 19:16:02 +08:00
z-index: 1;
}
.line {
2024-06-12 15:52:21 +08:00
width: 48px;
height: 14rpx;
background: linear-gradient(-48deg, #019C88, #2DC48E);
border-radius: 7rpx;
opacity: 0.35;
2024-06-05 19:16:02 +08:00
position: relative;
2024-06-12 15:52:21 +08:00
top: -7px;
2024-06-05 19:16:02 +08:00
z-index: -1;
left: 50%;
transform: translateX(-50%);
}
.tanColor {
2024-06-12 15:52:21 +08:00
color: #019C88;
2024-06-05 19:16:02 +08:00
font-weight: bold;
}
.btn {
width: 140upx;
height: 55upx;
border: 2upx solid #FF130A;
border-radius: 30upx;
text-align: center;
line-height: 55upx;
color: #FF130A;
font-size: 24upx;
}
</style>