<template>
	<view>
		<custom-nav title="礼品兑换"></custom-nav>
		<view class="giftContainer">
			
			<!-- <view class="status_bar" :style="style">
				<view
					:style="[{'height': customBarH + 'px', 'line-height': customBarH + 'px','padding-top': statusBarH + 'px' }]"
					class="nav_box">
					<text class="back cuIcon-back"></text>
					<text style="color: #333;font-size: 32rpx;">礼品兑换</text>
					<view style="width: 50rpx;"></view>
				</view>
			</view> -->
			<view v-if="message" class="message">
				<view class="icon"><text>通知</text></view>
				<view class="text">
					<view class="scroll">{{ message }}</view>
				</view>
			</view>
			<view class="banner">
				<view class="num">
					<text class="spec" v-if="userServerInfo">{{ userServerInfo.bonus }}</text>
					<text>奖学金</text>
				</view>
				<view class="flex">
					<view class="mingxi" @click="goDetail">
						奖学金明细
					</view>
					<!-- <view style="margin-left: 10rpx;" class="mingxi" @click="showImg">
						发圈分享
					</view> -->
				</view>
		
				<!-- <view class="num">兑换礼包，福利优人一步</view> -->
			</view>
			<view class="fixedHeader">
				<view class="num">
					<text>奖学金：</text>
					<text class="spec" v-if="userServerInfo">{{ userServerInfo.bonus }}</text>
				</view>
				<view v-if="userServerInfo">
					<view v-if="userServerInfo.type === 1 || userServerInfo.type === 2" class="title" @tap="exchangerecord">
						<text>{{ userServerInfo.type === 2 ? '礼品详情' : '兑换记录' }}</text>
					</view>
					<!-- <view v-if="userServerInfo.type === 1 || userServerInfo.type === 2" class="title" @tap="exchangerecord">
						<text>兑换记录</text>
					</view> -->
				</view>
			</view>
			<view class="list" v-if="list.length > 0">
				<view v-for="item in list" :key="item.id" class="item" @click="exchange(item)">
					<view class="avatar" :style="{ backgroundImage: `url(${item.img})` }" @click.stop="priview(item.img)">
						<view v-if="!Number(item.surplus)" class="none"><text>已兑完</text></view>
					</view>
					<view class="info">
						<view class="title">{{ item.name }}</view>
						<view class="info-num">
							<view class="info-other">限量{{ item.total }}份</view>
							<view class="info-status" v-if="item.exchanged">已兑换</view>
						</view>
						<view class="bottom">
							<view class="money">
								<text class="spec">{{ item.price }}</text>
								<text>奖学金</text>
							</view>
							<view class="btn" v-if="!Number(item.surplus)"
								:class="Number(item.surplus) && isCan ? '' : 'disabled'">已兑完</view>
							<view class="btn" v-else :class="Number(item.surplus) && isCan ? '' : 'disabled'">立即兑换</view>
						</view>
					</view>
				</view>
			</view>
			<view class="share_show" v-if="shareShow" @click="shareShow = false">
				<view class="share_con flexCC">
					<!-- 	<text class="iconfont iconguanbi">
						<image src="../../static/new_challenge/error.png" mode="widthFix" style="width: 48rpx;" @click="shareShow = false"></image>
					</text>
					 -->
					<view class="canvas">
						<canvas canvas-id="canvas" style="width: 100%;height:100%;" id="canvas">
							<img :src="poster" class="poster_img" mode="widthFix" />
						</canvas>
					</view>
					<view class="save_img">长按图片保存到本地</view>
				</view>
			</view>
		</view>
	</view>

