<wxs src="../../../utils/format.wxs" module="format" />

<view class="myqr" wx:if="{{myqr_show}}">
  <view style="text-align:center">
    <image class="cancel" src="/static/images/cancel.png" bindtouchstart="qrtouchstart"></image>
    <span style="font-size: 16px;color: #333;margin-top: 30rpx;font-weight:600">处理内容</span>
  </view>
  <view style="text-align:center;margin:50rpx auto">
    <textarea style="width:unset;border:2rpx solid #999;border-radius:10rpx;text-align: left;padding:10rpx;color:#333;"
      bindinput="bindContent" value="{{content}}" placeholder='请输入处理内容'></textarea>
  </view>
  <view class="btn" style="text-align: center;margin: 0 auto;" bindtap="ticketHandle">提交</view>
</view> 

<view class="container" style="filter:brightness({{myqr_blur}})">
  <view class="orders-switch">
    <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="{{list.length <= 0}}">
    <view class="c">
      <text>还没有工单呢</text>
    </view>
  </view>

  <view class="orders">
    <view class='book' wx:for="{{list}}" wx:for-item="item" wx:key="item" style="background-color:#fff;padding:10rpx;">
      <view style="display: flex;justify-content: space-between;margin-bottom: 20rpx;">
        <view class="ticketSn">工单号：{{item.ticketSn}}</view>
        <view class="{{item.status=='已完成-完成'?'status':'status-action'}}">状态：{{item.status}}</view>
      </view>
      <view class="ticket">
        <view class="ticket-item">工单类型：</view>
        <view class="ticket-content">{{item.type}}</view>
      </view>
      <view class="ticket">
        <view class="ticket-item">客户名称：</view>
        <view class="ticket-content">{{item.cusName}}</view>
      </view>
      <view class="ticket">
        <view class="ticket-item">客户手机：</view>
        <view class="ticket-content flex-center">
          <text>{{item.cusMobile}}</text>
          <image src="/static/images/phone.png" style="width: 30rpx;height: 30rpx;margin-left:10rpx;"
            data-mobile="{{item.cusMobile}}" bindtap="makeCall"></image>
        </view>
      </view>
      <view class="ticket">
        <view class="ticket-item">创建时间：</view>
        <view class="ticket-content">{{item.createTime}}</view>
      </view>
      <view class="ticket">
        <view class="ticket-item">服务单号：</view>
        <view class="ticket-content">{{item.bookSn}}</view>
      </view>
      <view class="ticket">
        <view class="ticket-item">服务时间：</view>
        <view class="ticket-content">{{item.bookTime}}</view>
      </view>
      <view class="ticket">
        <view class="ticket-item">服务人员：</view>
        <view class="ticket-content">{{item.servicer}}</view>
      </view>
      <view class="ticket">
        <view class="ticket-item">咨询项：</view>
        <view style="display: flex;flex-direction: column;">
          <view class="ticket-content" wx:for="{{item.consults}}" wx:for-item="consult" wx:key="consult">
            {{consult}}
          </view>
        </view>
      </view>
      <view class="ticket">
        <view class="ticket-item">处理时长：</view>
        <view class="ticket-content">{{item.duration}}</view>
      </view>
      <view class="ticket">
        <view class="ticket-item">工单描述：</view>
        <view class="ticket-content-ellipsis">{{item.ticketDesc}}</view>
      </view>

      <view class="tool">
        <!-- <van-icon name="fire-o" dot></van-icon> -->
        <view class="btn" bindtap="viewTicket" data-sn="{{item.ticketSn}}">工单详情</view>
        <view class="btn" wx:if="{{item.isCanHandle}}" bindtap="goHandle" data-sn="{{item.ticketSn}}">处理工单</view>
        <!-- <view class="btn" wx:if="{{item.isCanHandle}}" style="color:darkred" bindtap="goCompleted"
          data-sn="{{item.ticketSn}}">完成工单</view> -->
      </view>
    </view>


  </view>
</view>