<t-navbar left-arrow title="个人信息" />
<view class="info-edit">
  <t-cell class="info-edit__cell" required title="姓名">
    <t-input bind:change="onNameChange" align="right" borderless placeholder="请输入患者姓名" slot="note" value="{{personInfo.username}}" />
  </t-cell>
  <t-cell class="info-edit__cell" required title="性别">
    <t-radio-group
      bind:change="onGenderChange"
      borderless
      defaultValue="{{personInfo.sex}}"
      options="{{genderOptions}}"
      slot="note"
      t-class="info-edit__gender"
      value="{{personInfo.sex}}"
    />
  </t-cell>
  <t-cell class="info-edit__cell" title="身份证号">
    <t-input bind:change="onIdInput" align="right" borderless placeholder="请输入身份证号" slot="note" value="{{personInfo.id_number}}"
    
    tips="{{idError ? '身份证号输入不正确' : ''}}"
     />
  </t-cell>
  <t-cell required arrow bind:click="showPicker" data-mode="birth" note="{{personInfo.birthday || '请选择'}}" title="出生日期" />

  <t-cell class="info-edit__cell" align="right" required title="年龄" note="{{personInfo.age}}">
  
  </t-cell>
  <t-cell class="info-edit__cell" required title="出生体重">
    <t-input align="right" bind:change="onWeightInput" borderless placeholder="请输入" slot="note" value="{{personInfo.birth_weight}}" suffix="g"
    format="{{numberFormat}}"
    tips="{{numberError ? '请输入正确的体重' : ''}}"
     />
   
  </t-cell>
  
  <t-cell required arrow bind:click="showPicker" data-mode="operative" note="{{personInfo.operative_date || '请选择'}}" title="胆道闭锁手术时间" />
  <t-cell title="胎次" required arrow bind:click="showSelect" data-mode="parity_number" data-list="{{parity_numberList}}" note="{{personInfo.parity_number ? (parity_numberList[personInfo.parity_number - 1].label) : '请选择'}}">
  </t-cell>
  <t-cell title="产次" required arrow bind:click="showSelect" data-mode="birth_number" data-list="{{birth_numberList}}" note="{{personInfo.birth_number ? (birth_numberList[personInfo.birth_number - 1].label) : '请选择'}}">
  </t-cell>
  <t-cell title="受孕方式" required arrow bind:click="showSelect" data-mode="conception_type" data-list="{{conception_typeList}}" note="{{personInfo.conception_type ? (conception_typeList[personInfo.conception_type - 1].label) : '请选择'}}">
  </t-cell>
  
  <t-cell class="info-edit__cell" required title="孕周">
    <t-input align="right" suffix="周" bind:change="onWeekInput" borderless placeholder="请输入" slot="note" value="{{personInfo.gestational_week}}"
    format="{{numberFormat}}"
    tips="{{weekError ? '请输入正确的孕周' : ''}}" />
  </t-cell>
 
  <t-cell title="产检是否有异常(如有，请填写)" required arrow bind:click="showSelect" data-mode="prenatal_check_type" data-list="{{prenatal_checkList}}" note="{{personInfo.prenatal_check_type ? (prenatal_checkList[personInfo.prenatal_check_type - 1].label) : '请选择'}}">
  </t-cell>
    
    <t-textarea t-class="external-class" wx:if="{{personInfo.prenatal_check_type == 1}}" placeholder="请输入异常描述" disableDefaultPadding="{{true}}" value="{{personInfo.prenatal_check_remark}}" />
  <t-cell title="分娩方式" required arrow bind:click="showSelect" data-mode="delivery_type" data-list="{{deliveryList}}" note="{{personInfo.delivery_type ? (deliveryList[personInfo.delivery_type - 1].label) : '请选择'}}">
  </t-cell>
  
</view>

<view class="info-edit__save">
  <t-button bind:tap="onSaveInfo" block size="medium" theme="primary">保存</t-button>
</view>

<t-date-time-picker
  auto-close
  bind:cancel="hidePicker"
  bind:change="onPickerChange"
  cancelBtn="取消"
  confirmBtn="确认"
  data-mode="birth"
  defaultValue="{{timePicker}}"
  end="{{birthEnd}}"
  filter="{{birthFilter}}"
  format="YYYY-MM-DD"
  mode="date"
  popup-props="{{ { usingCustomNavbar: true } }}"
  start="{{birthStart}}"
  title="选择生日"
  value="{{timeValue}}"
  visible="{{birthVisible}}"
/>

<!-- 下拉选择 -->
<t-picker
  visible="{{selectVisible}}"
  value="{{selectValue}}"
  data-key="value"
  cancelBtn="取消"
  confirmBtn="确认"
  usingCustomNavbar
  bindchange="onSelectChange"
  bindcancel="onPickerCancel"
>
  <t-picker-item options="{{selectList}}"></t-picker-item>
</t-picker>