<!--pages/orderDetail/orderDetail.wxml-->
<wxs src="../../../filters/filter.wxs" module="timeModule"></wxs>
<view class="ui-navigatorbar" style="border-bottom: 1rpx solid #E3E4E5;">
    <image class="ui-navigatorbar-back" bindtap="goBack" src="{{img_host+'/back.png'}}" />
    <view class="ui-title">订单详情</view>
  </view>
<view class="page">
  <view class="databox {{showPadding?'active':''}}">
    <view class="datacell">
        <image src="../../../assets/images/addComment.png" mode="" class="comment" bind:tap="openComment" wx:if="{{order.inquiry_status==5 || order.inquiry_status==6}}"/>
      <view class="titlebox">

        <view class="name">订单信息</view>
        <view class="status" wx:if="{{order.inquiry_status==1 && order.inquiry_pay_status==1}}">
          <view class="waitpay">待支付</view>
          <view class="countdown">
            <van-count-down time="{{timeModule.countDown(order.created_at)}}" />
          </view>
        </view>
        <view class="status" wx:elif="{{order.inquiry_status==2}}">分配医生中</view>
        <view class="status" wx:elif="{{order.inquiry_status==3}}">等待接诊</view>
        <view class="status" wx:elif="{{order.inquiry_status==4}}">问诊中</view>
        <view class="status" wx:elif="{{order.inquiry_status==5}}">问诊完成</view>
        <view class="status" wx:elif="{{order.inquiry_status==6}}">问诊结束 </view>
        <view class="status" wx:elif="{{order.inquiry_status==7 && order.inquiry_pay_status!=5}}">问诊取消</view>
        <view class="status" wx:elif="{{order.inquiry_status==7 && order.inquiry_pay_status==5}}">
          <view class="waitpay">支付超时</view>
        </view>
      </view>

      <view class="row first">
        <view class="name">订单编号</view>
        <view  class="dot">：</view>
        <view class="desc">{{order.inquiry_no}}</view>
        <view class="copy" bindtap="copy" data-text="{{order.inquiry_no}}" wx:if="{{order.inquiry_no}}">复制</view>
      </view>

      <view class="row">
        <view class="name">下单时间</view>
        <view  class="dot">：</view>
        <view class="desc">{{order.created_at}}</view>
      </view>
      <view class="row">
        <view class="name">问诊类型</view>
        <view  class="dot">：</view>
        <view class="desc" wx:if="{{order.inquiry_type==1 && order.inquiry_mode==1}}">专家问诊-图文</view>
          <view class="desc" wx:elif="{{order.inquiry_type==1 && order.inquiry_mode==2}}">专家问诊-视频</view>
          <view class="desc" wx:elif="{{order.inquiry_type==1 && order.inquiry_mode==6}}">专家问诊-疑难会诊</view>
          <view class="desc" wx:elif="{{order.inquiry_type==1 && order.inquiry_mode==7}}">专家问诊-附赠回复</view>
          <view class="desc" wx:elif="{{order.inquiry_type==1 && order.inquiry_mode==8}}">健康包服务</view>
          <view class="desc" wx:elif="{{order.inquiry_type==1 && order.inquiry_mode==9}}">随访包服务</view>
        <view class="desc" wx:elif="{{order.inquiry_type==2 && order.inquiry_mode!=7}}">快速问诊</view>
        <view class="desc" wx:elif="{{order.inquiry_type==2 && order.inquiry_mode==7}}">快速问诊-附赠回复</view>
        <view class="desc" wx:elif="{{order.inquiry_type==3 && order.inquiry_mode!=7}}">公益问诊</view>
        <view class="desc" wx:elif="{{order.inquiry_type==3 && order.inquiry_mode==7}}">公益问诊-附赠回复</view>
        <view class="desc" wx:elif="{{order.inquiry_type==4 && order.inquiry_mode!=7}}">问诊购药</view>
       <view class="desc" wx:elif="{{order.inquiry_type==4 && order.inquiry_mode==7}}">问诊购药-附赠回复</view>
       <view class="desc" wx:elif="{{order.inquiry_type==5 && order.inquiry_mode!=7}}">糖组检测</view>
       <view class="desc" wx:elif="{{order.inquiry_type==5 && order.inquiry_mode==7}}">糖组检测-附赠回复</view>
      
    </view>
      <view class="row">
        <view class="name">问诊金额</view>
        <view class="dot">：</view>
        <view class="desc  price"><text wx:if="{{order.amount_total}}">￥</text>{{order.amount_total}}</view>
      </view>
      <view class="row">
        <view class="name"><view class="textyou"><view >优</view><view>惠</view><view>券</view></view></view>
        <view  class="dot">：</view>
        <view class="desc">
          <text wx:if="{{timeModule.formatMoney(order.coupon_amount_total)>0}}">- ￥{{timeModule.formatMoney(order.coupon_amount_total)}}</text>
          <text wx:else>无</text>
        </view>
      </view>
      <view class="row">
        <view class="left">
          <view class="name">支付金额</view>
          <view  class="dot">：</view>
          <view class="desc price"><text wx:if="{{order.payment_amount_total}}">￥</text>{{order.payment_amount_total}}</view>
        </view>
      </view>
      <!-- 1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时 -->
      <view class="row" style="align-items: flex-start;" wx:if="{{order.cancel_reason}}">
        <view class="name"><text>备</text><text>注</text></view>
        <view  class="dot">：</view>
