index.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!--
  2. * @Author: xiebaomin 1771403033@qq.com
  3. * @Date: 2023-03-29 10:58:14
  4. * @LastEditors: xiebaomin 1771403033@qq.com
  5. * @LastEditTime: 2023-05-12 09:16:20
  6. * @FilePath: \caimei-authentic-manager\src\components\PermissionButton\index.vue
  7. * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  8. -->
  9. <template>
  10. <el-button v-bind="$attrs" @click="handleClick"><slot /></el-button>
  11. </template>
  12. <script>
  13. export default {
  14. name: 'PermissionButton',
  15. data() {
  16. return {
  17. hasPermission: true
  18. }
  19. },
  20. methods: {
  21. handleClick($event) {
  22. const { freeUseFlag, vipStatus } = this.$store.getters.vipInfo
  23. // 试用期 || 会员未到期
  24. this.hasPermission = freeUseFlag > 0 || [0, 3].indexOf(vipStatus) === -1
  25. if (this.hasPermission) {
  26. this.$emit('click', $event)
  27. } else {
  28. this.$confirm('对不起,您账号的会员权限已到期,请尽快续费会员,以免影响正常使用!', '提示', {
  29. confirmButtonText: '续费',
  30. cancelButtonText: '取消'
  31. })
  32. .then(() => {
  33. // jumpAction()
  34. // console.log('开通会员')
  35. this.$router.push('/vip/vip-open')
  36. })
  37. .catch(() => {
  38. this.$message({
  39. type: 'info',
  40. message: '已取消操作'
  41. })
  42. })
  43. }
  44. }
  45. }
  46. }
  47. </script>