<style>
	.activeDetails{}
	.acdetailTop{
		width:100%;
		height:315px;
		background-color: #fff;
		padding:15px;
	}
	.acdetailImg{
		width:100%;
		height:190px;
		border-radius: 3px;
		overflow: hidden;
	}
	.acdetaiTitle{
		margin:15px auto;
		color:#0B0B0B;
		font-size:16px;
		font-weight: bold;
		text-align: center;
	}
	.acdetaiDate{
		display: flex;
		justify-content: space-between;
		font-size: 12px;
		color:#FF5D69;
		font-weight: bold;
	}
	.acdetaiWriter{
		display: flex;
		justify-content: space-between;
		color:#B9B9B9;
		font-size:12px;
		font-weight: bold;
		margin-top:10px;
		align-items: center;
	}
	.acdetailLittleBtn{
		width:55px;
		height:22px;
		text-align: center;
		line-height: 22px;
		background-color: #AFAFAF;
		color:#fff;
		border-radius: 3px;
		font-size: 12px;
	}
	.acdetaiLine{
		width:100%;
		height:10px;
		background-color: #F3F5F7;
	}
	.acdetailBottom{
		width:100%;
		min-height:283px;
		padding:15px;
		background-color: #fff;
	}
	.acdetail_Intro{
		color:#404040;
		font-size:14px;
		line-height: 25px;
		margin:20px 0 30px 0;
	}
	.acdetailBtn{
		position: fixed;
		bottom:0;
		width:100%;
		height:50px;
		line-height: 50px;
		font-size:15px;
		font-weight: bold;
		background-color: #AFAFAF;
		color:#fff;
		text-align: center;
	}
</style>
<template>
	<view class="activeDetails" style="height:100vh;">
		<view class="acdetailTop">
			<view class="acdetailImg">
				<img :src="dataList.CoverImg" alt="" style="width:100%;height:100%;"/>
			</view>
			<view class="acdetaiTitle">{{dataList.ActivityName}}</view>
			<view class="acdetaiDate">
				<view>开始日期：{{dataList.StartTimeStr}}</view>
				<view>结束日期：{{dataList.EndTimeStr}}</view>
			</view>
			<view class="acdetaiWriter">
				<view>作者：{{dataList.CreateByName}}</view>
				<view class="acdetailLittleBtn" v-if="dataList.ActivityStatus==0" style="background-color: #000450;">{{dataList.ActivityStatusStr}}</view>
				<view class="acdetailLittleBtn" v-if="dataList.ActivityStatus==1" style="background-color: #000450;">{{dataList.ActivityStatusStr}}</view>
				<view class="acdetailLittleBtn" v-if="dataList.ActivityStatus==2">{{dataList.ActivityStatusStr}}</view>
			</view>
		</view>
		<view class="acdetaiLine"></view>
		<view class="acdetailBottom">
			<u-divider color="#0B0B0B;" half-width="50" border-color="#0B0B0B" fontSize="35">活动详情</u-divider>
			<view class="acdetail_Intro" v-html="dataList.ActivityInfo">
				
			</view>
		</view>
		<template v-if="isShowBtn">
			<view class="acdetailBtn" v-if="dataList.ActivityStatus==2">报名活动（已结束）</view>
			<view class="acdetailBtn" @click="showModal=true" style="background-color: #000450;" v-if="dataList.ActivityStatus==1&&dataList.IsJoinActivity==0">马上报名</view>
			<view class="acdetailBtn" style="background-color: #000450;" v-if="dataList.ActivityStatus==0">未开始</view>
			<view class="acdetailBtn" v-if="dataList.IsJoinActivity==1">已报名</view>
		</template>
		<u-popup v-model="showModal" mode="center" length="80%">
			<view style='display: flex;flex-direction: column;align-items: center;background: #fff;'>
				<view style="display: flex;width: 100%;margin-top:30px;padding-left:20px;">
					<Text style='display:inline-block;width:80px;text-align: right;margin-top: 6px;'>姓名：</Text>
					<input class="uni-input inputM" style='margin-left: 10px;margin-top: 5px;' v-model="signMsg.LinkMan" placeholder="请输入姓名" />
				</view>
				<view style="display: flex;width: 100%;margin:30px;padding-left:20px;">
					<Text style='display:inline-block;width:80px;text-align: right;margin-top: 6px'>联系电话：</Text>
					<input class="uni-input inputM" type="number" style='margin-left: 10px;margin-top: 5px;' v-model="signMsg.LinkTel" placeholder="请输入电话" />
				</view>
				<view style="display: flex;flex-direction: row;align-items: center;height: 50px;border-top: 1px solid #F5F5F5;width: 100%;">
					<view style="width: 50%;display: flex;align-items: center;justify-content: center" @click="showModal=false">
						<Text>取消</Text>
					</view>
					<view style="width: 50%;color: #a0cfff;display: flex;align-items: center;justify-content: center" @click="signUp">
						<Text>确定</Text>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				pageTitle: '活动详情',
				msg: {
					Id:0
				},
				dataList:{},
				showModal:false,
				signMsg:{
					ActivityId:0,
					LinkMan:"",
					LinkTel:""
				},
				isShowBtn:true
			}
		},
		created() {},
		mounted() {
			uni.setNavigationBarTitle({
				title: this.pageTitle,
			});
		},
		onLoad(option) {
			this.msg.Id = option.Id;
			this.signMsg.ActivityId = option.Id;
			if(option.isFromActive==1){
				this.isShowBtn = false;
			}
			this.getList();
		},
		methods: {
			getList(){
				this.request2({
						url: "/api/AppletTrade/GetCommerceActivity",
						data: this.msg,
					},
					(res) => {
						if (res.resultCode == 1) {
							console.log(res, '数据11111');
							this.dataList = res.data
						}
					}
				);
			},
			//报名
			signUp(){
				if(this.signMsg.LinkMan==''){
					uni.showToast({
					  title: "请输入姓名",
					  icon:'none'
					});
					return;
				}
				if(this.signMsg.LinkTel==''){
					uni.showToast({
					  title: "请输入联系电话",
					  icon:'none'
					});
					return;
				}
				this.request2({
						url: "/api/AppletTrade/SetCommerceConsult",
						data: this.signMsg,
					},
					(res) => {
						if (res.resultCode == 1) {
							uni.showToast({
							  title: "报名成功，请到个人中心我的活动查看"
							});
							this.getList();
							this.showModal=false;
						}
					}
				);
			}
			
		}
	}
</script>
