<!--pages/medinceOrderDetail/medinceOrderDetail.wxml-->
<wxs src="../../../filters/filter.wxs" module="filter"></wxs>
<view class="ui-navigatorbar" style="border-bottom: 1rpx solid #E3E4E5;background:#fff;">
    <image class="ui-navigatorbar-back" bindtap="goBack" src="{{img_host+'/back.png'}}" />
    <view class="ui-title">订单详情</view>
  </view>
<view class="page">

   <view class="outwraper {{order.detection_status==2?'active':''}}">
  <view class="patientbox">
   <view class="patient_name">
    就诊人信息
   </view>
   <view class="rightcon">
    {{order.patient_name}}（<text wx:if="{{order.patient_sex==1}}">男</text><text wx:elif="{{order.patient_sex==2}}">女</text><text wx:else>未知</text>｜{{order.patient_age}}岁）
   </view>
</view>
<view class="bindbox" wx:if="{{order.detection_status==2 || order.detection_status==3 || order.detection_status==4}}">
  <view class="tiptitle" wx:if="{{!showError}}">
     <view class="tipleft">
      绑定检测码
     </view>
     <!-- <view class="tipright">
      查看手册
     </view> -->
  </view>
  <view class="errorbox" wx:else="{{showError}}">
    <view class="errorleft">
      <image src="{{img_host+'/check_error.png'}}"  class="checkerror" mode=""/>
    <text>检测码有误，请重新输入</text>
    </view>
    <image src="{{img_host+'/check_close.png'}}" class="checkclose" mode="" bindtap="closeError"/>
  </view>
  <view class="iptbox {{showError?'active':''}}" >
    <input type="text"  value="{{detection_bar_code}}" class="ipt" placeholder="请输入检测码或扫描条形码绑定" bindinput="chnageIpt" bindblur="bluript" 	disabled="{{order.detection_status==3 || order.detection_status==4}}"/>
    <view class="mybar" wx:if="{{order.detection_status==2}}"></view>
    <image src="{{img_host+'/scancode.png'}}" class="scan" mode="" bindtap="goScan"  wx:if="{{order.detection_status==2}}"/>   
  </view>
  <view class="tiptitle" hidden="{{(order.detection_status==3 && fileList.length==0)|| (order.detection_status==4 && fileList.length==0)}}">
     <view class="tipleft">
      检测管照片
     </view>
  </view>
  <view class="uploadbox">
        <image wx:for="{{fileList}}" src="{{item}}" mode="aspectFill" class="upload" bindtap="previewImage" data-id="{{idx}}" wx:for-index="idx" wx:key="idx">
          <image src="{{img_host+'/xiaoclose.png'}}" class="close" catchtap="delImg" data-id="{{idx}}"></image>
        </image>
        <view class="upload" bindtap="upload" wx:if="{{order.detection_status==2}}">
          <van-icon name="plus" />
          <view class="text">
           上传
          </view>
        </view>
      </view>
      <view class="finish" wx:if="{{order.detection_status==3 || order.detection_status==4 }}">
        <view class="left">预计检测完成时间</view>
        <view class="right">{{order.detection_success_time}}</view>
      </view>
