stats.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view class="stats-page">
  3. <view class="stat-card">
  4. <view class="stat-row">
  5. <view class="stat-item">
  6. <text class="stat-num">{{ stats.invited }}</text>
  7. <text class="stat-label">邀请人数</text>
  8. </view>
  9. <view class="stat-item">
  10. <text class="stat-num">{{ stats.paid }}</text>
  11. <text class="stat-label">成功付费</text>
  12. </view>
  13. <view class="stat-item">
  14. <text class="stat-num">{{ stats.rewards }}</text>
  15. <text class="stat-label">已获奖励</text>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="tip-card">
  20. <text class="tip-title">如何获得奖励?</text>
  21. <text class="tip-desc">1. 在我的海报页复制专属邀请码</text>
  22. <text class="tip-desc">2. 把海报/邀请码分享给朋友</text>
  23. <text class="tip-desc">3. 朋友报名时填写邀请码并完成付费</text>
  24. <text class="tip-desc">4. 你将自动获得一张私教激励卡券</text>
  25. </view>
  26. <view class="poster-link" @click="goPoster">
  27. <text>去生成我的专属海报</text>
  28. <text class="arrow">›</text>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import { getInviteStats } from '@/utils/api.js'
  34. export default {
  35. data() {
  36. return {
  37. stats: { invited: 0, paid: 0, rewards: 0 }
  38. }
  39. },
  40. onShow() {
  41. this.loadStats()
  42. },
  43. methods: {
  44. loadStats() {
  45. var self = this
  46. getInviteStats().then(function(resp) {
  47. var data = resp.data || {}
  48. self.stats = {
  49. invited: data.invited || 0,
  50. paid: data.paid || 0,
  51. rewards: data.rewards || 0
  52. }
  53. }).catch(function() {})
  54. },
  55. goPoster() {
  56. uni.navigateBack({})
  57. }
  58. }
  59. }
  60. </script>
  61. <style scoped>
  62. .stats-page { min-height: 100vh; background: #F5F5F5; padding: 24rpx 32rpx; }
  63. .stat-card { background: #FFF; border-radius: 16rpx; padding: 40rpx 24rpx; margin-bottom: 24rpx; }
  64. .stat-row { display: flex; justify-content: space-around; }
  65. .stat-item { display: flex; flex-direction: column; align-items: center; flex: 1; }
  66. .stat-num { font-size: 56rpx; font-weight: 700; color: #F97316; }
  67. .stat-label { font-size: 26rpx; color: #64748B; margin-top: 12rpx; }
  68. .tip-card { background: #FFF; border-radius: 16rpx; padding: 32rpx; margin-bottom: 24rpx; }
  69. .tip-title { display: block; font-size: 30rpx; font-weight: 700; color: #1E293B; margin-bottom: 16rpx; border-left: 8rpx solid #F97316; padding-left: 16rpx; }
  70. .tip-desc { display: block; font-size: 26rpx; color: #475569; line-height: 48rpx; }
  71. .poster-link { display: flex; align-items: center; justify-content: center; padding: 32rpx 0; color: #64748B; font-size: 28rpx; }
  72. .poster-link .arrow { color: #94A3B8; font-size: 32rpx; margin-left: 8rpx; }
  73. </style>