index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <template>
  2. <view class="page">
  3. <view class="header">
  4. <text class="header-title">选择会员方案</text>
  5. <text class="header-desc">解锁数字能量的全部潜力</text>
  6. </view>
  7. <template v-if="loading">
  8. <view class="loading-state"><text class="loading-text">加载中...</text></view>
  9. </template>
  10. <template v-else>
  11. <!-- C端 ¥131 方案 -->
  12. <view
  13. class="plan-card"
  14. :class="{ selected: selectedPlan === 'annual' }"
  15. @click="selectedPlan = 'annual'"
  16. >
  17. <view class="plan-badge popular">推荐</view>
  18. <view class="plan-top">
  19. <text class="plan-name">C端会员</text>
  20. <view class="plan-price-row">
  21. <text class="price-symbol">¥</text>
  22. <text class="price">{{ formatYuan(pricing.annualFee) }}</text>
  23. <text class="per">/年</text>
  24. </view>
  25. <text class="price-daily">每天仅 ¥{{ (pricing.annualFee / 100 / 365).toFixed(2) }}</text>
  26. </view>
  27. <view class="plan-features">
  28. <text class="feature">✦ AI 互动问答 — 无限次</text>
  29. <text class="feature">✦ 获得推广权限,赚取佣金</text>
  30. <text class="feature">✦ 一级 40% + 二级 5% 佣金比例</text>
  31. <text class="feature">✦ VIP 标识</text>
  32. </view>
  33. </view>
  34. <!-- B端 ¥1,314 方案 -->
  35. <view
  36. class="plan-card plan-pro"
  37. :class="{ selected: selectedPlan === 'practitioner' }"
  38. @click="selectedPlan = 'practitioner'"
  39. >
  40. <view class="plan-badge pro">专业</view>
  41. <view class="plan-top">
  42. <text class="plan-name">能量师</text>
  43. <view class="plan-price-row">
  44. <text class="price-symbol">¥</text>
  45. <text class="price">{{ formatYuan(currentPractitionerPrice) }}</text>
  46. <text class="per">/年</text>
  47. </view>
  48. <view v-if="pricing.isSeedPrice" class="seed-badge">
  49. 种子价 · 仅剩 {{ pricing.remainingSeats }}/{{ pricing.seedLimit }} 个名额
  50. </view>
  51. <text class="price-daily">每天仅 ¥{{ (currentPractitionerPrice / 100 / 365).toFixed(2) }}</text>
  52. </view>
  53. <view class="plan-features">
  54. <text class="feature">✦ 包含 C 端全部权益</text>
  55. <text class="feature">✦ 无限命盘生成</text>
  56. <text class="feature">✦ AI 五区完整解读,随问随答</text>
  57. <text class="feature">✦ 全部历史记录永久保存</text>
  58. <text class="feature">✦ 推广佣金 — 固定 ¥500/人 + 二级 ¥100/人</text>
  59. </view>
  60. </view>
  61. <!-- Compare table -->
  62. <view class="compare-card">
  63. <view class="compare-header">
  64. <text class="col">功能</text>
  65. <text class="col">普通</text>
  66. <text class="col c">C端</text>
  67. <text class="col pro">能量师</text>
  68. </view>
  69. <view class="compare-row" v-for="row in compareData" :key="row.label">
  70. <text class="col">{{ row.label }}</text>
  71. <text class="col">{{ row.free }}</text>
  72. <text class="col c">{{ row.c }}</text>
  73. <text class="col pro">{{ row.pro }}</text>
  74. </view>
  75. </view>
  76. <!-- Pay button -->
  77. <button class="pay-btn" @click="onPay" :disabled="paying">
  78. {{ paying ? '处理中...' : payButtonText }}
  79. </button>
  80. <text class="note">支付即表示同意《订阅协议》</text>
  81. </template>
  82. </view>
  83. </template>
  84. <script setup>
  85. import { ref, computed, onMounted } from 'vue'
  86. import { payApi, pricingApi } from '@/utils/api'
  87. const paying = ref(false)
  88. const loading = ref(true)
  89. const selectedPlan = ref('annual')
  90. const pricing = ref({
  91. seedPrice: 131400,
  92. standardPrice: 198600,
  93. annualFee: 13100,
  94. isSeedPrice: true,
  95. remainingSeats: 300,
  96. seedLimit: 300
  97. })
  98. const compareData = [
  99. { label: '命盘生成', free: '3次/天', c: '3次/天', pro: '不限' },
  100. { label: 'AI 解读', free: '3轮/天', c: '无限次', pro: '无限次' },
  101. { label: '历史记录', free: '7天', c: '永久', pro: '永久' },
  102. { label: '推广佣金', free: '--', c: '40%+5%', pro: '¥500+¥100/人' },
  103. { label: '分享导出', free: '1次/天', c: '不限', pro: '不限' },
  104. ]
  105. const currentPractitionerPrice = computed(() => {
  106. return pricing.value.isSeedPrice ? pricing.value.seedPrice : pricing.value.standardPrice
  107. })
  108. const payButtonText = computed(() => {
  109. if (selectedPlan.value === 'annual') {
  110. return `立即开通 · C端会员 ¥${formatYuan(pricing.value.annualFee)}/年`
  111. }
  112. const price = currentPractitionerPrice.value
  113. const label = pricing.value.isSeedPrice ? '种子价' : '标准价'
  114. return `立即开通 · 能量师 ${label} ¥${formatYuan(price)}/年`
  115. })
  116. function formatYuan(cents) {
  117. if (cents == null) return '0'
  118. return (cents / 100).toLocaleString()
  119. }
  120. onMounted(async () => {
  121. try {
  122. const res = await pricingApi.current()
  123. if (res) pricing.value = res
  124. } catch (e) {
  125. // Use defaults if API fails
  126. }
  127. loading.value = false
  128. })
  129. async function onPay() {
  130. paying.value = true
  131. try {
  132. const totalFee = selectedPlan.value === 'annual' ? pricing.value.annualFee : currentPractitionerPrice.value
  133. const productType = selectedPlan.value
  134. await payApi.create({ totalFee, payType: 'wxpay', productType })
  135. uni.showToast({ title: '开通成功!', icon: 'success' })
  136. setTimeout(() => uni.navigateBack(), 1500)
  137. } catch (e) {
  138. uni.showToast({ title: '支付失败,请重试', icon: 'none' })
  139. }
  140. paying.value = false
  141. }
  142. </script>
  143. <style scoped lang="scss">
  144. .page {
  145. padding: 20px;
  146. min-height: 100vh;
  147. background: linear-gradient(180deg, #0c0a1a 0%, #120d28 60%, #0f0c1e 100%);
  148. }
  149. .header {
  150. text-align: center;
  151. margin-bottom: 20px;
  152. }
  153. .header-title {
  154. font-size: 22px;
  155. font-weight: 700;
  156. color: rgba(255,255,255,0.9);
  157. display: block;
  158. }
  159. .header-desc {
  160. font-size: 13px;
  161. color: rgba(255,255,255,0.4);
  162. margin-top: 6px;
  163. display: block;
  164. }
  165. .loading-state {
  166. padding: 60px 0;
  167. text-align: center;
  168. }
  169. .loading-text {
  170. font-size: 14px;
  171. color: rgba(255,255,255,0.3);
  172. }
  173. /* Plan Cards */
  174. .plan-card {
  175. position: relative;
  176. background: rgba(255,255,255,0.03);
  177. border: 1px solid rgba(255,255,255,0.08);
  178. border-radius: 16px;
  179. padding: 22px 18px 18px;
  180. margin-bottom: 12px;
  181. transition: border-color 0.2s;
  182. }
  183. .plan-card.selected {
  184. border-color: #fbbf24;
  185. background: rgba(251,191,36,0.06);
  186. }
  187. .plan-card.plan-pro.selected {
  188. border-color: #a78bfa;
  189. background: rgba(167,139,250,0.06);
  190. }
  191. .plan-badge {
  192. position: absolute;
  193. top: -1px;
  194. right: 20px;
  195. font-size: 11px;
  196. font-weight: 600;
  197. padding: 3px 14px;
  198. border-radius: 0 0 8px 8px;
  199. }
  200. .plan-badge.popular {
  201. background: #f59e0b;
  202. color: #fff;
  203. }
  204. .plan-badge.pro {
  205. background: #7c3aed;
  206. color: #fff;
  207. }
  208. .plan-top { text-align: center; }
  209. .plan-name {
  210. font-size: 17px;
  211. font-weight: 600;
  212. color: rgba(255,255,255,0.85);
  213. display: block;
  214. margin-bottom: 10px;
  215. }
  216. .plan-price-row {
  217. display: flex;
  218. align-items: baseline;
  219. justify-content: center;
  220. }
  221. .price-symbol {
  222. font-size: 20px;
  223. color: #fbbf24;
  224. font-weight: 600;
  225. }
  226. .price {
  227. font-size: 38px;
  228. font-weight: 700;
  229. color: #fbbf24;
  230. margin: 0 2px;
  231. }
  232. .plan-pro .price-symbol,
  233. .plan-pro .price {
  234. color: #a78bfa;
  235. }
  236. .per {
  237. font-size: 14px;
  238. color: rgba(255,255,255,0.4);
  239. }
  240. .price-daily {
  241. display: block;
  242. font-size: 12px;
  243. color: rgba(255,255,255,0.3);
  244. margin-top: 4px;
  245. }
  246. .seed-badge {
  247. display: inline-block;
  248. margin-top: 6px;
  249. font-size: 11px;
  250. color: #fbbf24;
  251. background: rgba(251,191,36,0.12);
  252. padding: 2px 12px;
  253. border-radius: 4px;
  254. }
  255. .plan-features {
  256. margin-top: 16px;
  257. }
  258. .feature {
  259. display: block;
  260. padding: 5px 0;
  261. font-size: 13px;
  262. color: rgba(255,255,255,0.6);
  263. line-height: 1.5;
  264. }
  265. .plan-card.selected .feature {
  266. color: rgba(255,255,255,0.8);
  267. }
  268. /* Compare table */
  269. .compare-card {
  270. background: rgba(255,255,255,0.03);
  271. border: 1px solid rgba(255,255,255,0.06);
  272. border-radius: 14px;
  273. overflow: hidden;
  274. margin-bottom: 20px;
  275. }
  276. .compare-header,
  277. .compare-row {
  278. display: flex;
  279. padding: 12px 10px;
  280. font-size: 12px;
  281. }
  282. .compare-header {
  283. background: rgba(251,191,36,0.06);
  284. font-weight: 600;
  285. color: rgba(255,255,255,0.7);
  286. }
  287. .compare-row {
  288. border-bottom: 1px solid rgba(255,255,255,0.04);
  289. color: rgba(255,255,255,0.5);
  290. }
  291. .compare-row:last-child { border-bottom: none; }
  292. .col {
  293. flex: 1;
  294. text-align: center;
  295. }
  296. .col:first-child {
  297. text-align: left;
  298. flex: 1.3;
  299. color: rgba(255,255,255,0.7);
  300. }
  301. .col.c { color: #fbbf24; }
  302. .col.pro { color: #a78bfa; }
  303. .pay-btn {
  304. width: 100%;
  305. padding: 16px;
  306. background: linear-gradient(135deg, #f59e0b, #d97706);
  307. color: #fff;
  308. border: none;
  309. border-radius: 14px;
  310. font-size: 17px;
  311. font-weight: 600;
  312. letter-spacing: 2px;
  313. margin-bottom: 8px;
  314. }
  315. .pay-btn[disabled] { opacity: 0.4; }
  316. .note {
  317. display: block;
  318. text-align: center;
  319. font-size: 12px;
  320. color: rgba(255,255,255,0.25);
  321. }
  322. </style>