<template>
  <sail-page type="autoBindHouse" title="绑定房源" isHead>
    <div slot="content">
        <div class="bind-house-wrapper">
            <div class="weui-cells zero-top">
              <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" disabled :value="houseInfo.applicantName" type="text" placeholder="请输入姓名">
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">身份证号</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" disabled :value="houseInfo.applicantCardCode" placeholder="请输入联系方式">
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">房间信息</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" disabled :value="houseInfo.fullName" placeholder="房间信息">
                    </div>
                </div>
                <div class="weui-cell">
                    <div class="weui-cell__hd"><label class="weui-label">合同日期</label></div>
                    <div class="weui-cell__bd">
                        <input class="weui-input" disabled :value="houseInfo.outputDate" placeholder="请输入联系方式">
                    </div>
                </div>
            </div>
        </div>
        <van-button size="large" :loading="bindLoading" @click="bindHouse" class="submit-btn">绑定</van-button>
    </div>
  </sail-page>
</template>

<script>
import { mapState } from "vuex";
// import { Toast } from 'vant';
import sailPage from "@/components/sail-page.vue";

export default {
  components: {
    sailPage
  },
  computed: {
    ...mapState({
      houseInfo: state => state.bindHouseModule.houseInfo,
      info: state => bindHouseModule.info,
    })
  },
  data: function(){
    return {
      bindLoading: false
    }; 
  },
  methods: {
    bindHouse() {
        
      this.bindLoading = true;
      this.$store.dispatch("bindHouseModule/bindHouseSecond").then(res => {
        this.bindLoading = false;
        if(res) {
          res.Toast.success("绑定房源成功");
          this.$store.dispatch("bindHouseModule/viewHouseInfo").then(res => {
              
            this.$store.commit("loginModule/SET_LOGIN_HOUSE_INFO", res.data.data);
          });
        }
        this.$router.push({path: "/MyPage"});
      });
    }
  }
};
</script>
<style lang="less">
  
</style>
<style lang="less" scoped>
    .bind-house-wrapper {
      margin-top: 14px;
    }
</style>1