<template>
	<view class="content">
		<view class="container">
			<view class="top_show">
				<view class="wx_" v-if="show == false" @click="show =! show"></view>
				<view class="x_" v-else @click="show =! show">
					<u-icon name="checkbox-mark" color="#fff" size="14"></u-icon>
				</view>
				<view style="font-size: 14px;">仅查看已中奖的记录</view>
			</view>
			<view class="box_" v-for="(item,index) in 3" :key="index">
				<view class="title_">抽奖</view>
				<view class="box_bs">
					<image src="../../static/logo.png" style="width: 80px; height: 80px; "></image>
					<view class="r_box">
						<view class="">
							<view class="b_title">获得 <text style="color:#E02020 ;">抽纸</text> 1份</view>
							<view style="margin: 5px 0px;">抽纸1份</view>
							<view class="">2024-08-02 12:02:24</view>
						</view>
						<view class="anniu">待核销</view>
					</view>
				</view>
			</view>
			<u-popup :show="showl" :round="10" mode="bottom" @close="close" @open="open">
				<view class="">
					<view class="pop-top">
						<view style="width: 20px;"></view>
						<view class="">立即使用</view>
						<view class=""><u-icon name="close"></u-icon></view>
					</view>
					<view class="popup-box">
						<view class="">
							<view class="">请向商家出示此码使用</view>
							<view style="display: flex;align-items: center;justify-content: center; margin: 10px auto;">
								<w-qrcode :options="options"></w-qrcode>
							</view>

							<view class="">核销码：6688172293684182</view>
						</view>
					</view>
				</view>

			</u-popup>

		</view>

	</view>
</template>

<script>
	import request from '../../utils/request';
	export default {
		data() {
			return {
				title: '',
				show: false,
				List: [],
				pageNo: 1,
				pageSize: 10,
				totalPage: '',
				showl: true,
				options: {
					code: 'https://oilapi.youkerr.com/oily?storeId=' + uni.getStorageSync('storeId') + '&userId=' + uni
						.getStorageSync('userId') + '&type=yaoqingyouli',
					// code: 'https://www.tuofeng.cc/oily?storeId=' + uni.getStorageSync('storeId') + ' &userId=' + uni
					// 	.getStorageSync('userId'), // 生成二维码的值
					size: 400, // 460代表生成的二维码的宽高均为460rpx
				},
			}
		},
		onLoad() {

		},
		onPullDownRefresh() {
			//下拉刷新
			this.resetting() //重置方法
			this.getList() //调用请求
			uni.stopPullDownRefresh()
		},
		onReachBottom() {
			// 触底加载
			if (this.pageNo >= this.totalPage) {
				uni.showToast({
					title: '没有下一页数据',
					icon: 'none'
				})
			} else {
				this.pageNo++
				this.getList()
			}
		},

		components: {

		},
		methods: {
			//滞空方法
			resetting() {
				this.pageNo = 1
				this.pageSize = 10
				this.totalPage = ''
				this.List = []
			},
			// 分页——网络请求
			async getList() {
				uni.showLoading({
					title: '加载中'
				});
				let res = await request({
					url: '网络请求',
					method: 'get',
					data: {
						pageNo: this.pageNo,
						pageSize: this.pageSize,
					}
				})
				if (res.code == 200) {
					uni.hideLoading(); //交互反馈
					if (this.pageNo != 1) {
						this.List = this.ruleList.concat(res.result.records)
					} else {
						this.List = res.result.records
					}
					this.totalPage = res.result.pages
				}
			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #f4f5f6;
	}

	.container {
		width: 100%;
		height: 100vh;
		box-sizing: border-box;
		background: #f4f5f6;
	}

	.box_ {
		width: 95%;
		background: #fff;
		border-radius: 4px;
		box-sizing: border-box;
		padding: 10px;
		margin: 15px auto;
	}

	.box_bs {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
		font-size: 12px;
	}

	.r_box {
		width: 70%;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.anniu {
		border-radius: 13px;
		border: 1px solid #FA6400;
		width: 60px;
		height: 20px;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #FA6400;
		font-size: 14px;
	}

	.title_ {
		font-size: 16px;
		color: #333333;
		margin-bottom: 15px;
	}

	.top_show {
		width: 100%;
		background: #fff;
		box-sizing: border-box;
		padding: 10px 20px;
		display: flex;
		align-items: center;
	}

	.b_title {
		font-size: 14px;

	}

	.wx_ {
		width: 14px;
		height: 14px;
		border-radius: 50%;
		border: 1px solid #eee;
		margin-right: 5px;
	}

	.x_ {
		width: 14px;
		height: 14px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 50%;
		border: 1px solid #FA6400;
		background: #FA6400;
		margin-right: 5px;
	}

	.popup-box {
		background: #fff;
		box-sizing: border-box;
		padding: 10px;
		background: #ffffff;
		margin: 15px auto;
		box-sizing: border-box;
		padding: 10px;
		text-align: center;
	}

	.pop-top {
		width: 100%;
		box-sizing: border-box;
		padding: 10px;
		display: flex;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1px solid #eee;
	}
</style>