<template>
	<view class="rules-container" :style="{ color: themeStore.theme.text.normal }">
		<view class="ft13">
			<view class="flex-acenter pb16">
				<theme-image src="@/static/promo/rz.png" style="width: 30rpx; height: 30rpx;"></theme-image>
				<view class="ml12" :style="{ color: themeStore.theme.text.highlight }">
					{{ $t('earn.home.relation') }}
				</view>
			</view>
			<view>
				<view class="rule-top-image-view" :style="{ 'background': themeStore.theme.itemLightBgColor }">
					<theme-image src="@/static/earn/earn-tree.png" style="width: 100%; height: 100%;"></theme-image>
				</view>
			</view>
			<view class="flex-acenter ptb16">
				<theme-image src="@/static/promo/rz.png" style="width: 30rpx; height: 30rpx;"></theme-image>
				<view class="ml12" :style="{ color: themeStore.theme.text.highlight }">
					{{ $t('earn.home.commission') }}
				</view>
			</view>
			<view style="line-height: 1.8;">
				<view>
					{{ $t('earn.home.commission1') }}
				</view>
				<view>
					{{ $t('earn.home.commission2') }}
				</view>
			</view>
			<view class="flex-acenter">
				<view class="commission-table-btn" :style="{ color: themeStore.theme.text.theme2, 'border-bottom': '1rpx solid ' + themeStore.theme.text.theme2 }" @click.stop="handleCommissionTableClick">
					{{ $t('earn.home.commissionTable') }}
				</view>
			</view>
			<view class="flex-acenter ptb16">
				<theme-image src="@/static/promo/rz.png" style="width: 30rpx; height: 30rpx;"></theme-image>
				<view class="ml12" :style="{ color: themeStore.theme.text.highlight }">
					{{ $t('earn.home.rules') }}
				</view>
			</view>
			<view style="line-height: 1.8;">
				<view>
					{{ $t('earn.home.rules1') }}
				</view>
				<view>
					{{ $t('earn.home.rules2') }}
				</view>
				<view>
					{{ $t('earn.home.rules3') }}
				</view>
				<view>
					{{ $t('earn.home.rules4') }}
				</view>
				<view>
					{{ $t('earn.home.rules5') }}
				</view>
			</view>
		</view>
		<EarnV2CommissionTablePopup
			ref="commissionTablePopupRef"
		/>
	</view>
</template>

<script setup>
	import { usePromoStore } from '@/store/usePromoStore'
	import { useAppStore } from '@/store/useAppStore'
	import { useThemeStore } from '@/store/useThemeStore'
	import { onMounted, reactive, ref } from 'vue'
	import EarnV2CommissionTablePopup from './EarnV2CommissionTablePopup.vue'
	
	const promoStore = usePromoStore()
	const appStore = useAppStore()
	const themeStore = useThemeStore()
	
	const commissionTablePopupRef = ref(null)
	const handleCommissionTableClick = () => {
		commissionTablePopupRef.value.show()
	}
</script>

<style lang="scss" scoped>
	.rules-container {
		position: relative;
		padding: 0 30rpx 45rpx 30rpx;

		.rule-top-image-view {
			margin: 16rpx 0rpx;
			padding: 30rpx;
			height: 370rpx;
			border-radius: 20rpx;
		}

		.commission-table-btn {
			line-height: 24rpx;
			margin-top: 32rpx;
			margin-bottom: 16rpx;
		}
	}
</style>