<template>
  <layout @goBack="goBack" :isNavBar="isNavBar" bgColor="#F1D6D9">
    <!-- type 1（砍一刀） 2（邀请好友） 3 （失败） 4 （成功）都是邀请人  0 是被邀请人 -->
    <bargainingAssistance
      ref="bargainingAssistance"
      :type="$route.params.type"
      :operateActivityId="operateActivityId"
      :getSystemTime="getSystemTime"
      :leaveFun="leaveFun"
      :wxIntercept="wxIntercept"
      :inviteeData="inviteeData"
    />
  </layout>
</template>

<script>
import layout from './components/layout';
import bargainingAssistance from './components/bargainingAssistance';
import common from './mixins/common';
export default {
  auth: false,
  head: {
    title: '0元购机，尽情享受',
  },
  mixins: [common],
  components: {
    layout,
    bargainingAssistance,
  },
  data() {
    return {
      inviteeData: {},
      operateActivityId: '',
      isNavBar: true
    };
  },
  mounted() {
    const { invitationUserName, operateActivityId, userLaunchId } =
      this.$route.query;
    if (invitationUserName && operateActivityId && userLaunchId) {
      this.inviteeData.invitationUserName = window.atob(invitationUserName);
      this.inviteeData.operateActivityId = window.atob(operateActivityId);
      this.inviteeData.userLaunchId = window.atob(userLaunchId);
    }
    this.operateActivityId = +localStorage.getItem('auth.operateActivityId')
    this.isNavBar = !(+localStorage.getItem('auth.inviteeNum'))
  },
  methods: {
    goBack() {
      const { bargainingStatus } = this.$refs.bargainingAssistance.info;
      if (bargainingStatus === 1 || bargainingStatus === 2) {
        this.$refs.bargainingAssistance.exitVisible = true;
      }
    },
  },
};
</script>

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