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

	<!-- 服务单信息 -->
	<view class="service-order-new {{orderInfo.statusName=='服务已完成'?'finished-order':''}}">
		<view class="service-title">
			<view class="title-left">
				<image mode="aspectFit" src="/static/images/upgrade/order@selected.png">
				</image>
				<view  wx:if="{{showjz}}">{{orderInfo.channel}}</view>
				
			</view>
			<view class="order-status">
				{{orderInfo.statusName}}
			</view>
		</view>
		<view class="service-content main-info">
			<view>服务内容</view>
			<view class="detail">{{orderInfo.goodsName}}</view>
		</view>
		<view class="service-content main-info">
			     <view>服务时间</view>
					 <view class="detail">{{orderInfo.bookDate}}  {{orderInfo.bookTimeRange}}</view>
			</view>
			<block wx:if="{{orderInfo.channel!='盒马'}}">
							<view class="service-content main-info">
									<view>服务技能时长</view>
									<view class="detail">{{orderInfo.skillName}},{{orderInfo.serviceLength}}小时</view>
							</view>
							<view class="service-content main-info">
									<view>上门打卡时间</view>
									<view class="detail">{{orderInfo.isOndoor==1?'已打卡':'未打卡'}} {{orderInfo.ondoorTime==null?'':orderInfo.ondoorTime}}</view>
							</view>
							<view class="service-content main-info">
									<view>服务完成时间</view>
									<view class="detail">{{orderInfo.isFinish==1?'已服务':'未服务'}} {{orderInfo.finishTime==null?'':orderInfo.finishTime}}</view>
							</view>
			</block>
			<view class="service-content main-info" wx:if="{{orderInfo.unitIncreaseNumber >=1 }}">
			     <view>加购内容</view>
					 <view class="detail">{{orderInfo.unitDescribe}} * {{orderInfo.unitIncreaseNumber}}</view>
			</view>
			<view class="service-content main-info">
			     <view>工单ID</view>
					 <view class="detail">{{orderInfo.detailId}}</view>
			</view>
			<view class="service-content main-info">
			     <view>服务进度</view>
					 <view class="detail">订单剩余 {{orderInfo.leftTimes}} 次</view>
			</view>
		<!-- <view class="service-address">
			<view class="address-dot"></view>
			<view class="address-detail">
			{{orderInfo.addr}}
			</view>
		</view> -->
		<!-- <view class="service-tips">
			<view class="tips-title">注意事项：</view>
			<view class="tips-detail">注意家里有宠物，一猫一…</view>
		</view> -->
		<!-- <view class="service-provision"  wx:if="{{showjz}}">
			<view>预计计提¥ </view>
			<view class="provision-amount">{{orderInfo.income}}</view>
		</view> -->
		<view class="service-tag-line">
			<view class="{{item.level==1?'tag-important':'tag-common'}}" wx:for="{{orderInfo.labelList}}" wx:key="index">{{item.resultName}}</view>
			
		</view>
		<view class="data-update">
			<view>数据更新时间：{{orderInfo.reportUpdateTime}}</view>
			<view bindtap="getDataRefresh" >点击刷新</view>
		</view>

	</view>
	<view class="customer-remark {{orderInfo.statusName=='服务已完成'?'finished-order':''}}"  bindtap="tapCusRemark" wx:if="{{orderInfo.customerServiceSr&&orderInfo.customerServiceSr!=null}}">
		<view class="remark-title">
			客户需求备注
		</view>
		<view class="remark-content">
		{{orderInfo.customerServiceSr}}
		</view>
	</view>
	
	<view class="customer-address {{orderInfo.statusName=='服务已完成'?'finished-order':''}}">
    <view class="remark-title">
      客户预采需求
    </view>
    <view class="remark-content">
      <view class="customer-need" wx:for="{{ticketPrelist}}"
      wx:key="index">
        <view class="tag-l">
          <view class="tag-l-item">{{item.levelTwo}}</view>
        </view>
        <view class="tag-r">
          <view class="tag-r-item" wx:for="{{item.child}}" wx:for-item="items">{{items}}</view>
        </view>
      </view>
    </view>

  </view>
	
	 <view class="customer-address {{orderInfo.statusName=='服务已完成'?'finished-order':''}}">
		 <view class="address-title">
			<view>服务地址</view>
			<view class="right" wx:if="{{orderInfo.statusName!='服务已完成'}}" bindtap="openMap" >
			  
				<image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-servant/new/icon-navigation.png">
				</image>
				<view class="navi-now">立即导航</view>
			</view>
		</view> 
		<view class="address-detail">
			{{(orderInfo.statusName!='服务已完成')?orderInfo.addr:'信息保护中'}}
			 <text wx:if="{{orderInfo.statusName!='服务已完成'}}" data-content="{{orderInfo.addr}}" bindtap="copyNum">点击复制</text>
		</view>
	</view>
	<view class="new-operate">
		<view class="operate-left">
			<view>复购码</view>
			<view class="rebuy-code">{{orderInfo.rebuyCode}}</view>
		</view>
		<view class="operate-right" data-content="{{orderInfo.rebuyCode}}" bindtap="copyNum">
			<image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-servant/new/icon-finger.png">
			</image>
			<view class="operate-text">点击复制</view>
		</view>
	</view>
	<view class="new-operate" wx:if="{{orderInfo.channel!='盒马'}}">
		<view class="operate-left">
			<view>补差</view>

		</view>
		<view class="operate-right" bindtap="supplyCode" data-bookno="{{orderInfo.detailId}}">
			<image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-servant/new/icon-finger.png">
			</image>
			<view class="operate-text">发起补差</view>
		</view>
	</view>
	<view bindtap="supplyRecord" data-bookno="{{orderInfo.detailId}}" class="supply-board" wx:if="{{orderInfo.channel!='盒马'}}">
		<image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-servant/new/icon-supply-record.png">
			</image>
			<view>查看补差记录</view>
	</view>
	<view class="new-operate">
		<view class="operate-left">
			<view>企微</view>

		</view>
		<view class="operate-right" data-channel="{{orderInfo.channel}}"  data-id="{{orderInfo.detailId}}" bindtap="getQrCode">
			<image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-servant/new/icon-finger.png">
			</image>
			<view class="operate-text">加企微</view>
		</view>
	</view>


	<view class="bottom-wrapper">
		<view class="bottom-operate">
			<image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-servant/new/contact-cus.png"  data-mobile="{{orderInfo.userPhone}}" bindtap="makeCall" wx:if="{{orderInfo.canOperateMap.canContract}}">
			</image>
			<image mode="aspectFit" src="https://jzmall.lifejingzhi.com/file/wx-servant/new/contact-cus-disable.png"   wx:else>
			</image>
			<view class="operate-btn" wx:if="{{orderInfo.canOperateMap.ondoor}}" bindtap="arriveCusNew">
				我已到户
			</view>
			<view class="operate-btn" wx:if="{{orderInfo.canOperateMap.canAcceptance}}" bindtap="goCusCheck">
				邀请验收
			</view>
			<view class="operate-btn" wx:if="{{orderInfo.canOperateMap.preCheck}}" bindtap="goPre" data-id="{{orderInfo.preResultData.id}}" data-bookNo="{{orderInfo.preResultData.bookNo}}" data-userPhone="{{orderInfo.preResultData.userPhone}}">
				发起预检
			</view>
		</view>
	</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="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>

			<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" bind:change="onTabChange" id="tabs">
		<van-tab title="问题工单" name="1"></van-tab>
		<!-- <van-tab title="补差记录" name="3"></van-tab> -->
		<van-tab title="预检单" name="2" wx:if="{{orderInfo.pl}}"></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(orderInfo.detailId,'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>

<van-overlay show="{{ remarkTipsShow }}">
	<view class="refund-order-overlay">
		<view class="refund-order-dialog">
			<view class="refund-dia-title">客户需求备注</view>
			<view class="refund-dia-tips">
				{{orderInfo.customerServiceSr}}
			</view>
			<view class="dia-btn-wrapper">
				<view class="dia-cancel-btn" bindtap="goIm">联系在线客服</view>
				<view class="dia-conf-btn" bindtap="readRemark">收到已读</view>

			</view>
		</view>
	</view>
</van-overlay>

<van-overlay show="{{ issueTipsShow}}">
	<view class="refund-order-overlay issue-overlay">
		<view class="refund-order-dialog">
			<view class="refund-dia-title">异常</view>
			<view class="refund-dia-tips">服务时间尚未开始，您确定要开始服务吗？请和客户确认后报备</view>
			<view class="dia-btn-wrapper">
				<view class="dia-cancel-btn" bindtap="hideIssue">返回</view>
				<view class="dia-conf-btn" bindtap="exceotionConf">确认并报备</view>

			</view>
		</view>
	</view>
</van-overlay>

<issue-mov pageX="500" pageY="900" issue="{{orderInfo.detailId}}"></issue-mov>