<template>
  <div id="bind">
    <el-row>
      <el-col :span="24" class="style">
        <el-col :span="24" class="top">
          <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
        </el-col>
        <el-col :span="24" class="main">
          <el-button @click="bindBtn()" type="primary">确认绑定</el-button>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import NavBar from '@/layout/common/topInfo.vue';
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: authUser } = createNamespacedHelpers('authUser');
export default {
  name: 'bind',
  props: {},
  components: {
    NavBar,
  },
  data: () => ({
    // 头部标题
    title: '',
    // meta为true
    isleftarrow: '',
    // 返回
    navShow: true,
  }),
  created() {},
  computed: {
    uid() {
      return this.$route.query.uid;
    },
    openid() {
      return this.$route.query.openid;
    },
  },
  methods: {
    ...authUser(['bind']),
    async bindBtn() {
      let data = {};
      data.uid = this.uid;
      data.openid = this.openid;
      console.log(data);
      let res = await this.bind(data);
      if (res.errcode == '0') {
        this.$message({
          message: '绑定成功',
          type: 'success',
        });
      }
    },
  },
  mounted() {
    this.title = this.$route.meta.title;
    this.isleftarrow = this.$route.meta.isleftarrow;
  },
};
</script>

<style lang="less" scoped>
.style {
  width: 100%;
  min-height: 667px;
  position: relative;
  background-color: #f9fafc;
}
.top {
  height: 46px;
  overflow: hidden;
}
.main {
  min-height: 570px;
  padding: 150px;
}
.foot {
  position: absolute;
  bottom: 0;
}
</style>
