<!--pages/detail/enroll/index.wxml-->
<wxs src="../../common.wxs" module="common"></wxs>

<view class='page-wrapper'>

  <view class='project-title'>
    <text>报名项目</text>
  </view>

  <!-- 报名详情 -->
  <view class='project_info-box'>
    <view class='project_info'>
      <image class='project_info_image' src='{{detail.poster}}'></image>
      <view class='info-box'>
        <text>{{detail.title}}</text>
        <view>
          <text class='text-price'>￥{{detail.price}}</text>
          <text class='text-vip-price'>￥{{detail.vip_price}}</text>
          <image class='vip-img' src='/images/icon_vip_price.png'></image>
        </view>
      </view>
    </view>
  </view>

  <view class='project-title'>
    <text>报名信息</text>
  </view>

  <!-- 报名信息 -->
  <view class='project-input margin-bottom'>
    <i-cell-group>
      <i-cell title="数量" is-link i-class="cell-class">
        <picker slot="footer" class="num-picker" bindchange="bindPickerChange" range="{{nums}}" value="{{familyNum}}">
          <view class='picker-text'>{{familyNum + 1}}</view>
        </picker>
      </i-cell>
    </i-cell-group>
  </view>

  <view class='project-input'>
    <i-cell-group>
      <i-cell title="姓名" i-class="cell-class">
        <input slot="footer" class='input' type='text' placeholder='请输入您的姓名' bindinput='handleNickname' value='{{nickname}}'></input>
      </i-cell>
      <i-cell title="手机号" i-class="cell-class">
        <block wx:if="{{phone.length == 0}}">
          <button slot="footer" bindtap='openAlert' type="info" class="btn-auth-phone">填写手机号</button>
        </block>
        <block wx:else>
          <text slot="footer">{{phone}}</text>
        </block>
      </i-cell>
      <!-- <i-cell title="成人人数" is-link i-class="cell-class">
        <picker slot="footer" class="num-picker" bindchange="handleAdultNum" range="{{nums}}" value="{{adultNum}}">
          <view class='picker-text'>{{adultNum + 1}}</view>
        </picker>
      </i-cell>
      <i-cell title="孩子人数" is-link i-class="cell-class">
        <picker slot="footer" class="num-picker" bindchange="handleChildrenNum" range="{{nums}}" value="{{childrenNum}}">
          <view class='picker-text'>{{childrenNum + 1}}</view>
        </picker>
      </i-cell>
      <i-cell title="孩子年龄" i-class="cell-class">
        <input slot="footer" class='input' type='text' placeholder='如5岁、八岁' bindinput='handleChildrenAge'></input>
      </i-cell> -->
      <i-cell title="地址" i-class="cell-class">
        <input slot="footer" class='input' type='text' placeholder='请输入地址' bindinput='handleAddress'></input>
      </i-cell>
      <i-cell title="备注" i-class="cell-class">
        <input slot="footer" class='input' type='text' placeholder='备注(可选)' bindinput='handleRemark'></input>
      </i-cell>
    </i-cell-group>
  </view>

  <i-row i-class="margin-top-20">
    <i-col span="20" offset='2' i-class="col-class">
      <i-button bind:click="handleSubmit" type="info" shape="circle" loading="{{loading}}">
        立即支付
        <text class='margin-left-10'>¥ {{user.is_vip != 0 ? common.numFixed(detail.vip_price*(familyNum+1), 2) : common.numFixed(detail.price*(familyNum+1), 2)}}</text>
      </i-button>
    </i-col>
  </i-row>
</view>



<!-- 手机号授权框 -->
<i-modal title="填写手机号" visible="{{ visible }}" bind:ok="savePhone" bind:cancel="alertClose">
  <i-input error="{{ errMsg }}" value="{{ value }}" type="number" bindchange='handlePhone' title="手机号" placeholder="请输入手机号" />
  <view class="color-red">{{ errMessage }}</view>
</i-modal>

<!-- 弹窗 -->
<i-toast id="toast" />