<template>
  <view class="page-checkin-list">
    <view class="header" :style="{ backgroundColor: `rgba(23, 83, 234, ${scrollTop / 100})` }">
      <view class="left">
        <u-icon class="icon" name="arrow-left" @click="uni.navigateBack()" />
      </view>
      <view class="title">登记清单</view>
      <view class="right"></view>
    </view>
    <view class="content">
      <wyb-table :headers="headers" :contents="checkin.getBills" enable-check="multiple" />
    </view>
    <view class="bottom-bar">
      <u-row>
        <u-col :span="6">
          <u-button type="error" @click="onDelete">删除</u-button>
        </u-col>
        <u-col :span="6"><u-button @click="uni.navigateBack()">返回</u-button></u-col>
      </u-row>
    </view>
  </view>
</template>

<script lang="ts">
import { Component } from 'vue-property-decorator';
import { BasePage } from '@/components/base/page';
import { checkin } from './model';
import { headers } from './config';

@Component
export default class CheckInListPage extends BasePage {
  // 预约看单模块
  checkin = checkin;

  // 表头
  headers = headers;

  // 删除
  onDelete() {
    this.checkin.bills
      .map((_, i) => i)
      .forEach((index) => {
        checkin.splice({ index });
      });
  }
}
</script>

<style lang="scss" scoped>
.page-checkin-list {
  background: #f2f2f2 linear-gradient(0deg, #f2f2f2 0%, #4a78ea 51%, #1753ea 100%) no-repeat;
  background-size: 100% 600rpx;
  padding: 118rpx 30rpx 162rpx;
  min-height: 100%;

  .header {
    position: fixed;
    top: 36rpx;
    left: 0;
    right: 0;
    z-index: 99;
    display: flex;
    height: 88rpx;
    line-height: 88rpx;
    color: #fff;
    font-size: 34rpx;
    font-weight: 500;
    text-align: center;
    .title {
      flex: 3;
    }
    .left,
    .right {
      flex: 1;
    }
    .icon {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 88rpx;
      height: 88rpx;
    }
  }

  .content {
    flex: 1;
    overflow-x: scroll;

    .active {
      background-color: #ccc;
    }
  }

  .form {
    background-color: #fff;
    padding: 40rpx;
    border-radius: 10rpx;
    box-shadow: 0 0 20rpx 0 rgba(128, 128, 128, 0.2);

    .u-form-item {
      padding: 30rpx 0;
      line-height: 35rpx;
    }
  }

  .bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99;
    background: #ffffff;
    box-shadow: 0 1rpx 20rpx 0 rgba(128, 128, 128, 0.2);
    padding: 20rpx;
  }
}
</style>
