<wxs src="../../../utils/format.wxs" module="format" />
<view>
  <view class="box-wrapper" wx:if="{{workerNotice.length>0}}">
  <image  src="https://jzmall.lifejingzhi.com/file/wx-servant/course-tips.png" mode="aspectFit"></image>
  <view class="msg-box">
    <!-- vertical="true" -->
    <swiper class="swiper-container"  autoplay="true" circular="true" interval="3000">
   <block wx:for="{{workerNotice}}" wx:key="index">
<!-- 3       <navigator url="/pages/upgrade/messageList?title={{item.url}}" open-type="navigate"> -->     <swiper-item>        <view class="msg-item">
  <view class="content-wrapper">
      <view class="msg-content">{{item}}
      </view>
      </view>
           </view>
   </swiper-item>
<!-- 7       </navigator> -->  
</block>
 </swiper>
 
  </view>
</view>
   <!-- 服务工单 -->
 <view class="service-order">
     <view class="service-title">
       <view class="ser-title-left">
          <image mode="aspectFit" src="/static/images/upgrade/order@selected.png"></image>
          <view>服务工单</view>
       </view>
       <view class="ser-title-right" >
        <image mode="aspectFit" src="/static/images/upgrade/icon-hm.png" wx:if="{{!format.indexOf(bookOrderInfo.bookTradeNo,'JZ')}}"></image>
          <view>{{bookOrderInfo.channel}}</view>
       </view>
     </view>
     <view class="related-info">
       <view class="column">
         <view class="title">相关信息</view>
         <view>客户剩余总服务次数：{{bookOrderInfo.cusRemain}}次</view>
       </view>
       <!-- 消息 -->
       <view class="notice" wx:if="{{bookOrderInfo.rebuySpeach!=''}}">
       <image mode="aspectFit" src="/static/images/upgrade/icon-alert.png"></image>
       <view>
       {{bookOrderInfo.rebuySpeach}}
       </view>
       
       </view>
       <view class="row">服务内容：{{bookOrderInfo.goodsName}} </view>
       <view class="row">客户信息：{{bookOrderInfo.syncTag}} {{bookOrderInfo.cusStatus}} </view>
       <!-- <view class="column">
         <view>订单类型：{{bookOrderInfo.itemType}}</view>
         <view>此次服务进度：{{bookOrderInfo.serviceProcess}}</view>
       </view> -->
       <view class="row">订单类型：{{bookOrderInfo.itemType}}</view>
       <view class="row">此次服务进度：{{bookOrderInfo.serviceProcess}}</view>

     </view>
     <view class="service-info">
      <view class="order-num">
        <view>服务单号：{{bookOrderInfo.bookTradeNo}}</view>
        <image src="/static/images/upgrade/icon-copy.png" mode="aspectFit" class="copy-img" bindtap="copyNum" data-bookno="{{bookOrderInfo.bookTradeNo}}"></image>
      </view>
      <view class="row service-status">
        <view>当前状态：{{bookOrderInfo.status}}</view>
        <view class="invite-comment" wx:if="{{bookOrderInfo.canEval}}">可邀评</view>
        <view class="hp-wrapper" wx:if="{{bookOrderInfo.evalType=='好评'}}">
          <image src="/static/images/upgrade/icon-hp.png" mode="aspectFit" class="hp-img" ></image>
        <text>好评</text>
        </view>
       
        <view class="cp-wrapper" wx:if="{{bookOrderInfo.evalType=='差评'}}">
          <image src="/static/images/upgrade/icon-cp.png" mode="aspectFit" class="cp-img"></image>
          <text>差评</text>
        </view>
        </view>
      <view class="row">服务时间：{{bookOrderInfo.startTime}} - {{bookOrderInfo.endTime}}</view>
      <view class="column">
        <view>客户手机：{{bookOrderInfo.maskUserPhone}}</view>
        <image src="/static/images/upgrade/icon-phone1.png" mode="aspectFit" class="callup-img" bindtap="callUp" data-phone="{{bookOrderInfo.userPhone}}"  wx:if="{{bookOrderInfo.status=='待上门'}}" data-status="{{bookOrderInfo.status}}"></image>
      </view>
      <view class="address">
        <view>服务地址：</view>
        <view class="detail">{{bookOrderInfo.addr}}</view>
        <image src="/static/images/upgrade/icon-map1.png" bindtap="openMap" 
        data-status="{{bookOrderInfo.status}}"  data-lnglat="{{bookOrderInfo.addrDetail}}"  data-address="{{bookOrderInfo.addr}}" wx:if="{{bookOrderInfo.status=='待上门'}}"></image>
      </view>
      <view class="row">客户备注：{{bookOrderInfo.cusremark}}</view>
      
     </view>
     <view class="operate-block">
        <!-- 我已到门 服务完成 品类预检 异常报备 -->
        <view class="{{bookOrderInfo.status=='待上门'?'':'disable'}} operate-item" bindtap="arriveCus" wx:if="{{!format.indexOf(bookOrderInfo.bookTradeNo,'JZ')}}">
            <image src="{{bookOrderInfo.status=='待上门'?'/static/images/upgrade/icon-wydm.png':'/static/images/upgrade/icon-wydm2.png'}}">
            </image>
            <view>我已到门</view>
        </view>

        <view class="{{bookOrderInfo.status=='待履约'||bookOrderInfo.status=='已预约'?'':'disable'}} operate-item" bindtap="finishOrder">
            <image src="{{bookOrderInfo.status=='待履约'||bookOrderInfo.status=='已预约'?'/static/images/upgrade/icon-fwwc.png':'/static/images/upgrade/icon-fwwc2.png'}}">
            </image>
            <view>服务完成</view>
        </view>

        <!-- {{preResultDate.state!=0?'disable':''}}  -->
        <view class="operate-item" wx:if="{{preResultData.status==0}}"  bindtap="goPre" data-id="{{preResultData.id}}"
          data-bookNo="{{preResultData.bookNo}}" data-userPhone="{{preResultData.userPhone}}" >
            <image src="{{false?'/static/images/upgrade/icon-detail2.png':'/static/images/upgrade/icon-detail.png'}}">
            </image>
            <view>品类预检</view>
        </view>

        <view class="{{false?'disable':''}} operate-item"  bindtap="goProblemList">
            <image src="/static/images/upgrade/icon-ycbb.png">
            </image>
            <view>异常报备</view>
        </view>

     </view>

 </view>


 <van-tabs active="{{ activeTab }}" color="#09afff"  id="tabs" bind:change="onTabChange" id="tabs">
    <van-tab title="问题工单" name="1"></van-tab>
    <van-tab title="预检单" name="2" wx:if="{{bookOrderInfo.itemType=='品类'}}"></van-tab >

  </van-tabs>
  <!-- 问题工单 -->
  <view class="ticket-list" wx:if="{{activeTab==1}}">
      <view class="ticket-item" wx:for="{{ticketList}}" wx:key="index">
         <view class="ticket-top">
          <view class="top-left">
          <image src="/static/images/upgrade/icon-wtgd.png" mode="aspectFit"></image>
          <view wx:if="{{item.ticketType==1}}">问题工单</view>
          <view wx:if="{{item.ticketType==0}}">报备工单</view>
          </view>
          <view class="top-right" >
            <image src="/static/images/upgrade/icon-hm.png" mode="aspectFit" wx:if="{{!format.indexOf(bookOrderInfo.bookTradeNo,'JZ')}}"></image>
            <view>{{item.channel}}</view>
          </view>
         </view>
         <view class="ticket-content">
           <view>工单类型：{{item.ticketTypeStr}}</view>
           <view>工单状态：{{item.statusDesc}}</view>
           <view>工单时间：{{item.createTime}}</view>
           <view>关联单据：{{item.relationBookTradeNo}}</view>
           <view>最新进度:</view>
         </view>
         <!-- 进度 -->
         <view class="prorgress">
            <view class="progress-dot"></view>
            <view>{{item.content}}</view>
         </view>
         <view class="progress-tip">
          {{item.processTime}}
         </view>
         <!-- wx:if="{{item.ticketType==0&&item.source=='SS'}}" -->
         <view class="ticket-bottom" >
          <!-- wx:if="{{item.status!=2&&item.status!=3&&item.statusDesc!='处理中-升级'}}" -->
          <view class="operate-item"  bindtap="goUrge" data-sn="{{item.ticketSN}}" wx:if="{{item.status!=2&&item.status!=3&&item.statusDesc!='处理中-升级'}}">
          <image src="/static/images/upgrade/icon-hurry.png" mode="aspectFit"></image>
           <view>催促办理</view>
         </view>
         <!-- wx:if="{{item.status==2&&item.isCommented==false}}"  -->
         <view class="operate-item"  
         data-id="{{item.ticketId}}" data-sn="{{item.ticketSN}}" bindtap="goComment"  wx:if="{{item.status==2&&item.isCommented==false}}">
          <image src="/static/images/upgrade/icon-detail.png" mode="aspectFit"></image>
           <view>评价过程</view>
         </view>
         <!-- wx:if="{{item.status==1}}"  -->
         <view class="operate-item" bindtap="goCancel" data-sn="{{item.ticketSN}}" wx:if="{{item.status==1}}" >
          <image src="/static/images/upgrade/icon-cancel.png" mode="aspectFit"></image>
           <view>取消报备</view>
         </view>
         
         </view>
      </view>
  </view>
  <!-- 预检单 -->
  <view  wx:if="{{activeTab==2}}">
    <view class='book' >
      <view style="border-bottom:0.5rpx dashed #999">
        <view class="status">{{preResultData.status==0?'未预检':'已预检'}}</view>
        <view class="bookname">工单号：{{preResultData.bookNo}}</view>
        <view class="address">服务地址：{{preResultData.stationName}}-{{preResultData.address}}</view>
        <view class="serviceTime">预约时间：{{preResultData.serviceTime}}</view>
        <view class="serviceTime" wx:if="{{item.status==1}}">服务时间：{{preResultData.createTime}}</view>
        <view class="goodsname">客户名称：{{preResultData.userName}}</view>
      </view>

      <!-- 预检项目 -->
      <view class="content" wx:for="{{preResultData.items}}" wx:for-item='detail' wx:key='*this'>
        <view class="category">服务项:{{detail.categoryName}}</view>
        <view class="device">
          {{detail.deviceName}}
          <span wx:if="{{detail.positionName}}">(</span>
          <span>{{detail.positionName}}</span>
          <span wx:if="{{detail.positionName}}">)</span>
        </view>

        <view class="problem">
          <view class="item" wx:for="{{detail.problemsName}}" wx:for-item='problem' wx:key='*this'>{{problem}}</view>
          <view class="item" wx:if="{{detail.memo}}">备注:{{detail.memo}}</view>
        </view>
        <view class="problem">
          <image class="img" src="{{pic}}" wx:for="{{detail.picUrls}}" wx:for-item='pic' wx:key='*this' />
        </view>

      </view>


      <view class="tool">
        <!--  <button class="btn" bindtap="openMap" data-lng="{{item.lng}}" data-lat="{{item.lat}}" data-address="{{substring(item.stationName,1,2)+item.address}}">地图</button> -->
        <button class="btn" data-mobile="{{preResultData.userPhone}}" bindtap="makeCall">联系客户</button>
        <!-- <button class="btn" wx:if="{{preResultData.status==0}}" style="color:darkred" bindtap="goPre" data-id="{{preResultData.id}}"
          data-bookNo="{{preResultData.bookNo}}" data-userPhone="{{preResultData.userPhone}}">去预检</button> -->

        <button class="btn" bindtap="editPre" data-bookno="{{preResultData.bookNo}}"
          wx:if="{{format.substrDate(preResultData.createTime)==today}}">修改</button>
      </view>
    </view>

  </view>
 

</view>
<van-overlay show="{{ myqr_show }}" bind:click="onClickHide">
<view class="myqr" >
  <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:0rpx auto">
    <view class="star">
      <view style="line-height: 70rpx;font-size: 32rpx;color: #333;">总体：</view>
      <image wx:for="{{comments.stars}}" wx:key="id" src="{{item.checked?item.imgSelected:item.img}}"
        data-level="{{item.level}}" bindtap="clickStar"></image>
      <view style="line-height: 70rpx;margin-left:10rpx;color: #333;">
        {{comments.selectedDes}}
      </view>
    </view>
    <view style="margin:10rpx 0;padding: 5rpx 0;height: 322rpx;">
      <textarea class="comment-txt" bindinput="bindCommentRemark" value="{{comments.comment}}"
        placeholder='请输入处理速度、结果等'></textarea>
    </view>
  </view>
  <view style="text-align: center;display: flex;justify-content: center;margin:20rpx">
    <view class="btn" bindtap="goSaveCommnet">提交</view>
  </view>
</view>
</van-overlay>