<template>
	<view>
		<view class="head-box"></view>
		<uv-navbar autoBack title="签到列表" leftIconColor="#fff" :bgColor="bgColor" height="100rpx" :titleStyle="{color:'#fff'}"></uv-navbar>
	
		<view class="content">
			<zlx-item 
			:item="detail.activityInfo"
			:showBottom="false"></zlx-item>
			<view class="xie-box-val" v-for="(item,i) in list" :key="i">
				<view class="val-text">
					<view>{{item.name}}</view>
					<view class="phone-box">{{item.phone}}</view>
					<view class="type-box">{{item.type}}X{{item.num}}</view>
				</view>
				<view class="choose-box">
					<view class="normol-box" v-if="i == 1"></view>
					<image src="./static/choose-icon.png" mode="widthFix" v-else></image>
				</view>
			</view>
		</view>
		
		<view class="btn-box">
			<uv-button @click="saoma" text="扫码签到" color="#381615" shape="circle" :customStyle="btnCustomStyle"></uv-button>
		</view>
	</view>
</template>

<script>
	import zlxItem  from '@/components/zhaomu/zlx-item.vue'
	import listMixin from '@/mixins/list.js'
	export default{
		mixins: [listMixin],
		components:{
			zlxItem
		},
		data() {
			return {
				mixinsListApi : 'getSignInUserPageList',
				btnCustomStyle:{
					color:'#FF5858'
				},
				bgColor:'transparent',
				detail : {
					activityInfo : {},
				},
			}
		},
		onPageScroll(e) {
			if(e.scrollTop > 50) {
				this.bgColor = '#49070c'
			}else{
				this.bgColor = 'transparent'
			}
		},
		onLoad({id}) {
			this.queryParams.recruitId = id
			this.getActivityInfo()
		},
		methods:{
			saoma() {
				let self = this
				uni.scanCode({
					success(code) {
						self.$api('signIn', {
							orderId: code.result
						}, res => {
							if (res.code == 200) {
								self.$refs.toast.show({
									type: 'success',
									message: res.result
								})
							}
							self.getData()
							self.getActivityInfo()
						})
					}
				})
			},
			getActivityInfo(){
				this.$api('activityInfo', {
					activityId : this.queryParams.recruitId,
				}, res => {
					if(res.code == 200){
						this.detail = res.result
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #060504;
	}
</style>
<style lang="scss" scoped>
	.head-box {
		background: url('@/static/image/nav-bg.png') no-repeat;
		background-size: 100% 100%;
		width: 100%;
		height: 534rpx;
		position: absolute;
		z-index: -1;
	}
	.content {
		margin-top: 40rpx;
		padding: 0 30rpx;
		padding-top: calc(var(--status-bar-height) + 110rpx);
		.xie-box-val {
			margin-top: 34rpx;
			margin-bottom: 16rpx;
			height: 116rpx;
			background: #1B1713;
			border-radius: 27rpx 27rpx 27rpx 27rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 0 36rpx;
			.val-text {
				font-weight: 400;
				font-size: 25rpx;
				color: #FFFFFF;
				display: flex;
				align-items: center;
				.phone-box {
					color: #666666;
					margin: 0 10rpx;
				}
				.type-box {
					background: #322511;
					border-radius: 0rpx 12rpx 12rpx 12rpx;
					color: #FFA200;
					font-size: 20rpx;
					padding: 10rpx 10rpx;
				}
			}
			.choose-box {
				.normol-box {
					width: 31rpx;
					height: 31rpx;
					border: 1px solid #fff;
					border-radius: 5rpx;
				}
				image {
					width: 31rpx;
					height: 31rpx;
				}
			}
		}
	}

	.btn-box {
		position: fixed;
		bottom: 70rpx;
		left: 0;
		right: 0;
		padding: 0 40rpx;
	}
</style>