<template>
	<view class="content">
		<u-tabs-swiper ref="uTabs" :active-color="mainColor" :list="tabList" :current="current" @change="tabsChange"
		 :is-scroll="false"></u-tabs-swiper>
		<swiper :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish" class="swiper-box">
			<swiper-item class="swiper-item" v-for="(item, index1) in tabList" :key="index1">
				<scroll-view scroll-y class="scroll-box" @scrolltolower="handleLoadMore" :refresher-enabled="true"
				 :refresher-triggered="triggered" :refresher-threshold="100" refresher-background="white" @refresherrefresh="onRefresh"
				 @refresherrestore="onRestore">
				 <template v-if="current != 3">
					 <u-card :show-head="false" :show-foot="false" padding="0px" margin="10px" borderRadius="40" v-for="(site, index2) in item.tableList"
					  :key="index2" class="class-card">
					 	<view class="class-content" slot="body">
					 		<view class="class-info-img">
					 			<u-image width="60px" height="60px" :src="site.url" shape="circle"></u-image>
					 		</view>
					 		<view class="class-info-content">
					 			<view class="class-info-label" v-if="site.discountType==3">{{site.name}}&nbsp;&nbsp;课时{{site.discountNum}}</view>
								<view class="class-info-label" v-else>{{site.name}}￥{{site.money}}</view>
					 			<view class="class-info-text">{{site.content}}</view>
					 			<view class="class-info-text">{{site.endDate}}&nbsp;&nbsp;到期</view>
					 		</view>
							<view style="width:40px;">
								<view class="card-mask" v-if="index1 == 1"></view>
								<template v-if="index1 == 0">
									<u-button v-if="site.commonFlag == 2" type="warning" :custom-style="{background: mainColor}" size="mini" shape="circle" :ripple="true"  @click="handleShowClick(site)">查看</u-button>
									<view class="out-date">{{ site.commonFlag == 1 ? '通用券' : '专用券' }}</view>
								</template>
								<view class="out-date" v-if="index1 == 2">已用</view>
							</view>

					 	</view>
					 </u-card>
					 <u-divider v-if="item.isOver" bg-color="transparent">没有更多了</u-divider>
				 </template>
					<template v-else>
						<view class="content-info">
							<view style="background: #fff;">
								<u-form ref="form" label-width="80">
									<u-form-item label="学员:" right-icon="arrow-right" required @click.native="studentShow = true">
										<u-input v-model="studentName" placeholder="请选择学员" disabled  @click="studentShow = true" />
									</u-form-item>
								</u-form>
							</view>
							<view class="share-img">
								<u-image width="60vw" height="60vw" :src="qrcodeUrl" ></u-image>
								<view class="qr-box">
									<canvas canvas-id="qrcode" style="width: 60vw;height:60vw;margin: 0 auto;"/>
								</view>
								<view class="share-class">共{{ classes }}节课</view>
							</view>
						</view>
					</template>
				</scroll-view>
			</swiper-item>
		</swiper>
		<!-- 可用场馆 -->
		<u-popup v-model="couponShow" mode="center" border-radius="30" width="600rpx">
			<view class="common-title">可用场馆</view>
			<view class="menber-box" style="overflow-y: auto;min-height: 200px;">
				<template v-if="Object.keys(venueInfo).length">
					<view style="font-size: 16px;font-weight: bold;margin-bottom: 5px;">卡种</view>
					<view style="margin-bottom: 8px;">{{ venueInfo.cardType }}</view>
					<view style="font-size: 16px;font-weight: bold;margin-bottom: 5px;">场馆</view>
					<view style="margin-bottom: 8px;">{{ venueInfo.venue }}</view>
				</template>
				<template v-else>
					<u-empty mode="data"></u-empty>
				</template>
			</view>
			<view class="button-box">
				<u-button type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="couponShow = false">确定</u-button>
			</view>
		</u-popup>
		<u-picker mode="selector" v-model="studentShow" :range="studentList" range-key="childName" @confirm="handleStudentClick"></u-picker>
		<u-top-tips ref="uTips"></u-top-tips>
	</view>
</template>

