{$layout}
{$template "menu"}

<form class="ui form">
    <csrf-token></csrf-token>

    <input type="hidden" name="packageId" :value="packageId"/>
    <input type="hidden" name="regionId" :value="regionId"/>
    <input type="hidden" name="periodId" :value="periodId"/>

    <table class="ui table definition selectable">
        <tr>
            <td class="title">选择流量包规格 *</td>
            <td>
                <span v-if="packages.length > 0"><a v-for="p in packages" class="ui label basic" :class="{blue: p.id == packageId}" @click.prevent="selectPackage(p.id)">{{p.size}}{{p.unit.toUpperCase().replace(/(.)B/, "$1iB")}}</a></span>
                <span v-else="" class="red">没有流量包可供选择</span>
            </td>
        </tr>
        <tr>
            <td>选择区域 *</td>
            <td>
                <span v-if="regions.length > 0"><a v-for="region in regions" class="ui label basic" :class="{blue: region.id == regionId && hasRegionPrice(region.id), disabled: !hasRegionPrice(region.id)}" @click.prevent="selectRegion(region.id)">{{region.name}}</a></span>
                <span v-else="" class="red">没有区域可供选择</span>
            </td>
        </tr>
        <tr>
            <td>选择有效期 *</td>
            <td>
                <span v-if="periods.length > 0"><a v-for="period in periods" class="ui label basic" :class="{blue: period.id == periodId && hasPeriodPrice(period.id), disabled: !hasPeriodPrice(period.id)}" @click.prevent="selectPeriod(period.id)">{{period.count}}{{period.unitName}}</a></span>
                <span v-else="" class="red">没有有效期可供选择</span>
            </td>
        </tr>
        <tr>
            <td>流量包数量 *</td>
            <td>
                <div class="ui input">
                    <select class="ui dropdown" name="count" v-model="count" @change="changeCount">
                        <option v-for="i in 20" :value="i">{{i}}</option>
                    </select>
                </div>
            </td>
        </tr>
        <tr>
            <td>价格</td>
            <td>
                <span v-if="amount == 0" class="disabled">没有找到对应价格</span>
                <span v-if="amount > 0">{{amount}}元</span>
            </td>
        </tr>
    </table>
    <button class="ui button primary" :class="{disabled: amount <= 0}" type="button" @click.prevent="goNext()">下一步</button>
</form>