<view class="home-wrapper"
      style="padding-top: {{navBarConfig.booFixed ? navBarHeight : 0}}px">
  <!-- 顶部栏 -->
  <navigation-bar
    navBarConfig="{{navBarConfig}}"
    bind:navBarEvent="navBarEvent"/>
  <view class="introduce">
    <view class="list"
          wx:for="{{introduceList}}"
          wx:key="index">
      <image src="{{tools.imgFilter(item.icon)}}"></image>
      <text>{{item.name}}</text>
    </view>
  </view>
  <view class="main">
    <view class="address start">
      <text class="icon">起</text>
      <view class="text-wrap {{ form.start_point.address_name ? 'has' : 'empty' }}"
            data-formkey="start_point"
            data-lat="{{form.start_point.latitude}}"
            data-lon="{{form.start_point.longitude}}"
            bind:tap="handleChooseLocation">
        <text wx:if="{{!(form.start_point.address_name)}}">从哪里出发</text>
        <block wx:else>
          <text>{{form.start_point.name}}</text>
          <text>{{form.start_point.address_name}}</text>
        </block>
      </view>
    </view>
    <block wx:if="{{form.order_pass_location.length}}">
      <view class="address underway"
            wx:for="{{form.order_pass_location}}"
            wx:key="index">
        <text class="icon">经</text>
        <view class="text-wrap {{ item.address_name ? 'has' : 'empty' }}"
              data-formkey="{{'order_pass_location-' + index}}"
              data-lat="{{item.latitude}}"
              data-lon="{{item.longitude}}"
              bind:tap="handleChooseLocation">
          <text wx:if="{{!(item.address_name)}}">输入途经点地址{{index + 1}}</text>
          <block wx:else>
            <text>{{item.name}}</text>
            <text>{{item.address_name}}</text>
          </block>
          <view class="del-wrap"
                catch:tap="delWay"
                data-index="{{index}}">
            <image class="del {{ item.address_name ? 'has' : 'empty' }}"
                   src="{{tools.imgFilter('/home/Home_address_icon_delete@2x.png')}}"></image>
          </view>
        </view>
      </view>
    </block>
    <view class="address end">
      <text class="icon">终</text>
      <view class="text-wrap {{ form.end_point.address_name ? 'has' : 'empty' }}"
            data-formkey="end_point"
            data-lat="{{form.end_point.latitude}}"
            data-lon="{{form.end_point.longitude}}"
            bind:tap="handleChooseLocation">
        <text wx:if="{{!(form.end_point.address_name)}}">要到哪里去？</text>
        <block wx:else>
          <text>{{form.end_point.name}}</text>
          <text>{{form.end_point.address_name}}</text>
        </block>
      </view>
    </view>
    <view class="btn-wrap">
      <view class="number"
            bind:tap="showTravelerPopup">
        <text>{{form.order_user_num ? '乘客 ' + form.order_user_num + ' 人' : '输入乘车人数'}}</text>
        <image src="{{tools.imgFilter('/common/Home_people_icon_arrow@2x.png')}}"></image>
      </view>
      <view class="add" bind:tap="addWay">
        <image src="{{tools.imgFilter('/home/Home_via_icon_add@2x.png')}}"></image>
        <text>添加途经地</text>
      </view>
    </view>
  </view>
  <view class="main">
    <view class="time">
      <view class="label">
        <image class="icon"
               src="{{tools.imgFilter('/home/Home_time_icon_start@2x.png')}}"></image>
        <text>出发时间</text>
      </view>
      <view class="text-wrap {{ form.order_start_time ? 'has' : 'empty' }}" bind:tap="showGoTimePicker">
        <text wx:if="{{!(form.order_start_time)}}">请选择出发时间</text>
        <block wx:else>
          <text>{{tools.formatTs(form.order_start_time, 'YYYY.MM.DD hh:mm week')}}</text>
        </block>
        <image class="arrow"
               src="{{tools.imgFilter('/common/Home_time_icon_arrow@2x.png')}}"></image>
      </view>
    </view>
    <view class="time">
      <view class="label">
        <image class="icon"
               src="{{tools.imgFilter('/home/Home_time_icon_back@2x.png')}}"></image>
        <text>返程时间</text>
      </view>
      <view class="text-wrap {{ form.order_end_time ? 'has' : 'empty' }}" bind:tap="showBackTimePicker">
        <text wx:if="{{!(form.order_end_time)}}">请选择返程时间</text>
        <block wx:else>
          <text wx:if="{{form.order_end_time === '无返程'}}">无返程</text>
          <text wx:else>{{tools.formatTs(form.order_end_time, 'YYYY.MM.DD hh:mm week')}}</text>
        </block>
        <image class="arrow"
               src="{{tools.imgFilter('/common/Home_time_icon_arrow@2x.png')}}"></image>
      </view>
    </view>
    <button class="next"
            type="primary"
            disabled="{{booLock}}"
            bind:tap="onsubmit">下一步
    </button>
  </view>
  <view class="footer {{objOrderCount.count >= 1 ? 'padding-bottom-134' : 'padding-bottom-26'}}">
    <swiper class="home-swiper"
            indicator-color="rgba(255,255,255,1)"
            indicator-active-color="#FFFFFF9B"
            indicator-dots="{{false}}"
            autoplay="{{false}}"
            interval="{{2000}}"
            duration="{{500}}">
      <block wx:for="{{['demo-text-1', 'demo-text-2', 'demo-text-3']}}"
             wx:key="*this">
        <swiper-item>
          <view class="swiper-item" bind:tap="jumpCompany">
            <image src="{{tools.imgFilter('/home/banner.png?v=202207132134')}}"></image>
          </view>
        </swiper-item>
      </block>
    </swiper>
    <view class="tools">
      <view class="title">
        <image src="{{tools.imgFilter('/home/Home_Zone_icon_zone@2x.png')}}"></image>
        <text>功能专区</text>
      </view>
      <image class="customer-services"
             src="{{tools.imgFilter('/home/Home_Zone_banner_service@2x.png')}}"
             bind:tap="jumpHelp"></image>
      <view class="wrap">
        <view bind:tap="jumpInvoice">
          <image class="icon" src="{{tools.imgFilter('/home/Home_Zone_icon_invoice@2x.png')}}"></image>
          <text>开具发票</text>
        </view>
        <view bind:tap="jumpFeedback">
          <image class="icon" src="{{tools.imgFilter('/home/Home_Zone_icon_opinion@2x.png')}}"></image>
          <text>意见反馈</text>
        </view>
      </view>
    </view>
  </view>
