index.vue 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538
  1. <template>
  2. <view class="page-profile" :class="themeClass">
  3. <!-- ========== Merged Region 1+2: User Card + Membership ========== -->
  4. <view class="user-card">
  5. <!-- Login prompt for unauthenticated users -->
  6. <view v-if="!userStore.isLoggedIn" class="user-card__login" @click="goLogin">
  7. <view class="avatar avatar--empty">
  8. <text class="avatar__icon">+</text>
  9. </view>
  10. <text class="user-card__nickname">未登录</text>
  11. <text class="user-card__login-hint">点击登录 / 注册</text>
  12. </view>
  13. <!-- Authenticated user card — tap to edit -->
  14. <view v-else class="user-card__logged" @click="goEditProfile">
  15. <view class="user-card__inner">
  16. <view class="avatar">
  17. <image :src="userStore.avatarUrl || '/static/default-avatar.png'" mode="aspectFill" />
  18. </view>
  19. <view class="user-card__info">
  20. <view class="user-card__name-row">
  21. <text class="user-card__nickname">{{ userStore.nickname }}</text>
  22. <!-- Role tag -->
  23. <view
  24. class="user-card__tag"
  25. :class="{
  26. 'user-card__tag--practitioner': userStore.vipType === 'practitioner',
  27. 'user-card__tag--annual': userStore.vipType === 'annual',
  28. 'user-card__tag--super': userStore.vipType === 'super_annual',
  29. 'user-card__tag--normal': !userStore.vipType
  30. }"
  31. >
  32. <text v-if="!userStore.vipType">普通用户</text>
  33. <text v-else-if="userStore.vipType === 'annual'">C端会员</text>
  34. <text v-else>能量师 🌟</text>
  35. </view>
  36. </view>
  37. <!-- Social summary (optional) -->
  38. <text v-if="userStore.bio || userStore.city" class="user-card__summary">
  39. {{ userStore.city || '' }}{{ userStore.city && userStore.bio ? ' · ' : '' }}{{ userStore.bio || '' }}
  40. </text>
  41. </view>
  42. <view class="user-card__header-right">
  43. <view class="theme-toggle-btn" @click.stop="themeStore.toggle">
  44. <text class="theme-toggle-text">{{ themeStore.theme === 'dark' ? '亮' : '暗' }}</text>
  45. </view>
  46. <text class="user-card__arrow">›</text>
  47. </view>
  48. </view>
  49. </view>
  50. <!-- ========== Membership Status (merged into User Card) ========== -->
  51. <!-- US-5.1 §13: Profile incomplete banner -->
  52. <view v-if="userStore.isLoggedIn && userStore.profileIncomplete" class="banner" @click="goEditProfile">
  53. <text class="banner__text">📝 请完善个人资料,开启能量匹配</text>
  54. <text class="banner__arrow">›</text>
  55. </view>
  56. <!-- US-4.3: Renewal reminder (7 days before expiry) -->
  57. <view v-if="isExpiringSoon" class="banner banner--warning" @click="goRenew">
  58. <text class="banner__text">⏰ 您的会员即将到期,请及时续费</text>
  59. <text class="banner__arrow">›</text>
  60. </view>
  61. <!-- Seed-price badge -->
  62. <view v-if="userStore.isSeedPriceUser" class="seed-badge">
  63. <text class="seed-badge__text">🌱 种子价专属会员</text>
  64. </view>
  65. <!-- VIP status card — role-based -->
  66. <!-- Case 1: Energy master (practitioner, in valid period) -->
  67. <view
  68. v-if="userStore.vipType === 'practitioner' && userStore.isVip && !isExpired"
  69. class="vip-card vip-card--practitioner"
  70. >
  71. <view class="vip-card__body">
  72. <text class="vip-card__title">能量师会员 🌟</text>
  73. <text class="vip-card__desc">
  74. 有效期至 {{ formatDate(userStore.vipEndTime) }}
  75. </text>
  76. </view>
  77. <text class="vip-card__action" @click="goRenew">续费</text>
  78. </view>
  79. <!-- Case 2: Super annual subscriber (in valid period) -->
  80. <view
  81. v-else-if="userStore.vipType === 'super_annual' && userStore.isVip && !isExpired"
  82. class="vip-card vip-card--super"
  83. >
  84. <view class="vip-card__body">
  85. <text class="vip-card__title">超级会员 🏆</text>
  86. <text class="vip-card__desc">
  87. 有效期至 {{ formatDate(userStore.vipEndTime) }}
  88. </text>
  89. <view class="vip-card__perks">
  90. <text class="perk-tag">关系能量</text>
  91. <text class="perk-tag">八星号码</text>
  92. <text class="perk-tag">分销推广</text>
  93. </view>
  94. </view>
  95. <text class="vip-card__action" @click="goUpgradePractitioner">升级能量师</text>
  96. </view>
  97. <!-- Case 3: C-end annual subscriber (in valid period) -->
  98. <view
  99. v-else-if="userStore.vipType === 'annual' && userStore.isVip && !isExpired"
  100. class="vip-card vip-card--annual"
  101. >
  102. <view class="vip-card__body">
  103. <text class="vip-card__title">C端会员</text>
  104. <text class="vip-card__desc">
  105. 有效期至 {{ formatDate(userStore.vipEndTime) }}
  106. </text>
  107. </view>
  108. <view style="display:flex;gap:8px;flex-shrink:0;">
  109. <text class="vip-card__action" @click="goSuperMember">升超级</text>
  110. <text class="vip-card__action" @click="goUpgradePractitioner">升能量师</text>
  111. </view>
  112. </view>
  113. <!-- Case 4: Expired member (vipEndTime < now) -->
  114. <view v-else-if="userStore.vipType && isExpired" class="vip-card vip-card--expired">
  115. <view class="vip-card__body">
  116. <text class="vip-card__title">会员已过期</text>
  117. <text class="vip-card__desc">
  118. 过期时间 {{ formatDate(userStore.vipEndTime) }}
  119. </text>
  120. </view>
  121. <text class="vip-card__action" @click="goPayment">重新开通</text>
  122. </view>
  123. <!-- Case 5: Free user — three payment options -->
  124. <view v-else class="vip-card vip-card--upsell">
  125. <view class="vip-card__body">
  126. <text class="vip-card__title">选择方案</text>
  127. <view class="vip-card__dual">
  128. <view class="vip-card__option" @click="goPayment">
  129. <text class="option-title">C端会员</text>
  130. <text class="option-price">¥131/年</text>
  131. <text class="option-desc">无限AI解读</text>
  132. <button class="option-btn light">开通</button>
  133. </view>
  134. <view class="vip-card__option" @click="goSuperMember">
  135. <text class="option-title">超级会员</text>
  136. <text class="option-price">¥1,314/年</text>
  137. <text class="option-desc">关系能量+号码分析</text>
  138. <button class="option-btn light">开通</button>
  139. </view>
  140. <view class="vip-card__option vip-card__option--pro" @click="goUpgradePractitioner">
  141. <text class="option-title">能量师</text>
  142. <text class="option-price">¥1,314/年</text>
  143. <text class="option-desc">完整功能+分销</text>
  144. <button class="option-btn primary">申请</button>
  145. </view>
  146. </view>
  147. </view>
  148. </view>
  149. <!-- Daily quota (non-VIP only) -->
  150. <view v-if="!userStore.isVip" class="quota-bar">
  151. <view class="quota-bar__item">
  152. <text class="quota-bar__label">今日分析</text>
  153. <text class="quota-bar__value">{{ userStore.usedCharts }}/{{ userStore.maxCharts }}</text>
  154. </view>
  155. <view class="quota-bar__divider"></view>
  156. <view class="quota-bar__item">
  157. <text class="quota-bar__label">今日解读</text>
  158. <text class="quota-bar__value">{{ userStore.usedChats }}/{{ userStore.maxChats }}</text>
  159. </view>
  160. </view>
  161. </view>
  162. <!-- ========== Region 3: Feature Menu ========== -->
  163. <!-- Group 1: My Services (practitioner workbench only) -->
  164. <view v-if="userStore.vipType === 'practitioner' && userStore.isVip" class="menu-section">
  165. <view class="menu-section__header">我的服务</view>
  166. <!-- Practitioner workbench (practitioners only) — EPIC 9 -->
  167. <view v-if="userStore.vipType === 'practitioner' && userStore.isVip" class="menu-item" @click="goWorkbench">
  168. <text class="menu-item__label">🔧 工作台</text>
  169. <view class="menu-item__badge menu-item__badge--new">NEW</view>
  170. <text class="menu-item__arrow">›</text>
  171. </view>
  172. </view>
  173. <!-- ===== Promotion Center (paid users only) ===== -->
  174. <template v-if="userStore.isLoggedIn && userStore.isVip">
  175. <!-- 收益 -->
  176. <view class="promo-section earnings-section">
  177. <view class="promo-section__header">
  178. <text class="promo-section__title">💰 我的收益</text>
  179. </view>
  180. <view class="earnings-grid">
  181. <view class="earn-item">
  182. <text class="earn-label">累计收益</text>
  183. <text class="earn-value accent">¥{{ formatCommissionMoney(stats.totalEarnings) }}</text>
  184. </view>
  185. <view class="earn-item">
  186. <text class="earn-label">可提现余额</text>
  187. <text class="earn-value">¥{{ formatCommissionMoney(stats.availableBalance) }}</text>
  188. </view>
  189. <view class="earn-item">
  190. <text class="earn-label">本月收益</text>
  191. <text class="earn-value">¥{{ formatCommissionMoney(stats.monthEarnings) }}</text>
  192. </view>
  193. <view class="earn-item">
  194. <text class="earn-label">今日预估</text>
  195. <text class="earn-value">¥{{ formatCommissionMoney(stats.todayEstimate) }}</text>
  196. </view>
  197. </view>
  198. <view v-if="l1Total > 0 || l2Total > 0" class="earnings-breakdown">
  199. <view class="breakdown-row">
  200. <text class="breakdown-label">一级推广佣金</text>
  201. <text class="breakdown-value">¥{{ formatCommissionMoney(l1Total) }}</text>
  202. </view>
  203. <view class="breakdown-row">
  204. <text class="breakdown-label">二级推广佣金</text>
  205. <text class="breakdown-value">¥{{ formatCommissionMoney(l2Total) }}</text>
  206. </view>
  207. </view>
  208. </view>
  209. <!-- 团队 -->
  210. <view class="promo-section">
  211. <view class="promo-section__header">
  212. <text class="promo-section__title">👥 我的团队</text>
  213. <text v-if="team.length > 0" class="promo-section__sub" @click="showTeamDetail">查看全部 →</text>
  214. </view>
  215. <view class="team-grid">
  216. <view class="team-stat">
  217. <text class="stat-num">{{ stats.directInvites }}</text>
  218. <text class="stat-label">直接下级</text>
  219. </view>
  220. <view class="team-stat">
  221. <text class="stat-num">{{ stats.indirectInvites }}</text>
  222. <text class="stat-label">间接下级</text>
  223. </view>
  224. <view class="team-stat">
  225. <text class="stat-num">{{ stats.convertedCount }}</text>
  226. <text class="stat-label">下级升级</text>
  227. </view>
  228. <view class="team-stat">
  229. <text class="stat-num">{{ stats.totalCommissions }}</text>
  230. <text class="stat-label">佣金笔数</text>
  231. </view>
  232. </view>
  233. <view v-if="team.length > 0" class="team-preview">
  234. <view v-for="(m, idx) in team.slice(0, 5)" :key="idx" class="member-row">
  235. <image class="member-avatar" :src="m.avatarUrl || '/static/default-avatar.png'" mode="aspectFill" />
  236. <view class="member-info">
  237. <text class="member-name">{{ m.nickname || '微信用户' }}</text>
  238. <text class="member-date">{{ formatDate(m.createdAt) }} 加入</text>
  239. </view>
  240. <text v-if="m.isVip" class="member-vip">VIP</text>
  241. </view>
  242. </view>
  243. <view v-else class="promo-empty">
  244. <text class="promo-empty-text">暂无推广成员</text>
  245. </view>
  246. </view>
  247. <!-- 佣金明细 -->
  248. <view class="promo-section">
  249. <view class="promo-section__header">
  250. <text class="promo-section__title">📋 佣金明细</text>
  251. </view>
  252. <view v-if="commissions.length === 0" class="promo-empty">
  253. <text class="promo-empty-text">暂无佣金记录</text>
  254. </view>
  255. <view v-for="(c, idx) in commissions" :key="idx" class="commission-row">
  256. <view class="comm-left">
  257. <text class="comm-amount">+¥{{ (c.amount / 100).toFixed(2) }}</text>
  258. <text class="comm-level">{{ c.level === 1 ? '一级推广' : '二级推广' }}</text>
  259. <text v-if="c.remark" class="comm-remark">{{ c.remark }}</text>
  260. </view>
  261. <view class="comm-right">
  262. <text class="comm-status" :class="'status-' + c.status">{{ commissionStatusText(c.status) }}</text>
  263. <text class="comm-date">{{ formatDate(c.createdAt) }}</text>
  264. </view>
  265. </view>
  266. </view>
  267. </template>
  268. <!-- Group 2: Promotion Tools (paid users only) -->
  269. <view v-if="userStore.isLoggedIn && userStore.isVip && userStore.referralCode" class="menu-section">
  270. <view class="menu-section__header">
  271. <text>推广工具</text>
  272. <text class="menu-section__more" @click="goCommission">查看详细 ›</text>
  273. </view>
  274. <view class="promo-card">
  275. <view class="promo-card__code-area">
  276. <text class="promo-card__prefix">推广码</text>
  277. <text class="promo-card__code">{{ userStore.referralCode }}</text>
  278. </view>
  279. <view class="promo-card__actions">
  280. <text class="promo-card__btn" @click="copyReferral">复制推广码</text>
  281. <text class="promo-card__divider">|</text>
  282. <text class="promo-card__btn" @click="generatePoster">生成推广海报</text>
  283. </view>
  284. </view>
  285. </view>
  286. <!-- Group 3: More -->
  287. <view class="menu-section">
  288. <view class="menu-section__header">更多</view>
  289. <!-- My tags (practitioner only, P2) -->
  290. <view v-if="userStore.vipType === 'practitioner'" class="menu-item" @click="goTags">
  291. <text class="menu-item__label">🏷 我的标签</text>
  292. <text class="menu-item__arrow">›</text>
  293. </view>
  294. <!-- About us (all) -->
  295. <view class="menu-item" @click="goAbout">
  296. <text class="menu-item__label">ℹ️ 关于我们</text>
  297. <text class="menu-item__arrow">›</text>
  298. </view>
  299. </view>
  300. <!-- ========== Region 4: Logout ========== -->
  301. <view v-if="userStore.isLoggedIn" class="menu-section">
  302. <view class="menu-item menu-item--danger" @click="handleLogout">
  303. <text class="menu-item__label menu-item__label--danger">退出登录</text>
  304. </view>
  305. </view>
  306. <!-- Hidden canvas for poster generation -->
  307. <canvas type="2d" id="posterCanvas" class="poster-canvas" />
  308. </view>
  309. </template>
  310. <script setup>
  311. import { ref, computed, getCurrentInstance } from 'vue'
  312. import { onShow } from '@dcloudio/uni-app'
  313. import { useUserStore } from '@/stores/user'
  314. import { useThemeStore } from '@/stores/theme'
  315. import { useTheme } from '@/composables/useThemeStyle'
  316. import { profileApi, commissionApi } from '@/utils/api'
  317. const userStore = useUserStore()
  318. const themeStore = useThemeStore()
  319. const { themeClass } = useTheme()
  320. // Commission reactive data
  321. const commissions = ref([])
  322. const team = ref([])
  323. const stats = ref({
  324. totalEarnings: 0,
  325. availableBalance: 0,
  326. todayEstimate: 0,
  327. monthEarnings: 0,
  328. directInvites: 0,
  329. indirectInvites: 0,
  330. convertedCount: 0,
  331. totalCommissions: 0
  332. })
  333. const l1Total = computed(() =>
  334. commissions.value.filter(c => c.level === 1 && c.status === 'settled').reduce((s, c) => s + (c.amount || 0), 0)
  335. )
  336. const l2Total = computed(() =>
  337. commissions.value.filter(c => c.level === 2 && c.status === 'settled').reduce((s, c) => s + (c.amount || 0), 0)
  338. )
  339. // US-4.3: Renewal reminder if expiry within 7 days
  340. const isExpiringSoon = computed(() => {
  341. if (!userStore.vipEndTime) return false
  342. const expiry = new Date(userStore.vipEndTime)
  343. const now = new Date()
  344. const diffHours = (expiry - now) / (1000 * 60 * 60)
  345. return diffHours > 0 && diffHours <= 7 * 24
  346. })
  347. // US-4.3: Expired check
  348. const isExpired = computed(() => {
  349. if (!userStore.vipEndTime) return false
  350. return new Date(userStore.vipEndTime) < new Date()
  351. })
  352. function formatDate(dateStr) {
  353. if (!dateStr) return ''
  354. // Handle Jackson array format: [2026, 6, 8, 23, 59, 59]
  355. if (Array.isArray(dateStr)) {
  356. const [y, m, d] = dateStr
  357. return `${y}-${String(m).padStart(2, '0')}-${String(d).padStart(2, '0')}`
  358. }
  359. // Handle ISO string: "2026-06-08T23:59:59"
  360. return dateStr.slice(0, 10)
  361. }
  362. onShow(() => {
  363. themeStore.init()
  364. if (userStore.isLoggedIn) {
  365. userStore.fetchProfile()
  366. userStore.fetchQuota()
  367. userStore.fetchCommissionSummary()
  368. fetchCommissionData()
  369. }
  370. })
  371. function goLogin() {
  372. uni.navigateTo({ url: '/pages/login/index' })
  373. }
  374. function goEditProfile() {
  375. if (!userStore.isLoggedIn) {
  376. uni.navigateTo({ url: '/pages/login/index' })
  377. return
  378. }
  379. uni.navigateTo({ url: '/pages/profile/edit' })
  380. }
  381. function goPayment() {
  382. uni.navigateTo({ url: '/pages/payment/index?product=annual' })
  383. }
  384. function goRenew() {
  385. const product = userStore.vipType === 'practitioner' ? 'practitioner' : 'annual'
  386. uni.navigateTo({ url: `/pages/payment/index?product=${product}` })
  387. }
  388. function goUpgradePractitioner() {
  389. uni.navigateTo({ url: '/pages/payment/index?product=practitioner' })
  390. }
  391. function goSuperMember() {
  392. uni.navigateTo({ url: '/pages/payment/index?product=super_member' })
  393. }
  394. function formatCommissionMoney(cents) {
  395. if (cents == null) return '0.00'
  396. return (cents / 100).toFixed(2)
  397. }
  398. function commissionStatusText(status) {
  399. const map = { settled: '已结算', pending: '处理中', withdrawn: '已提现', available: '可提现' }
  400. return map[status] || status
  401. }
  402. async function fetchCommissionData() {
  403. if (!userStore.isVip) return
  404. try {
  405. const [listData, teamData, statsData] = await Promise.all([
  406. commissionApi.list(),
  407. commissionApi.team(),
  408. commissionApi.stats()
  409. ])
  410. commissions.value = listData || []
  411. team.value = teamData || []
  412. if (statsData) stats.value = statsData
  413. } catch (e) { /* ignore */ }
  414. }
  415. function showTeamDetail() {
  416. uni.showModal({
  417. title: '推广团队',
  418. content: `直接下级 ${stats.value.directInvites} 人\n间接下级 ${stats.value.indirectInvites} 人\n已升级VIP ${stats.value.convertedCount} 人`,
  419. showCancel: false
  420. })
  421. }
  422. // EPIC 9: Navigate to practitioner workbench
  423. function goWorkbench() {
  424. uni.navigateTo({ url: '/pages/plan/workbench' })
  425. }
  426. function copyReferral() {
  427. if (userStore.referralCode) {
  428. uni.setClipboardData({
  429. data: userStore.referralCode,
  430. success: () => uni.showToast({ title: '已复制推广码', icon: 'success' })
  431. })
  432. }
  433. }
  434. function generatePoster() {
  435. uni.showLoading({ title: '生成海报…', mask: true })
  436. const baseUrl = 'http://127.0.0.1:8186'
  437. // Get canvas node via selector query (Canvas 2D API)
  438. const query = uni.createSelectorQuery()
  439. query.select('#posterCanvas').fields({ node: true, size: true }).exec((res) => {
  440. if (!res || !res[0]) {
  441. uni.hideLoading()
  442. uni.showToast({ title: '生成失败,请重试', icon: 'none' })
  443. return
  444. }
  445. const canvas = res[0].node
  446. const ctx = canvas.getContext('2d')
  447. const W = 375, H = 670
  448. const dpr = uni.getSystemInfoSync().pixelRatio || 2
  449. canvas.width = W * dpr
  450. canvas.height = H * dpr
  451. ctx.scale(dpr, dpr)
  452. // Download images first
  453. Promise.all([
  454. downloadImage(userStore.avatarUrl),
  455. profileApi.qrcode().then(res => {
  456. const url = res.qrCodeUrl.startsWith('http') ? res.qrCodeUrl : baseUrl + res.qrCodeUrl
  457. return downloadImage(url)
  458. })
  459. ]).then(([avatarPath, qrPath]) => {
  460. // Load images into Canvas 2D Image objects
  461. const imgPromises = []
  462. let avatarImg = null
  463. let qrImg = null
  464. if (avatarPath) {
  465. imgPromises.push(new Promise((resolve) => {
  466. const img = canvas.createImage()
  467. img.onload = () => { avatarImg = img; resolve() }
  468. img.onerror = () => resolve()
  469. img.src = avatarPath
  470. }))
  471. }
  472. if (qrPath) {
  473. imgPromises.push(new Promise((resolve) => {
  474. const img = canvas.createImage()
  475. img.onload = () => { qrImg = img; resolve() }
  476. img.onerror = () => resolve()
  477. img.src = qrPath
  478. }))
  479. }
  480. Promise.all(imgPromises).then(() => {
  481. // ─── Background ───
  482. const grd = ctx.createLinearGradient(0, 0, 0, H)
  483. grd.addColorStop(0, '#0c0a1a')
  484. grd.addColorStop(1, '#1a1040')
  485. ctx.fillStyle = grd
  486. ctx.fillRect(0, 0, W, H)
  487. // Top glow
  488. const topGlow = ctx.createLinearGradient(0, 0, 0, 220)
  489. topGlow.addColorStop(0, 'rgba(90, 50, 180, 0.35)')
  490. topGlow.addColorStop(1, 'rgba(90, 50, 180, 0)')
  491. ctx.fillStyle = topGlow
  492. ctx.fillRect(0, 0, W, 220)
  493. // Gold accent line
  494. ctx.fillStyle = '#C9A84C'
  495. ctx.fillRect(W * 0.32, 28, W * 0.36, 1.5)
  496. // Brand title
  497. ctx.font = '13px sans-serif'
  498. ctx.fillStyle = 'rgba(201, 168, 76, 0.7)'
  499. ctx.textAlign = 'center'
  500. ctx.fillText('数字能量学', W / 2, 52)
  501. // Avatar (circular)
  502. const avatarSize = 76
  503. ctx.save()
  504. ctx.beginPath()
  505. ctx.arc(W / 2, 128, avatarSize / 2, 0, 2 * Math.PI)
  506. ctx.closePath()
  507. ctx.fillStyle = '#ffffff'
  508. ctx.fill()
  509. if (avatarImg) {
  510. ctx.clip()
  511. ctx.drawImage(avatarImg, (W - avatarSize) / 2, 128 - avatarSize / 2, avatarSize, avatarSize)
  512. }
  513. ctx.restore()
  514. // Nickname
  515. ctx.font = 'bold 18px sans-serif'
  516. ctx.fillStyle = '#FFFFFF'
  517. ctx.textAlign = 'center'
  518. ctx.fillText(userStore.nickname || '数字能量探索者', W / 2, 192)
  519. // Role badge
  520. const roleText = userStore.vipType === 'practitioner' ? '能量师' : userStore.vipType === 'annual' ? 'C端会员' : '探索者'
  521. ctx.font = '11px sans-serif'
  522. ctx.fillStyle = userStore.vipType === 'practitioner' ? '#C9A84C' : 'rgba(255,255,255,0.5)'
  523. ctx.fillText(roleText, W / 2, 214)
  524. // Divider
  525. ctx.fillStyle = 'rgba(255,255,255,0.07)'
  526. ctx.fillRect(30, 240, W - 60, 1)
  527. // Section title
  528. ctx.font = '12px sans-serif'
  529. ctx.fillStyle = 'rgba(255,255,255,0.38)'
  530. ctx.fillText('推荐体验', W / 2, 270)
  531. // QR code background
  532. const qrSize = 160
  533. const qrX = (W - qrSize) / 2
  534. const qrY = 288
  535. ctx.fillStyle = '#FFFFFF'
  536. ctx.fillRect(qrX, qrY, qrSize, qrSize)
  537. if (qrImg) {
  538. ctx.drawImage(qrImg, qrX + 8, qrY + 8, qrSize - 16, qrSize - 16)
  539. }
  540. // Hint
  541. ctx.font = '11px sans-serif'
  542. ctx.fillStyle = 'rgba(255,255,255,0.32)'
  543. ctx.fillText('扫码开启你的数字能量之旅', W / 2, qrY + qrSize + 24)
  544. // Bottom
  545. ctx.font = '10px sans-serif'
  546. ctx.fillStyle = 'rgba(255,255,255,0.18)'
  547. ctx.fillText('数字能量学 · 数字能量智能体', W / 2, H - 22)
  548. // Canvas 2D draws immediately — no ctx.draw() needed
  549. // Export to temp file (pass canvas object, not canvasId)
  550. uni.canvasToTempFilePath({
  551. canvas,
  552. quality: 1,
  553. success: (res) => {
  554. uni.saveImageToPhotosAlbum({
  555. filePath: res.tempFilePath,
  556. success: () => {
  557. uni.hideLoading()
  558. uni.showToast({ title: '海报已保存到相册', icon: 'success' })
  559. },
  560. fail: (e) => {
  561. uni.hideLoading()
  562. if (e.errMsg && e.errMsg.includes('auth deny')) {
  563. uni.showModal({
  564. title: '保存海报',
  565. content: '需要相册权限才能保存海报到本地',
  566. confirmText: '去设置',
  567. success: (r) => { if (r.confirm) uni.openSetting() }
  568. })
  569. } else {
  570. uni.showToast({ title: '保存失败,请重试', icon: 'none' })
  571. }
  572. }
  573. })
  574. },
  575. fail: () => {
  576. uni.hideLoading()
  577. uni.showToast({ title: '生成失败,请重试', icon: 'none' })
  578. }
  579. })
  580. })
  581. }).catch(e => {
  582. console.error('generatePoster error:', e)
  583. uni.hideLoading()
  584. uni.showToast({ title: '生成失败,请重试', icon: 'none' })
  585. })
  586. })
  587. }
  588. function downloadImage(url) {
  589. if (!url) return Promise.resolve('')
  590. return new Promise((resolve) => {
  591. uni.downloadFile({
  592. url,
  593. success: (res) => resolve(res.tempFilePath),
  594. fail: () => resolve('')
  595. })
  596. })
  597. }
  598. function goTags() {
  599. uni.navigateTo({ url: '/pages/tags/index' })
  600. }
  601. function goAbout() {
  602. uni.showToast({ title: '功能开发中', icon: 'none' })
  603. }
  604. function goCommission() {
  605. uni.navigateTo({ url: '/pages/commission/index' })
  606. }
  607. function handleLogout() {
  608. uni.showModal({
  609. title: '确认退出',
  610. content: '确定要退出登录吗?',
  611. success: (res) => {
  612. if (res.confirm) {
  613. userStore.logout()
  614. uni.showToast({ title: '已退出', icon: 'success' })
  615. }
  616. }
  617. })
  618. }
  619. </script>
  620. <style scoped lang="scss">
  621. // Brand colors (using CSS custom properties — responsive to theme)
  622. $blue-dark: var(--color-brand);
  623. $gold: var(--color-gold);
  624. $gold-light: var(--color-gold-light);
  625. $warm-white: var(--color-bg);
  626. $white: #FFFFFF;
  627. $card-bg: var(--color-bg-card);
  628. $text-primary: var(--color-text-primary);
  629. $text-secondary: var(--color-text-secondary);
  630. $text-muted: var(--color-text-tertiary);
  631. $danger: var(--color-danger);
  632. // ===== Theme Variables (class-based, replaces inline :style) =====
  633. .page-profile {
  634. // Default: Dark Theme
  635. --color-bg: #0c0a1a;
  636. --color-bg-secondary: #120d28;
  637. --color-bg-tertiary: #0f0c1e;
  638. --color-bg-card: rgba(255, 255, 255, 0.06);
  639. --color-bg-card-hover: rgba(255, 255, 255, 0.1);
  640. --color-bg-input: rgba(255, 255, 255, 0.1);
  641. --color-bg-tag: rgba(255, 255, 255, 0.08);
  642. --color-bg-overlay: rgba(12, 10, 26, 0.85);
  643. --color-text-primary: #FFFFFF;
  644. --color-text-secondary: #CBD5E1;
  645. --color-text-tertiary: rgba(255, 255, 255, 0.6);
  646. --color-text-link: #60A5FA;
  647. --color-text-gold: #C9A84C;
  648. --color-brand: #1E3A5F;
  649. --color-brand-light: #1E3A5F;
  650. --color-elevated: #172943;
  651. --color-gold: #C9A84C;
  652. --color-gold-bg: rgba(201, 168, 76, 0.15);
  653. --color-gold-light: #FEF3C7;
  654. --color-border: rgba(255, 255, 255, 0.1);
  655. --color-border-light: rgba(255, 255, 255, 0.06);
  656. --color-border-focus: rgba(201, 168, 76, 0.5);
  657. --color-success: #10b981;
  658. --color-success-bg: rgba(16, 185, 129, 0.15);
  659. --color-warning: #fbbf24;
  660. --color-warning-bg: rgba(251, 191, 36, 0.15);
  661. --color-danger: #ef4444;
  662. --color-danger-bg: rgba(239, 68, 68, 0.15);
  663. --color-info: #3B82F6;
  664. --color-info-bg: rgba(59, 130, 246, 0.15);
  665. --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  666. --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  667. --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
  668. --shadow-modal: 0 10px 40px rgba(0, 0, 0, 0.5);
  669. --shadow-btn: 0 4px 15px rgba(30, 58, 95, 0.4);
  670. --shadow-gold: 0 4px 15px rgba(201, 168, 76, 0.3);
  671. // Light Theme override
  672. &.theme-light {
  673. --color-bg: #F8F6F1;
  674. --color-bg-secondary: #F0EDE6;
  675. --color-bg-tertiary: #E8E5DE;
  676. --color-bg-card: #FFFFFF;
  677. --color-bg-card-hover: #F7F8FC;
  678. --color-bg-input: #F3F4F6;
  679. --color-bg-tag: #F3F4F6;
  680. --color-bg-overlay: rgba(248, 246, 241, 0.9);
  681. --color-text-primary: #1A1A2E;
  682. --color-text-secondary: #4A5568;
  683. --color-text-tertiary: #9CA3AF;
  684. --color-text-link: #2563EB;
  685. --color-text-gold: #92400E;
  686. --color-brand: #1E3A5F;
  687. --color-brand-light: #1E3A5F;
  688. --color-elevated: #2C5282;
  689. --color-gold: #C9A84C;
  690. --color-gold-bg: #FEF3C7;
  691. --color-gold-light: #FEF3C7;
  692. --color-border: #E2E8F0;
  693. --color-border-light: #F3F4F6;
  694. --color-border-focus: rgba(201, 168, 76, 0.6);
  695. --color-success: #059669;
  696. --color-success-bg: #D1FAE5;
  697. --color-warning: #D97706;
  698. --color-warning-bg: #FEF3C7;
  699. --color-danger: #DC2626;
  700. --color-danger-bg: #FEE2E2;
  701. --color-info: #2563EB;
  702. --color-info-bg: #DBEAFE;
  703. --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  704. --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  705. --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06);
  706. --shadow-modal: 0 8px 30px rgba(0, 0, 0, 0.1);
  707. --shadow-btn: 0 4px 12px rgba(30, 58, 95, 0.2);
  708. --shadow-gold: 0 4px 12px rgba(201, 168, 76, 0.2);
  709. }
  710. }
  711. .page-profile {
  712. padding: 16px;
  713. min-height: 100vh;
  714. background: $warm-white;
  715. }
  716. // ========== Merged Region 1+2: User Card + Membership ==========
  717. .user-card {
  718. background: linear-gradient(135deg, var(--color-brand), var(--color-elevated));
  719. border-radius: 16px;
  720. padding: 20px 18px;
  721. margin-bottom: 24px;
  722. &__login {
  723. cursor: pointer;
  724. text-align: center;
  725. padding: 8px 0;
  726. }
  727. &__logged {
  728. cursor: pointer;
  729. }
  730. &__inner {
  731. display: flex;
  732. align-items: center;
  733. gap: 14px;
  734. }
  735. &__info {
  736. flex: 1;
  737. min-width: 0;
  738. }
  739. &__name-row {
  740. display: flex;
  741. align-items: center;
  742. gap: 8px;
  743. flex-wrap: wrap;
  744. }
  745. &__nickname {
  746. font-size: 17px;
  747. font-weight: 600;
  748. color: $white;
  749. }
  750. &__login-hint {
  751. font-size: 12px;
  752. color: rgba(255, 255, 255, 0.7);
  753. display: block;
  754. margin-top: 4px;
  755. }
  756. &__tag {
  757. display: inline-flex;
  758. padding: 2px 12px;
  759. border-radius: 20px;
  760. font-size: 11px;
  761. margin-top: 6px;
  762. background: rgba(255, 255, 255, 0.22);
  763. color: #fff;
  764. &--practitioner {
  765. background: $gold;
  766. color: #fff;
  767. font-weight: 600;
  768. }
  769. &--annual {
  770. background: $gold;
  771. color: #fff;
  772. font-weight: 600;
  773. }
  774. &--super {
  775. background: $gold;
  776. color: #fff;
  777. font-weight: 600;
  778. }
  779. &--normal {
  780. background: rgba(255, 255, 255, 0.22);
  781. color: #fff;
  782. }
  783. }
  784. &__summary {
  785. font-size: 11px;
  786. color: rgba(255, 255, 255, 0.78);
  787. margin-top: 4px;
  788. display: block;
  789. overflow: hidden;
  790. text-overflow: ellipsis;
  791. white-space: nowrap;
  792. }
  793. &__arrow {
  794. font-size: 22px;
  795. color: rgba(255, 255, 255, 0.3);
  796. flex-shrink: 0;
  797. padding-left: 4px;
  798. }
  799. &__header-right {
  800. display: flex;
  801. align-items: center;
  802. gap: 8px;
  803. flex-shrink: 0;
  804. align-self: flex-start;
  805. padding-top: 2px;
  806. }
  807. }
  808. // Theme toggle button
  809. .theme-toggle-btn {
  810. width: 36px;
  811. height: 36px;
  812. display: flex;
  813. align-items: center;
  814. justify-content: center;
  815. background: rgba(255, 255, 255, 0.2);
  816. border: 1.5px solid rgba(255, 255, 255, 0.35);
  817. border-radius: 50%;
  818. cursor: pointer;
  819. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  820. }
  821. .theme-toggle-text {
  822. font-size: 13px;
  823. font-weight: 700;
  824. color: #fff;
  825. line-height: 1;
  826. }
  827. // ===== Promotion Center Sections =====
  828. .promo-section {
  829. background: var(--color-bg-card);
  830. border-radius: 14px;
  831. padding: 16px;
  832. margin-bottom: 16px;
  833. &__header {
  834. display: flex;
  835. justify-content: space-between;
  836. align-items: center;
  837. margin-bottom: 14px;
  838. }
  839. &__title {
  840. font-size: 16px;
  841. font-weight: 700;
  842. color: $text-primary;
  843. }
  844. &__sub {
  845. font-size: 12px;
  846. color: #3B82F6;
  847. font-weight: 500;
  848. }
  849. }
  850. .earnings-section {
  851. background: linear-gradient(135deg, var(--color-brand), var(--color-elevated));
  852. .promo-section__title {
  853. color: rgba(255,255,255,0.9);
  854. }
  855. }
  856. .earnings-grid {
  857. display: grid;
  858. grid-template-columns: 1fr 1fr;
  859. gap: 12px;
  860. }
  861. .earn-item {
  862. text-align: center;
  863. padding: 8px 0;
  864. }
  865. .earn-label {
  866. font-size: 11px;
  867. color: rgba(255,255,255,0.78);
  868. display: block;
  869. margin-bottom: 4px;
  870. }
  871. .earn-value {
  872. font-size: 22px;
  873. font-weight: 700;
  874. color: #fff;
  875. display: block;
  876. }
  877. .earn-value.accent {
  878. color: var(--color-gold);
  879. }
  880. .earnings-breakdown {
  881. margin-top: 12px;
  882. padding: 10px 14px;
  883. background: rgba(255,255,255,0.03);
  884. border-radius: 8px;
  885. }
  886. .breakdown-row {
  887. display: flex;
  888. justify-content: space-between;
  889. align-items: center;
  890. padding: 4px 0;
  891. }
  892. .breakdown-label {
  893. font-size: 12px;
  894. color: rgba(255,255,255,0.7);
  895. }
  896. .breakdown-value {
  897. font-size: 13px;
  898. font-weight: 500;
  899. color: rgba(255,255,255,0.9);
  900. }
  901. // Team
  902. .team-grid {
  903. display: grid;
  904. grid-template-columns: 1fr 1fr 1fr 1fr;
  905. gap: 8px;
  906. margin-bottom: 14px;
  907. }
  908. .team-stat {
  909. text-align: center;
  910. padding: 8px 0;
  911. }
  912. .stat-num {
  913. font-size: 24px;
  914. font-weight: 700;
  915. color: var(--color-text-primary);
  916. display: block;
  917. }
  918. .stat-label {
  919. font-size: 11px;
  920. color: $text-secondary;
  921. margin-top: 2px;
  922. display: block;
  923. }
  924. .team-preview {
  925. border-top: 1px solid var(--color-border);
  926. padding-top: 10px;
  927. }
  928. .member-row {
  929. display: flex;
  930. align-items: center;
  931. padding: 8px 0;
  932. border-bottom: 1px solid var(--color-bg);
  933. }
  934. .member-row:last-child { border-bottom: none; }
  935. .member-avatar {
  936. width: 32px;
  937. height: 32px;
  938. border-radius: 50%;
  939. margin-right: 10px;
  940. flex-shrink: 0;
  941. }
  942. .member-info { flex: 1; }
  943. .member-name {
  944. font-size: 13px;
  945. color: $text-primary;
  946. display: block;
  947. }
  948. .member-date {
  949. font-size: 11px;
  950. color: $text-secondary;
  951. margin-top: 1px;
  952. display: block;
  953. }
  954. .member-vip {
  955. font-size: 10px;
  956. color: var(--color-gold);
  957. background: #FEF3C7;
  958. padding: 2px 8px;
  959. border-radius: 4px;
  960. font-weight: 500;
  961. }
  962. .promo-empty {
  963. padding: 24px 0;
  964. text-align: center;
  965. }
  966. .promo-empty-text {
  967. font-size: 13px;
  968. color: $text-secondary;
  969. }
  970. // Commission List
  971. .commission-row {
  972. display: flex;
  973. justify-content: space-between;
  974. align-items: center;
  975. padding: 12px 0;
  976. border-bottom: 1px solid var(--color-border);
  977. }
  978. .commission-row:last-child { border-bottom: none; }
  979. .comm-left { flex: 1; }
  980. .comm-amount {
  981. font-size: 15px;
  982. font-weight: 600;
  983. color: #2D8B67;
  984. display: block;
  985. }
  986. .comm-level {
  987. font-size: 12px;
  988. color: $text-secondary;
  989. margin-top: 2px;
  990. display: block;
  991. }
  992. .comm-remark {
  993. font-size: 11px;
  994. color: $text-secondary;
  995. margin-top: 1px;
  996. display: block;
  997. }
  998. .comm-right { text-align: right; }
  999. .comm-status {
  1000. font-size: 11px;
  1001. padding: 2px 8px;
  1002. border-radius: 4px;
  1003. display: inline-block;
  1004. margin-bottom: 2px;
  1005. }
  1006. .comm-status.status-settled { background: #ECFDF5; color: #2D8B67; }
  1007. .comm-status.status-pending { background: #FEF3C7; color: #D4A017; }
  1008. .comm-status.status-withdrawn { background: var(--color-bg-input); color: $text-secondary; }
  1009. .comm-status.status-available { background: #EFF6FF; color: #3B82F6; }
  1010. .comm-date {
  1011. font-size: 11px;
  1012. color: $text-secondary;
  1013. display: block;
  1014. }
  1015. // Avatar
  1016. .avatar {
  1017. width: 56px;
  1018. height: 56px;
  1019. border-radius: 50%;
  1020. overflow: hidden;
  1021. flex-shrink: 0;
  1022. image {
  1023. width: 100%;
  1024. height: 100%;
  1025. border-radius: 50%;
  1026. border: 2px solid rgba(255, 255, 255, 0.25);
  1027. }
  1028. &--empty {
  1029. width: 56px;
  1030. height: 56px;
  1031. background: rgba(255, 255, 255, 0.12);
  1032. display: flex;
  1033. align-items: center;
  1034. justify-content: center;
  1035. border: 2px dashed rgba(255, 255, 255, 0.25);
  1036. }
  1037. &__icon {
  1038. font-size: 24px;
  1039. color: rgba(255, 255, 255, 0.5);
  1040. }
  1041. }
  1042. // ========== (merged into Region 1+2) ==========
  1043. // Banners
  1044. .banner {
  1045. display: flex;
  1046. align-items: center;
  1047. justify-content: space-between;
  1048. padding: 10px 14px;
  1049. border-radius: 10px;
  1050. margin-bottom: 12px;
  1051. background: #FEF3C7;
  1052. border: 1px solid #FDE68A;
  1053. &--warning {
  1054. background: #FEF3C7;
  1055. border-color: #FDE68A;
  1056. }
  1057. &__text {
  1058. font-size: 13px;
  1059. color: #92400E;
  1060. flex: 1;
  1061. }
  1062. &__arrow {
  1063. font-size: 18px;
  1064. color: #92400E;
  1065. margin-left: 8px;
  1066. }
  1067. }
  1068. // Seed-price badge
  1069. .seed-badge {
  1070. display: flex;
  1071. align-items: center;
  1072. justify-content: center;
  1073. padding: 6px 14px;
  1074. border-radius: 8px;
  1075. margin-bottom: 12px;
  1076. background: $gold-light;
  1077. border: 1px solid $gold;
  1078. &__text {
  1079. font-size: 12px;
  1080. color: $blue-dark;
  1081. font-weight: 500;
  1082. }
  1083. }
  1084. // VIP status card
  1085. .vip-card {
  1086. border-radius: 12px;
  1087. padding: 16px;
  1088. display: flex;
  1089. justify-content: space-between;
  1090. align-items: center;
  1091. margin-top: 16px;
  1092. &__body {
  1093. flex: 1;
  1094. }
  1095. &__title {
  1096. font-weight: 600;
  1097. font-size: 16px;
  1098. display: block;
  1099. }
  1100. &__desc {
  1101. font-size: 12px;
  1102. opacity: 0.92;
  1103. display: block;
  1104. margin-top: 4px;
  1105. }
  1106. &__action {
  1107. font-size: 14px;
  1108. font-weight: 500;
  1109. padding: 6px 14px;
  1110. border-radius: 8px;
  1111. white-space: nowrap;
  1112. cursor: pointer;
  1113. }
  1114. // Practitioner
  1115. &--practitioner {
  1116. background: linear-gradient(135deg, #7c3aed, #6d28d9);
  1117. .vip-card__title, .vip-card__desc { color: #fff; }
  1118. .vip-card__action {
  1119. color: #7c3aed;
  1120. background: rgba(255, 255, 255, 0.95);
  1121. }
  1122. }
  1123. // Super member
  1124. &--super {
  1125. background: linear-gradient(135deg, #C9A84C, #B8922E);
  1126. .vip-card__title, .vip-card__desc { color: #1E3A5F; }
  1127. .vip-card__action {
  1128. color: #C9A84C;
  1129. background: #1E3A5F;
  1130. }
  1131. .vip-card__perks {
  1132. display: flex;
  1133. gap: 6px;
  1134. margin-top: 6px;
  1135. }
  1136. .perk-tag {
  1137. font-size: 10px;
  1138. font-weight: 500;
  1139. padding: 2px 8px;
  1140. border-radius: 4px;
  1141. background: rgba(30, 58, 95, 0.15);
  1142. color: #1E3A5F;
  1143. }
  1144. }
  1145. // Annual
  1146. &--annual {
  1147. background: linear-gradient(135deg, #f59e0b, #d97706);
  1148. .vip-card__title, .vip-card__desc { color: #fff; }
  1149. .vip-card__action {
  1150. color: #d97706;
  1151. background: rgba(255, 255, 255, 0.95);
  1152. }
  1153. }
  1154. // Expired
  1155. &--expired {
  1156. background: #E5E7EB;
  1157. .vip-card__title { color: $text-primary; }
  1158. .vip-card__desc { color: $text-secondary; }
  1159. .vip-card__action {
  1160. color: #fff;
  1161. background: $text-secondary;
  1162. }
  1163. }
  1164. // Upsell (free user — two options)
  1165. &--upsell {
  1166. background: linear-gradient(135deg, var(--color-brand), var(--color-elevated));
  1167. flex-direction: column;
  1168. align-items: flex-start;
  1169. gap: 14px;
  1170. .vip-card__body {
  1171. width: 100%;
  1172. }
  1173. .vip-card__title {
  1174. color: $gold;
  1175. font-size: 16px;
  1176. margin-bottom: 8px;
  1177. }
  1178. .vip-card__dual {
  1179. display: flex;
  1180. gap: 12px;
  1181. width: 100%;
  1182. }
  1183. .vip-card__option {
  1184. flex: 1;
  1185. background: rgba(255, 255, 255, 0.06);
  1186. border: 1px solid rgba(255, 255, 255, 0.08);
  1187. border-radius: 12px;
  1188. padding: 14px 12px;
  1189. display: flex;
  1190. flex-direction: column;
  1191. align-items: center;
  1192. gap: 6px;
  1193. cursor: pointer;
  1194. }
  1195. .vip-card__option:active {
  1196. background: rgba(255, 255, 255, 0.1);
  1197. }
  1198. .vip-card__option .option-title {
  1199. font-size: 15px;
  1200. font-weight: 600;
  1201. color: rgba(255, 255, 255, 0.9);
  1202. }
  1203. .vip-card__option .option-price {
  1204. font-size: 18px;
  1205. font-weight: 700;
  1206. color: $gold;
  1207. }
  1208. .vip-card__option .option-desc {
  1209. font-size: 11px;
  1210. color: rgba(255, 255, 255, 0.7);
  1211. }
  1212. .vip-card__option .option-btn {
  1213. width: 100%;
  1214. border: none;
  1215. border-radius: 8px;
  1216. padding: 8px 0;
  1217. font-size: 13px;
  1218. font-weight: 600;
  1219. cursor: pointer;
  1220. margin-top: 4px;
  1221. }
  1222. .option-btn.light {
  1223. background: rgba(255, 255, 255, 0.12);
  1224. color: #fff;
  1225. }
  1226. .option-btn.primary {
  1227. background: $gold;
  1228. color: $blue-dark;
  1229. }
  1230. .vip-card__option--pro {
  1231. border-color: rgba(201, 168, 76, 0.2);
  1232. background: rgba(201, 168, 76, 0.06);
  1233. }
  1234. }
  1235. }
  1236. // Daily quota
  1237. .quota-bar {
  1238. background: $card-bg;
  1239. border-radius: 12px;
  1240. padding: 16px;
  1241. margin-bottom: 16px;
  1242. display: flex;
  1243. align-items: center;
  1244. justify-content: space-around;
  1245. &__item {
  1246. text-align: center;
  1247. }
  1248. &__label {
  1249. font-size: 12px;
  1250. color: $text-secondary;
  1251. display: block;
  1252. margin-bottom: 4px;
  1253. }
  1254. &__value {
  1255. font-size: 20px;
  1256. font-weight: 700;
  1257. color: $text-primary;
  1258. }
  1259. &__divider {
  1260. width: 1px;
  1261. height: 36px;
  1262. background: #E5E7EB;
  1263. }
  1264. }
  1265. // ========== Region 3: Feature Menu ==========
  1266. .menu-section {
  1267. background: $card-bg;
  1268. border-radius: 12px;
  1269. margin-bottom: 16px;
  1270. overflow: hidden;
  1271. &__header {
  1272. font-size: 12px;
  1273. font-weight: 600;
  1274. color: $text-secondary;
  1275. text-transform: uppercase;
  1276. letter-spacing: 0.5px;
  1277. padding: 14px 16px 6px;
  1278. display: flex;
  1279. justify-content: space-between;
  1280. align-items: center;
  1281. }
  1282. &__more {
  1283. font-size: 12px;
  1284. font-weight: 500;
  1285. color: #3B82F6;
  1286. text-transform: none;
  1287. letter-spacing: 0;
  1288. cursor: pointer;
  1289. }
  1290. }
  1291. .menu-item {
  1292. display: flex;
  1293. align-items: center;
  1294. gap: 8px;
  1295. padding: 14px 16px;
  1296. border-bottom: 1px solid #F3F4F6;
  1297. cursor: pointer;
  1298. transition: background 0.15s;
  1299. &:active {
  1300. background: #F9FAFB;
  1301. }
  1302. &:last-child {
  1303. border-bottom: none;
  1304. }
  1305. &__label {
  1306. flex: 1;
  1307. font-size: 15px;
  1308. color: $text-primary;
  1309. &--danger {
  1310. color: $danger;
  1311. }
  1312. }
  1313. &__badge {
  1314. font-size: 10px;
  1315. font-weight: 700;
  1316. padding: 2px 6px;
  1317. border-radius: 4px;
  1318. &--new {
  1319. background: #FEF3C7;
  1320. color: #D97706;
  1321. }
  1322. }
  1323. &__arrow {
  1324. color: $text-secondary;
  1325. font-size: 18px;
  1326. }
  1327. &--danger {
  1328. justify-content: center;
  1329. border-bottom: none;
  1330. }
  1331. }
  1332. // Promotion tools card
  1333. .promo-card {
  1334. margin: 0 16px 14px;
  1335. background: #FFFBEB;
  1336. border: 1px solid #FDE68A;
  1337. border-radius: 10px;
  1338. overflow: hidden;
  1339. &__code-area {
  1340. display: flex;
  1341. align-items: center;
  1342. justify-content: center;
  1343. gap: 10px;
  1344. padding: 14px 16px 8px;
  1345. }
  1346. &__prefix {
  1347. font-size: 13px;
  1348. color: $blue-dark;
  1349. }
  1350. &__code {
  1351. font-size: 22px;
  1352. font-weight: 700;
  1353. color: $blue-dark;
  1354. letter-spacing: 3px;
  1355. font-family: monospace;
  1356. }
  1357. &__actions {
  1358. display: flex;
  1359. align-items: center;
  1360. justify-content: center;
  1361. gap: 10px;
  1362. padding: 6px 16px 14px;
  1363. }
  1364. &__btn {
  1365. font-size: 12px;
  1366. color: $blue-dark;
  1367. font-weight: 500;
  1368. cursor: pointer;
  1369. }
  1370. &__divider {
  1371. color: #D1D5DB;
  1372. font-size: 12px;
  1373. }
  1374. }
  1375. .poster-canvas {
  1376. position: fixed;
  1377. left: -9999px;
  1378. top: -9999px;
  1379. width: 375px;
  1380. height: 670px;
  1381. }
  1382. </style>