<!--module/user/pages/user-edit/user-edit.wxml-->
<wxs src="../../../../core/wxs/dictionary.wxs" module="dictionary" />
<t-navbar title="完善信息" left-arrow />
<scroll-view class="page-scroll__container" type="list" scroll-y style="{{containerStyle}}">
  <form mut-bind:submit="onSubmit" bindinput="onFormInput">
    <form-fix _loading="{{dirty}}" delay="200">
      <!-- <t-cell t-class="cell-border-gradient" title="手机号" note="{{model['phone']}}" /> -->
      <t-cell title="姓名">
        <input class="cell-field__inner" slot="note" name="name" value="{{model['name']}}" type="text" placeholder="请输入姓名" confirm-type="next" data-field="name" bindinput="onFormInput"  />
      </t-cell>
      <view class="cell-row">
        <view class="label">身份证号</view>
        <input class="input" name="cardno" value="{{model['cardno']}}" type="idcard" placeholder="请输入身份证号" confirm-type="next" data-field="cardno" bindinput="onFormInput" maxlength="18" />
      </view>
      <block wx:if="{{!idCardValid}}">
        <t-cell title="年龄" required>
          <input class="cell-field__inner" slot="note" name="age" value="{{model['age']}}" type="number" placeholder="请输入年龄" confirm-type="next" data-field="age" bindinput="onFormInput" style="padding-right:12%" />
          <view class="cell-field__suffix" slot="note">岁</view>
        </t-cell>
        <t-cell title="性别" required>
          <field-radio slot="note" name="sex" value="{{model['sex']}}" options="{{dictionary.options($dictionaries, 'sys_user_sex')}}" bind:change="onSexChange" />
        </t-cell>
      </block>
      <block wx:else>
        <t-cell title="年龄" note="{{model['age']}}岁" required />
        <t-cell title="性别" note="{{dictionary.label($dictionaries, 'sys_user_sex', model['sex'])}}" required />
      </block>
      <user-data-edit model="{{model}}" dirty="{{dirty}}"></user-data-edit>
      <form-button block index="1" loading="{{dirty}}" auto="{{true}}"></form-button>
    </form-fix>
  </form>
</scroll-view>

<t-message id="{{$messageId}}" />