</view>
  <view class="rowbox">
    <view class="titlebox">
      <view class="name">订单信息</view>
      
      <!-- 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) -->
      <!-- 支付状态（1:未支付 2:已支付 3:支付中 4:支付失败 5:支付超时 6:支付关闭 7:已撤销 8:转入退款） -->
      <view class="status" wx:if="{{order.detection_status==1}}">
        <view class="waitpay">待支付</view>
        <view class="countdown">
          <van-count-down time="{{filter.countDown(order.created_at)}}" />
        </view>
      </view>
      <view class="status waitpay" wx:elif="{{order.detection_status==2}}">待绑定</view>
      <view class="status waitpay" wx:elif="{{order.detection_status==3}}">检测中</view>
      <view class="status" wx:elif="{{order.detection_status==4}}" style="color:#3CC7C0">检测完成</view>
      <view class="status"  wx:elif="{{order.detection_status==5 && order.detection_pay_status!=5 }}">取消检测</view>
      <view class="status waitpay"  wx:elif="{{order.detection_status==5 && order.detection_pay_status==5}}">支付超时</view>
    </view>
    <view class="row first">
      <view class="namebox">
        <view class="name">订单编号</view>
        <view  class="dot">：</view>
      </view>
      <view class="rightbox">
        <view class="desc">{{order.detection_no}}</view>
        <view class="bar">
          |
        </view>
      <view class="copy" bindtap="copy" data-text="{{order.detection_no}}">复制</view>
      </view>
    </view>
    <view class="row">
      <view class="namebox">
        <view class="name">下单时间</view>
        <view  class="dot">：</view>
      </view>
      <view class="desc rightbox">{{order.created_at}}</view>
    </view>
    <view class="row">
     <view class="namebox">
      <view class="name">问诊类型</view>
      <view  class="dot">：</view></view>
      <view class="desc">糖组检测</view>
    </view> 
    <view class="row">
     <view class="namebox">
      <view class="name">订单金额</view>
      <view  class="dot">：</view>
     </view>
      <view class="desc  rightbox">￥{{order.amount_total}}</view>
    </view>
    <view class="row">
      <view class="namebox">
        <view class="name"><text>优</text><text>惠</text><text>券</text></view>
      <view  class="dot">：</view>
      </view>
      <view class="desc rightbox" wx:if="{{order.coupon_amount_total>0}}">￥{{order.coupon_amount_total}}</view>
      <view class="desc rightbox" wx:else>无</view>
    </view>
    <view class="row">
       <view class="namebox">
        <view class="name">支付金额</view>
      <view  class="dot">：</view>
       </view>
      <view class="desc  price rightbox">
      ￥{{pay_money}}
      </view>
    </view>
    <view class="row beizhu" wx:if="{{order.cancel_reason}}">
      <view class="namebox">
        <view class="name"><text>备</text><text>注</text></view>
      <view  class="dot">：</view>
      </view>
      <!-- 取消订单原因（1:主动取消 2:客服取消 3:支付超时） -->
      <view class="desc rightbox" wx:if="{{order.cancel_reason==1}}">主动取消 </view>
        <view class="desc rightbox" wx:elif="{{order.cancel_reason==2}}">客服取消</view>
        <view class="desc rightbox" wx:elif="{{order.cancel_reason==3}}">支付超时</view>
    </view>
    <!-- 商品订单退款状态（0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭） -->
    <view class="row"  wx:if="{{order.cancel_reason==2}}">
     <view class="namebox">
      <view class="name">退款进度</view>
      <view  class="dot">：</view>
     </view>
      <view class="desc rightbox" wx:if="{{order.detection_refund_status==0}}">
        无退款
      </view>
      <view class="desc rightbox" wx:elif="{{order.detection_refund_status==1}}">
        申请退款
      </view>
      <view class="desc rightbox" wx:elif="{{order.detection_refund_status==2}}">
        退款中
      </view>
      <view class="desc rightbox" wx:elif="{{order.detection_refund_status==3}}">
        退款成功
      </view>
      <view class="desc rightbox" wx:elif="{{order.detection_refund_status==4}}">
        拒绝退款
      </view>
      <view class="desc rightbox" wx:elif="{{order.detection_refund_status==5}}">
        退款关闭
      </view>
    </view>
    <!-- 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) -->
    <view class="contactbox" wx:if="{{order.detection_status==3 || order.detection_status==4}}" bindtap="orderMsg">
      <image src="{{img_host+'/kefu.png'}}" class="kefu" mode=""/>
      <text>联系客服</text>
    </view>
    <view class="contactbox" wx:if="{{order.detection_status==2}}" bindtap="confirmCancelOrder">
      <text>取消检测</text>
  </view>
    <view class="contactbox" wx:if="{{order.detection_status==5}}" bindtap="confirmDelOrder">
      <text>删除订单</text>
  </view>
