<script setup>
// Copyright 2024 FlexCDN root@flexcdn.cn. All rights reserved. Official site: https://flexcdn.cn .

import PopupLayout from "@/layouts/PopupLayout.vue";
import ctxRef from "@/utils/ctx_ref.js"
import Context from "./updatePricePeriodPopup.js"
import TOption from "@/components/ui/TOption.vue";
import TSelect from "@/components/ui/TSelect.vue";
import PostForm from "@/components/form/PostForm.vue";
import SubmitButton from "@/components/form/SubmitButton.vue";
import DefinitionTable from "@/components/common/DefinitionTable.vue";

const ctx = ctxRef(new Context())

</script>

<template>
	<PopupLayout>
		<header>修改支付周期</header>

		<PostForm action="$" @success="ctx.success">
			<DefinitionTable>
				<tbody>
				<tr>
					<td class="title">新支付周期 *</td>
					<td>
						<TSelect name="pricePeriod" v-model="ctx.pricePeriod">
							<TOption v-for="p in ctx.pricePeriods" :value="p.code">{{ p.name }}</TOption>
						</TSelect>
						<template v-for="p in ctx.pricePeriods">
							<p class="comment" v-if="ctx.pricePeriod == p.code">{{ p.description }}如果当前计费周期内已经生成账单，则支付周期变更将在下个计费周期内生效。</p>
						</template>
					</td>
				</tr>
				</tbody>
			</DefinitionTable>
			<SubmitButton></SubmitButton>
		</PostForm>
	</PopupLayout>
</template>

<style lang="postcss" scoped>
</style>