<template>
  <el-link :type="type" @click="handleClick" :disabled="billId == null">{{text | defaultValue}}</el-link>
</template>

<script>
import { mapGetters } from 'vuex'
import { UserType } from '@/utils/constants'

export default {
  name: "RechargeLink",
  props: {
    billId: {
      type: String,
      default: null,
    },
    text: {
      type: String,
      default: null
    },
    type: {
      type: String,
      default: 'primary'
    }
  },
  computed: {
    ...mapGetters(['userType']),
  },
  methods: {
    handleClick() {
      let url = `/transaction/recharge/${this.billId}`;
      if (this.userType === UserType.APP) {
        url = `/bill/recharge/${this.billId}`;
      }
      console.log("url", url)
      this.$router.push(url)
    }
  }
}
</script>
