<!--pages/use-record/index.wxml-->
<view class="sg-container sg-pad">
  <inner-device-card item="{{inner_device}}" wx:key="index"></inner-device-card>
  <van-collapse value="{{ activeNames }}" bind:change="onChange">
    <van-collapse-item title="历史阅历" name="1">
      <view class="sg-list">
        <block wx:if="{{order_devices.length > 0}}">
          <view class="sg-item" wx:for="{{order_devices}}" wx:key="index">
            <view class="sg-date sg-flex sg-align-center sg-space-between sg-index-color sg-bold sg-pad-tb-sm sg-bottom-border">
              <view>{{item.start_date}}</view>
              <view>-</view>
              <view>{{ index == 0 && inner_device.end_date ? '' : item.end_date}}</view>
            </view>
            <view class="sg-flex sg-align-center sg-bottom-border sg-space-between sg-pad-tb-sm">
              <view>调用项目</view>
              <view class="sg-bold sg-black">{{item.project ? item.project.name : ''}}</view>
            </view>
            <view class="sg-flex sg-align-center sg-bottom-border sg-space-between sg-pad-tb-sm">
              <view>调用人员</view>
              <view class="sg-bold sg-black">{{item.user ? item.user.name : ''}}</view>
            </view>
          </view>
        </block>
        <block wx:else class="sg-center">暂无历史阅历</block>
      </view>
    </van-collapse-item>
    <van-collapse-item title="维修记录" name="2">
      <block wx:if="{{repair_devices.length > 0}}">
          <view class="sg-item" wx:for="{{repair_devices}}" wx:key="index">
            <view class="sg-date sg-flex sg-align-center sg-space-between sg-index-color sg-bold sg-pad-tb-sm sg-bottom-border">
              <view>{{item.date}}</view>
              <view>维修部位</view>
              <view>金额</view>
            </view>
            <view class="sg-part-list">
              <view wx:for="{{item.parts}}" wx:for-item="j_item" wx:for-index="j_index" wx:key="j_index" class="sg-flex sg-align-center sg-space-between sg-pad-tb-sm">
                <view>更换配件{{j_index + 1}}</view>
                <view>{{j_item.name}}</view>
                <view>￥{{j_item.price/100}}</view>
              </view>
            </view>
            <view class="sg-center sg-bold sg-black sg-pad-tb-sm">维修合计金额：￥{{item.money/100}}</view>
            <view>
              <view class="sg-flex sg-align-center sg-space-between sg-pad-tb-sm sg-bottom-border">
                <view class="sg-black">上报项目</view>
                <view>{{item.project ? item.project.name : ''}}</view>
                <view class="sg-black">提交人</view>
                <view>{{item.user ? item.user.name : ''}}</view>
              </view>
              <view class="sg-flex sg-align-center sg-space-between sg-pad-tb-sm sg-bottom-border">
                <view class="sg-black">维修天数</view>
                <view>{{item.day}}</view>
              </view>
              <view class="sg-flex sg-align-center sg-space-between sg-pad-tb-sm sg-bottom-border">
                <view class="sg-black">维修原因</view>
                <view>{{item.reason}}</view>
              </view>
              <view class="sg-flex sg-align-center sg-space-between sg-pad-tb-sm sg-bottom-border">
                <view class="sg-black">备注</view>
                <view>{{item.remark}}</view>
              </view>
            </view>
          </view>
        </block>
        <block wx:else class="sg-center">暂无维修记录</block>
    </van-collapse-item>
  </van-collapse>
</view>