<!--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.order_service_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="rowbox" style="margin-top: 172rpx;">
    <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.order_service_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.order_service_status==2}}">待接诊</view>
      <view class="status waitpay" wx:elif="{{order.order_service_status==3}}">服务中</view>
      <view class="status" wx:elif="{{order.order_service_status==4}}" style="color:#3CC7C0">服务完成</view>
      <view class="status"  wx:elif="{{order.order_service_status==5 && order.pay_status!=5 }}">服务取消</view>
      <view class="status waitpay"  wx:elif="{{order.order_service_status==5 && order.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.order_service_no}}</view>
        <view class="bar">
          |
        </view>
      <view class="copy" bindtap="copy" data-text="{{order.order_service_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">{{order.order_service_type==1?"健康包":'随访包'}}</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 class="moneydetail" bind:tap="toggleDetail">明细<van-icon name="{{showMoneyDetail?'arrow-down':'arrow-up'}}" color="#fff" size="12"/></view>
    </view>
    <view class="detaibox" wx:if="{{showMoneyDetail}}">
      <view class="row">
        <view class="namebox">
        <view class="name">药 品 费</view>
      <view  class="dot">：</view>
       </view>
       <view class="desc  ">
      ￥{{order.discount_product_total_amount}}
      </view>
      </view>
      <view class="row">
        <view class="namebox">
        <view class="name">问 诊 费</view>
      <view  class="dot">：</view>
       </view>
       <view class="desc  ">
      ￥{{(pay_money-order.discount_product_total_amount)}}
      </view>
      </view>
    </view>
    <view class="row beizhu" wx:if="{{order.cancel_remarks}}">
      <view class="namebox">
        <view class="name"><text>备</text><text>注</text></view>
      <view  class="dot">：</view>
      </view>
      <!-- 取消订单原因（1:主动取消 2:客服取消 3:支付超时） -->
      <view class="desc rightbox">{{order.cancel_remarks}}</view>
      <!-- <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.order_refund.length>0}}">
     <view class="namebox">
      <view class="name">退款进度</view>
      <view  class="dot">：</view>
     </view>
      <view class="desc rightbox" wx:if="{{refund.refund_status==0}}">
        无退款
      </view>
      <view class="desc rightbox" wx:elif="{{refund.refund_status==1}}">
        申请退款
      </view>
      <view class="desc rightbox" wx:elif="{{refund.refund_status==2}}">
        退款中
      </view>
      <view class="desc rightbox" wx:elif="{{refund.refund_status==3}}">
        退款成功
      </view>
      <view class="desc rightbox" wx:elif="{{refund.refund_status==4}}">
        拒绝退款
      </view>
      <view class="desc rightbox" wx:elif="{{refund.refund_status==5}}">
        退款关闭
      </view>
    </view>
    <view class="row" wx:if="{{order.order_refund.length>0}}">
        <view class="namebox">
      <view class="name">退款金额</view>
      <view  class="dot">：</view>
     </view>
     <view class="desc rightbox" >
     {{refund.refund_total}}
      </view>
    </view>
    <!-- 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) -->
    <view class="dealbox">
       <view class="cancelbtn" wx:if="{{order.order_service_status==2}}" bind:tap="confirmCancelOrder">取消订单</view>
        <view class="linkbtn" style="margin-left: 20rpx;" wx:if="{{order.order_service_status==2 || order.order_service_status==3 || order.order_service_status==4 || (order.order_service_status==5 && order.refund_status==2)}}" bindtap="orderMsg">
     
     联系客服 
    </view>
   
    </view>
   
  
