<template>
  <div class="index">
    <div class="appointment">
      <div class="type"><span class="point"></span> 待预约的服务</div>
      <div class="item-container">
        <Item v-for="(item, index) in items" :item="item" :key="index" />
      </div>
    </div>
    <div class="appointmented">
      <div class="type"><span class="point"></span>已预约的服务</div>
      <div class="item-container">
        <Item v-for="(item, index) in itemb" :item="item" :key="index" />
      </div>
    </div>
    <!-- 新卡-初始对话框 -->
    <a-modal
      v-model="visible"
      title="个人基本信息填写"
      @ok="handleHideModal"
      :footer="null"
    >
      <Form @hideModal="handleHideModal"/>
    </a-modal>
  </div>
</template>

<script>
import Item from './components/item.vue'
import Form from './components/form.vue'
import api from '@/api/customer'
export default {
  components: { Item, Form },
  data() {
    return {
      id:'',
      visible: true, //是否显示"个人基本信息填写"弹窗
      items: [
        {
          name: '体检套餐名称-某某单位-某某套餐',
          detailUrl: 'http://baidu.com',
          type: 1,
          date: '2021-11-18',
        },
        {
          name: '体检套餐名称-某某单位-某某套餐',
          detailUrl: 'http://baidu.com',
          type: 1,
          date: '2021-11-18',
        },
        {
          name: '体检套餐名称-某某单位-某某套餐',
          detailUrl: 'http://baidu.com',
          type: 1,
          date: '2021-11-18',
        },
        {
          name: '体检套餐名称-某某单位-某某套餐',
          detailUrl: 'http://baidu.com',
          type: 1,
          date: '2021-11-18',
        },
      ],
      itemb: [
        {
          name: '体检套餐名称-某某单位-某某套餐',
          detailUrl: 'http://baidu.com',
          type: 2,
          date: '2021-11-18',
        },
        {
          name: '体检套餐名称-某某单位-某某套餐',
          detailUrl: 'http://baidu.com',
          type: 2,
          date: '2021-11-18',
        },
        {
          name: '体检套餐名称-某某单位-某某套餐',
          detailUrl: 'http://baidu.com',
          type: 2,
          date: '2021-11-18',
        },
        {
          name: '体检套餐名称-某某单位-某某套餐',
          detailUrl: 'http://baidu.com',
          type: 2,
          date: '2021-11-18',
        },
      ],
    }
  },
  created() {
    const {id}= this.$route.query
    this.id = id
    this.getCustomerDetail()
  },
  methods: {
    showModal() {
      this.visible = true
    },
    handleHideModal(e) {
      console.log(e)
      this.visible = false
    },
    // 获取客户详情
    getCustomerDetail() {
      console.log('this.id=',this.id,typeof(this.id),typeof(parseInt(this.id)));
      api.getCustomerDetail({ id: parseInt(this.id) }).then((res) => {
        if (res.returnCode == '0000') {
          // 根据information是否显示'个人基本信息填写'弹窗(01:完善 02:不完善)
          console.log('获取客户详情information',res.content.information )
          // res.content.information == '02'
          //   ? (this.visible = true)
          //   : (this.visible = false)
        } else {
          this.$message.error(res.returnMsg)
        }
      })
    },
  },
}
</script>

<style lang="less" scoped>
.index {
  padding-bottom: 48px;
  padding-top: 20px;
  background-color: #fafafa;
  ::v-deep .ant-modal {
    background-color: saddlebrown;
  }
  ::v-deep .ant-modal-footer {
    display: none;
  }
  .appointment,
  .appointmented {
    padding: 19.5px 14.5px 33.5px 14.5px;
    background-color: white;
    width: 900px;
    margin: 0 auto;
    .point {
      display: inline-block;
      border-radius: 5px;
      width: 6px;
      height: 6px;
      background-color: #3f7ffb;
      margin-right: 6px;
      position: relative;
      top: -1px;
    }
    border-radius: 8px;
    .type {
      font-size: 14px;
      font-weight: bold;
    }
    .item-container {
      margin-top: 8.5px;
    }
  }
  .appointmented {
    margin-top: 20px;
    .point {
      background-color: #ffcc00;
    }
  }
}
</style>
