{$layout "layout_popup"}

<!-- <h3>修改用户套餐</h3> -->

<form class="ui form" data-tea-action="$" data-tea-success="success">
    <csrf-token></csrf-token>
    <input type="hidden" name="userPlanId" :value="userPlan.id"/>

    <table class="ui table definition selectable">
        <tr>
            <td class="title">用户 *</td>
            <td>
                <span v-if="userPlan.user != null"><user-link :v-user="userPlan.user"></user-link></span>
                <span v-else class="disabled">已被删除</span>
            </td>
        </tr>
        <tr>
            <td>套餐 *</td>
            <td>
                <b-select
                    name="planId"
                    v-model="userPlan.planId"
                    auto-width
                    :options="[
                        {label: '[选择套餐]', value: '0'},
                        ...plans.map(plan => ({
                            label: plan.name,
                            value: plan.id,
                        }))
                    ]"
                ></b-select>

                <!-- <select class="ui dropdown auto-width" name="planId" v-model="userPlan.planId">
                    <option value="0">[选择套餐]</option>
                    <option v-for="plan in plans" :value="plan.id">{{plan.name}}</option>
                </select> -->
            </td>
        </tr>
        <tr>
            <td>周期 *</td>
            <td>
                <b-select
                    name="periodUnit"
                    v-model="userPlan.periodUnit"
                    auto-width
                    :options="[
                        {label: '按月', value: 'monthly'},
                        {label: '按年', value: 'yearly'},
                    ]"
                ></b-select>

                <!-- <select class="ui dropdown auto-width" name="periodUnit" v-model="userPlan.periodUnit">
                    <option value="monthly">按月</option>
                    <option value="yearly">按年</option>
                </select> -->
            </td>
        </tr>
        <tr>
            <td>到期日期 *</td>
            <td>
                <datepicker :v-name="'dayTo'" :v-value="userPlan.dayTo"></datepicker>
            </td>
        </tr>
    </table>

    <submit-btn></submit-btn>
</form>