index.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. <template>
  2. <view class="page" :style="{ '--font-scale': fontScale }">
  3. <!-- 加载状态 -->
  4. <BaseLoading :loading="loading" text="加载心愿中..." />
  5. <!-- 积分卡片 -->
  6. <view class="points-card" v-if="!loading">
  7. <view class="points-card__glow"></view>
  8. <view class="points-card__inner">
  9. <view class="points-card__header">
  10. <text class="points-card__icon">⭐</text>
  11. <text class="points-card__label">我的积分</text>
  12. </view>
  13. <text class="points-card__value">{{ formattedPoints }}</text>
  14. <view class="milestone">
  15. <view class="milestone__track">
  16. <view
  17. class="milestone__fill"
  18. :style="{ width: milestoneInfo.progress + '%' }"
  19. ></view>
  20. </view>
  21. <text class="milestone__text">🎯 距离下一个奖励还差 {{ milestoneInfo.remaining }} 分</text>
  22. </view>
  23. </view>
  24. </view>
  25. <!-- 筛选标签 -->
  26. <scroll-view
  27. class="filter-tabs"
  28. scroll-x="true"
  29. show-scrollbar="false"
  30. v-if="!loading && wishes.length > 0"
  31. >
  32. <view class="filter-tabs__inner">
  33. <view
  34. v-for="tab in filterTabs"
  35. :key="tab.key"
  36. class="filter-tab"
  37. :class="{ 'filter-tab--active': activeFilter === tab.key }"
  38. @click="onFilterChange(tab.key)"
  39. >
  40. <text class="filter-tab__label">{{ tab.emoji }} {{ tab.label }}</text>
  41. <view class="filter-tab__count" v-if="getFilterCount(tab.key) > 0">{{ getFilterCount(tab.key) }}</view>
  42. </view>
  43. </view>
  44. </scroll-view>
  45. <!-- 空状态:无任何心愿 -->
  46. <BaseEmpty
  47. v-if="!loading && wishes.length === 0"
  48. icon="🗺️"
  49. title="还没有心愿呢"
  50. description="点击 + 添加第一个心愿吧!"
  51. >
  52. <template v-slot:action>
  53. <PlayfulButton variant="clay" size="lg" @click="showAddModal = true">
  54. ✨ 添加第一个心愿
  55. </PlayfulButton>
  56. </template>
  57. </BaseEmpty>
  58. <!-- 空状态:筛选后无结果 -->
  59. <BaseEmpty
  60. v-else-if="!loading && filteredWishes.length === 0 && wishes.length > 0"
  61. icon="🔍"
  62. title="没有找到"
  63. :description="'还没有' + getActiveTabLabel + '的心愿哦'"
  64. />
  65. <!-- 心愿列表(宝箱卡片) -->
  66. <view class="wish-list" v-if="!loading && wishes.length > 0">
  67. <view
  68. v-for="(wish, index) in filteredWishes"
  69. :key="wish.id"
  70. class="wish-item"
  71. :class="['animate-slide-up', 'animate-stagger-' + (index + 1)]"
  72. >
  73. <PlayfulCard variant="clay" padding="0" :clickable="false">
  74. <view class="wish-card">
  75. <!-- 左侧 emoji 图标 -->
  76. <view class="wish-card__icon-wrap">
  77. <text class="wish-card__emoji">{{ getCategoryEmoji(wish.category) }}</text>
  78. </view>
  79. <!-- 中间内容 -->
  80. <view class="wish-card__body">
  81. <view class="wish-card__top">
  82. <text class="wish-card__title">{{ wish.title }}</text>
  83. <BaseBadge :variant="getStatusBadgeVariant(wish.status)" size="xs">
  84. <text>{{ getStatusEmoji(wish.status) }} {{ wish.statusText || wish.status }}</text>
  85. </BaseBadge>
  86. </view>
  87. <view class="wish-card__points-row">
  88. <text class="wish-card__points-label">需要</text>
  89. <text class="wish-card__points-value">{{ wish.pointsRequired || '???' }}</text>
  90. <text class="wish-card__points-unit">⭐</text>
  91. </view>
  92. <!-- 根据不同状态显示操作区域 -->
  93. <view class="wish-card__actions">
  94. <!-- draft:等待定价 -->
  95. <view class="wish-card__status-text" v-if="wish.status === 'draft'">
  96. <text class="wish-card__status-emoji">⏳</text>
  97. <text class="wish-card__status-msg">等待妈妈定价中</text>
  98. </view>
  99. <!-- active + 积分足够 → 兑换按钮 -->
  100. <PlayfulButton
  101. v-if="wish.status === 'active'"
  102. :variant="canRedeem(wish) ? 'primary' : 'secondary'"
  103. size="sm"
  104. :disabled="!canRedeem(wish)"
  105. @click="onRedeem(wish)"
  106. >
  107. {{ canRedeem(wish) ? '🎁 兑换' : '还差 ' + (wish.pointsRequired - currentPoints) + ' ⭐' }}
  108. </PlayfulButton>
  109. <!-- pending_exchange:审批中 -->
  110. <view class="wish-card__status-text wish-card__status-text--warning" v-if="wish.status === 'pending_exchange'">
  111. <text class="wish-card__status-emoji">⏳</text>
  112. <text class="wish-card__status-msg">等待妈妈审批</text>
  113. </view>
  114. <!-- approved:已批准 -->
  115. <view class="wish-card__status-text wish-card__status-text--info" v-if="wish.status === 'approved'">
  116. <text class="wish-card__status-emoji">📦</text>
  117. <text class="wish-card__status-msg">妈妈准备中</text>
  118. </view>
  119. <!-- exchanging:确认收货 -->
  120. <PlayfulButton
  121. v-if="wish.status === 'exchanging'"
  122. variant="success"
  123. size="sm"
  124. @click="onConfirmReceived(wish)"
  125. >
  126. 📦 确认收货
  127. </PlayfulButton>
  128. <!-- fulfilled:已完成 -->
  129. <view class="wish-card__status-text wish-card__status-text--success" v-if="wish.status === 'fulfilled'">
  130. <text class="wish-card__status-emoji">🎉</text>
  131. <text class="wish-card__status-msg">已兑换</text>
  132. </view>
  133. <!-- rejected:未通过 -->
  134. <view class="wish-card__status-text wish-card__status-text--error" v-if="wish.status === 'rejected'">
  135. <text class="wish-card__status-emoji">😢</text>
  136. <text class="wish-card__status-msg">未通过</text>
  137. </view>
  138. </view>
  139. </view>
  140. <!-- 右侧删除按钮(仅可取消状态) -->
  141. <view
  142. class="wish-card__delete"
  143. v-if="wish.status === 'draft' || wish.status === 'active'"
  144. @click.stop="onDeleteWish(wish)"
  145. >
  146. <text class="wish-card__delete-icon">✕</text>
  147. </view>
  148. </view>
  149. </PlayfulCard>
  150. </view>
  151. <!-- 底部间距(给 FAB 让位) -->
  152. <view class="wish-list__spacer"></view>
  153. </view>
  154. <!-- 浮动操作按钮 -->
  155. <view class="fab" @click="showAddModal = true">
  156. <view class="fab__pulse"></view>
  157. <text class="fab__icon">+</text>
  158. </view>
  159. <!-- 添加心愿弹窗 -->
  160. <view class="modal-overlay" v-if="showAddModal" @click="closeAddModal">
  161. <view class="modal" @click.stop>
  162. <view class="modal__header">
  163. <text class="modal__title">✨ 添加新心愿</text>
  164. <text class="modal__close" @click="closeAddModal">✕</text>
  165. </view>
  166. <!-- 表情/分类选择 -->
  167. <view class="form-group">
  168. <text class="form-group__label">选择分类</text>
  169. <view class="emoji-grid">
  170. <view
  171. v-for="cat in categories"
  172. :key="cat.value"
  173. class="emoji-item"
  174. :class="{ 'emoji-item--active': addForm.category === cat.value }"
  175. @click="addForm.category = cat.value; addForm.emoji = cat.emoji"
  176. >
  177. <text class="emoji-item__icon">{{ cat.emoji }}</text>
  178. <text class="emoji-item__label">{{ cat.label }}</text>
  179. </view>
  180. </view>
  181. </view>
  182. <!-- 心愿名称 -->
  183. <view class="form-group">
  184. <text class="form-group__label">心愿名称</text>
  185. <input
  186. class="form-input"
  187. v-model="addForm.title"
  188. placeholder="写下你的心愿吧~"
  189. maxlength="20"
  190. @input="onTitleInput"
  191. />
  192. <text class="form-input__counter">{{ addForm.title.length }}/20</text>
  193. </view>
  194. <!-- 所需积分 -->
  195. <view class="form-group">
  196. <text class="form-group__label">所需积分(给妈妈参考)</text>
  197. <view class="form-input__wrapper">
  198. <input
  199. class="form-input form-input--number"
  200. v-model="addForm.pointsRequired"
  201. placeholder="建议积分"
  202. type="number"
  203. maxlength="4"
  204. />
  205. <text class="form-input__suffix">⭐</text>
  206. </view>
  207. </view>
  208. <!-- 提交按钮 -->
  209. <PlayfulButton variant="clay" size="lg" block :disabled="!canSubmit" @click="onAddWish">
  210. ✨ 许下心愿
  211. </PlayfulButton>
  212. </view>
  213. </view>
  214. </view>
  215. </template>
  216. <script>
  217. import {
  218. getWishes,
  219. createWish,
  220. requestWishExchange,
  221. confirmWishReceived,
  222. cancelWish,
  223. getPointsBalance, reportAppEnter
  224. } from '../../utils/api.js'
  225. import PlayfulCard from '../../components/PlayfulCard.vue'
  226. import PlayfulButton from '../../components/PlayfulButton.vue'
  227. import BaseBadge from '../../components/BaseBadge.vue'
  228. import BaseEmpty from '../../components/BaseEmpty.vue'
  229. import BaseLoading from '../../components/BaseLoading.vue'
  230. import fontScaleMixin from '@/mixins/font-scale.js'
  231. export default {
  232. mixins: [fontScaleMixin],
  233. components: {
  234. PlayfulCard,
  235. PlayfulButton,
  236. BaseBadge,
  237. BaseEmpty,
  238. BaseLoading
  239. },
  240. data() {
  241. return {
  242. wishes: [],
  243. currentPoints: 0,
  244. memberId: '',
  245. loading: true,
  246. activeFilter: 'all',
  247. // 添加心愿弹窗
  248. showAddModal: false,
  249. addForm: {
  250. title: '',
  251. category: '',
  252. emoji: '🎁',
  253. pointsRequired: ''
  254. },
  255. submittingWish: false,
  256. // 筛选标签配置
  257. filterTabs: [
  258. { key: 'all', emoji: '📋', label: '全部' },
  259. { key: 'redeemable', emoji: '🎯', label: '可兑换' },
  260. { key: 'pending', emoji: '⏳', label: '审核中' },
  261. { key: 'completed', emoji: '✅', label: '已兑换' },
  262. { key: 'rejected', emoji: '❌', label: '未通过' }
  263. ],
  264. // 分类配置
  265. categories: [
  266. { value: '玩具', emoji: '🎮', label: '玩具' },
  267. { value: '图书', emoji: '📚', label: '图书' },
  268. { value: '美食', emoji: '🍕', label: '美食' },
  269. { value: '娱乐', emoji: '🎪', label: '娱乐' },
  270. { value: '活动', emoji: '🏕️', label: '活动' },
  271. { value: '其他', emoji: '🎁', label: '其他' }
  272. ],
  273. // 状态 → badge 颜色映射
  274. statusBadgeMap: {
  275. draft: 'warning',
  276. active: 'accent',
  277. pending_exchange: 'warning',
  278. approved: 'accent',
  279. exchanging: 'primary',
  280. fulfilled: 'success',
  281. rejected: 'error'
  282. },
  283. // 状态 → emoji 映射
  284. statusEmojiMap: {
  285. draft: '⏳',
  286. active: '🎯',
  287. pending_exchange: '⏳',
  288. approved: '📦',
  289. exchanging: '🚚',
  290. fulfilled: '✅',
  291. rejected: '😢'
  292. },
  293. // 分类 → emoji 映射
  294. categoryEmojiMap: {
  295. '玩具': '🎮',
  296. '图书': '📚',
  297. '美食': '🍕',
  298. '娱乐': '🎪',
  299. '活动': '🏕️',
  300. '其他': '🎁'
  301. },
  302. // 用于触发列表重绘(筛选切换时重新触发动画)
  303. listKey: 0
  304. }
  305. },
  306. computed: {
  307. formattedPoints() {
  308. if (!this.currentPoints) return '0'
  309. return this.currentPoints.toLocaleString()
  310. },
  311. milestoneInfo() {
  312. const step = 200
  313. const current = this.currentPoints || 0
  314. const next = Math.ceil(current / step) * step
  315. const remaining = next - current
  316. const progress = step > 0 ? (current % step) / step * 100 : 0
  317. return { nextMilestone: next, remaining, progress }
  318. },
  319. filteredWishes() {
  320. return this.getFilteredWishes(this.activeFilter)
  321. },
  322. getActiveTabLabel() {
  323. var activeFilter = this.activeFilter
  324. var tab = this.filterTabs.find(function(t) { return t.key === activeFilter })
  325. return tab ? tab.label : ''
  326. },
  327. canSubmit() {
  328. var title = this.addForm.title || ''
  329. return title.trim().length > 0 && !this.submittingWish
  330. }
  331. },
  332. onShow() {
  333. reportAppEnter('wish');
  334. this.loadData()
  335. },
  336. methods: {
  337. async loadData() {
  338. this.loading = true
  339. var currentRole
  340. var results
  341. try {
  342. currentRole = uni.getStorageSync('currentRole') || uni.getStorageSync('role')
  343. if (currentRole !== 'child') {
  344. uni.reLaunch({ url: '/pages/index-home/index' })
  345. return
  346. }
  347. this.memberId = uni.getStorageSync('currentChildId') || uni.getStorageSync('userId')
  348. // 并行获取心愿列表和积分
  349. results = await Promise.all([
  350. getWishes({ memberId: this.memberId }),
  351. getPointsBalance(this.memberId)
  352. ])
  353. this.wishes = (results[0] && results[0].data) || []
  354. this.currentPoints = (results[1] && results[1].data && results[1].data.balance) || 0
  355. } catch (e) {
  356. console.error('加载心愿列表失败', e)
  357. uni.showToast({ title: '加载失败', icon: 'none' })
  358. } finally {
  359. this.loading = false
  360. }
  361. },
  362. // 筛选切换(触发重动画)
  363. onFilterChange(key) {
  364. this.activeFilter = key
  365. this.listKey++
  366. },
  367. getFilteredWishes(filterKey) {
  368. var list = this.wishes || []
  369. if (filterKey === 'all') return list
  370. if (filterKey === 'redeemable') {
  371. return list.filter(function(w) {
  372. return w.status === 'active'
  373. })
  374. }
  375. if (filterKey === 'pending') {
  376. return list.filter(function(w) {
  377. return w.status === 'draft' || w.status === 'pending_exchange'
  378. })
  379. }
  380. if (filterKey === 'completed') {
  381. return list.filter(function(w) {
  382. return w.status === 'fulfilled' || w.status === 'exchanging' || w.status === 'approved'
  383. })
  384. }
  385. if (filterKey === 'rejected') {
  386. return list.filter(function(w) {
  387. return w.status === 'rejected'
  388. })
  389. }
  390. return list
  391. },
  392. getFilterCount(filterKey) {
  393. return this.getFilteredWishes(filterKey).length
  394. },
  395. canRedeem(wish) {
  396. return this.currentPoints >= (wish.pointsRequired || 0)
  397. },
  398. getCategoryEmoji(category) {
  399. var map = this.categoryEmojiMap
  400. if (category && map[category]) {
  401. return map[category]
  402. }
  403. return '🎁'
  404. },
  405. getStatusBadgeVariant(status) {
  406. var map = this.statusBadgeMap
  407. return (status && map[status]) || 'muted'
  408. },
  409. getStatusEmoji(status) {
  410. var map = this.statusEmojiMap
  411. return (status && map[status]) || '📋'
  412. },
  413. // 兑换操作
  414. onRedeem(wish) {
  415. var self = this
  416. uni.showModal({
  417. title: '兑换心愿',
  418. content: '确定要兑换"' + wish.title + '"吗?\n将消耗 ' + wish.pointsRequired + ' 积分',
  419. success: function(res) {
  420. if (res.confirm) {
  421. self.doRedeem(wish)
  422. }
  423. }
  424. })
  425. },
  426. async doRedeem(wish) {
  427. try {
  428. await requestWishExchange(wish.id)
  429. uni.showToast({ title: '已提交申请 🎉', icon: 'success' })
  430. this.loadData()
  431. } catch (e) {
  432. uni.showToast({ title: e.message || '申请失败', icon: 'none' })
  433. }
  434. },
  435. // 确认收货
  436. onConfirmReceived(wish) {
  437. var self = this
  438. uni.showModal({
  439. title: '确认收货',
  440. content: '确定已收到"' + wish.title + '"吗?',
  441. success: function(res) {
  442. if (res.confirm) {
  443. self.doConfirmReceived(wish)
  444. }
  445. }
  446. })
  447. },
  448. async doConfirmReceived(wish) {
  449. try {
  450. await confirmWishReceived(wish.id)
  451. uni.showToast({ title: '心愿完成!🎉', icon: 'success' })
  452. this.loadData()
  453. } catch (e) {
  454. uni.showToast({ title: '确认失败', icon: 'none' })
  455. }
  456. },
  457. // 删除/取消心愿
  458. onDeleteWish(wish) {
  459. var self = this
  460. uni.showModal({
  461. title: '取消心愿',
  462. content: '确定要取消"' + wish.title + '"吗?',
  463. success: function(res) {
  464. if (res.confirm) {
  465. self.doDeleteWish(wish)
  466. }
  467. }
  468. })
  469. },
  470. async doDeleteWish(wish) {
  471. try {
  472. await cancelWish(wish.id, '不想兑换了')
  473. uni.showToast({ title: '已取消', icon: 'success' })
  474. this.loadData()
  475. } catch (e) {
  476. uni.showToast({ title: '取消失败', icon: 'none' })
  477. }
  478. },
  479. // 添加心愿弹窗
  480. closeAddModal() {
  481. this.showAddModal = false
  482. this.resetAddForm()
  483. },
  484. resetAddForm() {
  485. this.addForm = {
  486. title: '',
  487. category: '',
  488. emoji: '🎁',
  489. pointsRequired: ''
  490. }
  491. },
  492. onTitleInput() {
  493. // 仅用于触发字符计数更新(vue 双向绑定已处理)
  494. },
  495. async onAddWish() {
  496. if (!this.canSubmit) return
  497. var title = (this.addForm.title || '').trim()
  498. if (!title) {
  499. uni.showToast({ title: '请输入心愿名称', icon: 'none' })
  500. return
  501. }
  502. this.submittingWish = true
  503. var data
  504. try {
  505. data = {
  506. memberId: this.memberId,
  507. title: title,
  508. category: this.addForm.category || '其他'
  509. }
  510. // 如果填写了积分建议,一并提交
  511. if (this.addForm.pointsRequired) {
  512. data.pointsRequired = parseInt(this.addForm.pointsRequired, 10) || 0
  513. }
  514. await createWish(data)
  515. uni.showToast({ title: '心愿已许下 ✨', icon: 'success' })
  516. this.closeAddModal()
  517. this.loadData()
  518. } catch (e) {
  519. uni.showToast({ title: e.message || '添加失败', icon: 'none' })
  520. } finally {
  521. this.submittingWish = false
  522. }
  523. }
  524. }
  525. }
  526. </script>
  527. <style scoped lang="scss">
  528. /* ============================================================
  529. 页面容器
  530. ============================================================ */
  531. .page {
  532. min-height: 100vh;
  533. background: var(--bg, $uni-bg-color);
  534. padding-bottom: 180rpx;
  535. }
  536. /* ============================================================
  537. 积分卡片
  538. ============================================================ */
  539. .points-card {
  540. position: relative;
  541. margin: 24rpx 32rpx 16rpx;
  542. border-radius: 24rpx;
  543. overflow: hidden;
  544. }
  545. .points-card__glow {
  546. position: absolute;
  547. top: -50%;
  548. right: -30%;
  549. width: 300rpx;
  550. height: 300rpx;
  551. background: radial-gradient(circle, rgba(249,115,22,0.15), transparent 70%);
  552. pointer-events: none;
  553. }
  554. .points-card__inner {
  555. position: relative;
  556. padding: 32rpx 36rpx 28rpx;
  557. border-radius: 24rpx;
  558. border: 4rpx solid var(--border, $uni-border-color);
  559. background: linear-gradient(145deg, $app-surface, var(--bg-grey, $uni-bg-color-grey));
  560. box-shadow:
  561. inset -4rpx -4rpx 12rpx rgba(249,115,22,0.05),
  562. 6rpx 6rpx 18rpx rgba(249,115,22,0.10);
  563. }
  564. .points-card__header {
  565. display: flex;
  566. align-items: center;
  567. margin-bottom: 12rpx;
  568. }
  569. .points-card__icon {
  570. font-size: calc(36rpx * var(--font-scale, 1));
  571. margin-right: 12rpx;
  572. }
  573. .points-card__label {
  574. font-size: calc(28rpx * var(--font-scale, 1));
  575. font-weight: 600;
  576. color: var(--text-secondary, $uni-text-color-secondary);
  577. }
  578. .points-card__value {
  579. display: block;
  580. font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
  581. font-weight: $uni-font-weight-extra-heavy;
  582. color: var(--color-primary, $brand-primary);
  583. line-height: 1.1;
  584. margin-bottom: 20rpx;
  585. letter-spacing: -2rpx;
  586. }
  587. /* 里程碑进度条 */
  588. .milestone {
  589. display: flex;
  590. flex-direction: column;
  591. }
  592. .milestone__track {
  593. height: 12rpx;
  594. background: var(--border-light, $uni-border-color-light);
  595. border-radius: 999rpx;
  596. overflow: hidden;
  597. margin-bottom: 12rpx;
  598. }
  599. .milestone__fill {
  600. height: 100%;
  601. border-radius: 999rpx;
  602. background: linear-gradient(90deg, var(--color-primary-light, $brand-primary-light), var(--color-primary, $brand-primary));
  603. transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  604. }
  605. .milestone__text {
  606. font-size: calc(24rpx * var(--font-scale, 1));
  607. color: var(--text-secondary, $uni-text-color-secondary);
  608. line-height: 1.5;
  609. }
  610. /* ============================================================
  611. 筛选标签
  612. ============================================================ */
  613. .filter-tabs {
  614. margin: 8rpx 0 16rpx;
  615. white-space: nowrap;
  616. padding: 0 24rpx;
  617. }
  618. .filter-tabs__inner {
  619. display: flex;
  620. gap: 16rpx;
  621. padding: 4rpx 8rpx;
  622. }
  623. .filter-tab {
  624. position: relative;
  625. display: inline-flex;
  626. align-items: center;
  627. padding: 16rpx 28rpx;
  628. border-radius: 999rpx;
  629. background: var(--surface, $app-surface);
  630. border: 2rpx solid var(--border-light, $uni-border-color-light);
  631. font-size: calc(26rpx * var(--font-scale, 1));
  632. font-weight: 500;
  633. color: var(--text-secondary, $uni-text-color-secondary);
  634. transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
  635. flex-shrink: 0;
  636. }
  637. .filter-tab--active {
  638. background: var(--color-primary, $brand-primary);
  639. border-color: var(--color-primary, $brand-primary);
  640. color: $app-surface;
  641. box-shadow: 0 4rpx 16rpx rgba(249,115,22,0.25);
  642. }
  643. .filter-tab:active {
  644. transform: scale(0.96);
  645. }
  646. .filter-tab__count {
  647. display: inline-flex;
  648. align-items: center;
  649. justify-content: center;
  650. min-width: 32rpx;
  651. height: 32rpx;
  652. padding: 0 8rpx;
  653. margin-left: 8rpx;
  654. border-radius: 999rpx;
  655. background: rgba(255, 255, 255, 0.25);
  656. color: inherit;
  657. font-size: calc(20rpx * var(--font-scale, 1));
  658. font-weight: 700;
  659. }
  660. .filter-tab--active .filter-tab__count {
  661. background: rgba(255, 255, 255, 0.3);
  662. color: $app-surface;
  663. }
  664. /* ============================================================
  665. 心愿列表
  666. ============================================================ */
  667. .wish-list {
  668. padding: 8rpx 32rpx 0;
  669. }
  670. .wish-item {
  671. margin-bottom: 24rpx;
  672. }
  673. .wish-list__spacer {
  674. height: 160rpx;
  675. }
  676. /* ============================================================
  677. 心愿卡片(内部布局)
  678. ============================================================ */
  679. .wish-card {
  680. display: flex;
  681. align-items: stretch;
  682. padding: 24rpx;
  683. min-height: 160rpx;
  684. }
  685. /* 左侧 emoji 区域 */
  686. .wish-card__icon-wrap {
  687. display: flex;
  688. align-items: center;
  689. justify-content: center;
  690. width: 96rpx;
  691. min-height: 120rpx;
  692. margin-right: 20rpx;
  693. flex-shrink: 0;
  694. }
  695. .wish-card__emoji {
  696. font-size: calc($uni-font-size-display * var(--font-scale, 1));
  697. line-height: 1;
  698. }
  699. /* 中间内容区域 */
  700. .wish-card__body {
  701. flex: 1;
  702. display: flex;
  703. flex-direction: column;
  704. justify-content: center;
  705. min-width: 0;
  706. padding-right: 8rpx;
  707. }
  708. .wish-card__top {
  709. display: flex;
  710. align-items: center;
  711. justify-content: space-between;
  712. margin-bottom: 8rpx;
  713. gap: 12rpx;
  714. }
  715. .wish-card__title {
  716. font-size: calc(32rpx * var(--font-scale, 1));
  717. font-weight: 700;
  718. color: var(--text, $uni-text-color);
  719. flex: 1;
  720. overflow: hidden;
  721. text-overflow: ellipsis;
  722. white-space: nowrap;
  723. line-height: 1.4;
  724. }
  725. /* 积分行 */
  726. .wish-card__points-row {
  727. display: flex;
  728. align-items: baseline;
  729. margin-bottom: 12rpx;
  730. gap: 6rpx;
  731. }
  732. .wish-card__points-label {
  733. font-size: calc(24rpx * var(--font-scale, 1));
  734. color: var(--text-secondary, $uni-text-color-secondary);
  735. }
  736. .wish-card__points-value {
  737. font-size: calc(40rpx * var(--font-scale, 1));
  738. font-weight: $uni-font-weight-extra-heavy;
  739. color: var(--color-accent, $uni-info);
  740. line-height: 1;
  741. }
  742. .wish-card__points-unit {
  743. font-size: calc(28rpx * var(--font-scale, 1));
  744. color: var(--color-accent, $uni-info);
  745. font-weight: 600;
  746. }
  747. /* 操作区域 */
  748. .wish-card__actions {
  749. display: flex;
  750. align-items: center;
  751. }
  752. /* 状态文本 */
  753. .wish-card__status-text {
  754. display: flex;
  755. align-items: center;
  756. gap: 8rpx;
  757. }
  758. .wish-card__status-emoji {
  759. font-size: calc(28rpx * var(--font-scale, 1));
  760. }
  761. .wish-card__status-msg {
  762. font-size: calc(24rpx * var(--font-scale, 1));
  763. font-weight: 500;
  764. color: var(--text-secondary, $uni-text-color-secondary);
  765. }
  766. .wish-card__status-text--warning .wish-card__status-msg {
  767. color: var(--color-warning, $dim-wealth);
  768. }
  769. .wish-card__status-text--info .wish-card__status-msg {
  770. color: var(--color-accent, $uni-info);
  771. }
  772. .wish-card__status-text--success .wish-card__status-msg {
  773. color: var(--color-success, $status-success-2);
  774. }
  775. .wish-card__status-text--error .wish-card__status-msg {
  776. color: var(--color-error, $status-danger);
  777. }
  778. /* 右侧删除按钮 */
  779. .wish-card__delete {
  780. display: flex;
  781. align-items: center;
  782. justify-content: center;
  783. width: 48rpx;
  784. flex-shrink: 0;
  785. margin-left: 8rpx;
  786. }
  787. .wish-card__delete-icon {
  788. font-size: calc(28rpx * var(--font-scale, 1));
  789. color: var(--muted, $app-text-subtle);
  790. padding: 12rpx;
  791. }
  792. .wish-card__delete-icon:active {
  793. opacity: 0.5;
  794. }
  795. /* ============================================================
  796. 浮动操作按钮 (FAB)
  797. ============================================================ */
  798. .fab {
  799. position: fixed;
  800. right: 40rpx;
  801. bottom: 80rpx;
  802. width: 110rpx;
  803. height: 110rpx;
  804. border-radius: 50%;
  805. display: flex;
  806. align-items: center;
  807. justify-content: center;
  808. background: linear-gradient(145deg, var(--color-primary-light, $brand-primary-light), var(--color-primary, $brand-primary));
  809. border: 4rpx solid var(--border, $uni-border-color);
  810. box-shadow:
  811. inset -3rpx -3rpx 10rpx rgba(255, 255, 255, 0.3),
  812. 4rpx 4rpx 16rpx rgba(249,115,22,0.3);
  813. z-index: 100;
  814. transition: transform 0.15s ease;
  815. }
  816. .fab:active {
  817. transform: scale(0.92);
  818. }
  819. .fab__pulse {
  820. position: absolute;
  821. inset: -8rpx;
  822. border-radius: 50%;
  823. background: rgba(249,115,22,0.15);
  824. animation: pulseGlow 2s ease-in-out infinite;
  825. pointer-events: none;
  826. }
  827. .fab__icon {
  828. font-size: calc($uni-font-size-display * var(--font-scale, 1));
  829. color: $app-surface;
  830. font-weight: 400;
  831. line-height: 1;
  832. margin-top: -4rpx;
  833. }
  834. /* ============================================================
  835. 添加心愿弹窗
  836. ============================================================ */
  837. .modal-overlay {
  838. position: fixed;
  839. inset: 0;
  840. background: rgba(0, 0, 0, 0.45);
  841. z-index: 999;
  842. display: flex;
  843. align-items: flex-end;
  844. justify-content: center;
  845. animation: fadeIn 0.2s ease both;
  846. }
  847. .modal {
  848. width: 100%;
  849. max-height: 80vh;
  850. background: var(--surface, $app-surface);
  851. border-radius: 24rpx 24rpx 0 0;
  852. padding: 40rpx 36rpx;
  853. padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
  854. animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  855. overflow-y: auto;
  856. }
  857. .modal__header {
  858. display: flex;
  859. align-items: center;
  860. justify-content: space-between;
  861. margin-bottom: 36rpx;
  862. }
  863. .modal__title {
  864. font-size: calc(36rpx * var(--font-scale, 1));
  865. font-weight: 700;
  866. color: var(--text, $uni-text-color);
  867. }
  868. .modal__close {
  869. font-size: calc(36rpx * var(--font-scale, 1));
  870. color: var(--muted, $app-text-subtle);
  871. padding: 12rpx;
  872. min-width: 60rpx;
  873. text-align: center;
  874. }
  875. .modal__close:active {
  876. opacity: 0.5;
  877. }
  878. /* 表单组 */
  879. .form-group {
  880. margin-bottom: 32rpx;
  881. }
  882. .form-group__label {
  883. display: block;
  884. font-size: calc(26rpx * var(--font-scale, 1));
  885. font-weight: 600;
  886. color: var(--text, $uni-text-color);
  887. margin-bottom: 16rpx;
  888. }
  889. /* 分类/表情选择器 */
  890. .emoji-grid {
  891. display: grid;
  892. grid-template-columns: repeat(3, 1fr);
  893. gap: 16rpx;
  894. }
  895. .emoji-item {
  896. display: flex;
  897. flex-direction: column;
  898. align-items: center;
  899. padding: 20rpx 12rpx;
  900. border-radius: 24rpx;
  901. background: var(--bg, $uni-bg-color);
  902. border: 2rpx solid var(--border-light, $uni-border-color-light);
  903. transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  904. }
  905. .emoji-item--active {
  906. background: linear-gradient(145deg, $app-surface, var(--bg-grey, $uni-bg-color-grey));
  907. border-color: var(--color-primary, $brand-primary);
  908. box-shadow: 0 4rpx 12rpx rgba(249,115,22,0.15);
  909. }
  910. .emoji-item:active {
  911. transform: scale(0.95);
  912. }
  913. .emoji-item__icon {
  914. font-size: calc(48rpx * var(--font-scale, 1));
  915. margin-bottom: 8rpx;
  916. line-height: 1;
  917. }
  918. .emoji-item__label {
  919. font-size: calc(24rpx * var(--font-scale, 1));
  920. color: var(--text-secondary, $uni-text-color-secondary);
  921. font-weight: 500;
  922. }
  923. .emoji-item--active .emoji-item__label {
  924. color: var(--color-primary, $brand-primary);
  925. font-weight: 600;
  926. }
  927. /* 输入框 */
  928. .form-input {
  929. width: 100%;
  930. background: var(--bg, $uni-bg-color);
  931. border: 2rpx solid var(--border-light, $uni-border-color-light);
  932. border-radius: 24rpx;
  933. padding: 24rpx 28rpx;
  934. font-size: calc(30rpx * var(--font-scale, 1));
  935. color: var(--text, $uni-text-color);
  936. box-sizing: border-box;
  937. }
  938. .form-input--number {
  939. padding-right: 80rpx;
  940. }
  941. .form-input__wrapper {
  942. position: relative;
  943. }
  944. .form-input__suffix {
  945. position: absolute;
  946. right: 28rpx;
  947. top: 50%;
  948. transform: translateY(-50%);
  949. font-size: calc(32rpx * var(--font-scale, 1));
  950. color: var(--color-accent, $uni-info);
  951. font-weight: 700;
  952. }
  953. .form-input__counter {
  954. display: block;
  955. text-align: right;
  956. font-size: calc(22rpx * var(--font-scale, 1));
  957. color: var(--muted, $app-text-subtle);
  958. margin-top: 8rpx;
  959. }
  960. </style>