<!--components/out-order-item/index.wxml-->
<view class="sg-item sg-white-bg sg-pad sg-margin-bottom sg-font-small">
  <view class="sg-top sg-bottom-border">
    <view class="sg-order-status sg-flex sg-align-center sg-space-between sg-margin-bottom sg-font-xs">
      <view class="sg-order sg-gray-color">订单号：{{item.order_number}}</view>
      <view class="sg-status sg-bold" style="color: {{item.color}}">{{item.status}}</view>
    </view>
    <view class="sg-device-info sg-font-xs">
      <view class="sg-table-row sg-flex sg-align-center sg-space-around sg-pad-tb-sm sg-top-border">
        <view class="sg-table-column">资产编号</view>
        <view class="sg-table-column">设备名称</view>
        <view class="sg-table-column">开始时间</view>
        <view class="sg-table-column">结束时间</view>
      </view>
      <view class="sg-table-row sg-flex sg-align-center sg-space-around sg-pad-tb-sm sg-top-border"
        wx:for="{{item.devices}}" wx:for-item="j_item" wx:for-index="j_index" wx:key="j_index">
        <view class="sg-table-column">{{j_item.number}}</view>
        <view class="sg-table-column">{{j_item.inner_name}}</view>
        <view class="sg-table-column">{{j_item.pivot ? j_item.pivot.start_date : ''}}</view>
        <view class="sg-table-column">{{j_item.pivot ? j_item.pivot.end_date : ''}}</view>
      </view>
    </view>
  </view>
  <view class="sg-bottom sg-flex sg-align-center sg-space-between">
    <view class="sg-left">
      <view class="sg-left-item sg-margin-tb-sm">所属项目：{{item.project_name}}</view>
      <view class="sg-left-item sg-margin-tb-sm">提交人：{{item.user_name}}</view>
      <view class="sg-left-item sg-margin-tb-sm">创建时间：{{item.date_time}}</view>
    </view>
    <view>
      <block
        wx:if="{{(item.status_key=='reject' || item.status_key=='checking' || item.is_draft == 1) && (role && role.key == 'machine') && showDelete}}">
        <view class="sg-right sg-red-bg sg-pad-sm sg-white sg-margin-bottom" catchtap="doAction" data-type="delete"
          data-order="{{item}}">删除订单</view>
      </block>
      <block wx:if="{{item.status_key=='reject'}}">
        <view class="sg-right sg-red-bg sg-pad-sm sg-white" catchtap="doAction" data-type="edit"
          data-url="/pages/create-order-inner/index?id={{item.project_id}}&order_id={{item.id}}&type=edit">重新修订</view>
      </block>
      <block wx:else>
        <view class="sg-right sg-index-bg sg-pad-sm sg-white" catchtap="doAction" data-type="edit"
          data-url="/pages/create-order-inner/index?id={{item.project_id}}&order_id={{item.id}}&type=edit">查看详情</view>
      </block>
    </view>
  </view>
</view>