</template>
<script>
	import {
		api_getExchangeList,
		GetBonus,
		api_record,
		getMessage
	} from '../../api.js';
	export default {
		data() {
			return {
				shareShow: false,
				poster: '',
				canvasWidth: '',
				canvasHeight: '',
				message: '',
				model: '',
				customBarH: 0,
				statusBarH: 0,

				// Imglist:[
				// 	{
				// 	  cover: require('../../static/huan.jpg'),
				// 	  name: '手环',
				// 	  num: 1
				// 	},
				// 	{
				// 	  cover: require('../../static/huan.jpg'),
				// 	  name: '护心卡',
				// 	  num: 1
				// 	},
				// 	{
				// 	  cover: require('../../static/huan.jpg'),
				// 	  name: '毛毯红色',
				// 	  num: 1
				// 	},
				// 	{
				// 	  cover: require('../../static/huan.jpg'),
				// 	  name: '远红外手环',
				// 	  num: 1
				// 	},
				// 	{
				// 	  cover: require('../../static/huan.jpg'),
				// 	  name: '远红外手环',
				// 	  num: 1
				// 	},
				// 	{
				// 	  cover: require('../../static/huan.jpg'),
				// 	  name: '远红外手环',
				// 	  num: 1
				// 	}
				// ],
				pageTitle: '礼品兑换',
				scrollViewHeight: 0,
				list: [],
			};
		},
		computed: {
			userServerInfo() {
				//用户服务器信息
				return this.$store.state.userServerInfo;
			},
			isCan() {
				return this.$store.state.userServerInfo && this.$store.state.userServerInfo.status == 3 ? true : false;
			},
			style() {
				let _style = `height: ${this.customBarH}px;margin-bottom:${this.statusBarH}px`
				return _style
			}
		},
		mounted() {
			let menuButtonObject = uni.getMenuButtonBoundingClientRect(); //获取菜单按钮（右上角胶囊按钮）的布局位置信息。坐标信息以屏幕左上角为原点。
			uni.getSystemInfo({ //获取系统信息
				success: res => {
					let navHeight = menuButtonObject.height + (menuButtonObject.top - res.statusBarHeight) *
						2; //导航栏高度=菜单按钮高度+（菜单按钮与顶部距离-状态栏高度）*2
					// 导航栏（胶囊）高度
					this.customBarH = navHeight;
					//  状态栏（顶部）高度
					this.statusBarH = res.statusBarHeight
				},
				fail(err) {
					console.log(err);
				}
			})

		},
		// onLoad:function(option){
		// 	this.type=option.type
		// 	console.log('我是type值：',this.type)
		// },
		onShow() {
			console.log(this.userServerInfo)
			this.getGiftList()
			this.getBound()
			this.getmessageInfo()
		},
		onPullDownRefresh() {
			this.getGiftList()
			this.getBound()
			setTimeout(function() {
				uni.stopPullDownRefresh()
			}, 1500);
		},
		methods: {
			getmessageInfo() {
				this.$ajax.get(getMessage).then(([, {
					data: res
				}]) => {
					this.message = res.data.map((value) => value.content).join('        ')
					console.log(111, this.message)
				})
			},
			showImg() {
				this.$ajax.get(api_record).then(([, {
					data: res
				}]) => {
					if (res.code === 200) {
						// this.Imglist = res.data.list
						if (this.Imglist.length === 0) {
							uni.showToast({
								title: '您还没有兑换礼品',
								icon: 'none'
							})
							return
						}
						uni.getSystemInfo({
							success: res => {
								this.model = res.model
								this.canvasWidth = res.windowWidth / 375
								this.canvasHeight = res.windowHeight
								this.shareShow = true
								this.drawPoster()
							}
						})
					} else {
						uni.showToast({
							title: res.message || '获取失败',
							icon: 'none'
						})
					}
				})
			},
			drawPoster() {
				let that = this;
				uni.getImageInfo({
					src: this.userServerInfo.name,
					success: res => {
						uni.showLoading({
							title: '图片加载中...'
						});
						let ctx = uni.createCanvasContext('canvas');
						let rpx = that.canvasWidth;

						// ctx.drawImage('../../static/bg1.png', 0, 0, 270 * rpx, 480 * rpx);
						ctx.drawImage('../../static/bg3.jpg', 0, 0, 270 * rpx, 480 * rpx);
						ctx.drawImage('../../static/bg2.png', 0, 0, 270 * rpx, 480 * rpx);
						ctx.font = 'noraml bold 15px pingfang';
						ctx.textAlign = 'center';
						ctx.setFillStyle('#F2EDCF');
						ctx.fillText(that.userServerInfo.name.length > 6 ? that.userServerInfo.name.slice(0,
							6) : that.userServerInfo.name, uni.upx2px(281), uni.upx2px(514));
						ctx.beginPath();
						if (that.Imglist.length === 1) {
							that.getOne(ctx)
						}
						if (that.Imglist.length === 2) {
							that.getTwo(ctx)
						}
						if (that.Imglist.length === 3) {
							that.getThree(ctx)
						}
						if (that.Imglist.length === 4) {
							that.getFour(ctx)
						}
						if (that.Imglist.length === 5) {
							that.getFive(ctx)
						}
						if (that.Imglist.length === 6) {
							that.getSix(ctx)
						}
						ctx.beginPath();
						ctx.arc(uni.upx2px(96) / 2 + uni.upx2px(236), uni.upx2px(97) / 2 + uni.upx2px(360),
							uni.upx2px(97) / 2,
							0, Math.PI * 2, false); // 画一个圆形裁剪区域
						ctx.clip(); // 裁剪
						ctx.drawImage(res.path, uni.upx2px(236), uni.upx2px(360), uni.upx2px(97), uni.upx2px(
							97));

						ctx.restore(); //恢复之前保存的绘图上下文
						setTimeout(res => {
							ctx.draw(false, () => {
								uni.canvasToTempFilePath({
									width: 270 * rpx,
									height: 480 * rpx,
									canvasId: 'canvas',
									success: res => {
										uni.hideLoading();
										if (this.model == 'iPhone') {
											this.poster = this.dataURLtoFile(res
												.tempFilePath).name;
										} else {
											let url = res.tempFilePath.replace(
												/\. +/g, '');
											this.poster = url.replace(/[\r\n]/g,
												'');
										}
									},
									fail: () => {
										uni.hideLoading()
									}
								});
							});
						}, 500);
					}
				})
			},
			getOne(ctx) {
				ctx.setFillStyle('#ED1A08');
				ctx.font = 'noraml bold 11px pingfang';
				ctx.fillText(this.Imglist[0].name + 'x' + this.Imglist[0].num, uni.upx2px(268), uni.upx2px(850));
				ctx.drawImage(this.Imglist[0].cover, uni.upx2px(195), uni.upx2px(670), uni.upx2px(145), uni.upx2px(145));
			},
			getTwo(ctx) {
				ctx.setFillStyle('#ED1A08');
				ctx.font = 'noraml bold 11px pingfang';
				ctx.fillText(this.Imglist[0].name + 'x' + this.Imglist[0].num, uni.upx2px(165), uni.upx2px(840));
				ctx.drawImage(this.Imglist[0].cover, uni.upx2px(85), uni.upx2px(650), uni.upx2px(160), uni.upx2px(160));
				ctx.fillText(this.Imglist[1].name + 'x' + this.Imglist[1].num, uni.upx2px(360), uni.upx2px(840));
				ctx.drawImage(this.Imglist[1].cover, uni.upx2px(285), uni.upx2px(650), uni.upx2px(160), uni.upx2px(160));
			},
			getThree(ctx) {
				ctx.setFillStyle('#ED1A08');
				ctx.font = 'noraml bold 10px pingfang';
				ctx.fillText(this.Imglist[0].name + 'x' + this.Imglist[0].num, uni.upx2px(110), uni.upx2px(840));
				ctx.drawImage(this.Imglist[0].cover, uni.upx2px(40), uni.upx2px(650), uni.upx2px(145), uni.upx2px(145));
				ctx.fillText(this.Imglist[1].name + 'x' + this.Imglist[1].num, uni.upx2px(270), uni.upx2px(840));
				ctx.drawImage(this.Imglist[1].cover, uni.upx2px(200), uni.upx2px(650), uni.upx2px(145), uni.upx2px(145));
				ctx.fillText(this.Imglist[2].name + 'x' + this.Imglist[2].num, uni.upx2px(430), uni.upx2px(840));
				ctx.drawImage(this.Imglist[2].cover, uni.upx2px(360), uni.upx2px(650), uni.upx2px(145), uni.upx2px(145));
			},
			getFour(ctx) {
				ctx.setFillStyle('#ED1A08');
				ctx.font = 'noraml bold 9px pingfang';
				ctx.fillText(this.Imglist[0].name + 'x' + this.Imglist[0].num, uni.upx2px(172), uni.upx2px(765));
				ctx.drawImage(this.Imglist[0].cover, uni.upx2px(120), uni.upx2px(640), uni.upx2px(100), uni.upx2px(100));
				ctx.fillText(this.Imglist[1].name + 'x' + this.Imglist[1].num, uni.upx2px(365), uni.upx2px(760));
				ctx.drawImage(this.Imglist[1].cover, uni.upx2px(310), uni.upx2px(640), uni.upx2px(100), uni.upx2px(100));

				ctx.fillText(this.Imglist[2].name + 'x' + this.Imglist[2].num, uni.upx2px(172), uni.upx2px(905));
				ctx.drawImage(this.Imglist[2].cover, uni.upx2px(120), uni.upx2px(780), uni.upx2px(100), uni.upx2px(100));

				ctx.fillText(this.Imglist[3].name + 'x' + this.Imglist[3].num, uni.upx2px(365), uni.upx2px(905));
				ctx.drawImage(this.Imglist[3].cover, uni.upx2px(310), uni.upx2px(780), uni.upx2px(100), uni.upx2px(100));
			},
			getFive(ctx) {
				ctx.setFillStyle('#ED1A08');
				ctx.font = 'noraml bold 9px pingfang';
				ctx.fillText(this.Imglist[0].name + 'x' + this.Imglist[0].num, uni.upx2px(120), uni.upx2px(768));
				ctx.drawImage(this.Imglist[0].cover, uni.upx2px(70), uni.upx2px(640), uni.upx2px(100), uni.upx2px(100));
				ctx.fillText(this.Imglist[1].name + 'x' + this.Imglist[1].num, uni.upx2px(270), uni.upx2px(768));
				ctx.drawImage(this.Imglist[1].cover, uni.upx2px(220), uni.upx2px(640), uni.upx2px(100), uni.upx2px(100));

				ctx.fillText(this.Imglist[2].name + 'x' + this.Imglist[2].num, uni.upx2px(420), uni.upx2px(768));
				ctx.drawImage(this.Imglist[2].cover, uni.upx2px(370), uni.upx2px(640), uni.upx2px(100), uni.upx2px(100));


				ctx.fillText(this.Imglist[3].name + 'x' + this.Imglist[3].num, uni.upx2px(190), uni.upx2px(910));
				ctx.drawImage(this.Imglist[3].cover, uni.upx2px(140), uni.upx2px(785), uni.upx2px(100), uni.upx2px(100));

				ctx.fillText(this.Imglist[4].name + 'x' + this.Imglist[4].num, uni.upx2px(350), uni.upx2px(910));
				ctx.drawImage(this.Imglist[4].cover, uni.upx2px(298), uni.upx2px(785), uni.upx2px(100), uni.upx2px(100));
			},
			getSix(ctx) {
				ctx.setFillStyle('#ED1A08');
				ctx.font = 'noraml bold 9px pingfang';
				ctx.fillText(this.Imglist[0].name + 'x' + this.Imglist[0].num, uni.upx2px(120), uni.upx2px(768));
				ctx.drawImage(this.Imglist[0].cover, uni.upx2px(70), uni.upx2px(640), uni.upx2px(100), uni.upx2px(100));
				ctx.fillText(this.Imglist[1].name + 'x' + this.Imglist[1].num, uni.upx2px(270), uni.upx2px(768));
				ctx.drawImage(this.Imglist[1].cover, uni.upx2px(220), uni.upx2px(640), uni.upx2px(100), uni.upx2px(100));

				ctx.fillText(this.Imglist[2].name + 'x' + this.Imglist[2].num, uni.upx2px(420), uni.upx2px(768));
				ctx.drawImage(this.Imglist[2].cover, uni.upx2px(370), uni.upx2px(640), uni.upx2px(100), uni.upx2px(100));


				ctx.fillText(this.Imglist[3].name + 'x' + this.Imglist[3].num, uni.upx2px(120), uni.upx2px(910));
				ctx.drawImage(this.Imglist[3].cover, uni.upx2px(70), uni.upx2px(785), uni.upx2px(100), uni.upx2px(100));

				ctx.fillText(this.Imglist[4].name + 'x' + this.Imglist[4].num, uni.upx2px(270), uni.upx2px(910));
				ctx.drawImage(this.Imglist[4].cover, uni.upx2px(220), uni.upx2px(785), uni.upx2px(100), uni.upx2px(100));
				ctx.fillText(this.Imglist[5].name + 'x' + this.Imglist[5].num, uni.upx2px(420), uni.upx2px(910));
				ctx.drawImage(this.Imglist[5].cover, uni.upx2px(370), uni.upx2px(785), uni.upx2px(100), uni.upx2px(100));
			},
			dataURLtoFile(dataurl, filename = 'file') {
				let arr = dataurl.split(',');
				let mime = arr[0].match(/:(.*?);/)[1];
				let suffix = mime.split('/')[1];
				let bstr = atob(arr[1]);
				let n = bstr.length;
				let u8arr = new Uint8Array(n);
				while (n--) {
					u8arr[n] = bstr.charCodeAt(n);
				}
				return new File([u8arr], `${filename}.${suffix}`, {
					type: mime
				});
			},
			goDetail() {
				uni.navigateTo({
					url: "./detail"
				})
			},
			goBack() {
				uni.redirectTo({
					url: "../other/other"
				})
			},
			getGiftList() {
				// uni.showLoading();
				this.$ajax.get(api_getExchangeList).then(([, {
					data: res
				}]) => {
					if (res.code == 200) {
						//获取兑换礼品列表
						this.list = res.data.list;
						console.log(res.data.list)
						// uni.hideLoading();
					} else {
						uni.showToast({
							title: res.message || '获取失败',
							duration: 2000,
							icon: 'none'
						})
					}
				});
			},
			getBound() {
				this.$ajax.get(GetBonus).then(([, {
					data: res
				}]) => {
					//获取奖学金
					this.userServerInfo.bonus = res.data.bonus
					console.log(res.data.bonus)
				});
			},
			exchangerecord() {
				//进入兑换记录页面 
				// if (this.userServerInfo.type === 1 || this.userServerInfo.type === 2) {
				// 	uni.navigateTo({ url: '../mygift/mygift' })
				// } else {
				// 	uni.showModal({
				// 		content: '无兑换记录',
				// 		showCancel: false
				// 	})
				// }
				if (this.userServerInfo.type === 1) {
					uni.navigateTo({
						url: '../exchangerecord/exchangerecord'
					})
				} else if (this.userServerInfo.type === 2) {
					uni.navigateTo({
						url: '../mygift/mygift'
					})
				} else {
					uni.showModal({
						content: '无兑换记录',
						showCancel: false
					})
				}
			},
			priview(src) {
				// 预览
				uni.previewImage({
					urls: [src]
				});
			},
			exchange(data) {
				// 兑换
				// getApp().globalData.detail = data; //把兑换列表保存到 globalData 中
				// 	uni.navigateTo({
				// 		url: '../detail/detail' //去商品详情页面时
				// 	});
				// return false;

				// status 不等于3 提示兑换还未开始
				if (!this.isCan) {
					uni.showModal({
						content: '兑换还未开始',
						showCancel: false
					});
					return false;
				}
				if (data.surplus) {
					//如果有货
					getApp().globalData.detail = data; //把兑换列表保存到 globalData 中
					uni.navigateTo({
						url: '../detail/detail' //去商品详情页面时
					});
				} else {
					uni.showModal({
						content: '来晚了！礼品已兑换完毕！再看看别的吧！',
						showCancel: false
					});
				}
			}
		}
	};
