<template>
	<Card
		v-if="referralLink"
		title="推荐有礼"
		subtitle="您的专属推荐链接"
		class="mx-auto max-w-3xl"
	>
		<div class="flex flex-col space-y-4 overflow-hidden">
			<ClickToCopyField :textContent="referralLink" />
			<span class="text-sm font-medium leading-4 text-gray-700">
				邀请他人加入 今果 Jingrow，
				<strong>
					当他们注册并消费至少 ¥100 时，
					您将获得 ¥20 </strong
				>
			</span>
		</div>
	</Card>
</template>
<script>
import ClickToCopyField from '../../ClickToCopyField.vue';

export default {
	name: 'AccountReferral',
	components: {
		ClickToCopyField
	},
	computed: {
		referralLink() {
			if (this.$team.pg?.referrer_id) {
				return `${location.origin}/dashboard/signup?referrer=${this.$team.pg?.referrer_id}`;
			}
			return '';
		}
	}
};
</script>