<template>
  <div class="myReservation">
    <div class="historyItem" v-for="item in historyList">
      <div class="tags" :class="item.slateStatusStr==='待招商确认'?'dqrTag':'yslTag'">{{item.slateStatusStr}}</div>
      <div class="historyItemTitle">{{ item.groupName + item.floorDiscName + item.buildName + item.roomNo }}</div>
      <div class="historyItemInfo">预定时间：{{item.time}}</div>
      <div class="historyItemInfo">企业联系人：{{item.projectManager}}</div>
      <div class="historyItemInfo">联系电话：{{ item.managerPhone }}</div>
      <div class="historyItemBottom">
        <button class="btn" :class="item.slateStatusStr==='招商已受理'?'yslBtn':''" @click="remove(item)">删除</button>
        <button class="btn zcBtn" :class="item.slateStatusStr==='招商已受理'?'yslBtn':''">编辑</button>
      </div>
    </div>
  </div>
</template>

<script>
import { getByCodes, parkRoomSlateList, getUserLocalStorageInfo } from "@/js_sdk/http";

export default {
  name: "myReservation",
  created() {
    this.getData()
  },
  data(){
    return{
      historyList:[
        {slateStatusStr:'待招商确认'},
        {slateStatusStr:'招商已受理'},
      ],
      getUserLocalStorageInfo: getUserLocalStorageInfo(),
    }
  },
  methods: {
    getData(){
      this.historyList = []
      const data = {
        createdAt: getUserLocalStorageInfo().userId
      }
      parkRoomSlateList(data).then(res=>{
        if(res.code == '200'){
          res.data.forEach(item=>{
            const json = this.getItemJson(item)
            this.historyList.push(json)
          })

        }else {
          this.$showToast(res.msg);
        }
      })
    },
    getItemJson(item){
      item.time = item.createdAt == null ? item.updatedAt : item.createdAt
      return item
    },
    remove(item){

    }
  }
}
</script>

<style lang="scss">
</style>
