<template>
  <view class="page">
	<view class="page-info">
	  	<view class="banner">
			<view class="title" style="margin-top: 20rpx;">活动名称</view>
			<view class="" style="margin-top: 20rpx;">{{tableData.title}}</view>
			<view style="width: 100%;height: 1px; background-color: rgba(#D8D8D8, 0.5);margin: 20rpx 0 ;"></view>
			<view class="title" style="margin-top: 20rpx;">活动时间</view>
			<view class="" style="margin-top: 20rpx;">{{tableData.startTime}} 至 {{tableData.endTime}}</view>
			<view style="width: 100%;height: 1px; background-color: rgba(#D8D8D8, 0.5);margin: 20rpx 0 ;"></view>
			<view class="title" style="margin-top: 20rpx;">活动类型</view>
			<view class="" style="margin-top: 20rpx;">{{tableData.type}}</view>
			<view style="width: 100%;height: 1px; background-color: rgba(#D8D8D8, 0.5);margin: 20rpx 0 ;"></view>
			<view class="title" style="margin-top: 20rpx;">参与商家</view>
			<view class="" style="margin-top: 20rpx;">{{tableData.location}}</view>
	  	</view>
		<view class="" style="display: flex;justify-content: space-between;margin-top: 20px;">
			<view :style="'width: 48%;padding:10px 15px; background-size:100% 70px;'+`background:url(${$imgUrl('/cynum.png')});`">
					<view style="color: #3D3D3D;margin-bottom: 12px;font-weight: bold;">参与人数</view>
					<view style="font-size: 18px;color: #0FBB59;font-weight: bold;">500</view>
			</view>
		<view :style="'width: 48%;padding:10px 15px; background-size:100% 70px;'+`background:url(${$imgUrl('/jpnum.png')});`">
			<view style="color: #3D3D3D;margin-bottom: 12px;font-weight: bold;">商品发放数量</view>
			<view style="font-size: 18px;color: #0FBB59;font-weight: bold;">500</view>
		</view>
		</view>
		<view class="info-box">
			<view style="display: flex;justify-content: space-between;">
				<view class="title">奖品设置</view>
				<view style="width: 30%;color: #0FBB59;">
					<u-input v-model="juli" type="select" @click="addressShow = true"
						placeholder="请选择打卡点" />
					<u-select v-model="addressShow" :list="juliList" @confirm="addressChange"></u-select>
				</view>
			</view>
			
			<view style="margin-top: 10px;">
				<u-table :borde="false" font-size="24">
					<u-tr>
						<u-th>会员昵称</u-th>
						<u-th>奖品</u-th>
						<u-th>时间</u-th>
					</u-tr>
					 <u-tr v-for="(item, index) in jiangData" :key="index" >
					      <u-td >{{ item.type  }}</u-td>
					      <u-td >{{ item.name }}</u-td>
					      <u-td >{{ item.time }}</u-td>
					    </u-tr>
				</u-table>
			</view>

		</view>
	</view>
	
	
    <!-- 底部 -->
	<view style="height: 125rpx;"></view>
    <view class="page-footer">
		<view class="footer-btn">
			<u-button type="success" @click="baoShow">发放奖励</u-button>
		</view>
	
    </view>
	<u-toast ref="uToast" />
  </view>
</template>

<script>

export default {
  data() {
    return {
		tableData:{},
		swiperList: [
			{
				id: 0,
				type: 'image',
				url: this.$imgUrl('/img/1.jpg')
			}
		],
		joinShow: false,
		form: {
			activityId:'',
			userId:'',
			createTime:'',
			createUser:'',
			userName: '',
			userPhone: '',
		},
		pagesize: {
			id:null,
		},
		imgurl:'',
		jiangData:[
			{
			type: '实物',
			name: '玩偶',
			num: '50',
			tu: 'www.baidu.com',
			fangshi: '邮寄',
			xianz: false,
			time:'2024-01-01 14:00'
			},
			{
			type: '实物',
			name: '糖果',
			num: '不限制数量',
			tu: 'www.baidu.com',
			fangshi: '现场兑换',
			xianz: false,
			time:'2024-01-01 14:00'
			}
		],
		addressShow:false,
		juli:'',
		juliList: [
			{
				label:'天府广场',
				value:1
			},
			{
				label:'天府三街',
				value:2
			}
		],
    }
  },
  onLoad(option){
	  this.imgurl = this.$img
	let ce = decodeURIComponent(option.item)
	let data = JSON.parse(ce)
	console.log(data)
	this.tableData = data


  },
  methods: {
	  addressChange(val){
	  	this.juli = val[0].label
	  },
	  baoShow(){
		  uni.navigateTo({
		  	url: `/pagesA/PunchInAct/issueRewards?ids=${this.tableData.id}`
		  })
	  },
		 getCurrentDateTime() {
		  const now = new Date();
		  const year = now.getFullYear();
		  const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份是从0开始的，所以需要+1
		  const day = String(now.getDate()).padStart(2, '0');
		  const hours = String(now.getHours()).padStart(2, '0');
		  const minutes = String(now.getMinutes()).padStart(2, '0');
		  const seconds = String(now.getSeconds()).padStart(2, '0');
		
		  return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
		},
  }
};
</script>

<style scoped lang="scss">
.page {
	position: relative;
	width: 100%;
	// height: 100%;
	overflow-x: hidden;
	// overflow-y: auto;
}
.page-info {
	width: 100%;
	padding: 24rpx;
}
// 活动详情
.banner {
	width: 100%;
	margin-top: 10rpx;
	border-radius: 30rpx;
	background-color: #fff;
	padding: 24rpx 30rpx;
	color: #888D9C;
	.title {
		font-weight: 700;
		color: #3D3D3D;
		font-size: 32rpx;
		margin-bottom: 30rpx;
	}
	.banner-info-top {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 30rpx;
	
	}
	.times{
		white-space: nowrap; /* 不换行 */
		 overflow: hidden; /* 隐藏超出部分 */
		 text-overflow: ellipsis; /* 显示省略号 */
		 width:70%;
	}
}
// 活动信息
.info-box {
	margin-top: 30rpx;
	background-color:#fff;
	padding:10px;
	border-radius: 30rpx;
	.title {
		font-weight: 700;
		color: #3D3D3D;
		font-size: 32rpx;
		margin-bottom: 10rpx;
	}
	.info-item {
		font-size: 26rpx;
		line-height: 50rpx;
	}
}

/* 底部 */
.page-footer{
	position: fixed;
	left: 0;
	bottom: 0;
	// display: flex;
	// align-items: center;
	// justify-content: center;
	width: 100%;
	height: 125rpx;
	background-color: #FFFFFF;
	padding-bottom: constant(safe-area-inset-bottom);
	padding-bottom: env(safe-area-inset-bottom);
	.footer-btn {
	 padding: 0 20px;
		margin-top: 20rpx;
	}
	.footer-service {
		display: flex;
		flex-direction: column;
		align-items: center;
		text {
			margin-top: 6rpx;
			line-height: 42rpx;
		}
	}
}

.userForm {
	margin: 0 40rpx ;
	.form-box {
		padding: 18rpx 30rpx;
		
	}
	.title {
		font-size: 32rpx;
		font-weight: 700;
	}
}
</style>
