<!--预约记录-->
<template>
  <div class="container">
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      error-text="加载失败 请刷新"
      @load="GetOrderListByDoctor"
    >
      <div class="item" v-for="(item,index) in list" :key="index">
        <p>{{item.VisitDay | getTime}} {{item.VisitDay | getWeek}} {{item.HospitalName}}</p>
        <div>
          <div>
            <span>姓名</span>
            <span>年龄</span>
            <span>性别</span>
            <span>时段</span>
            <span>操作</span>
          </div>
          <div v-for="temp in item.List">
            <span>{{temp.FamilyMemberName}}</span>
            <span>{{temp.Birthday | getAge}}岁</span>
            <span>{{temp.Gender | filterSex}}</span>
            <span>{{temp.TimeSlot}}</span>
            <router-link :to="'/DoctorPatientInfo?id='+temp.FamilyMemberID">病历</router-link>
          </div>
        </div>
      </div>
    </van-list>
  </div>
</template>

<script>
export default {
  name: "Appointments",
  data() {
    return {
      name: "", //名称 ,
      pageIndex: 1, //页码 ,
      pageSize: 10, //页大小
      loading: false,
      finished: false,
      list: [], // 保存预约记录数据
      Pager: {}
    };
  },
  created() {
    // this.GetOrderListByDoctor();
  },
  methods: {
    GetOrderListByDoctor() {
      var obj = {
        name: this.name, //名称 ,
        pageIndex: this.pageIndex, //页码 ,
        pageSize: this.pageSize //页大小
      };
      this.$http.GetOrderListByDoctor(obj).then(res => {
        this.loading = false;
        if (res.data.IsSuccess) {
          this.list = this.list.concat(res.data.ResultObject);
          this.Pager = res.data.Pager || {};
          if (res.data.ResultObject.length < 10) {
            this.finished = true;
          }
          this.pageIndex++;
        } else {
          this.$toast(res.data.ResultMsg);
        }
      });
    }
  }
};
</script>

<style scoped lang="less">
.container {
  width: 7rem;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 0.3rem 0;
}
.item {
  border-radius: 5px;
  background-color: #fff;
  box-sizing: border-box;
  padding: 0.2rem 0.3rem;
  box-shadow: 0 0 7px 0px #ccc;
  margin-bottom: 0.2rem;
  p {
    font-size: 0.3rem;
    color: #9d9d9d;
    text-align: left;
    margin-bottom: 0.2rem;
  }
  > div {
    width: 100%;
    > div {
      display: flex;
      justify-content: normal;
      align-items: center;
      span:nth-child(4) {
        width: 25%;
      }
      span,
      a {
        height: 1rem;
        display: inline-block;
        line-height: 1rem;
        width: 20%;
      }
      a {
        display: inline;
        font-size: 0.26rem;
        color: #00a0e9;
        text-decoration: underline;
      }
    }
  }
}
</style>