</view>
  <!--  有未结束的订单时，首页底部有浮层提示，订单包括：待支付、待接单、待安排车辆、待出发、行驶中、已完成-->
  <!--  当只有1个订单时，点击浮层直接进入该订单详情;当有2个（含）以上时，点击浮层进入“我的订单”列表页-->
<view
  class="jump-order"
  wx:if="{{objOrderCount.count >= 1}}"
  bind:tap="jumpOrder">
  <!-- 悬浮按钮 -->
  <image class="icon-0"
         src="{{tools.imgFilter('/home/Home_remind_icon_indent@2x.png')}}"></image>
  <text>您有{{objOrderCount.count}}笔订单进行中</text>
  <image class="icon-1"
         src="{{tools.imgFilter('/common/Home_remind_icon_arrow@2x.png')}}"></image>
</view>
  <!-- 弹窗：乘车人数 -->
<van-popup
  custom-class="customer-van-popup customer-van-popup_traveler"
  show="{{travelerPopup}}"
  close-on-click-overlay="{{false}}"
  round
  position="bottom"
  bind:close="onClose">
  <view style="left:0;top:0;"
        class="close-icon"
        bind:tap="onClose">
    <image class="image" src="{{tools.imgFilter('/common/Popup_bus_icon_close@2x.png')}}"></image>
  </view>
  <view class="title">乘车人数</view>
  <form bindsubmit="bindSubmit">
    <view class="form-item">
      <input value="{{form.order_user_num}}"
             name="number"
             type="number"
             focus="{{isAutoFocus}}"
             placeholder="请输入乘车人数"
             placeholder-class="placeholder"
             cursor-spacing="{{52}}"
             bindinput="bindInput"></input>
    </view>
    <button type="primary"
            hover-class="none"
            form-type="submit">确定
    </button>
  </form>
</van-popup>

  <!-- 时间选择器：请选择出发时间 -->
<van-popup
  custom-class="customer-van-popup"
  show="{{ booGoTimePicker }}"
  round
  position="bottom"
  bind:close="onCloseGoTimePicker">
  <view style="right:0;top:0;"
        class="close-icon"
        bind:tap="onCloseGoTimePicker">
    <image class="image" src="{{tools.imgFilter('/common/Popup_bus_icon_close@2x.png')}}"></image>
  </view>
  <view class="title">请选择出发时间</view>
  <view>
    <van-picker
      id="van-picker-start_time"
      columns="{{ startColumns }}"
      bind:change="bindChangeGoTimePicker"/>
  </view>
  <button class="customer-picker_footer"
          hover-class="none"
          type="primary"
          bind:tap="getValueGoTimePicker">确定
  </button>
</van-popup>

  <!-- 时间选择器：请选择返程时间 -->
<van-popup
  custom-class="customer-van-popup"
  show="{{ booBackTimePicker }}"
  round
  position="bottom"
  bind:close="onCloseBackTimePicker">
  <view style="right:0;top:0;"
        class="close-icon"
        bind:tap="onCloseBackTimePicker">
    <image class="image" src="{{tools.imgFilter('/common/Popup_bus_icon_close@2x.png')}}"></image>
  </view>
  <view class="title">请选择返程时间</view>
  <view>
    <van-picker
      id="van-picker-back_time"
      columns="{{ endColumns }}"
      bind:change="bindChangeBackTimePicker"/>
  </view>
  <button class="customer-picker_footer"
          hover-class="none"
          type="primary"
          bind:tap="getValueBackTimePicker">确定
  </button>
</van-popup>
<wxs src="../../components/wxs/index.wxs" module="tools"></wxs>
