plans.vue 11 KB

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