<template>
	<view class="content">
		<view style="background: #BE573F; height: 56rpx; width: 100%;"></view>

		<view class="whiteBg">

			<!-- firstView -->
			<view class="firstView">
				<view class="money">{{detailData.ActName}}</view>
				<view class="condition" v-if="detailData.WhereMoney != 0">满{{detailData.WhereMoney}}元可用</view>
				<view class="condition" v-else>满任意金额可用</view>
			</view>
			<view class="point leftP"></view>
			<view class="point rightP"></view>

			<!-- secondView -->
			<view class="secondView">
				
				<view  v-if="detailData.EndOffsetDays===null||detailData.EndOffsetDays==='null'||detailData.EndOffsetDays===''">
					
					<view class="same" >有效期：{{detailData.StartTime.slice(0,detailData.StartTime.length-8)}}至 {{detailData.EndTime.slice(0,detailData.EndTime.length-8)}}</view>
				</view>
				<view v-else>
				
					<view class="same" v-if="detailData.EndOffsetDays>-1">有效期：自领取后，{{detailData.EndOffsetDays}}天有效</view>
				     <view class="same" v-if="detailData.EndOffsetDays==-1||detailData.EndOffsetDays==null||detailData.EndOffsetDays=='null'">有效期：{{detailData.StartTime.slice(0,detailData.StartTime.length-8)}}至 {{detailData.EndTime.slice(0,detailData.EndTime.length-8)}}</view>
				</view>
				
				
				<!-- <view class="same">可用次数：{{detailData.avaQty}}</view> -->
			</view>

			<!-- thirdView -->
			<view class="thirdView">
				<view class="thirdTitle">适用门店</view>
				<view class="store">
					<!-- <view class="grayPoint"></view> -->
					<view class="same" v-if="detailData.shopNames">{{detailData.shopNames}}</view>
					<view class="same" v-else>全部</view>
				</view>
			</view>
			
			<!-- 列表 -->
			<view class="itemContent">
				<view class="thirdTitle">使用说明</view>
				<rich-text :nodes="couContent" style="color: #666666; font-size: 26rpx;"></rich-text>
				<!-- <view v-for="(item,index) in itemData" :key="index">
					<view class="store">
						<view class="grayPoint"></view>
						<view class="same">{{item}}</view>
					</view>
				</view> -->
			</view>

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

<script>
	export default {
		data() {
			return {
				detailData:{},
				couponId:'',
				couContent:'',
			}
		},
		onLoad(opt) {
			this.couponId = opt.couponId,
			
			this.getDetailData()
		},
		methods: {
			getDetailData() {
				uni.showLoading({
					title: '加载中'
				})
				let url = 'worldKeepCar/keepCarMy/queryTCouponPickDetail',
					params = {
						ID: this.couponId,
						
					}
				this.$http(url, params, 'GET').then(res => {
					uni.hideLoading();
					var data = res.data
					
					if(res.data.CouContent){
						 this.couContent=res.data.CouContent.replace(/\<p/gi, '<p style="display: inline-block"');
					}
					// 处理 undefined和null转为空白字符串
					
						for (const key in data) {
							data[key] = this.$praseStrEmpty(data[key])
						}
					
					this.detailData = data
			
					
					
				})
			},
		}
	}
</script>

<style scoped>
	.content {
		background: #BE573F;
		min-height: 100vh;
	}

	.whiteBg {
		margin: 0rpx 24rpx;
		background-color: #FFFFFF;
		border-radius: 10rpx;
		min-height: 60vh;
	}

	.firstView {
		border-bottom: 1rpx #EEEEEE dashed;
		text-align: center;
		padding: 50rpx 20rpx;
		padding-bottom: 30rpx;
	}

	.money {
		font-size: 44rpx;
		color: #333333;
		font-weight: bold;
		margin-bottom: 10rpx;
	}

	.condition {
		font-size: 28rpx;
		color: #999999;
	}

	.point {
		width: 30rpx;
		height: 30rpx;
		background-color: #BE573F;
		border-radius: 15rpx;
	}

	.leftP {
		float: left;
		margin-left: -15rpx;
		margin-top: -15rpx;
	}

	.rightP {
		float: right;
		margin-right: -15rpx;
		margin-top: -15rpx;
	}

	.secondView {
		padding: 30rpx 40rpx;
		
	}



	.same {
		font-size: 28rpx;
		color: #666666;
	}

	.thirdView {
		padding: 30rpx 40rpx;
		border: 1rpx #EEEEEE solid;
	}

	.thirdTitle {
		font-size: 32rpx;
		color: #333333;
		margin-bottom: 20rpx;
	}

	.store {
		display: flex;
		align-items: center;
		margin-bottom: 20rpx;
	}

	.grayPoint {
		width: 12rpx;
		height: 12rpx;
		border-radius: 6rpx;
		background-color: #DDDDDD;
		margin-right: 15rpx;
	}
	.itemContent{
		padding: 30rpx 40rpx;
	}
</style>
