<template>
	<view class="app">
		<!-- <view class="tabs">
			<view class="tab-item">
				<view class="title">
					券
				</view>
				<view class="text">
					{{total}}张
				</view>
			</view>
		</view> -->
		<view class="content">
			<view class="statuss">
				<view class="statusitem" :style="couponstatus==''?'color: #F44B2F;':''">
					全部
				</view>
				<span> |</span>
				<view class="statusitem" :style="couponstatus=='NOT_USED'?'color: #F44B2F;':''">
					待领取
				</view>
				<span> |</span>
				<view class="statusitem" :style="couponstatus=='USED'?'color: #F44B2F;':''">
					已使用
				</view>
				<span> |</span>
				<view class="statusitem" :style="couponstatus=='EXPIRED'?'color: #F44B2F;':''">
					已过期
				</view>
			</view>
			<view class="rollup">
				<view class="item">
					<view class="top" style="background: #EFECEC;color: #4B4B4B;">
						<view class="title">
							<span class="text">
								￥
							</span>
							<span class="price">
								0
							</span>
						</view>
						<view class="what" style="background: #EFECEC;">
							名字
						</view>
						<view class="texts">
							满10可用
						</view>
						<view class="time">
							有效期至
						</view>
						<view class="btngq">
							已过期
						</view>
						<!-- <view class="btn">
							使用
						</view> -->
					</view>
					<view class="bottom">
						新人福利
					</view>
				</view>
			</view>
			<view class="noorder">
				<u-empty mode="coupon" icon-size='220'></u-empty>
			</view>
		</view>
		<u-toast ref="uToast" />
	</view>
</template>
<script>
	export default {
		data() {
			return {
				pageNum: 1,
				pageSize: 10,
				couponlist: null,
				total: 0,
				couponstatus: ''
			};
		},
		onLoad() {},
		methods: {},
		onReachBottom() { //下滑加载
			if (this.couponlist.length >= this.total) {} else {
				this.pageNum++;
				selectCoupon(this.pageNum, this.pageSize, this.patientId, this.couponstatus).then(res => {
					res.rows.forEach(e => {
						this.couponlist.push(e)
					})
				})
			}
		},
		onPullDownRefresh() { //下拉刷新
			this.pageNum = 1;
			this.getlist();
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
	}
</script>

<style lang="scss">
	@import './coupon.scss'
</style>