<page-container>
  <item-row title="选择时段">
    <view class="select-time-component-container">
      <block a:if="{{times.length > 0}}">
        <view
          a:for="{{times}}"
          a:for-item="item"
          a:for-index="index"
          data-value="{{index}}"
          onTap="onItemTap"
          class="select-item{{(!(+item.stock) || item.disabled) ? ' disabled':(selectedIndex === index ? ' active' : '')}}"
        >
          <text class="time">{{ item.startTime }}-{{ item.endTime }}</text>
          <view class="sold">{{ (+item.stock) === -1? '999+' : item.stock}}</view>
        </view>
      </block>
      <view
        a:else
        class="select-item{{ !!(+totalStock) ?(selectedIndex === 0 ? ' active' : '') : ' disabled'}}"
      >
        <text class="time">全天</text>
        <view class="sold">{{(+totalStock) === -1? '999+' : item.stock}}</view>
      </view>
    </view>
  </item-row>
</page-container>


