| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 | <template>	<view class="youhuiquan">		<view class="flex justify-between padding-lr bg">			<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 class="card-box">			<view class="item" :class="tabIndex == 1 ||tabIndex == 2?'disabled':''"  v-for="(item,index) in hongbao" :key="index">				<view class="left">					<view class="money">						<view class="number">							{{item.money}}						</view>						<view class="unit">							元						</view>					</view>					<view class="limit">						满{{item.minMoney}}元可用					</view>				</view>				<view class="mid">					<view class="title">						{{item.couponName}}					</view>										<view class="time">						有效期至:{{item.expirationTime}}					</view>				</view>				<view class="right">					<view class="btn" @tap="shiYong()" v-if="tabIndex == 0">						立即使用					</view>					<view class="btn" v-else-if="tabIndex == 1">						已使用					</view>					<view class="btn" v-else-if="tabIndex == 2">						已失效					</view>				</view>			</view>		</view>		<!-- <view v-if="tabIndex == 0">			<view v-for="(item,index) in hongbao" :key="index" class="bg padding radius" style="margin: 24upx 32upx;">				<view class="flex justify-between">					<view class="text-lg text-bold">{{item.couponName}}</view>					<view class="text-lg" style="color: #FF130A;">¥<text class="text-df text-xxl">{{item.money}}</text>					</view>				</view>				<view style="color: #999999;">到期时间:{{item.expirationTime}}</view>				<view style="width: 638upx;height: 2upx;border: 2upx dashed #E6E6E6;margin: 29upx auto;"></view>				<view class="flex justify-between">					<view style="color: #999999;">满{{item.minMoney}}元可用</view>					<view class="btn" @tap="shiYong()">立即使用</view>				</view>			</view>		</view>		<view v-if="tabIndex == 1">			<view v-for="(item,index) in hongbao" :key="index" class="bg padding radius " style="margin: 24upx 32upx;position: relative;">				<view class="flex justify-between">					<view class="text-lg text-bold">{{item.couponName}}</view>					<view class="text-lg" style="color: #FF130A;">¥<text class="text-df text-xxl">{{item.money}}</text>					</view>				</view> -->				<!-- <view>到期时间:{{item.expirationTime}}</view> -->				<!-- <view style="width: 638upx;height: 2upx;border: 2upx dashed #E6E6E6;margin: 29upx auto;"></view>				<view class="flex justify-between">					<view style="color: #999999;">满{{item.minMoney}}元可用</view>				</view>				<view style="position: absolute;top: 0;right: 0;">					<image src="../../static/images/my/youhui-user.png" style="width: 120upx;height: 117upx;"></image>				</view>			</view>		</view>		<view v-if="tabIndex == 2">			<view v-for="(item,index) in hongbao" :key="index" class="bg padding radius" style="margin: 24upx 32upx;position: relative;">				<view class="flex justify-between">					<view class="text-lg text-bold">{{item.couponName}}</view>					<view class="text-lg" style="color: #FF130A;">¥<text class="text-df text-xxl">{{item.money}}</text>					</view>				</view>				<view style="color: #999999;">到期时间:{{item.expirationTime}}</view>				<view style="width: 638upx;height: 2upx;border: 2upx dashed #E6E6E6;margin: 29upx auto;"></view>				<view class="flex justify-between">					<view style="color: #999999;">满{{item.minMoney}}元可用</view>				</view>				<view style="position: absolute;top: 0;right: 0;">					<image src="../../static/images/my/shixioa.png" style="width: 120upx;height: 117upx;"></image>				</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><style lang="scss" scoped>	.youhuiquan{		.card-box{			padding: 20rpx 32rpx;			background: #F6F6F6;			.item.disabled{				filter: grayscale(1);			}			.item{				display: flex;				background-image: url('../../static/card-bg.png');				background-repeat: no-repeat;				background-size: 100% 196rpx;				.left{					width: 200rpx;					display: flex;					flex-direction: column;					align-items: center;					.money{						display: flex;						align-items: first baseline;						color: #FF6E98;						font-weight: bold;						margin-top: 30rpx;						.number{							font-size: 60rpx;						}						.unit{							font-size: 28rpx;						}					}										.limit{						font-size: 24rpx;						color: #FF6E98;						margin-top: 12rpx;					}									}				.mid{					flex: 1;					padding-left: 30rpx;					.title{						font-weight: 800;						font-size: 32rpx;						color: #222222;						margin-top: 48rpx;					}											.time{						font-size: 24rpx;						color: #AAAAAA;						margin-top: 24rpx;					}				}				.right{					display: flex;					justify-content: center;					align-items: center;					width: 184rpx;					height: 196rpx;					.btn{						width: 136rpx;						height: 44rpx;						line-height: 44rpx;						text-align: center;						background: linear-gradient( 313deg, #FFE6EE 0%, #FFBACA 100%);						border-radius: 36rpx 36rpx 36rpx 36rpx;						font-size: 24rpx;						color: #FF6E98;						border: none;					}				}			}		}	}		page {		background: #F5F5F5;	}	.bg {		background: #FFFFFF;	}	.box {		width: 128upx;		color: #999999;		text-align: center;		font-size: 30upx;		z-index: 1;	}	.line {		width: 128upx;		height: 16upx;		background: #52C375;		position: relative;		top: -18upx;		/* opacity: 0.8; */		z-index: -1;	}	.tanColor {		color: #000000;		font-size: 38upx;		font-weight: 800;	}	.btn {		width: 140upx;		height: 55upx;		border: 2upx solid #FF130A;		border-radius: 30upx;		text-align: center;		line-height: 55upx;		color: #FF130A;		font-size: 24upx;	}</style>
 |