</script>

<style lang="scss" scoped>
	.flexCC {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	.share_show {
		width: 100%;
		height: 100vh;
		position: fixed;
		top: 0;
		left: 0;
		background-color: rgba(0, 0, 0, 0.7);
		z-index: 9999;

		.share_con {
			width: 80%;
			margin: 0 auto;
			height: 100%;
			z-index: 999999;

			.canvas {
				width: 540rpx;
				height: 960rpx;
				position: relative;

				#canvas {
					width: 540rpx;
					height: 960rpx;
					position: absolute;
					top: 0;
					left: 0;
				}

				.poster_img {
					-webkit-touch-callout: default;
					width: 540rpx;
					height: 960rpx;
					display: block;
				}

				img[src=''],
				img:not([src]) {
					opacity: 0;
				}
			}

			.save_img {
				color: #fff;
				width: 100%;
				text-align: center;
				font-size: 40rpx;
				margin-top: 20rpx;
			}

			.iconfont {
				position: absolute;
				top: 4vh;
				right: 25rpx;
				color: #dedede;
				font-size: 60rpx;
				z-index: 999;
			}
		}

		.sub_btn {
			margin-top: 76rpx;
		}
	}

	page {
		height: auto;
		display: flex;
		flex-direction: column;

		// .status_bar {
		// 	width: 100vw;
		// 	position: relative;
		// 	z-index: 10;
		// 	margin: 0;

		// 	.nav_box {
		// 		width: 100%;
		// 		padding: 0 20px;
		// 		font-size: 40rpx;

		// 		.back {
		// 			margin-right: 8rpx;
		// 		}
		// 	}


			// position: fixed;
			// top: 0;
			// padding-top: 40rpx;
			// left: 25rpx;
			// height: 128rpx;
			// z-index: 1000;
			// line-height: 88rpx;
			// background-color: #fff;
			// width: 100%;
			// display: flex;
			// justify-content: space-between;
			// align-items: center;
		// }

		.giftContainer {
			flex: 1;
			overflow: hidden;
			padding: 30rpx;
			box-sizing: border-box;
			// margin-top: 110rpx;

			.message {
				width: 100%;
				display: flex;
				align-items: center;
				padding: 0 42rpx 0 14rpx;
				box-sizing: border-box;
				background-color: #fff4f3;
				height: 62rpx;
				border-radius: 62rpx;
				margin-bottom: 30rpx;

				.icon {
					width: 128rpx;
					height: 46rpx;
					background: linear-gradient(88deg, #ffc401 0%, #fe2400 41%, #fe0000 100%);
					border-radius: 45rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					color: #ffffff;
					font-size: 28rpx;
					margin-right: 14rpx;

					&::before {
						content: '';
						display: block;
						width: 28rpx;
						height: 28rpx;
						background: url(../../static/gift/1.png) 100% center no-repeat;
						background-size: 100%;
						margin-right: 6rpx;
					}
				}

				.text {
					flex: 1;
					height: 40rpx;
					overflow: hidden;

					.scroll {
						height: 40rpx;
						line-height: 40rpx;
						white-space: nowrap;
						color: #ea4a41;
						font-weight: 28rpx;
						animation: scroll-left-right 12s linear infinite;
					}
				}
			}

			.banner {
				width: 100%;
				height: 240rpx;
				background: linear-gradient(270deg, #f97c55 0%, #f44545 100%);
				border-top-left-radius: 24rpx;
				border-top-right-radius: 24rpx;
				position: relative;
				padding: 60rpx 40rpx;
				box-sizing: border-box;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				margin-bottom: 30rpx;

				.num {
					color: #ffffff;
					font-size: 32rpx;
					line-height: 44rpx;

					.spec {
						font-size: 76rpx;
						margin-right: 10rpx;
					}

					margin-bottom: 10rpx;
				}

				.mingxi {
					width: 184rpx;
					height: 64rpx;
					background: linear-gradient(180deg, #FCEAC0 0%, #FFD57D 100%);
					border-radius: 32rpx;
					color: #FB231F;
					font-size: 28rpx;
					text-align: center;
					line-height: 64rpx;
				}

				&::after {
					content: '';
					display: block;
					width: calc(100% + 30rpx);
					height: 28rpx;
					background: linear-gradient(180deg, rgba(234, 74, 65, 0) 0%, rgba(234, 74, 65, 0.35) 100%);
					border-radius: 28rpx;
					position: absolute;
					left: -15rpx;
					right: -15rpx;
					bottom: -14rpx;
				}

				&::before {
					content: '';
					display: block;
					width: 170rpx;
					height: 170rpx;
					background-image: url('https://api.jiuweiyun.cn/public/uploads/weapp/icon/2.png');
					background-position: center;
					background-size: 100%;
					background-repeat: no-repeat;
					position: absolute;
					top: 50%;
					right: 30rpx;
					transform: translateY(-50%);
				}
			}

			.fixedHeader {
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-bottom: 30rpx;

				.num {
					display: flex;
					align-items: center;
					color: #333333;
					font-size: 32rpx;
					line-height: 56rpx;

					.spec {
						color: #ea4a41;
						font-size: 40rpx;
					}

					&::before {
						content: '';
						display: block;
						width: 40rpx;
						height: 40rpx;
						background-image: url(../../static/gift/3.png);
						background-size: 100%;
						background-position: center;
						background-repeat: no-repeat;
						margin-right: 10rpx;
					}
				}

				.title {
					display: flex;
					align-items: center;
					color: #999999;
					font-size: 32rpx;

					&::before {
						content: '';
						display: block;
						width: 34rpx;
						height: 34rpx;
						background-image: url(../../static/gift/4.png);
						background-size: 100%;
						background-position: center;
						background-repeat: no-repeat;
						margin-right: 10rpx;
					}
				}
			}

			.list {
				width: 100%;

				.item {
					width: 100%;
					display: flex;
					align-items: stretch;
					justify-content: space-between;
					margin-bottom: 30rpx;

					.avatar {
						width: 260rpx;
						height: 260rpx;
						background-color: #f9f9fb;
						position: relative;
						border-radius: 16rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						margin-right: 20rpx;
						background-position: center;
						background-repeat: no-repeat;
						background-size: 100%;
						overflow: hidden;

						.none {
							position: absolute;
							top: 0;
							bottom: 0;
							right: 0;
							left: 0;
							background: rgba(0, 0, 0, 0.5);
							display: flex;
							align-items: center;
							justify-content: center;
							color: #ffffff;
							font-size: 32rpx;
						}
					}

					.info {
						flex: 1;
						overflow: hidden;
						display: flex;
						flex-direction: column;
						justify-content: space-between;

						.title {
							color: #333333;
							font-size: 32rpx;
							line-height: 44rpx;
							width: 100%;
							height: 44rpx;
							overflow: hidden;
							font-weight: bold;
							margin-bottom: 20rpx;
						}

						&-num {
							display: flex;
							align-items: center;
							justify-content: space-between;
							margin-bottom: 70rpx;

							.info-other {
								color: #ea4a41;
								font-size: 28rpx;
								height: 52rpx;
								line-height: 52rpx;
								padding: 0 10rpx;
								border-radius: 8rpx;
								background-color: #fff4f3;
							}

							.info-status {
								color: #ffffff;
								font-size: 28rpx;
								height: 44rpx;
								line-height: 44rpx;
								padding: 0 14rpx;
								background-color: #ffbb01;
								border-top-left-radius: 16rpx;
								border-bottom-right-radius: 16rpx;
							}
						}

						.bottom {
							display: flex;
							align-items: center;
							justify-content: space-between;

							.money {
								color: #ea4a41;
								font-size: 24rpx;

								.spec {
									font-size: 40rpx !important;
								}
							}

							.btn {
								height: 68rpx;
								border-radius: 68rpx;
								background: linear-gradient(141deg, #f97c55 0%, #f44545 100%);
								line-height: 68rpx;
								width: 192rpx;
								text-align: center;
								color: #ffffff;
								font-size: 28rpx;

								&.disabled {
									background: #f8f8f8 !important;
									color: #999999;
								}
							}
						}
					}
				}
			}
		}
	}

	.exchange {
		// @include page();

		.content {
			display: flex;
			flex-direction: column;

			.scroll {
				height: 50rpx;
				line-height: 50rpx;
				background: rgba(250, 99, 66, 0.2);
				display: flex;
				align-items: center;
				color: #fa6342;

				text {
					font-size: 40rpx;
					color: #fa6342;
					margin-left: 30rpx;
				}

				.scroll-wrapper {
					flex: 1;
					height: 100%;
					overflow: hidden;

					.scroller {
						height: 100%;
						white-space: nowrap;
						font-size: 26rpx;
						padding-left: 10rpx;
						animation: scroll-left-right 12s linear infinite;
					}
				}
			}

			.banner {
				width: 100%;
				height: 216rpx;
			}

			.nav {
				height: 76rpx;
				box-sizing: border-box;
				padding: 0 30rpx;
				border-bottom: 6rpx solid #eeeeee;
				display: flex;
				justify-content: space-between;
				align-items: center;
				font-size: 32rpx;

				view {
					height: 100%;
					display: flex;
					align-items: center;

					.cuIcon {
						font-size: 40rpx;
						margin-right: 12rpx;
					}
				}
			}

			.list {
				flex: 1;

				scroll-view {
					box-sizing: border-box;
					padding: 0 30rpx 0;
				}
			}
		}
	}

	@keyframes scroll-left-right {
		0% {
			transform: translateX(100%);
		}

		100% {
			transform: translateX(-100%);
		}
	}
</style>