<import-sjs name="u" from="./utils.sjs"/>
<wrapper>
  <view class="hospital-num-item{{ isFlex ? ' flex' : '' }}">
    <view class="num-item-header">
      <image
        class="avatar"
        onTap="onShowDoctor"
        src="{{ item.picUrl || defaultUrl }}"
      />
      <view
        class="content"
        onTap="onShowDoctor"
      >
        <view class="name">
          {{ item.name }}
          <text class="zw" a:if="{{ isFlex }}">
            {{item.level}}
          </text>
        </view>
        <view class="desc" a:if="{{ !!item.desc && isFlex }}">
          <text number-of-lines="{{ !isRange ? 2 : 1 }}">{{ item.desc }}</text>
        </view>
      </view>
      <view class="footer" a:if="{{ !u.hasRange(item) || !isRange }}">
        <view
          onTap="toDoctorPage"
          data-item="{{ item }}"
          class="follow-button{{ item.remain > 0 ? '' : ' disabled' }}"
        >
          {{ item.remain > 0 ? '预约' : '已约满' }}
        </view>
      </view>
    </view>
    <order-session item="{{ item }}" a:if="{{ isRange }}">
      <view slot-scope="props" class="num-item-content">
        <view class="time-range-items">
          <view
            a:for-item="row" a:for="{{ props.rows }}"
            class="time-range-item{{ row.remain > 0 ? '' : ' disabled' }}"
          >
            <view class="range-left">
              <text class="am-text">{{ row.name }}</text>
              <text class="pm-text"> 剩余 {{ row.remain }}</text>
            </view>
            <view class="range-right">
              <text class="price">￥{{ row.min }}</text>
              <view
                onTap="onItemFollow" data-item="{{ row }}"
                class="follow-button{{ row.remain > 0 ? '' : ' disabled' }}"
              >
                {{ row.remain > 0 ? '预约' : '已约满' }}
              </view>
            </view>
          </view>
        </view>
      </view>
    </order-session>
  </view>
</wrapper>

<!--时间段-->
<time-range
  show="{{ showRange }}"
  rangeItem="{{ rangeItem }}"
  params="{{ routeState }}"
  onClose="onTimeRangeClose"
/>

<!--医生简介-->
<doctor-introduction
  show="{{ showDoctor }}"
  onClose="onClosedDoctor"
  doctorId="{{ item.doctorId }}"
/>
