renewal.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <view class="page">
  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. export default {
  61. data() {
  62. return {
  63. submitting: false,
  64. cfBalance: 0,
  65. discount: 0,
  66. payAmount: 199900
  67. }
  68. },
  69. computed: {
  70. discountAmount() {
  71. return (this.discount * 0.01).toFixed(2)
  72. },
  73. discountPercent() {
  74. return this.cfBalance >= 19900 ? 100 : Math.round(this.discount / 19900 * 100)
  75. }
  76. },
  77. benefits: [
  78. { icon: '📋', text: '无限报告上传' },
  79. { icon: '🤖', text: 'AI报告解析' },
  80. { icon: '📝', text: '无限方案生成' },
  81. { icon: '🏆', text: '全量闯关奖励' },
  82. { icon: '👨‍👩‍👧', text: '最多5名成员' },
  83. { icon: '🎯', text: '专属规划师' }
  84. ],
  85. onLoad() {
  86. this.loadInfo()
  87. },
  88. methods: {
  89. goBack() { uni.navigateBack() },
  90. async loadInfo() {
  91. try {
  92. var res = await getRenewalInfo()
  93. if (res.data && res.data.success) {
  94. this.cfBalance = res.data.cfBalance
  95. this.discount = res.data.discount
  96. this.payAmount = res.data.payAmount
  97. }
  98. } catch (e) {
  99. console.log('加载续费信息失败', e)
  100. }
  101. },
  102. handlePay() {
  103. // TODO: 对接真实支付
  104. uni.showModal({
  105. title: '续费确认',
  106. content: '确认支付 ¥' + (this.payAmount / 100).toFixed(2) + ' 续费家庭会员年费?',
  107. success: (res) => {
  108. if (res.confirm) {
  109. this.submitting = true
  110. setTimeout(() => {
  111. this.submitting = false
  112. uni.showToast({ title: '续费成功', icon: 'success' })
  113. setTimeout(() => {
  114. uni.navigateBack()
  115. }, 1500)
  116. }, 1000)
  117. }
  118. }
  119. })
  120. }
  121. }
  122. }
  123. </script>
  124. <style scoped>
  125. .page { min-height: 100vh; background: #FFF7ED; }
  126. .nav-bar { display: flex; align-items: center; height: 88rpx; padding-top: env(safe-area-inset-top); background: #fff; border-bottom: 1rpx solid #f0f0f0; position: relative; }
  127. .nav-back { position: absolute; left: 24rpx; top: 0; bottom: 0; display: flex; align-items: center; }
  128. .back-text { font-size: 28rpx; color: #F97316; }
  129. .nav-title { flex: 1; text-align: center; font-size: 32rpx; font-weight: bold; color: #333; }
  130. .content { height: calc(100vh - 88rpx); }
  131. .cf-balance-card { background: linear-gradient(135deg, #667eea, #764ba2); padding: 40rpx 32rpx; text-align: center; }
  132. .balance-label { font-size: 24rpx; color: rgba(255,255,255,0.8); display: block; }
  133. .balance-value { font-size: 64rpx; font-weight: bold; color: #fff; display: block; margin: 8rpx 0; }
  134. .balance-equivalent { font-size: 24rpx; color: rgba(255,255,255,0.9); display: block; }
  135. .card { margin: 16rpx 24rpx; background: #fff; border-radius: 20rpx; overflow: hidden; box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.06); }
  136. .card-header { padding: 24rpx; border-bottom: 1rpx solid #f5f5f5; }
  137. .card-title { font-size: 28rpx; font-weight: bold; color: #333; }
  138. .price-row { display: flex; justify-content: space-between; align-items: center; padding: 16rpx 24rpx; }
  139. .price-label { font-size: 26rpx; color: #666; }
  140. .price-original { font-size: 26rpx; color: #999; text-decoration: line-through; }
  141. .price-row.discount { background: #FFF3E0; }
  142. .price-discount { font-size: 26rpx; color: #F97316; font-weight: bold; }
  143. .price-divider { height: 1rpx; background: #e0e0e0; margin: 0 24rpx; }
  144. .price-row.total { background: #FFF8E1; }
  145. .price-total { font-size: 36rpx; color: #F97316; font-weight: bold; }
  146. .price-note { font-size: 22rpx; color: #999; text-align: center; padding: 12rpx 24rpx 24rpx; display: block; }
  147. .benefit-grid { display: flex; flex-wrap: wrap; padding: 16rpx 24rpx; }
  148. .benefit-cell { width: calc(50% - 12rpx); display: flex; align-items: center; gap: 12rpx; padding: 16rpx 0; border-bottom: 1rpx solid #f5f5f5; }
  149. .benefit-cell-icon { font-size: 32rpx; }
  150. .benefit-cell-text { font-size: 24rpx; color: #333; }
  151. .pay-wrap { padding: 32rpx 24rpx 40rpx; text-align: center; }
  152. .pay-btn { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; text-align: center; padding: 28rpx 0; border-radius: 16rpx; font-size: 32rpx; font-weight: bold; }
  153. .pay-btn.loading { opacity: 0.6; }
  154. .pay-tip { font-size: 22rpx; color: #999; margin-top: 16rpx; display: block; }
  155. </style>