<!--pages/consultOrder/consultOrder.wxml-->
<wxs src="../../../filters/filter.wxs" module="timeModule"></wxs>
<view class="page">
  <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="dropdown">
    <view class="bar"></view>
    <van-dropdown-menu active-color="#3CC7C0">
      <van-dropdown-item value="{{ inquiry_status }}"  options="{{ option1 }}"  title-class="droptitle {{selectstatus?'active':''}}" bind:change="changeStatus" />
      <van-dropdown-item value="{{ family_id }}"   title-class="droptitle {{selectfamily?'active':''}}" options="{{ option2 }}" bind:change="changeFamily" />
    </van-dropdown-menu>
  </view>
  <scroll-view scroll-y="true" bindrefresherrefresh="handleRefresher" refresher-triggered="{{isTriggered}}"	refresher-threshold="100"	refresher-enabled="true"  class="hasdata" bindscrolltolower="lower" wx:if="{{orderList.length>0}}">
    <view class="databox">
      <view class="datacell" bindtap="goDetail" wx:for="{{orderList}}" wx:key="order_inquiry_id" data-id="{{item.order_inquiry_id}}">
        <view class="titlebox">
            <view class="name" wx:if="{{item.inquiry_type==1 && item.inquiry_mode==1}}">专家问诊-图文</view>
          <view class="name" wx:elif="{{item.inquiry_type==1 && item.inquiry_mode==2}}">专家问诊-视频</view>
          <view class="name" wx:elif="{{item.inquiry_type==1 && item.inquiry_mode==6}}">专家问诊-疑难会诊</view>
          <view class="name" wx:elif="{{item.inquiry_type==1 && item.inquiry_mode==7}}">专家问诊-附赠回复</view>
          <view class="name" wx:elif="{{item.inquiry_type==2 && item.inquiry_mode!=7}}">快速问诊</view>
          <view class="name" wx:elif="{{item.inquiry_type==2 && item.inquiry_mode==7}}">快速问诊-附赠回复</view>
          <view class="name" wx:elif="{{item.inquiry_type==3 && item.inquiry_mode!=7}}">公益问诊</view>
          <view class="name" wx:elif="{{item.inquiry_type==3 && item.inquiry_mode==7}}">公益问诊-附赠回复</view>
          <view class="name" wx:elif="{{item.inquiry_type==4 && item.inquiry_mode!=7}}">问诊购药</view>
          <view class="name" wx:elif="{{item.inquiry_type==4 && item.inquiry_mode==7}}">问诊购药-附赠回复</view>
          <view class="name" wx:elif="{{item.inquiry_type==5 && item.inquiry_mode!=7}}">报告解读</view>
          <view class="name" wx:elif="{{item.inquiry_type==5 && item.inquiry_mode==7}}">报告解读-附赠回复</view>
          <view class="status" wx:if="{{item.inquiry_status==1 && item.inquiry_pay_status==1}}">
            <view class="waitpay">待支付</view>
            <view class="countdown">
              <van-count-down time="{{timeModule.countDown(item.created_at)}}" />
            </view>
          </view>
          <view class="status" wx:elif="{{item.inquiry_status==2}}">等待接诊</view>
         <view class="status" wx:elif="{{item.inquiry_status==3}}">等待接诊</view>
         <view class="status" wx:elif="{{item.inquiry_status==4}}">问诊中</view>
          <view class="status" wx:elif="{{item.inquiry_status==5}}">问诊完成</view>
          <view class="status" wx:elif="{{item.inquiry_status==6}}">问诊结束 </view>
          <view class="status" wx:elif="{{item.inquiry_status==7 && item.inquiry_pay_status!=5}}">问诊取消</view>
          <view class="status" wx:elif="{{item.inquiry_status==7 && item.inquiry_pay_status==5}}">
            <view class="waitpay">支付超时</view>
          </view>

        </view>
        <view class="infobox">
          <image src="{{img_host+'/jiezhening.png'}}" class="headicon" wx:if="{{item.inquiry_status==2}}"></image>
          <image src="{{item.user_doctor.avatar}}" class="headicon" wx:elif="{{item.inquiry_status!=2 && item.user_doctor.avatar}}" mode="aspectFill"></image>
          <image  src="{{img_host+'/doctor_avatar.png'}}"  class="headicon" wx:else></image>
          <view class="namebox">
            <view class="name" wx:if="{{item.user_doctor.user_name}}">{{item.user_doctor.user_name}} <text class="position">{{item.user_doctor.doctor_title}}</text></view>
            <view class="name" wx:elif="{{item.inquiry_status==2}}">平台分配医生中</view>
           <view class="name" wx:else>接诊医生</view>
           <view class="hospital" wx:if="{{item.user_doctor.hospital_name}}">
            {{item.user_doctor.hospital_name}}
           
           </view>
          </view>
        </view>
        <view class="row first">
          <view class="name"><text>就</text><text>诊</text><text>人</text></view>
          <view class="dot">：</view>
          <view class="desc">{{item.patient_name}}（<text wx:if="{{item.patient_sex==0}}">未知</text><text wx:if="{{item.patient_sex==1}}">男</text><text wx:else>女</text>，{{item.patient_age}}岁）</view>
        </view>
        <view class="row rowdesc" wx:if="{{item.inquiry_status!=1 }}">
          <view class="name">
           <text wx:if="{{item.inquiry_type!=5}}"> 病情描述</text>
           <text wx:else>检测项目</text>
          </view>
          <view class="dot">：</view>
          <view class="desc">
             <text wx:if="{{item.inquiry_type!=5}}">{{item.disease_desc}}</text>
             <text wx:else>糖组检测</text>
          </view>
        </view>
        <view class="row rowdesc" wx:else>
          <view class="name">下单时间</view>
          <view class="dot">：</view>
          <view class="desc">{{item.created_at}}</view>
        </view>
      
        <view class="row last" wx:if="{{item.inquiry_status!=1}}">
          <view class="left">
            <view class="name">下单时间</view>
            <view class="dot">：</view>
            <view class="desc">{{item.created_at}}</view>
          </view>
          <view class="right">
            <view class="detail">详情</view>
            <image  src="{{img_host+'/righticon.png'}}"  class="righticon"> </image>
          </view>
        </view>
        <view class="row last" wx:else>
          <view class="left">
            <view class="name">待付金额</view>
            <view class="dot">：</view>
            <view class="desc red">￥{{item.payment_amount_total}}</view>
          </view>
          <view class="right">
            <view class="detail">详情</view>
            <image src="{{img_host+'/righticon.png'}}"class="righticon"> </image>
          </view>
        </view>
      </view>
    </view>

  </scroll-view>
  <view class="nodata" wx:elif="{{!isLoading && orderList.length==0}}">
    <image src="{{img_host+'/noorder.png'}}" class="noorder"></image>
    <view class="tips">暂时没有订单记录</view>
    <view class="btn" bindtap="goExpertList">专家问诊</view>
  </view>

</view>