<!-- 取消订单原因（1:医生未接诊 2:主动取消 3:无可分配医生 4:客服取消 5:支付超时） -->
        <view class="desc" wx:if="{{order.cancel_reason==1}}">医生未接诊 </view>
        <view class="desc" wx:elif="{{order.cancel_reason==2}}">主动取消</view>
        <view class="desc" wx:elif="{{order.cancel_reason==3}}">无可分配医生 </view>
        <view class="desc" wx:elif="{{order.cancel_reason==4}}"> 客服取消</view>
        <view class="desc" wx:elif="{{order.cancel_reason==5}}"> 支付超时</view>
      </view>

      <!-- 0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常 -->
      <view class="row" wx:if="{{order.inquiry_status==7 && order.inquiry_pay_status!=5}}">
        <view class="name">退款进度</view>
        <view  class="dot">：</view>
        <view class="desc" wx:if="{{order.inquiry_refund_status==0}}">无退款</view>
        <view class="desc" wx:elif="{{order.inquiry_refund_status==1}}">申请退款</view>
        <view class="desc" wx:elif="{{order.inquiry_refund_status==2}}">退款中</view>
        <view class="desc" wx:elif="{{order.inquiry_refund_status==3}}">退款成功</view>
        <view class="desc" wx:elif="{{order.inquiry_refund_status==4}}">拒绝退款</view>
        <view class="desc" wx:elif="{{order.inquiry_refund_status==5}}">退款关闭</view>
        <view class="desc" wx:elif="{{order.inquiry_refund_status==6}}">退款异常</view>
      </view>

      <!-- 1:待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消 -->
      <!-- <view class="row" style="justify-content: flex-end;" wx:if="{{order.inquiry_status==1 && order.inquiry_pay_status==1}}">
        <view class="del">去支付</view> 
      </view> -->
      <view class="row" style="justify-content: flex-end;" wx:if="{{order.inquiry_status==2 || order.inquiry_status==3 }}" hidden="{{order.inquiry_status==3 && order.amount_total==0 && (order.inquiry_mode==8 || order.inquiry_mode==9)}}">
        <view class="del" bindtap="confirmCancelInquiry">取消问诊</view>
      </view>
      <!-- wx:elif="{{order.inquiry_status==4}}" -->
      <view class="row" style="justify-content: flex-end;text-align: right;" wx:elif="{{order.inquiry_status==4}}">
        <view class="contact"  bindtap="orderMsg">联系客服</view>
      </view>
      <view class="row" style="justify-content:space-between;text-align: right;" wx:elif="{{order.inquiry_status==5}}">
        <view class="tips">如有疑问请在三日内联系客服沟通解决</view>
        <view class="contact"  bindtap="orderMsg">联系客服</view>
      </view>
      <!-- <view class="row" style="justify-content: flex-end;" wx:elif="{{order.inquiry_status==6}}">
        <view class="del" bindtap="delOrder">删除订单</view>
      </view>
      <view class="row" style="justify-content: flex-end;" wx:if="{{order.inquiry_status==7 }}">
        <view class="del" bindtap="delOrder">删除订单</view>
      </view> -->
    </view>
    <view class="sickinfo" data-id="{{order.order_inquiry_id}}" >
      <view class="nameinfo">
        <view class="title">就诊人信息</view>
        <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>
      <!-- <image src="{{img_host+'/righticon.png'}}" class="righticon"></image> -->

    </view>
    <view class="sickinfo" bindtap="goSickInfo" data-id="{{order.order_inquiry_id}}" wx:if="{{order.inquiry_type!=5}}">
      <view class="nameinfo">
        <view class="title">病例信息</view>
        <view class="name">所患疾病：{{order.case.disease_class_name}}</view>
        <view class="name">病情主诉：{{order.case.disease_desc}}</view>
      </view>
      <image src="{{img_host+'/righticon.png'}}" class="righticon"></image>

    </view>
    <view class="infobox" wx:if="{{ order.user_doctor && order.user_doctor.user_name}}" bindtap="goExpert">
      <view class="namebox">
        <image src="{{order.user_doctor.avatar}}" class="head" wx:if="{{order.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">{{order.user_doctor.user_name}}</view>
            <view class="type" wx:if="{{order.user_doctor.hospital_level_name != '未知'&& order.user_doctor.hospital_level_name}}">{{order.user_doctor.hospital_level_name}}</view>
            <view class="type" wx:if="{{order.user_doctor.multi_point_status==1 && order.user_doctor.multi_point_enable==1}}">可处方</view>
          </view>
          <view class="hospital"><text class="doctor_title"  wx:if="{{order.user_doctor.doctor_title}}">{{order.user_doctor.doctor_title}}</text> <text>{{order.user_doctor.department_custom_name}}</text></view>
          <view class="hospital">{{order.user_doctor.hospital_name}}</view>
        </view>
        <view class="guanzhu" wx:if="{{!order.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 class="fenpeibox"  wx:if="{{order.inquiry_status==2}}">
      <image src="{{img_host+'/fenpei.gif'}}" class="fenpei"></image>
      <view class="tips">等待平台指定医生</view>
    </view>
    <view  hidden="{{!(order.inquiry_status==7 || order.inquiry_status==6)}}" wx:if="{{order.inquiry_type!=5}}">
    <view class="consultTitle">
        <!-- <view class="bar"></view>
        <view>在线推荐</view> -->
      </view> 
      <consult-list consultbox="consultwraper">
      </consult-list>
    </view>
    <!-- 待支付 2:待分配 3:待接诊 4:已接诊 5:已完成 6:已结束 7:已取消 -->

  </view>
  <view class="bottom" wx:if="{{order.inquiry_status==1 && order.inquiry_pay_status==1}}">
  <view class="cancel" bindtap="confirmCancelPay">取消支付</view>
  <view class="confirm" bindtap="handleGoPay">立即支付：¥{{order.payment_amount_total}}</view>
