plans.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <scroll-view class="container" scroll-y>
  3. <view class="plans-header">
  4. <text class="header-title">会员方案</text>
  5. <text class="header-subtitle">全家人的健康守护</text>
  6. </view>
  7. <view class="plans-list">
  8. <!-- 免费卡片(静态) -->
  9. <view class="plan-card plan-l0">
  10. <view class="plan-header">
  11. <text class="plan-name">注册会员</text>
  12. <text class="plan-tag">免费</text>
  13. </view>
  14. <view class="plan-price">
  15. <text class="price-amount">¥0</text>
  16. <text class="price-unit">/永久</text>
  17. </view>
  18. <view class="plan-features">
  19. <view class="feature-row" v-for="(feat, idx) in l0Features" :key="idx">
  20. <text class="feature-icon">✓</text>
  21. <text class="feature-text">{{ feat }}</text>
  22. </view>
  23. </view>
  24. <button class="btn-action" disabled>当前等级</button>
  25. </view>
  26. <!-- 付费等级卡片(从后端动态加载) -->
  27. <view class="plan-card" v-for="level in levels" :key="level.levelCode"
  28. :class="{'active': level.recommended}">
  29. <view class="plan-badge" v-if="level.recommended">推荐</view>
  30. <view class="plan-badge premium" v-else-if="level.levelCode === 'PREMIUM'">至尊</view>
  31. <view class="plan-header">
  32. <text class="plan-name">{{ level.levelName }}</text>
  33. <text class="plan-tag">{{ level.levelCode === 'FAMILY' ? '年付会员' : '年付/月付' }}</text>
  34. </view>
  35. <view class="plan-price">
  36. <text class="price-amount">{{ formatPrice(level.yearly) }}</text>
  37. <text class="price-unit">/年</text>
  38. </view>
  39. <view class="plan-features" v-if="level.levelDesc">
  40. <view class="feature-row" v-for="(feat, idx) in parseFeatures(level.levelDesc)" :key="idx">
  41. <text class="feature-icon">✓</text>
  42. <text class="feature-text">{{ feat }}</text>
  43. </view>
  44. </view>
  45. <button class="btn-action" :class="level.recommended ? 'btn-primary' : 'btn-premium'"
  46. @click="purchasePlan(level.levelCode)">
  47. {{ level.levelCode === 'FAMILY' ? '立即开通' : '立即订阅' }}
  48. </button>
  49. </view>
  50. </view>
  51. <view class="benefits-section">
  52. <text class="section-title">会员权益详解</text>
  53. <view class="benefits-grid">
  54. <view class="benefit-item" v-for="(item, idx) in benefits" :key="idx">
  55. <view class="benefit-icon" :style="'background:' + item.bg">
  56. <text class="benefit-emoji">{{ item.icon }}</text>
  57. </view>
  58. <text class="benefit-name">{{ item.name }}</text>
  59. <text class="benefit-desc">{{ item.desc }}</text>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="faq-section">
  64. <text class="section-title">常见问题</text>
  65. <view class="faq-item" v-for="(faq, idx) in faqs" :key="idx">
  66. <text class="faq-question">{{ faq.q }}</text>
  67. <text class="faq-answer">{{ faq.a }}</text>
  68. </view>
  69. </view>
  70. </scroll-view>
  71. </template>
  72. <script>
  73. import { getMembershipPlans } from '../../utils/api.js'
  74. export default {
  75. data() {
  76. return {
  77. levels: [],
  78. l0Features: [
  79. '每日 3 次 AI 问答',
  80. '基础健康百科',
  81. '社区内容浏览'
  82. ],
  83. benefits: [
  84. { icon: '🤖', name: 'AI 健康顾问', desc: '7×24 小时智能问答', bg: '#DBEAFE' },
  85. { icon: '👨‍👩‍👧‍👦', name: '家庭覆盖', desc: '一次付费全家守护', bg: '#D1FAE5' },
  86. { icon: '👨‍🏫', name: '专属管家', desc: '认证专业人员服务', bg: '#FEF3C7' },
  87. { icon: '🛒', name: '商品折扣', desc: '会员专享优惠价', bg: '#FCE7F3' },
  88. { icon: '💰', name: '消费返利', desc: 'P 点制终身返利', bg: '#FFEDD5' },
  89. { icon: '📈', name: '推广佣金', desc: 'R0-R4 阶梯奖励', bg: '#E0E7FF' }
  90. ],
  91. faqs: [
  92. { q: '家庭会员适合谁?', a: '适合有 1-2 个孩子的家庭,追求性价比,希望获得 AI 健康顾问 + 认证管家服务' },
  93. { q: '高级家庭会员与家庭会员的区别?', a: '高级会员享资深管家 (1:30 配比)、深度 AI 分析、专家会诊、更高折扣和返利加成' },
  94. { q: '可以取消吗?', a: '可以,取消后当前月结束后降级为免费用户,健康档案保留 30 天' },
  95. { q: '消费返利如何计算?', a: '被推荐人消费 P 点总和 × 推广人等级返利率,高级会员额外 +5% 加成' }
  96. ]
  97. }
  98. },
  99. onLoad() {
  100. this.loadPlans()
  101. },
  102. methods: {
  103. loadPlans() {
  104. var self = this
  105. getMembershipPlans().then(function(res) {
  106. if (res.code === 200 && Array.isArray(res.data)) {
  107. self.levels = res.data
  108. }
  109. }).catch(function(e) {
  110. console.error('获取方案失败', e)
  111. })
  112. },
  113. formatPrice(cents) {
  114. if (!cents && cents !== 0) return '¥0'
  115. return '¥' + (cents / 100).toLocaleString()
  116. },
  117. parseFeatures(features) {
  118. if (!features) return []
  119. if (Array.isArray(features)) return features
  120. try { return JSON.parse(features) } catch (e) { return [] }
  121. },
  122. purchasePlan(levelCode) {
  123. uni.navigateTo({ url: '/pages/membership/upgrade?level=' + levelCode })
  124. }
  125. }
  126. }
  127. </script>
  128. <style scoped>
  129. .container {
  130. padding: 30rpx;
  131. min-height: 100vh;
  132. background: linear-gradient(180deg, #FFF7ED 0%, #FEF3C7 100%);
  133. }
  134. .plans-header {
  135. text-align: center;
  136. padding: 60rpx 0 40rpx;
  137. }
  138. .header-title {
  139. font-size: 44rpx;
  140. font-weight: bold;
  141. color: #1E293B;
  142. display: block;
  143. }
  144. .header-subtitle {
  145. font-size: 28rpx;
  146. color: #64748B;
  147. margin-top: 12rpx;
  148. display: block;
  149. }
  150. .plans-list {
  151. display: flex;
  152. flex-direction: column;
  153. gap: 30rpx;
  154. margin-bottom: 40rpx;
  155. }
  156. .plan-card {
  157. background: #fff;
  158. border-radius: 24rpx;
  159. padding: 40rpx;
  160. position: relative;
  161. border: 2rpx solid #FED7AA;
  162. box-shadow: 0 4rpx 20rpx rgba(249,115,22,0.08);
  163. }
  164. .plan-card.active {
  165. border-color: #F97316;
  166. background: linear-gradient(135deg, #FFF7ED 0%, #FEF3C7 100%);
  167. transform: scale(1.02);
  168. }
  169. .plan-badge {
  170. position: absolute;
  171. top: -16rpx;
  172. right: 40rpx;
  173. background: #F97316;
  174. color: #fff;
  175. padding: 8rpx 24rpx;
  176. border-radius: 9999rpx;
  177. font-size: 22rpx;
  178. font-weight: 600;
  179. }
  180. .plan-badge.premium {
  181. background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  182. }
  183. .plan-header {
  184. display: flex;
  185. justify-content: space-between;
  186. align-items: center;
  187. margin-bottom: 20rpx;
  188. }
  189. .plan-name {
  190. font-size: 32rpx;
  191. font-weight: bold;
  192. color: #1E293B;
  193. }
  194. .plan-tag {
  195. font-size: 22rpx;
  196. color: #64748B;
  197. background: #F1F5F9;
  198. padding: 6rpx 16rpx;
  199. border-radius: 8rpx;
  200. }
  201. .plan-price {
  202. text-align: center;
  203. margin: 24rpx 0;
  204. }
  205. .price-amount {
  206. font-size: 56rpx;
  207. font-weight: bold;
  208. color: #F97316;
  209. }
  210. .price-unit {
  211. font-size: 24rpx;
  212. color: #94A3B8;
  213. margin-left: 8rpx;
  214. }
  215. .plan-features {
  216. margin: 24rpx 0;
  217. }
  218. .feature-row {
  219. display: flex;
  220. align-items: center;
  221. padding: 12rpx 0;
  222. }
  223. .feature-icon {
  224. width: 40rpx;
  225. height: 40rpx;
  226. line-height: 40rpx;
  227. text-align: center;
  228. background: #10B981;
  229. color: #fff;
  230. border-radius: 50%;
  231. font-size: 20rpx;
  232. margin-right: 12rpx;
  233. flex-shrink: 0;
  234. }
  235. .feature-text {
  236. font-size: 26rpx;
  237. color: #334155;
  238. flex: 1;
  239. }
  240. .btn-action {
  241. width: 100%;
  242. height: 80rpx;
  243. line-height: 80rpx;
  244. background: #E5E7EB;
  245. color: #9CA3AF;
  246. font-size: 28rpx;
  247. border-radius: 40rpx;
  248. border: none;
  249. margin-top: 20rpx;
  250. }
  251. .btn-action:disabled {
  252. opacity: 0.6;
  253. }
  254. .btn-primary {
  255. background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
  256. color: #fff;
  257. font-weight: 600;
  258. }
  259. .btn-premium {
  260. background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  261. color: #fff;
  262. font-weight: 600;
  263. }
  264. .btn-action::after {
  265. border: none;
  266. }
  267. .benefits-section {
  268. background: #fff;
  269. border-radius: 24rpx;
  270. padding: 30rpx;
  271. margin-bottom: 30rpx;
  272. box-shadow: 0 4rpx 20rpx rgba(249,115,22,0.08);
  273. }
  274. .section-title {
  275. font-size: 32rpx;
  276. font-weight: bold;
  277. color: #1E293B;
  278. display: block;
  279. margin-bottom: 24rpx;
  280. }
  281. .benefits-grid {
  282. display: flex;
  283. flex-wrap: wrap;
  284. }
  285. .benefit-item {
  286. width: 50%;
  287. display: flex;
  288. flex-direction: column;
  289. align-items: center;
  290. padding: 24rpx 16rpx;
  291. box-sizing: border-box;
  292. }
  293. .benefit-icon {
  294. width: 80rpx;
  295. height: 80rpx;
  296. border-radius: 50%;
  297. display: flex;
  298. align-items: center;
  299. justify-content: center;
  300. margin-bottom: 16rpx;
  301. }
  302. .benefit-emoji {
  303. font-size: 40rpx;
  304. }
  305. .benefit-name {
  306. font-size: 26rpx;
  307. font-weight: 600;
  308. color: #1E293B;
  309. margin-bottom: 8rpx;
  310. }
  311. .benefit-desc {
  312. font-size: 22rpx;
  313. color: #94A3B8;
  314. text-align: center;
  315. }
  316. .faq-section {
  317. background: #fff;
  318. border-radius: 24rpx;
  319. padding: 30rpx;
  320. box-shadow: 0 4rpx 20rpx rgba(249,115,22,0.08);
  321. }
  322. .faq-item {
  323. padding: 20rpx 0;
  324. border-bottom: 1rpx solid #F1F5F9;
  325. }
  326. .faq-item:last-child {
  327. border-bottom: none;
  328. }
  329. .faq-question {
  330. font-size: 26rpx;
  331. font-weight: 600;
  332. color: #1E293B;
  333. display: block;
  334. margin-bottom: 8rpx;
  335. }
  336. .faq-answer {
  337. font-size: 24rpx;
  338. color: #64748B;
  339. line-height: 1.6;
  340. display: block;
  341. }
  342. </style>