<wxs src="../../../utils/format.wxs" module="format" />
<view class="container">
  <view class="orders-switch">
    <view class="item {{ showType == 4 ? 'active' : ''}}" bindtap="switchTab" data-index='4'>
      <view class="txt">今日工单</view>
    </view>
    <view class="item {{ showType == 1 ? 'active' : ''}}" bindtap="switchTab" data-index='1'>
      <view class="txt">未服务</view>
    </view>
    <view class="item {{ showType == 2 ? 'active' : ''}}" bindtap="switchTab" data-index='2'>
      <view class="txt">已服务</view>
    </view>
    <!-- <view class="item {{ showType == 3 ? 'active' : ''}}" bindtap="switchTab" data-index='2'>
      <view class="txt">已取消</view>
    </view> -->
    <view class="item {{ showType == 0 ? 'active' : ''}}" bindtap="switchTab" data-index='0'>
      <view class="txt">全部工单</view>
    </view>

  </view>
  <view class="no-order" wx:if="{{orderList.length <= 0}}">
    <view class="c">
      <text>还没有服务工单呢</text>
      <!-- <view style="display:flex;margin-top:30rpx">
        <button class="btn" style="margin:0 auto" bindtap="goProblemAdd">手动报备问题</button>
      </view> -->
    </view>
  </view>

  <view class="orders">
    <view class='order' wx:for="{{orderList}}" wx:for-item="item" wx:key="item">
      <view class="h">
        <view class="l">预约时间：{{item.bookTime}}</view>
        <view class="r">{{item.status}}</view>
      </view>
      <view class="goods">
        <view class="info">
          <text class="name">服务地址：{{item.address}}</text>
          <text class="number">工单编号:{{item.bookTradeNo}}</text>
          <text class="number" decode="{{true}}">预约备注：{{item.remark}} </text>
          <text class="number" decode="{{true}}">客户名称：{{item.userName}} </text>
          <view class="number" bindtap="makeCall" data-phone='{{item.userPhone}}'
            style="display: flex;justify-content: space-between;">
            <view style="color:#666">联系电话：{{item.userPhone}}</view>
            <view style="display: flex;align-items: center;height: 40rpx;">
              <image style="width: 30rpx;height:32rpx;margin-top: 5rpx;" src="/static/images/phone.png"></image>
              <view style="color:#666;margin-left: 10rpx;font-size: 32rpx;">联系</view>
            </view>
          </view>
        </view>
      </view>
      <view class="order-item-operate">
        <view class="order-item-result"></view>
        <view class="order-operate-wrapper">
          <view wx:if="{{format.indexOf(item.bookTime,today)&&isTest&&(item.status=='待上门')}}" catchtap="goArrived"
            data-id='{{item.bookTradeNo}}'>我已上门</view>
          <view wx:if="{{format.indexOf(item.bookTime,today)&&isTest&&(item.status=='待履约'||item.status=='已预约')}}"
            catchtap="goConfirm" data-id='{{item.bookTradeNo}}'>服务已完成</view>
          <view catchtap="goProblemAdd" data-id='{{item.bookTradeNo}}'>问题报备</view>
          <view catchtap="openMap" data-id='{{item.bookTradeNo}}'>导航</view>
        </view>
      </view>

    </view>

  </view>
</view>