<script>
	import {
		mapGetters
	} from 'vuex'
	const NET = require('@/utils/request')
	const API = require('@/config/api')
	import uQRCode from '@/common/uqrcode.js'
	export default {
		computed: {
			...mapGetters([
				'mainColor',
				'handleCustomStyle',
				'handleDefaultCustomStyle',
			])
		},
		data() {
			return {
				triggered: false,
				tabList: [{
					name: '可用',
					isOver: false,
					pageIndex: 1,
					tableList: [],
				}, {
					name: '过期',
					isOver: false,
					pageIndex: 1,
					tableList: [],
				}, {
					name: '使用记录',
					isOver: false,
					pageIndex: 1,
					tableList: [],
				},{
					name: '赠送课时券',
					isOver: false,
					pageIndex: 1,
					tableList: [],
				}],
				current: 0,
				swiperCurrent: 0,
				//  学生id
				studentId: '',
				// 学生姓名
				studentName: '',
				studentShow: '',
				studentList: [],
				// 二维码
				qrcodeUrl: '',
				// 课时
				classes: 0,
				couponShow: false,
				venueInfo: {}
			}
		},
		onLoad() {
			this.getTableList(0)
			this.getTableList(1)
			this.getTableList(2)
			this.getCouponList()
		},
		onReady() {},
		methods: {
			//  获取可用优惠券列表
			getCouponList() {
				NET.request(API.getUserStudent, {
					userId: uni.getStorageSync('userData').userId }, 'POST').then( res => {
						if(res.status == 10000) {
							this.studentList = res.data
							if(this.studentList.length) {
								this.handleStudentClick(0)
							}
						}
					})
			},
			//  优惠券可用场馆
			handleShowClick(site) {
				NET.request(API.getCouponExInfo, 
					{id: site.discountCouponId}, 'POST').then( res => {
						this.venueInfo = res.data
						this.couponShow = true
				})
			},
			//  选择学生
			handleStudentClick(args) {
				this.studentId = this.studentList[args].studentId
				this.studentName = this.studentList[args].childName
				this.getInfo()
			},
			//  根据学员获取二维码和剩余课时
			getInfo() {
				this.qrFun(this.studentId)
				
				/*NET.request(API.studentQRcode, { studentId: this.studentId },'POST').then(res => {
					if(res.status == 10000) {
						this.qrcodeUrl = 'data:image/png;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCACWAJYDASIAAhEBAxEB/8QAHgAAAgMBAQEBAQEAAAAAAAAACAkABwoGBQMEAgH/xABFEAAABAQDAwUNBwMFAQEBAAABAgMEAAUGBwgREgkTIRQVGTE4FhgiQVh1dpams7TT1DdWV2iVw+QXNlEjMjNhdJFxgf/EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwBVUWklhUxQuEiLoY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5aj2rlVnJZYixQOsLt2UVDERKUomEpShqEM8igHiCHlRIDKvHSURcy49snjmYW3uBUlKOniQIuV5HNl2KiyYDmBDmROUTFz45DwzjUJHNVvcy29smbaYXIuBTVKNXiootl55NkGKaygBmJCGWOUDGAOOQccoDNdW96bx3MYISq492ayqtk1W5Qg2nc+dPkkldIl1lIscwFNpEQzAM8hEPHHm0VcOv7azRWd26rmoKVmK6AtVXkkma7FdRETFMKZjomKYSiYpR0iOWZQHxBDY9qPUMgxL2jpOlMOE8l91p3K6jCYPpbRDkk9dNWvJVk9+qkzFQ5E9ZyF1mAC6jFDPMQhaPenYp/Jpur6mzH5MB4NZ30vbcaUFp+4V4q4qiVlWK5KynNQu3rcFSgIFUBNVQxdQAYwAOWYZj/AJjiItXvTsU/k03V9TZj8mPDrCxF8beScair+zVc0zKgVKgL6cU68ZNwUNnpJvFUyl1DkOQZ5jkMASmyO7Z8k8yTX3EM02mlZVfQWECqqmoaqpxTs4bvpWRGYSl8qzcplO8SKYCqpGKYAEoiA5DxARCFl7I7tnyTzJNfcQxzawdiSr/OEo+ORgE199jin8pa6vrlMfnRIqqJASJEiQEiRIkBIkSJASHmbH7sdt/SWZ/txIkAbkSJEgJC29t19kNufSRx8KaJEgKQ2Jf2+V36ID8a3hycSJASAi2wfY8W9JpZ+7EiQAA7I7tnyTzJNfcQxzawdiSr/OEo+ORiRIBC0SJEgP/Z'
					} 
				})*/
				NET.request(API.getGiveLessons, { studentId: this.studentId },'POST').then(res => {
					console.log(res);
					if(res.status == 10000) {
						console.log(res.data);
						this.classes = res.data.length
					} 
				})
			},
			qrFun: function(text) {
				let that=this
				uQRCode.make({
					canvasId: 'qrcode',
					componentInstance: this,
					text: "xinghuoclass66889955224477"+text,
					size: 150,
					margin: 0,
					backgroundColor: '#ffffff',
					foregroundColor: '#000000',
					fileType: 'jpg',
					errorCorrectLevel: uQRCode.errorCorrectLevel.H,
					success: res => {
						that.qrcodeUrl=res
						//console.log(res)
					}
				})
			},
			//  tab页面切换
			tabsChange(index) {
				this.swiperCurrent = index;
				let that=this
				console.log(index)
				if(index==3){
					setTimeout(function(){
						that.qrFun(that.studentId)
					},1000)
					
				}
			},
			//  swiper-item左右移动，通知tabs的滑块跟随移动
			transition(e) {
				let dx = e.detail.dx;
				this.$refs.uTabs.setDx(dx);
			},
			//  swiper滑动结束，分别设置tabs和swiper的状态
			animationfinish(e) {
				let current = e.detail.current;
				this.$refs.uTabs.setFinishCurrent(current);
				this.swiperCurrent = current;
				this.current = current;
			},
			//  下拉刷新
			onRefresh() {
				if (!this.triggered) {
					this.triggered = true
					this.tabList[this.current].isOver = false
					this.tabList[this.current].pageIndex = 1
					this.tabList[this.current].tableList = []
					this.getTableList(this.current, 'refresh')
				}
			},
			//  重置下拉刷新状态
			onRestore() {
				this.triggered = 'restore'
				this.triggered = false
			},
			//  懒加载
			handleLoadMore() {
				if (!this.tabList[this.current].isOver) {
					this.tabList[this.current].pageIndex++
					this.getTableList(this.current)
				}
			},
			//  获取列表数据
			getTableList(index, refresh) {
				NET.request(API.getCouponList, {
					status: index,
					page: this.tabList[index].pageIndex,
					size: 10,
				}, 'POST').then(res => {
					this.triggered = false
					this.tabList[index].tableList = this.tabList[index].tableList.concat(res.data.row)
					this.tabList[index].isOver = res.data.row.length != 10
				}).catch(error => {
					this.triggered = false
					this.$refs.uTips.show({
						title: error.message,
						type: 'warning',
					})
				})
			}
		},
	}
