
<view class="reason-form">
  <!--  -->
  <view class="two-level-menu">
    <view class="title">
      <view class="back-icon" a:if="{{showSecondReason}}" onTap="handleReset">
        <am-icon type="left" size="30"></am-icon>
      </view>
      {{showSecondReason ? reasons[currentIndex].childContent.childSubject : subject}}
    </view>
    <page-result class="reason-container" local a:if="{{ reasonsError }}" type="network" title="查询来访原因列表失败" brief="点击按钮重试" footer="{{footer}}" onTapLeft="refreshReason"></page-result>
    <view class="reason-container flex-grid column3" a:if="{{reasons && reasons.length > 0 && !showSecondReason }}">
      <view class="btn-box {{currentIndex === index? 'active' : ''}} {{reasons.length <= 6 ? (reasons.length <= 3 ? 'line1' : 'line2') : 'line3'}}" a:for="{{reasons}}" a:key="{{item.name}}" onTap="handleReasons" data-code="{{item.code}}" data-title="{{item.name}}" data-index="{{index}}" >
        {{item.name}}
      </view>
    </view>
    <view a:if="{{showSecondReason}}">
      <view class="reason-container flex-grid column4" a:if="{{reasons && reasons[currentIndex].childContent.childContentType === 'radio'}}">
        <view class="btn-box {{form.description === item.code? 'active' : ''}}" a:for="{{reasons[currentIndex].childContent.childContentDatasource}}" a:key="{{item.title}}" onTap="handleSecondReason" data-title="{{item.title}}" data-value="{{item.code}}" data-logo="{{item.logo || ''}}">
          <image a:if="{{item.logo}}" class="logo" mode="scaleToFill" src="{{item.logo.length == 32 ? imgSrcPrefix + item.logo : item.logo}}"></image>
          {{item.title}}
        </view>
      </view>
      <block>
        <view a:if="{{reasons[currentIndex].showFloor}}">
          <!-- 小区信息以及房间选择步骤条 -->
          <steps activeIndex="{{ form.roomInfo ? 2 : activatedStep }}" communityInfo="{{ passport }}" roomInfo="{{ form }}" onClick="onStepsItemClick"></steps>
        </view>
        <view class="text-container" a:if="{{reasons[currentIndex] && reasons[currentIndex].childContent.childContentType === 'textarea'}}" >
          <textarea focus controlled value="{{form.description}}" placeholder="{{reasons[currentIndex].childContent.tips||''}}" maxlength="{{reasons[currentIndex].childContent.childContentLength}}" onInput="handleSecondReason"></textarea>
        </view>
      </block>
    </view>
  </view>
  <!--  -->
  <view class="button-container">
    <button class="btn" size="default" type="primary" onTap="onSubmit" disabled="{{ buttonDisable }}">提交登记</button>
  </view>
</view>