<!--order.wxml-->
 <import src="../../template/empty_box/empty_box"/> 
<!--  切换按钮  -->
<view class="nav_bar {{tabIndex == 1?'active':''}}" bindtap="switchTab">
  <view class="nav_item {{tabIndex == 0?'active':''}}" data-index="0">Purchase order</view>
  <view class="nav_item {{tabIndex == 1?'active':''}}" data-index="1">Reservation Order</view>
</view>
<!--  商品订单  -->
<block wx:for="{{orderList}}" wx:if="{{orderList.length>0 && tabIndex==0}}" wx:key="orderList">
  <navigator url="../orderDetail/orderDetail?id={{item.order_sn}}" hover-class="active" class="order">
    <view class='order_color'>
    <view class="order_header">
      <view class="order_num">Order id: {{item.order_sn}}</view>
      <view class="order_status">{{item.status == 1?'unpaid':item.status == 2?'paid':'closed'}}</view>
    </view>

    <view class="order_goods">
      <block wx:for="{{recommend}}">
      <view class="goods_image">
        <image src="{{item.picture}}"></image>
      </view>
      </block>
      <view class="goods_info">

        <block wx:for="{{item.car_content}}">
        <view class="goods_name">{{item.title}} X{{item.goods_num}}<text decode="{{true}}">&ensp;</text>{{item.attr_title}}<text wx:if="{{item.car_content.length>1}}" class="more"></text>
         
        </view>
       
        </block>
        
        <view>

        </view>
        
      </view>
    </view>
    </view>
    <view class='order_middle'>  
      <view class="goods_count">In total {{item.car_content.length}} piece</view>
      <view class="total_price">Total price：<text style='color:#DA1548;'>￥{{item.price}}</text></view>
    </view>

    <view class="order_footer">
      <view class="order_detail">Order details
        <text class="iconfont icon-more"></text></view>
      <block wx:if="{{item.order_type ==3 }}">
        <view class='ziti_text'>(Self lifting)</view>
      </block>
      <block wx:if="{{ item.status == 1  }}" >
        <view class='cancel_btn' catchtap='toCancel' data-order="{{item.order_sn}}" >cancel </view>
        </block>
        <block wx:if="{{ item.status == 3  }}" >
        <view class='cancel_btn' catchtap='toCancel' data-order="{{item.order_sn}}" >Delete order</view>
        </block>
        <block wx:if="{{ item.status == 2 }}" >
        <view class='cancel_btn' catchtap='toSure' data-order="{{item.order_sn}}" >complete </view>
        </block>
      
    </view>
  </navigator>
</block>
<!--  商品订单  -->

<!--  首页优惠购买订单  -->
<block wx:for="{{payList}}" wx:if="{{payList.length>0 && tabIndex==0}}" wx:key="payList">
    <view hover-class="active" class="order">  
    <view class='order_color'>
    <view class="order_header">
      <view class="order_num">Order number : {{item.order_sn}}</view>
      <view class="order_status" wx:if="{{item.status=='2'}}">Already paid</view>
    </view>

    <view class="order_goods">
      <block wx:for="{{recommend}}">
      <view class="goods_image">
        <image src="{{item.picture}}"></image>
      </view>
      </block>
      <view class="goods_info">

        <!-- <block wx:for="{{item.car_content}}"> -->
        <view class="goods_name2">preferential<text class="more"></text></view>
        <!-- </block> -->
        
        <view>

        </view>
        
      </view>
    </view>
    </view>
    <view class='order_middle'>  
      <!-- <view class="goods_count">共 {{item.car_content.length}} 件</view> -->
      <view class="total_price">Total price : <text style='color:#DA1548;'>￥{{item.money}}</text></view>
    </view>

    <view class="order_footer">
      <view class="order_detail">Order details
        <text class="iconfont icon-more"></text></view>
     
        <view class='cancel_btn' catchtap='toDel' data-did="{{item.id}}" >Delete order </view>

      
    </view>
   </view> 
</block>
<!--  首页购买订单  -->



<!--  预约订单  -->
<block wx:for="{{appointmentList}}" wx:if="{{appointmentList.length>0 && tabIndex==1}}" wx:key="appointmentList">
  <view class='order'>
  <view class='order_color'>
    <view class="order_header">
      <block wx:for="{{recommend}}">
      <view class="order_num">{{item.business_name}}</view>
      </block>
       <view class="order_status">appointment</view> 
    </view>

    <view class="order_goods">
      <block wx:for="{{recommend}}">
      <view class="goods_image">
        <image src="{{item.picture}}"></image>
      </view>
      </block>
      <view class="goods_info">


        <view class="goods_name">name  <text>{{item.name}}</text></view>
        <view class="goods_name">phone  <text>{{item.mobile}}</text></view>
        <view class="goods_name">number  <text> {{item.nums}}</text></view>
        <view class="goods_name"  >Dining place  <text>{{item.table}}</text></view>
        <view class="goods_name">date  <text>{{item.time}}</text></view>

        
        <view>

        </view>
        
      </view>
    </view>
    </view>
    <view class='order_middle'>  
      <view class="goods_count"></view>
      <view class="time_interval">period<text >{{item.time_intervcal==1? 'morning':item.time_interval==2?'noon':'evening'}}</text></view>
    </view>

    <view class="order_footer">
      <view class="order_time">Create order time:  <text>{{item.create_time}}</text></view>
    </view>
  </view>
</block>
<!--  预约订单  -->



<!-- <block wx:if="{{orderList.length<=0 && tabIndex==0}}">
  <template data="{{empty_box}}" is="empty_box"></template>
</block> -->

<block wx:if="{{!orderList.length && !payList.length && tabIndex==0}}">
  <template data="{{empty_box}}" is="empty_box"></template>
</block>

<block wx:if="{{!appointmentList && tabIndex==1}}">
  <template data="{{empty_box}}" is="empty_box"></template>
</block>