</view>
<view class="quanyibox rowbox " wx:if="{{(order.order_service_status==1 || order.order_service_status==2 || order.order_service_status==3 || order.order_service_status==4)}}">
   <view class="topbox">
    <view class="title">服务权益</view>
    <view class="row {{order.order_service_status==2?'mb':''}}"  wx:if="{{order.order_service_status==2 || order.order_service_status==3 || order.order_service_status==4}}">
        <view class="namebox">
      <view class="name">有 效 期</view>
      <view  class="dot">：</view>
     </view>
     <view class="desc time" wx:if="{{order.order_service_status==2}}"><text class="red">接诊后有效</text></view>
     <view class="desc time" wx:elif="{{order.order_service_status==3}}"><text class="red">{{filter.transforDay(equity.order_service_package.start_time,'dotdateminute')+'-'+filter.transforDay(equity.order_service_package.finish_time,'dotdateminute')}}</text></view>
    </view>
    <view class="row" style="align-items: flex-start;" wx:if="{{ order.order_service_status==3 || order.order_service_status==4}}">
        <view class="namebox">
      <view class="name">当月时间</view>
      <view  class="dot">：</view>
     </view>
     <view class="desc time" wx:if="{{order.order_service_status==3}}">{{equity.order_service_package.current_month_start_date+'-'+equity.order_service_package.current_month_finish_date}}</view>
    </view>
   </view>
   <view class="medbox" wx:if="{{equity.order_service_package.order_service_type==2}}">
     <view class="title">问诊服务</view>
     <view class="row" style="position: relative;margin-bottom: 22rpx;" wx:if="{{order.order_service_status==1 || order.order_service_status==2 || (order.order_service_status==5)}}">
        <view class="namebox">
      <view class="name"><text 	decode>内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容</text></view>
      <view  class="dot">：</view>
     </view>
     <view class="desc"><text class="red">{{equity.order_service_package_detail.service_period/30}}个</text>月内，每月<text class="red">{{equity.order_service_package_detail.monthly_frequency==0?'不限':equity.order_service_package_detail.monthly_frequency}}次</text>问诊</view>
  
    </view>
     <view class="row" style="position: relative;margin-bottom: 22rpx;" wx:if="{{order.order_service_status==3 || order.order_service_status==4 }}">
        <view class="namebox" wx:if="{{!(equity.order_inquiry.length==0 && equity.product.length==0) }}">
      <view class="name">当月剩余</view>
      <view  class="dot">：</view>
     </view>
     <view class="desc"  wx:if="{{!(equity.order_inquiry.length==0 && equity.product.length==0)}}"><text class="red">{{equity.order_service_package_detail.monthly_frequency==0?'不限':(equity.order_service_package_detail.monthly_frequency-equity.order_service_package_detail.month_inquiry_count)}}次</text>图文</view>
     <view class="expand" wx:if="{{ equity.order_inquiry.length>0 && (order.order_service_status==3 || order.order_service_status==4 || (order.order_service_status==5 && order.pay_status!=5))}}" bind:tap="toggleExpand">{{showExpand?'收起':'展开'}} <van-icon name="{{showExpand?'arrow-down':'arrow-up'}}" /></view>
    </view>
    <view class="usebox" wx:for="{{inquriyList}}" 
     wx:if="{{ equity.order_inquiry.length>0 && (order.order_service_status==3 || order.order_service_status==4 || (order.order_service_status==5 && order.pay_status!=5))}}"
    wx:key="order_inquiry_id"  bind:tap="goInquiry" data-id="{{item.order_inquiry_id}}">
        <view class="time">问诊时间：{{item.created_at}}</view>
        <view class="detail">{{item.inquiry_status==1?'待支付':item.inquiry_status==2?'待分配':item.inquiry_status==3?'待接诊':item.inquiry_status==4?'已接诊':item.inquiry_status==5?'已完成':item.inquiry_status==6?'已结束':'已取消'}}<van-icon name="arrow" size="12px"  color="#999"/></view>
    </view>
   
   </view>
   <view class="medbox" wx:if="{{equity.order_service_package.order_service_type==1}}">
     <view class="title">问诊服务</view>
     <view class="row" style="position: relative;margin-bottom: 22rpx;" wx:if="{{order.order_service_status==1 || order.order_service_status==2 || order.order_service_status==5 }}">
        <view class="namebox">
      <view class="name"><text 	decode>内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容</text></view>
      <view  class="dot">：</view>
     </view>
     <view class="desc"><text class="red">3个</text>月内，每月<text class="red">2次</text>问诊</view>
  
    </view>
     <view class="row" style="position: relative;margin-bottom: 22rpx;" wx:if="{{order.order_service_status==3}}">
        <view class="namebox"  wx:if="{{!(equity.order_inquiry.length==0 && equity.product.length==0) }}">
      <view class="name">当月剩余</view>
      <view  class="dot">：</view>
     </view>
     <view class="desc"  wx:if="{{!(equity.order_inquiry.length==0 && equity.product.length==0)}}"><text class="red">{{equity.order_service_package_detail.monthly_frequency==0?'不限':(equity.order_service_package_detail.remaining_inquiry_count)}}次</text>图文</view>
     <view class="expand" wx:if="{{ equity.order_inquiry.length>0 && (order.order_service_status==3 || order.order_service_status==4 || (order.order_service_status==5 && order.pay_status!=5))}}"  bind:tap="toggleExpand">{{showExpand?'收起':'展开'}} <van-icon name="{{showExpand?'arrow-down':'arrow-up'}}" /></view>
    </view>
 
    <view class="usebox" wx:for="{{inquriyList}}" 
    wx:if="{{ equity.order_inquiry.length>0 && (order.order_service_status==3 || order.order_service_status==4 || (order.order_service_status==5 && order.pay_status!=5))}}"
    wx:key="order_inquiry_id"  bind:tap="goInquiry" data-id="{{item.order_inquiry_id}}">
        <view class="time">问诊时间：{{item.created_at}}</view>
        <view class="detail">{{item.inquiry_status==1?'待支付':item.inquiry_status==2?'待分配':item.inquiry_status==3?'待接诊':item.inquiry_status==4?'已接诊':item.inquiry_status==5?'已完成':item.inquiry_status==6?'已结束':'已取消'}}<van-icon name="arrow" size="12px"  color="#999"/></view>
    </view>
   
   </view>
   <view class="medbox" wx:if="{{equity.order_service_package.order_service_type==1}}">
     <view class="title">药品服务</view>
     <view class="row" style="position: relative;margin-bottom: 22rpx;" wx:if="{{order.order_service_status==1 || order.order_service_status==2 || order.order_service_status==5 }}">
        <view class="namebox">
      <view class="name"><text 	decode>内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容</text></view>
      <view  class="dot">：</view>
     </view>
     <view class="desc"><text class="red">30盒</text>肝爽颗粒(步长)</view>
     </view>
     <view class="row" style="position: relative;margin-bottom: 22rpx;" wx:if="{{order.order_service_status==3}}">
        <view class="namebox"  wx:if="{{!(equity.order_inquiry.length==0 && equity.product.length==0)}}">
      <view class="name">药品剩余</view>
      <view  class="dot">：</view>
     </view>
     <view class="desc"  wx:if="{{!(equity.order_inquiry.length==0 && equity.order_product.length==0)}}"><text class="red">{{equity.order_service_package_detail.remaining_quantity}}盒</text>肝爽颗粒(步长) </view>
     <view class="expand" bind:tap="toggleProduct" wx:if="{{productList.length>0 && (order.order_service_status==3 || order.order_service_status==4 || (order.order_service_status==5 && order.pay_status!=5))}}">{{showProduct?'收起':'展开'}} <van-icon name="{{showProduct?'arrow-down':'arrow-up'}}" /></view>
    </view>
    <view class="usebox" wx:for="{{productList}}" wx:key="order_product_id" bind:tap="goProduct" data-id="{{item.order_product_id}}">
        <view class="time">下单时间：{{item.created_at}}</view>
        <view class="detail">{{item.order_product_status==1?'待支付':item.order_product_status==2?'待发货':item.order_product_status==3?'已发货':item.order_product_status==42?'已签收':'已取消'}}<van-icon name="arrow" size="12px"  color="#999"/></view>
    </view>
   
   </view>
   <view class="medbox" wx:if="{{equity.order_service_package.order_service_type==1}}">
     <view class="title">优惠卷</view>
     <view class="row" style="position: relative;margin-bottom: 22rpx;align-items: flex-start;">
        <view class="namebox">
      <view class="name"><text 	decode>内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容</text></view>
      <view  class="dot">：</view>
     </view>
     <view class="desc">
         <view wx:for="{{juanList}}" wx:key="id">{{item.name}}</view> 
        </view>
     
     <view class="expand" bind:tap="toggleJuan" wx:if="{{juanList.length>0 && (order.order_service_status==3 || order.order_service_status==4 || (order.order_service_status==5 && order.pay_status!=5))}}">{{showJuan?'收起':'展开'}} <van-icon name="{{showJuan?'arrow-down':'arrow-up'}}" /></view>
    </view>
    <view wx:if="{{order.order_service_status!=1 && !(order.order_service_status==5 && order.pay_status==5)}}" wx:for="{{equity.order_service_package_coupo}}" wx:key="coupon_name" bind:tap="goWelfare" class="usebox">
        <view class="time">{{item.coupon_name}}</view>
        <view class="detail">{{item.user_coupon_status==0?'未使用':item.user_coupon_status==1?'已使用':'已过期'}}<van-icon name="arrow" size="12px"  color="#999"/></view>
    </view>
    <view  class="usebox" bind:tap="goApp" wx:if="{{order.order_service_status!=1 && order.order_service_status!=2 && !(order.order_service_status==5 && order.pay_status==5)}}"> 
     <view class="time">100元的肝胆商城优惠劵</view>
      <view class="detail">注册即发放<van-icon name="arrow" size="12px"  color="#999"/></view>
    </view>
    
   </view>
