<template>
	<view class="content">
		<view class="container">
			<view class="my-header">
				<view class="my-icons" @click="goback"> <uni-icons type="left" size="16"></uni-icons> </view>
				<view class="my-text">{{title||"详情页"}}</view>
				<view class="my-icons"></view>
			</view>
			<!-- 顶部区域 -->
			<view style="text-align: center;">
				<image src="../../static/imgs/xfyl.png" v-if="title == '消费有礼活动'"></image>
				<image src="../../static/imgs/zkyx.png" v-if="title == '折扣营销活动'"></image>
				<image src="../../static/imgs/mjyh.png" v-if="title == '满减营销活动'"></image>
				<image src="../../static/imgs/xryl.png" v-if="title == '新人有礼活动'"></image>
				<image src="../../static/imgs/yqyl.png" v-if="title == '推荐有礼活动'"></image>
			</view>
			<view class="center-box">
				<view class="title-box">活动明细</view>
				<view class="g-box" v-for="(item,index) in datas" :key="index" v-if="title == '消费有礼活动'">
					<text>{{item.activeDescribe || ""}}</text>
				</view>
				<view class="g-box" v-for="(item,index) in datas" :key="index" v-if="title == '折扣营销活动'">
					<text>{{item.discountActiveDescribe || ""}}</text>
				</view>
				<view class="g-box" v-for="(item,index) in datas" :key="index" v-if="title == '满减营销活动'">
					<text>{{item.fullminusActiveDescribe || ""}}</text>
				</view>
				<view class="g-box" v-if="title == '新人有礼活动'">
					<text>{{datas.newlywedsActiveDescribe || ""}}</text>
				</view>
				<view class="g-box" v-if="title == '推荐有礼活动'">
					<text>{{datas.recommendActiveDescribeIn || ""}}</text>
					<text>{{datas.recommendActiveDescribeOut || ""}}</text>
				</view>
			</view>

		</view>
	</view>
</template>

<script>
	import request from '../../utils/request'
	export default {
		data() {
			return {
				title: '',
				datas: [],

			}
		},
		components: {

		},
		onLoad(option) {
			this.title = option.name

			this.getData(option.name);
		},
		methods: {
			getData(name) {
				uni.showLoading({
					//title: '加载中'
				});
				if (name == '消费有礼活动') {
					request({
						url: '/business/marketingActivity/activeConsumption/appletList',
						method: 'get',
					}).then(res => {
						if (res.code == 200) {
							this.datas = res.data
							uni.hideLoading();
						}

					})
				}
				if (name == '折扣营销活动') {
					request({
						url: '/business/marketingActivity/activeDiscount/appletList',
						method: 'get',
					}).then(res => {
						if (res.code == 200) {
							this.datas = res.data
							uni.hideLoading();
						}
					})
				}
				if (name == '推荐有礼活动') {
					request({
						url: '/business/marketingActivity/activeRecommend/applet',
						method: 'get',
					}).then(res => {
						if (res.code == 200) {
							this.datas = res.data
							uni.hideLoading();
						}
					})
				}
				if (name == '新人有礼活动') {
					request({
						url: '/business/marketingActivity/activeNewlyweds/applet',
						method: 'get',
					}).then(res => {
						if (res.code == 200) {
							this.datas = res.data
							uni.hideLoading();
						}
					})
				}
				if (name == '满减营销活动') {
					request({
						url: '/business/marketingActivity/activeFullminus/appletList',
						method: 'get',
					}).then(res => {
						if (res.code == 200) {
							this.datas = res.data
							uni.hideLoading();
						}
					})
				}


			},
			goback() {
				uni.navigateBack()
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		background: #ffffff;
		height: 100vh;
	}

	image {

		width: 95%;
		height: 160px;
		border-radius: 8px;

	}

	.container {
		width: 100%;

		background: #ffffff;
		box-sizing: border-box;
		padding-top: 88px;
		padding-bottom: 20px;
	}

	.my-header {
		width: 100%;
		height: 88px;
		background: #ffffff;
		display: flex;
		align-items: center;
		justify-content: space-between;
		color: #000;
		box-sizing: border-box;
		padding: 0px 15px;
		padding-top: 40px;

		.my-icons {
			width: 20px;

		}

		position: fixed;
		top: 0px;
	}

	.center-box {
		border-radius: 8px;
		background: #f4f5f6;
		margin: 10px auto;
		box-sizing: border-box;
		padding: 10px;
		width: 95%;
	}

	.title-box {
		font-size: 18px;
		font-weight: bold;

	}

	.g-box {
		box-sizing: border-box;
		width: 100%;
		padding: 4px 0px;
		font-size: 14px;
		color: #333333;
	}
</style>