</script>

<style>
	page {
		width: 100%;
		height: 100%;
		background-color: #f7f7f7;
	}
</style>
<style lang="scss" scoped>
	@import "@/static/css/themes.scss";

	.content {
		width: 100%;
		float: left;

		.swiper-box {
			height: calc(100vh - 34px);

			.swiper-item {
				height: calc(100vh - 34px);

				.scroll-box {
					width: 100%;
					height: calc(100vh - 34px);
					padding-bottom: 10px;
					box-sizing: border-box;

					.class-card {
						.class-content {
							padding: 10px 15px;
							display: flex;
							align-items: center;
							position: relative;
						}

						.class-info-img {
							width: 60px;
							height: 60px;
							margin-right: 10px;
						}

						.class-info-content {
							flex: 1;
						}

						.class-info-label {
							font-size: 16px;
							color: #000000;
							word-break: break-all;
							margin-bottom: 5px;
						}

						.class-info-text {
							color: #999999;
							margin-bottom: 5px;
						}

						.card-mask {
							width: 100%;
							height: 100%;
							position: absolute;
							left: 0;
							top: 0;
							background-color: rgba(0, 0, 0, 0.3);
						}

						.out-date {
							font-size: 14px;
							color: #ff9900;
							margin-bottom: 5px;
							position: absolute;
							right: 8px;
							bottom: 3px;
						}
					}
				}
			}
		}
	}
	.content-info {
		width: 100%;
		height: 100%;
		float: left;
		position: relative;
		border-top: 1px solid #eee;
		
		.share-img {
			top: 40%;
			left: 50%;
			transform: translate(-50%, -50%);
			position: absolute;
			
			.share-class {
				margin-top: 20rpx;
				text-align: center;
			}
		}
	}
	.qr-box {
		position: absolute;
		margin: 0 auto;
	}
	.menber-box {
		width: 100%;
		// float: left;
		padding: 10px 15px;
		// margin-bottom: 10px;
		
		.menber-col {
			width: 100%;
			padding: 15px;
			margin-bottom: 10px;
			display: inline-block;
			background-color: #FFFFFF;
			border-radius: 15px;
			box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
			position: relative;
			overflow: hidden;
			box-sizing: border-box;
			
			.menber-label {
				width: 100%;
				margin-bottom: 5px;
				float: left;
				font-size: 14px;
				// line-height: 20px;
			}
	
			.menber-num {
				width: 100%;
				float: left;
				font-size: 26px;
				line-height: 28px;
				color: $mainColor;
			}
	
			.menber-icon {
				font-size: 100px;
				color: $mainColor;
				position: absolute;
				right: -5px;
				bottom: -30px;
				opacity: 0.5;
			}
		}
	}
	.common-title {
		width:100%;
		text-align: center;
		font-size: 20px;
		margin: 10px 0;
	}
	.fix-add-icon {
		position: fixed;
		bottom: 15px;
		right: 15px;
	}
	.button-box {
		// width: 100%;
		padding: 10px 15px;
		box-sizing: border-box;
	}
</style>
