UpgradeGuideModal.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. if (this.quotaType === 'REPORT_UPLOAD') return '本月报告上传额度已用完(' + this.total + '/' + this.total + '),升级 FAMILY 解锁更多'
  39. return '本月额度已用完,升级 FAMILY 解锁更多权益'
  40. }
  41. },
  42. methods: {
  43. show() {
  44. this.visible = true
  45. },
  46. hide() {
  47. this.visible = false
  48. },
  49. handleKnow() {
  50. this.hide()
  51. this.$emit('know')
  52. },
  53. handleLearn() {
  54. this.hide()
  55. uni.navigateTo({ url: '/pages/membership/benefits' })
  56. this.$emit('learn')
  57. },
  58. handleUpgrade() {
  59. this.hide()
  60. uni.navigateTo({ url: '/pages/membership/upgrade' })
  61. this.$emit('upgrade')
  62. },
  63. handleMaskClick() {
  64. if (this.type === 'soft') {
  65. this.hide()
  66. }
  67. }
  68. }
  69. }
  70. </script>
  71. <style scoped>
  72. .upgrade-guide-mask {
  73. position: fixed;
  74. top: 0; left: 0; right: 0; bottom: 0;
  75. background: rgba(0,0,0,0.5);
  76. display: flex;
  77. align-items: center;
  78. justify-content: center;
  79. z-index: 999;
  80. }
  81. .upgrade-guide-content {
  82. width: 600rpx;
  83. background: #fff;
  84. border-radius: 24rpx;
  85. padding: 48rpx 36rpx 36rpx;
  86. text-align: center;
  87. }
  88. .upgrade-guide-icon {
  89. font-size: 72rpx;
  90. margin-bottom: 24rpx;
  91. }
  92. .upgrade-guide-title {
  93. font-size: 32rpx;
  94. font-weight: 600;
  95. color: #333;
  96. margin-bottom: 16rpx;
  97. }
  98. .upgrade-guide-desc {
  99. font-size: 26rpx;
  100. color: #666;
  101. line-height: 1.6;
  102. margin-bottom: 36rpx;
  103. }
  104. .upgrade-guide-actions {
  105. display: flex;
  106. flex-direction: column;
  107. gap: 16rpx;
  108. }
  109. .btn-know, .btn-learn, .btn-upgrade {
  110. height: 80rpx;
  111. line-height: 80rpx;
  112. border-radius: 40rpx;
  113. font-size: 28rpx;
  114. }
  115. .btn-know {
  116. background: #f5f5f5;
  117. color: #666;
  118. }
  119. .btn-learn {
  120. background: transparent;
  121. color: #F97316;
  122. border: 2rpx solid #F97316;
  123. }
  124. .btn-upgrade {
  125. background: #F97316;
  126. color: #fff;
  127. }
  128. </style>