renewal.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view class="page" :style="{ '--font-scale': fontScale }">
  3. <view class="nav-bar">
  4. <view class="nav-back" @tap="goBack">
  5. <text class="back-text">‹ 返回</text>
  6. </view>
  7. <text class="nav-title">续费升级</text>
  8. </view>
  9. <scroll-view class="content" scroll-y>
  10. <!-- CF值余额 -->
  11. <view class="cf-balance-card">
  12. <text class="balance-label">您的CF值余额</text>
  13. <text class="balance-value">{{ cfBalance }}</text>
  14. <text class="balance-equivalent">{{ cfBalance }} CF = ¥{{ (cfBalance * 0.01).toFixed(2) }}</text>
  15. </view>
  16. <!-- 续费信息 -->
  17. <view class="card">
  18. <view class="card-header">
  19. <text class="card-title">续费详情</text>
  20. </view>
  21. <view class="price-row">
  22. <text class="price-label">家庭会员年费</text>
  23. <text class="price-original">¥1,999</text>
  24. </view>
  25. <view class="price-row discount">
  26. <text class="price-label">CF值抵扣</text>
  27. <text class="price-discount">-¥{{ discountAmount }}</text>
  28. </view>
  29. <view class="price-divider"></view>
  30. <view class="price-row total">
  31. <text class="price-label">实付金额</text>
  32. <text class="price-total">¥{{ payAmount }}</text>
  33. </view>
  34. <text class="price-note" v-if="discountPercent > 0">已抵扣 {{ discountPercent }}%({{ cfBalance }} CF值)</text>
  35. </view>
  36. <!-- 会员权益 -->
  37. <view class="card">
  38. <view class="card-header">
  39. <text class="card-title">年费会员权益</text>
  40. </view>
  41. <view class="benefit-grid">
  42. <view class="benefit-cell" v-for="(item, idx) in benefits" :key="idx">
  43. <text class="benefit-cell-icon">{{ item.icon }}</text>
  44. <text class="benefit-cell-text">{{ item.text }}</text>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 支付按钮 -->
  49. <view class="pay-wrap">
  50. <view class="pay-btn" :class="{ 'loading': submitting }" @tap="handlePay">
  51. <text class="btn-text">{{ submitting ? '处理中...' : '立即续费' }}</text>
  52. </view>
  53. <text class="pay-tip">支持微信支付/支付宝,续费后即时生效</text>
  54. </view>
  55. </scroll-view>
  56. </view>
  57. </template>
  58. <script>
  59. import { getRenewalInfo } from '../../utils/api.js'
  60. import fontScaleMixin from '@/mixins/font-scale.js'
  61. export default {
  62. mixins: [fontScaleMixin],
  63. data() {
  64. return {
  65. submitting: false,
  66. cfBalance: 0,
  67. discount: 0,
  68. payAmount: 199900
  69. }
  70. },
  71. computed: {
  72. discountAmount() {
  73. return (this.discount * 0.01).toFixed(2)
  74. },
  75. discountPercent() {
  76. return this.cfBalance >= 19900 ? 100 : Math.round(this.discount / 19900 * 100)
  77. }
  78. },
  79. benefits: [
  80. { icon: '📋', text: '无限报告上传' },
  81. { icon: '🤖', text: 'AI报告解析' },
  82. { icon: '📝', text: '无限方案生成' },
  83. { icon: '🏆', text: '全量闯关奖励' },
  84. { icon: '👨‍👩‍👧', text: '最多5名成员' },
  85. { icon: '🎯', text: '专属规划师' }
  86. ],
  87. onLoad() {
  88. this.loadInfo()
  89. },
  90. methods: {
  91. goBack() { uni.navigateBack() },
  92. async loadInfo() {
  93. try {
  94. var res = await getRenewalInfo()
  95. if (res.data && res.data.success) {
  96. this.cfBalance = res.data.cfBalance
  97. this.discount = res.data.discount
  98. this.payAmount = res.data.payAmount
  99. }
  100. } catch (e) {
  101. console.log('加载续费信息失败', e)
  102. }
  103. },
  104. handlePay() {
  105. // TODO: 对接真实支付
  106. uni.showModal({
  107. title: '续费确认',
  108. content: '确认支付 ¥' + (this.payAmount / 100).toFixed(2) + ' 续费家庭会员年费?',
  109. success: (res) => {
  110. if (res.confirm) {
  111. this.submitting = true
  112. setTimeout(() => {
  113. this.submitting = false
  114. uni.showToast({ title: '续费成功', icon: 'success' })
  115. setTimeout(() => {
  116. uni.navigateBack()
  117. }, 1500)
  118. }, 1000)
  119. }
  120. }
  121. })
  122. }
  123. }
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. .page { min-height: 100vh; background: $uni-primary-pale; }
  128. .nav-bar { display: flex; align-items: center; height: 88rpx; padding-top: env(safe-area-inset-top); background: $app-surface; border-bottom: 1rpx solid $facade-fill; position: relative; }
  129. .nav-back { position: absolute; left: 24rpx; top: 0; bottom: 0; display: flex; align-items: center; }
  130. .back-text { font-size: calc(28rpx * var(--font-scale, 1)); color: $brand-primary; }
  131. .nav-title { flex: 1; text-align: center; font-size: calc(32rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; }
  132. .content { height: calc(100vh - 88rpx); }
  133. .cf-balance-card { background: linear-gradient(135deg, $accent-indigo, $accent-indigo-deep); padding: 40rpx 32rpx; text-align: center; }
  134. .balance-label { font-size: calc(24rpx * var(--font-scale, 1)); color: rgba(255,255,255,0.8); display: block; }
  135. .balance-value { font-size: calc($uni-font-size-4xl * var(--font-scale, 1)); font-weight: bold; color: $app-surface; display: block; margin: 8rpx 0; }
  136. .balance-equivalent { font-size: calc(24rpx * var(--font-scale, 1)); color: rgba(255,255,255,0.9); display: block; }
  137. .card { margin: 16rpx 24rpx; background: $app-surface; border-radius: 24rpx; overflow: hidden; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
  138. .card-header { padding: 24rpx; border-bottom: 1rpx solid $facade-fill-2; }
  139. .card-title { font-size: calc(28rpx * var(--font-scale, 1)); font-weight: bold; color: $facade-text-strong; }
  140. .price-row { display: flex; justify-content: space-between; align-items: center; padding: 16rpx 24rpx; }
  141. .price-label { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-body; }
  142. .price-original { font-size: calc(26rpx * var(--font-scale, 1)); color: $facade-text-muted; text-decoration: line-through; }
  143. .price-row.discount { background: $fortune-1-tint; }
  144. .price-discount { font-size: calc(26rpx * var(--font-scale, 1)); color: $brand-primary; font-weight: bold; }
  145. .price-divider { height: 1rpx; background: $facade-hairline; margin: 0 24rpx; }
  146. .price-row.total { background: $mat-amber-tint; }
  147. .price-total { font-size: calc(36rpx * var(--font-scale, 1)); color: $brand-primary; font-weight: bold; }
  148. .price-note { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; text-align: center; padding: 12rpx 24rpx 24rpx; display: block; }
  149. .benefit-grid { display: flex; flex-wrap: wrap; padding: 16rpx 24rpx; }
  150. .benefit-cell { width: calc(50% - 12rpx); display: flex; align-items: center; gap: 12rpx; padding: 16rpx 0; border-bottom: 1rpx solid $facade-fill-2; }
  151. .benefit-cell-icon { font-size: calc(32rpx * var(--font-scale, 1)); }
  152. .benefit-cell-text { font-size: calc(24rpx * var(--font-scale, 1)); color: $facade-text-strong; }
  153. .pay-wrap { padding: 32rpx 24rpx 40rpx; text-align: center; }
  154. .pay-btn { background: linear-gradient(135deg, $accent-indigo, $accent-indigo-deep); color: $app-surface; text-align: center; padding: 28rpx 0; border-radius: 16rpx; font-size: calc(32rpx * var(--font-scale, 1)); font-weight: bold; }
  155. .pay-btn.loading { opacity: 0.6; }
  156. .pay-tip { font-size: calc(22rpx * var(--font-scale, 1)); color: $facade-text-muted; margin-top: 16rpx; display: block; }
  157. </style>