<!--components/inner-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">
      <view class="sg-label">租借设备概要：</view>
      <view class="sg-device-item sg-flex sg-align-center sg-space-between sg-margin-tb-sm" wx:for="{{item.devices}}"
        wx:for-item="j_item" wx:for-index="j_index" wx:key="j_index">
        <view class="sg-name">
          {{j_index+1}}.{{j_item.device ? j_item.device.name : ''}}-{{j_item.device_name ? j_item.device_name.name : ''}}-{{j_item.spec ? j_item.spec.name : ''}}
        </view>
        <view class="sg-price">￥{{j_item.price/100}}×{{j_item.quantity}}</view>
      </view>
    </view>
    <view class="sg-total sg-text-right sg-margin-tb-sm">合计：￥{{item.money/100}}</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.work_point_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') && (role && role.key == 'work') && showDelete}}">
        <view class="sg-right sg-red-bg sg-pad-sm sg-white sg-font-xs sg-margin-bottom" catchtap="doAction"
          data-type="delete" data-order="{{item}}">
          删除订单</view>
      </block>
      <block wx:if="{{item.status=='项目经理 - 已审核' && role && role.project_role.key == 'work'}}">
        <view class="sg-right sg-green-bg sg-pad-sm sg-white sg-font-xs" catchtap="doAction" data-type="confirm"
          data-order="{{item}}">确认订单</view>
      </block>
      <block wx:elif="{{item.status_key=='reject'&&user_id==item.user_id}}">
        <view class="sg-right sg-red-bg sg-pad-sm sg-white sg-font-xs" catchtap="doAction" data-type="edit"
          data-url="/pages/create-order/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 sg-font-xs" catchtap="doAction" data-type="detail"
          data-url="/pages/create-order/index?id={{item.project_id}}&order_id={{item.id}}&type=edit"
          wx:if="{{item.is_draft == 1}}">查看详情</view>
        <view class="sg-right sg-index-bg sg-pad-sm sg-white sg-font-xs" catchtap="doAction" data-type="detail"
          data-url="/pages/order-detail/index?id={{item.id}}" wx:else>查看详情</view>
      </block>
    </view>
  </view>
</view>