<template>
	<view class="wanl-coupon">
		<view class="edgeInsetTop"></view>
		<view class="details padding-bj">
			<view class="text-center wanl-gray" v-if="!couponData.id">{{ $t('coupon.noDetails') }}</view>
			<view v-else>
				<view class="text-lg text-bold margin-bottom-bj">{{ couponData.name }}</view>
				<view class="wanl-gray text-sm margin-bottom-bj">
					<text class="cu-tag sm radius margin-right-xs">{{ couponData.type_text }}</text>
					{{ couponData.type == 'reduction' ? $t('mall.fullReduction', [Number(couponData.limit), Number(couponData.price)]) : couponData.type == 'discount' ? $t('mall.fullDiscount', [Number(couponData.limit), Number(couponData.discount)]) : $t('mall.freeShippingFull', [Number(couponData.limit)]) }}
				</view>
				<view class="wanl-gray text-sm" v-if="couponData.pretype == 'fixed'">
					{{ $t('coupon.validPeriod') }}：{{ couponData.startdate }} ~ {{ couponData.enddate }}
				</view>
				<view class="wanl-gray text-sm" v-else-if="couponData.pretype == 'appoint' && couponData.validity != 0">
					{{ $t('coupon.validDays', [couponData.validity]) }}
				</view>
				<view class="wanl-gray text-sm" v-else>
					{{ $t('coupon.permanent') }}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			couponData: {}
		}
	},
	onLoad(option) {
		if (option.data) {
			this.couponData = JSON.parse(option.data)
		}
	}
}
</script>

<style>
</style>