</view>
<view class="wenzhenbtn" wx:if="{{order.inquiry_status==3 || order.inquiry_status==4 || order.inquiry_status==5 || order.inquiry_status==6 }}">
  <view class="btn" bindtap="goChat">问诊详情</view>
</view>
</view>

<dialog bind:confirm="confirm" showDialog="{{show}}" message="{{message}}"></dialog>
<van-dialog id="van-dialog" confirm-button-color="#3CC7C0"  />

<view class="tui-cards-container {{showComment?'':'hide'}}" >
  <view class="service-evaluation" >
    <view class="header">
      <!-- <label>请对本次服务进行评价</label> -->
      <van-icon name="cross"  class="chatclose" catch:tap="handleClose" />
      <!-- <image src="../../../../../static/images/chat_close.png" class="chatclose" catch:tap="handleClose"> 

      </image>-->

    </view>
    <view class="main">
      <view class="doctorInfo">
        <image src="{{order.user_doctor.avatar}}" class="doctorAvatar" mode="aspectFill" wx:if="{{order.user_doctor.avatar}}"> </image>
        <image src="{{img_host+'/doctor_avatar.png'}}" class="doctorAvatar" wx:else> </image>
       
        <view class="namebox">
          <view class="name">{{order.user_doctor.user_name}}</view>
          <view class="position" wx:if="{{order.user_doctor.doctor_title}}">{{order.user_doctor.doctor_title}}</view>
         
        </view>
        <view class="viewstar">
          <van-rate value="{{ score }}" size="{{ 26 }}" color="#ed9c00" void-icon="star" void-color="#eee" bind:change="onChange" gutter="16" readonly  />
        </view>
      </view>
      <view class="linebox">
        <view class="line"></view>
        <view class="pingjia">非常满意</view>
        <view class="line"></view>
      </view>
      <view class="ratebox">
        <view class="starbox">
          <view class="name"> 回复质量</view>
          <van-rate value="{{comment.reply_quality}}" size="{{ 20 }}" color="#ed9c00" void-icon="star" void-color="#eee" bind:change="onChange" gutter="8" data-id="reply_quality" readonly="{{is_evaluation}}" />
          <view class="quality" wx:if="{{comment.reply_quality>=4}}">好评</view>
          <view class="quality" wx:elif="{{comment.reply_quality==3}}">中评</view>
          <view class="quality" wx:else="{{comment.reply_quality<=2}}">差评</view>
        </view>
        <view class="starbox">
          <view class="name"> 服务态度</view>
          <van-rate value="{{comment.service_attitude}}" size="{{ 20 }}" color="#ed9c00" void-icon="star" void-color="#eee" bind:change="onChange" gutter="8" data-id="service_attitude" readonly="{{is_evaluation}}" />
          <view class="quality" wx:if="{{comment.service_attitude>=4}}">好评</view>
          <view class="quality" wx:elif="{{comment.service_attitude==3}}">中评</view>
          <view class="quality" wx:else="{{comment.service_attitude<=2}}">差评</view>
        </view>
        <view class="starbox">
          <view class="name">回复速度</view>

          <van-rate value="{{comment.reply_progress}}" size="{{ 20 }}" color="#ed9c00" void-icon="star" void-color="#eee" bind:change="onChange" gutter="8" data-id="reply_progress" readonly="{{is_evaluation}}"/>
          <view class="quality" wx:if="{{comment.reply_progress>=4}}">好评</view>
          <view class="quality" wx:elif="{{comment.reply_progress==3}}">中评</view>
          <view class="quality" wx:else="{{comment.reply_progress<=2}}">差评</view>
        </view>
      </view>
      <van-field  maxlength="200"  class="commentArea" input-class="ipt" custom-style="height: 240rpx; border-radius: 10rpx;background: #fff;border:1px solid #ccc;"  placeholder="请您对本次服务进行评价" show-word-limit value="{{ comment.content }}" label="" type="textarea"  border="{{ false }}" bind:change="onChangeContent" disabled="{{is_evaluation}}"></van-field>
     
    </view>
    <view class="footer">
      <!-- bind:tap="sendMessage" -->
      <button class="btn"   type="primary" bindtap="handleEvaluation" disabled="{{is_evaluation}}">匿名评价</button>
    </view>
  </view>
</view>