</view>
  <view class="patientBox">
    <view class="titlebox">
        <view class="title">患者信息</view>
        <view class="more" bind:tap="goSickInfo">查看详情病情信息<van-icon name="arrow" /></view>
    </view>
    <view class="patientdesc">
        <view class="name">{{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 class="nameinfo">
        <view class="name">所患疾病：{{order.case.disease_class_name}}</view>
        <view class="name">病情主诉：{{order.case.disease_desc}}</view>
      </view>
    </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>
  
</view>
  
</view>
    <!-- 检测订单状态(1:待支付 2:待绑定 3:检测中 4:检测完成 5:已取消) -->

<view class="paybox" wx:if="{{order.pay_status==1&& order.order_service_status!=5}}">
    <view class="left" bindtap="confirmCancelPay">取消支付</view>
    <view class="right" bindtap="goPay">
       立即支付
    </view>
  </view>
  <view class="paybox"  style="background-color: transparent;" wx:if="{{order.order_service_status==3 }}">
    <view class="submitbtn" bindtap="handleCheckService">去使用</view>
  </view>
  <view class="paybox"  style="background-color: transparent;" wx:if="{{order.order_service_status==4 || (equity.order_service_package_detail.monthly_frequency!=0 && equity.order_service_package_detail.monthly_frequency-equity.order_service_package_detail.month_inquiry_count==0)}}">
    <view class="submitbtn" bindtap="goXuFei">去续费</view>
  </view>


 
<dialog bind:confirm="confirm" cancelBtn="{{cancelBtn}}" showDialog="{{showDialog}}" message="{{message}}"></dialog>
<van-dialog id="van-dialog" confirm-button-color="#3CC7C0"  />
<van-dialog id="van-dialog" confirm-button-color="#3CC7C0"  />
<dialog bind:confirm="confirmCheck" cancelBtn="{{true}}" showDialog="{{showCheckDialog}}" message="{{checkmessage}}" confirmtext="继续"></dialog>

<van-dialog
  show-cancel-button
   class="mydailog"
   bind:confirm="goHasOrder"
  title="温馨提示"
  message="{{messageWarn}}"
  z-index="9999"
   theme='green'
  show="{{showWarn}}"
  confirm-button-color="#3CC7C0"
  cancel-button-text="取消"
  confirm-button-text="{{confirmText}}"
>

</van-dialog>