<template>
	<view>
		<view class="">
			<cu-custom :isBack="true" bgColor="bg-gradual-blue">
				<block slot="backText">返回</block>
				<block slot="content">活动详情</block>
				<!-- <block slot="right" >
					<view  @click="bm()">
						报名
					</view>
				</block> -->
			</cu-custom>
		</view>
		<view class="cu-card article">
			<view class="cu-item shadow">
				<!-- 活动名称 -->
				<view class="title">
					<view class="text-center"> {{dataDetail.name}} </view>
				</view>
				<!-- 活动详情 -->
				<view class="content">
					<view class="desc">
						<view class="text-content"> {{dataDetail.detail}} </view>
					</view>
				</view>
				<!-- 图片 -->
				<view class="content">
					<image style="width: 100%;" src="/static/lucky_draw_events.png" mode="widthFix"></image>
				</view>
				
				<view class=" padding-lr" :key="'00'" :id="'00'">
					<view class="cu-bar solid-bottom bg-white">
						<view class="action">
							<text class="cuIcon-present text-red"></text>
							<text class="text-red" style="margin-left: 2upx;" @click="toLottery()">
								中奖信息
							</text>
						</view>
					</view>
				</view>
				<view class="padding-top padding-lr" v-for="(item,index) in dataDetail.luckyDrawAwardsDTOList" :key="index" :id="'main-'+index">
					<view class="cu-bar solid-bottom bg-white">
						<view class="action">
							<text class="cuIcon-present text-green"></text>
							<text class="text-green" style="margin-left: 2upx;">
								{{item.name}}
							</text>
							<text class="text-blue" style="margin-left: 20upx;">
								{{item.prizeName}}
							</text>
							<view class="action" style="margin-left: 20upx;">
								<view class="cu-tag round bg-green sm">{{item.number}}件</view>
							</view>
						</view>
					</view>
				</view>
				<view class=" margin-top" style="padding-left: 10px;padding-right: 10px;">
					<button style="width: 100%;" class='cu-btn lg bg-gradual-blue shadow ' @click="signUp()">报名</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import LuckyDrawEventsService from '@/api/test/luckyDraw/LuckyDrawEventsService'
	export default {
		data() {
			return {
				list: [],
				dataDetail: {}
			};
		},
		luckyDrawEventsService: null,
		onLoad(option) {
			this.luckyDrawEventsService = new LuckyDrawEventsService()
			let { eventId } = option
			this.init(eventId)
		},
		onReady() {
		},
		methods: {
			// 数据初始化方法
			init(id) {
				this.luckyDrawEventsService.queryById(id).then(({data}) => {
				  this.dataDetail = data
				})
			},
			// 跳转活动报名页面   参数eventId为活动id
			signUp() {
				uni.navigateTo({
				  url: '/pages/test/luckyDraw/LuckyDrawRegister?eventId='+this.dataDetail.id
				})
			},
			// 跳转活动中奖信息页面   参数eventId为活动id
			toLottery() {
				uni.navigateTo({
				  url: '/pages/test/luckyDraw/LuckyDrawShowList?eventId='+this.dataDetail.id
				})
			}
		},
	}
</script>

