UpgradeGuideModal.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="upgrade-guide-mask" v-if="visible" @click="handleMaskClick">
  3. <view class="upgrade-guide-content" :class="{ 'hard-modal': type === 'hard' }" @click.stop>
  4. <view class="upgrade-guide-icon">{{ icon }}</view>
  5. <view class="upgrade-guide-title">{{ title }}</view>
  6. <view class="upgrade-guide-desc">{{ desc }}</view>
  7. <view class="upgrade-guide-actions">
  8. <view v-if="type === 'soft'" class="btn-know" @click="handleKnow">知道了</view>
  9. <view v-if="type === 'soft'" class="btn-learn" @click="handleLearn">了解详情</view>
  10. <view v-if="type === 'hard'" class="btn-upgrade" @click="handleUpgrade">升级 FAMILY</view>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. name: 'UpgradeGuideModal',
  18. data() {
  19. return { visible: false }
  20. },
  21. props: {
  22. type: { type: String, default: 'soft' },
  23. quotaType: { type: String, default: '' },
  24. remaining: { type: Number, default: 0 },
  25. total: { type: Number, default: 0 }
  26. },
  27. computed: {
  28. icon() {
  29. return this.type === 'hard' ? '🔒' : 'ℹ️'
  30. },
  31. title() {
  32. return this.type === 'hard' ? '升级后即可使用' : '本月额度已用完'
  33. },
  34. desc() {
  35. if (this.type === 'hard') return '该功能为 FAMILY 会员专属权益,升级后即可使用'
  36. if (this.quotaType === 'AI_CHAT') return '您本月 AI 对话已用完(' + this.total + '/' + this.total + '),升级 FAMILY 享不限次畅聊'
  37. if (this.quotaType === 'REPORT_READING') return '本月报告解读额度已用完,升级 FAMILY 解锁不限次深度解读'
  38. return '本月额度已用完,升级 FAMILY 解锁更多权益'
  39. }
  40. },
  41. methods: {
  42. show() {
  43. this.visible = true
  44. },
  45. hide() {
  46. this.visible = false
  47. },
  48. handleKnow() {
  49. this.hide()
  50. this.$emit('know')
  51. },
  52. handleLearn() {
  53. this.hide()
  54. uni.navigateTo({ url: '/pages/membership/benefits' })
  55. this.$emit('learn')
  56. },
  57. handleUpgrade() {
  58. this.hide()
  59. uni.navigateTo({ url: '/pages/membership/upgrade' })
  60. this.$emit('upgrade')
  61. },
  62. handleMaskClick() {
  63. if (this.type === 'soft') {
  64. this.hide()
  65. }
  66. }
  67. }
  68. }
  69. </script>
  70. <style scoped>
  71. .upgrade-guide-mask {
  72. position: fixed;
  73. top: 0; left: 0; right: 0; bottom: 0;
  74. background: rgba(0,0,0,0.5);
  75. display: flex;
  76. align-items: center;
  77. justify-content: center;
  78. z-index: 999;
  79. }
  80. .upgrade-guide-content {
  81. width: 600rpx;
  82. background: #fff;
  83. border-radius: 24rpx;
  84. padding: 48rpx 36rpx 36rpx;
  85. text-align: center;
  86. }
  87. .upgrade-guide-icon {
  88. font-size: 72rpx;
  89. margin-bottom: 24rpx;
  90. }
  91. .upgrade-guide-title {
  92. font-size: 32rpx;
  93. font-weight: 600;
  94. color: #333;
  95. margin-bottom: 16rpx;
  96. }
  97. .upgrade-guide-desc {
  98. font-size: 26rpx;
  99. color: #666;
  100. line-height: 1.6;
  101. margin-bottom: 36rpx;
  102. }
  103. .upgrade-guide-actions {
  104. display: flex;
  105. flex-direction: column;
  106. gap: 16rpx;
  107. }
  108. .btn-know, .btn-learn, .btn-upgrade {
  109. height: 80rpx;
  110. line-height: 80rpx;
  111. border-radius: 40rpx;
  112. font-size: 28rpx;
  113. }
  114. .btn-know {
  115. background: #f5f5f5;
  116. color: #666;
  117. }
  118. .btn-learn {
  119. background: transparent;
  120. color: #F97316;
  121. border: 2rpx solid #F97316;
  122. }
  123. .btn-upgrade {
  124. background: #F97316;
  125. color: #fff;
  126. }
  127. </style>