</view>

  
  <view class="personinfobox" bindtap="goExpert" wx:if="user_doctor && user_doctor.doctor_id">

    <view class="namebox" style="justify-content: flex-start;">
      <image src="{{user_doctor.avatar}}" class="head" wx:if="{{user_doctor.avatar}}" mode="aspectFill"></image>
      <image src="{{img_host+'/doctor_avatar.png'}}" class="head" wx:else></image>
      <view class="namewraper">
        <view class="row">
           <view class="name">{{user_doctor.user_name}}</view>
            <view class="type" wx:if="{{user_doctor.hospital_level_name}}">{{user_doctor.hospital_level_name}}</view>
            <view class="type" wx:if="{{user_doctor.multi_point_status == 1 && user_doctor.multi_point_enable==1}}">可处方</view>
        </view>
        <view class="hospital">
          <!-- 1主任医师、2主任中医师、3副主任医师、4副主任中医师、5主治医师、8住院医师 -->
           
          <text class="doctor_title" wx:if="{{user_doctor.doctor_title}}">{{user_doctor.doctor_title}}</text>
        <text class="doctor_title" wx:elif="{{user_doctor.doctor_title==2}}">主任中医师</text>
        <text>{{user_doctor.department_custom_name}}</text>
        </view>
        <view class="hospital">{{user_doctor.hospital_name}}</view>
      </view>
      <view class="guanzhu" wx:if="{{!user_doctor.follow}}" catchtap="toggleFllow">
          <image src="{{img_host+'/star.png'}}" ></image>
          <text decode="true">&nbsp;&nbsp;关注</text>
        </view>
        <view class="guanzhu" wx:else catchtap="toggleFllow">
          <image  src="{{img_host+'/star_on.png'}}" ></image>
          <text decode="true">&nbsp;&nbsp;关注</text>
        </view> 


    </view>
    <!-- <view class="borderbox">
      <view class="goodjob" style="margin-top: 30rpx;">
        擅长：{{user_doctor.be_good_at}}
      </view>
    </view> -->
  </view>
  <view class="contactbox" style="border:none;"  wx:if="{{order.detection_status==2}}" bindtap="orderMsg">
      <image src="{{img_host+'/kefu.png'}}" class="kefu" mode=""/>
      <text>联系客服</text>
    </view>
</view>
  
</view>
    <!-- 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) -->

<view class="paybox" wx:if="{{order.detection_pay_status==1}}">
    <view class="left" bindtap="confirmCancelPay">取消支付</view>
    <view class="right" bindtap="goPay">
       立即支付
     
    <!-- ：¥{{order.payment_amount_total}} -->
    </view>
  </view>
  <view class="paybox" wx:if="{{order.detection_status==2 || order.detection_status==3}}">
    <view class="submitbtn {{order.detection_status==3?'active':''}}" bindtap="handleBindCheck">提交</view>
  </view>
  <view class="paybox" wx:if="{{order.detection_status==4}}">
    <view class="left" bindtap="goReport">查看报告</view>
    <view class="right" bindtap="handleCheckInquiry">
       <text>报告解读</text>
       <image src="{{img_host+'/freetalk.png'}}"  class="freetalk" alt=""/>
    </view>
  </view>
  <view class="paybox" wx:if="{{order.detection_status==5}}">
    <view class="submitbtn" bindtap="goSugar">重新检测</view>
  </view>
 
<dialog bind:confirm="confirm" cancelBtn="{{cancelBtn}}" showDialog="{{showDialog}}" message="{{message}}"></dialog>
<van-dialog id="van-dialog" confirm-button-color="#3CC7C0"  />
<van-overlay show="{{ showCover  }}" wx:if="{{order.detection_status==2}}">
  <view class="wrapper">
    <image src="{{img_host+'/mask_check1.png'}}" mode="widthFix" class="timg1" lazy-load/>
    <image src="{{img_host+'/mask_check2.png'}}" mode="widthFix" class="timg2" lazy-load/>
    <view class="button" bindtap="onClickHide">
    知道了
  </view>
  </view>
  
</van-overlay>
<van-dialog id="van-dialog" confirm-button-color="#3CC7C0"  />
<dialog bind:confirm="confirmCheck" cancelBtn="{{true}}" showDialog="{{showCheckDialog}}" message="{{checkmessage}}" confirmtext="继续"></dialog>