| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087 |
- <template>
- <view class="page" :style="{ '--font-scale': fontScale }">
- <!-- 加载状态 -->
- <BaseLoading :loading="loading" text="加载心愿中..." />
- <!-- 积分卡片 -->
- <view class="points-card" v-if="!loading">
- <view class="points-card__glow"></view>
- <view class="points-card__inner">
- <view class="points-card__header">
- <text class="points-card__icon">⭐</text>
- <text class="points-card__label">我的积分</text>
- </view>
- <text class="points-card__value">{{ formattedPoints }}</text>
- <view class="milestone">
- <view class="milestone__track">
- <view
- class="milestone__fill"
- :style="{ width: milestoneInfo.progress + '%' }"
- ></view>
- </view>
- <text class="milestone__text">🎯 距离下一个奖励还差 {{ milestoneInfo.remaining }} 分</text>
- </view>
- </view>
- </view>
- <!-- 筛选标签 -->
- <scroll-view
- class="filter-tabs"
- scroll-x="true"
- show-scrollbar="false"
- v-if="!loading && wishes.length > 0"
- >
- <view class="filter-tabs__inner">
- <view
- v-for="tab in filterTabs"
- :key="tab.key"
- class="filter-tab"
- :class="{ 'filter-tab--active': activeFilter === tab.key }"
- @click="onFilterChange(tab.key)"
- >
- <text class="filter-tab__label">{{ tab.emoji }} {{ tab.label }}</text>
- <view class="filter-tab__count" v-if="getFilterCount(tab.key) > 0">{{ getFilterCount(tab.key) }}</view>
- </view>
- </view>
- </scroll-view>
- <!-- 空状态:无任何心愿 -->
- <BaseEmpty
- v-if="!loading && wishes.length === 0"
- icon="🗺️"
- title="还没有心愿呢"
- description="点击 + 添加第一个心愿吧!"
- >
- <template v-slot:action>
- <PlayfulButton variant="clay" size="lg" @click="showAddModal = true">
- ✨ 添加第一个心愿
- </PlayfulButton>
- </template>
- </BaseEmpty>
- <!-- 空状态:筛选后无结果 -->
- <BaseEmpty
- v-else-if="!loading && filteredWishes.length === 0 && wishes.length > 0"
- icon="🔍"
- title="没有找到"
- :description="'还没有' + getActiveTabLabel + '的心愿哦'"
- />
- <!-- 心愿列表(宝箱卡片) -->
- <view class="wish-list" v-if="!loading && wishes.length > 0">
- <view
- v-for="(wish, index) in filteredWishes"
- :key="wish.id"
- class="wish-item"
- :class="['animate-slide-up', 'animate-stagger-' + (index + 1)]"
- >
- <PlayfulCard variant="clay" padding="0" :clickable="false">
- <view class="wish-card">
- <!-- 左侧 emoji 图标 -->
- <view class="wish-card__icon-wrap">
- <text class="wish-card__emoji">{{ getCategoryEmoji(wish.category) }}</text>
- </view>
- <!-- 中间内容 -->
- <view class="wish-card__body">
- <view class="wish-card__top">
- <text class="wish-card__title">{{ wish.title }}</text>
- <BaseBadge :variant="getStatusBadgeVariant(wish.status)" size="xs">
- <text>{{ getStatusEmoji(wish.status) }} {{ wish.statusText || wish.status }}</text>
- </BaseBadge>
- </view>
- <view class="wish-card__points-row">
- <text class="wish-card__points-label">需要</text>
- <text class="wish-card__points-value">{{ wish.pointsRequired || '???' }}</text>
- <text class="wish-card__points-unit">⭐</text>
- </view>
- <!-- 根据不同状态显示操作区域 -->
- <view class="wish-card__actions">
- <!-- draft:等待定价 -->
- <view class="wish-card__status-text" v-if="wish.status === 'draft'">
- <text class="wish-card__status-emoji">⏳</text>
- <text class="wish-card__status-msg">等待妈妈定价中</text>
- </view>
- <!-- active + 积分足够 → 兑换按钮 -->
- <PlayfulButton
- v-if="wish.status === 'active'"
- :variant="canRedeem(wish) ? 'primary' : 'secondary'"
- size="sm"
- :disabled="!canRedeem(wish)"
- @click="onRedeem(wish)"
- >
- {{ canRedeem(wish) ? '🎁 兑换' : '还差 ' + (wish.pointsRequired - currentPoints) + ' ⭐' }}
- </PlayfulButton>
- <!-- pending_exchange:审批中 -->
- <view class="wish-card__status-text wish-card__status-text--warning" v-if="wish.status === 'pending_exchange'">
- <text class="wish-card__status-emoji">⏳</text>
- <text class="wish-card__status-msg">等待妈妈审批</text>
- </view>
- <!-- approved:已批准 -->
- <view class="wish-card__status-text wish-card__status-text--info" v-if="wish.status === 'approved'">
- <text class="wish-card__status-emoji">📦</text>
- <text class="wish-card__status-msg">妈妈准备中</text>
- </view>
- <!-- exchanging:确认收货 -->
- <PlayfulButton
- v-if="wish.status === 'exchanging'"
- variant="success"
- size="sm"
- @click="onConfirmReceived(wish)"
- >
- 📦 确认收货
- </PlayfulButton>
- <!-- fulfilled:已完成 -->
- <view class="wish-card__status-text wish-card__status-text--success" v-if="wish.status === 'fulfilled'">
- <text class="wish-card__status-emoji">🎉</text>
- <text class="wish-card__status-msg">已兑换</text>
- </view>
- <!-- rejected:未通过 -->
- <view class="wish-card__status-text wish-card__status-text--error" v-if="wish.status === 'rejected'">
- <text class="wish-card__status-emoji">😢</text>
- <text class="wish-card__status-msg">未通过</text>
- </view>
- </view>
- </view>
- <!-- 右侧删除按钮(仅可取消状态) -->
- <view
- class="wish-card__delete"
- v-if="wish.status === 'draft' || wish.status === 'active'"
- @click.stop="onDeleteWish(wish)"
- >
- <text class="wish-card__delete-icon">✕</text>
- </view>
- </view>
- </PlayfulCard>
- </view>
- <!-- 底部间距(给 FAB 让位) -->
- <view class="wish-list__spacer"></view>
- </view>
- <!-- 浮动操作按钮 -->
- <view class="fab" @click="showAddModal = true">
- <view class="fab__pulse"></view>
- <text class="fab__icon">+</text>
- </view>
- <!-- 添加心愿弹窗 -->
- <view class="modal-overlay" v-if="showAddModal" @click="closeAddModal">
- <view class="modal" @click.stop>
- <view class="modal__header">
- <text class="modal__title">✨ 添加新心愿</text>
- <text class="modal__close" @click="closeAddModal">✕</text>
- </view>
- <!-- 表情/分类选择 -->
- <view class="form-group">
- <text class="form-group__label">选择分类</text>
- <view class="emoji-grid">
- <view
- v-for="cat in categories"
- :key="cat.value"
- class="emoji-item"
- :class="{ 'emoji-item--active': addForm.category === cat.value }"
- @click="addForm.category = cat.value; addForm.emoji = cat.emoji"
- >
- <text class="emoji-item__icon">{{ cat.emoji }}</text>
- <text class="emoji-item__label">{{ cat.label }}</text>
- </view>
- </view>
- </view>
- <!-- 心愿名称 -->
- <view class="form-group">
- <text class="form-group__label">心愿名称</text>
- <input
- class="form-input"
- v-model="addForm.title"
- placeholder="写下你的心愿吧~"
- maxlength="20"
- @input="onTitleInput"
- />
- <text class="form-input__counter">{{ addForm.title.length }}/20</text>
- </view>
- <!-- 所需积分 -->
- <view class="form-group">
- <text class="form-group__label">所需积分(给妈妈参考)</text>
- <view class="form-input__wrapper">
- <input
- class="form-input form-input--number"
- v-model="addForm.pointsRequired"
- placeholder="建议积分"
- type="number"
- maxlength="4"
- />
- <text class="form-input__suffix">⭐</text>
- </view>
- </view>
- <!-- 提交按钮 -->
- <PlayfulButton variant="clay" size="lg" block :disabled="!canSubmit" @click="onAddWish">
- ✨ 许下心愿
- </PlayfulButton>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- getWishes,
- createWish,
- requestWishExchange,
- confirmWishReceived,
- cancelWish,
- getPointsBalance, reportAppEnter
- } from '../../utils/api.js'
- import PlayfulCard from '../../components/PlayfulCard.vue'
- import PlayfulButton from '../../components/PlayfulButton.vue'
- import BaseBadge from '../../components/BaseBadge.vue'
- import BaseEmpty from '../../components/BaseEmpty.vue'
- import BaseLoading from '../../components/BaseLoading.vue'
- import fontScaleMixin from '@/mixins/font-scale.js'
- export default {
- mixins: [fontScaleMixin],
- components: {
- PlayfulCard,
- PlayfulButton,
- BaseBadge,
- BaseEmpty,
- BaseLoading
- },
- data() {
- return {
- wishes: [],
- currentPoints: 0,
- memberId: '',
- loading: true,
- activeFilter: 'all',
- // 添加心愿弹窗
- showAddModal: false,
- addForm: {
- title: '',
- category: '',
- emoji: '🎁',
- pointsRequired: ''
- },
- submittingWish: false,
- // 筛选标签配置
- filterTabs: [
- { key: 'all', emoji: '📋', label: '全部' },
- { key: 'redeemable', emoji: '🎯', label: '可兑换' },
- { key: 'pending', emoji: '⏳', label: '审核中' },
- { key: 'completed', emoji: '✅', label: '已兑换' },
- { key: 'rejected', emoji: '❌', label: '未通过' }
- ],
- // 分类配置
- categories: [
- { value: '玩具', emoji: '🎮', label: '玩具' },
- { value: '图书', emoji: '📚', label: '图书' },
- { value: '美食', emoji: '🍕', label: '美食' },
- { value: '娱乐', emoji: '🎪', label: '娱乐' },
- { value: '活动', emoji: '🏕️', label: '活动' },
- { value: '其他', emoji: '🎁', label: '其他' }
- ],
- // 状态 → badge 颜色映射
- statusBadgeMap: {
- draft: 'warning',
- active: 'accent',
- pending_exchange: 'warning',
- approved: 'accent',
- exchanging: 'primary',
- fulfilled: 'success',
- rejected: 'error'
- },
- // 状态 → emoji 映射
- statusEmojiMap: {
- draft: '⏳',
- active: '🎯',
- pending_exchange: '⏳',
- approved: '📦',
- exchanging: '🚚',
- fulfilled: '✅',
- rejected: '😢'
- },
- // 分类 → emoji 映射
- categoryEmojiMap: {
- '玩具': '🎮',
- '图书': '📚',
- '美食': '🍕',
- '娱乐': '🎪',
- '活动': '🏕️',
- '其他': '🎁'
- },
- // 用于触发列表重绘(筛选切换时重新触发动画)
- listKey: 0
- }
- },
- computed: {
- formattedPoints() {
- if (!this.currentPoints) return '0'
- return this.currentPoints.toLocaleString()
- },
- milestoneInfo() {
- const step = 200
- const current = this.currentPoints || 0
- const next = Math.ceil(current / step) * step
- const remaining = next - current
- const progress = step > 0 ? (current % step) / step * 100 : 0
- return { nextMilestone: next, remaining, progress }
- },
- filteredWishes() {
- return this.getFilteredWishes(this.activeFilter)
- },
- getActiveTabLabel() {
- var activeFilter = this.activeFilter
- var tab = this.filterTabs.find(function(t) { return t.key === activeFilter })
- return tab ? tab.label : ''
- },
- canSubmit() {
- var title = this.addForm.title || ''
- return title.trim().length > 0 && !this.submittingWish
- }
- },
- onShow() {
- reportAppEnter('wish');
-
- this.loadData()
- },
- methods: {
- async loadData() {
- this.loading = true
- var currentRole
- var results
- try {
- currentRole = uni.getStorageSync('currentRole') || uni.getStorageSync('role')
- if (currentRole !== 'child') {
- uni.reLaunch({ url: '/pages/index-home/index' })
- return
- }
- this.memberId = uni.getStorageSync('currentChildId') || uni.getStorageSync('userId')
- // 并行获取心愿列表和积分
- results = await Promise.all([
- getWishes({ memberId: this.memberId }),
- getPointsBalance(this.memberId)
- ])
- this.wishes = (results[0] && results[0].data) || []
- this.currentPoints = (results[1] && results[1].data && results[1].data.balance) || 0
- } catch (e) {
- console.error('加载心愿列表失败', e)
- uni.showToast({ title: '加载失败', icon: 'none' })
- } finally {
- this.loading = false
- }
- },
- // 筛选切换(触发重动画)
- onFilterChange(key) {
- this.activeFilter = key
- this.listKey++
- },
- getFilteredWishes(filterKey) {
- var list = this.wishes || []
- if (filterKey === 'all') return list
- if (filterKey === 'redeemable') {
- return list.filter(function(w) {
- return w.status === 'active'
- })
- }
- if (filterKey === 'pending') {
- return list.filter(function(w) {
- return w.status === 'draft' || w.status === 'pending_exchange'
- })
- }
- if (filterKey === 'completed') {
- return list.filter(function(w) {
- return w.status === 'fulfilled' || w.status === 'exchanging' || w.status === 'approved'
- })
- }
- if (filterKey === 'rejected') {
- return list.filter(function(w) {
- return w.status === 'rejected'
- })
- }
- return list
- },
- getFilterCount(filterKey) {
- return this.getFilteredWishes(filterKey).length
- },
- canRedeem(wish) {
- return this.currentPoints >= (wish.pointsRequired || 0)
- },
- getCategoryEmoji(category) {
- var map = this.categoryEmojiMap
- if (category && map[category]) {
- return map[category]
- }
- return '🎁'
- },
- getStatusBadgeVariant(status) {
- var map = this.statusBadgeMap
- return (status && map[status]) || 'muted'
- },
- getStatusEmoji(status) {
- var map = this.statusEmojiMap
- return (status && map[status]) || '📋'
- },
- // 兑换操作
- onRedeem(wish) {
- var self = this
- uni.showModal({
- title: '兑换心愿',
- content: '确定要兑换"' + wish.title + '"吗?\n将消耗 ' + wish.pointsRequired + ' 积分',
- success: function(res) {
- if (res.confirm) {
- self.doRedeem(wish)
- }
- }
- })
- },
- async doRedeem(wish) {
- try {
- await requestWishExchange(wish.id)
- uni.showToast({ title: '已提交申请 🎉', icon: 'success' })
- this.loadData()
- } catch (e) {
- uni.showToast({ title: e.message || '申请失败', icon: 'none' })
- }
- },
- // 确认收货
- onConfirmReceived(wish) {
- var self = this
- uni.showModal({
- title: '确认收货',
- content: '确定已收到"' + wish.title + '"吗?',
- success: function(res) {
- if (res.confirm) {
- self.doConfirmReceived(wish)
- }
- }
- })
- },
- async doConfirmReceived(wish) {
- try {
- await confirmWishReceived(wish.id)
- uni.showToast({ title: '心愿完成!🎉', icon: 'success' })
- this.loadData()
- } catch (e) {
- uni.showToast({ title: '确认失败', icon: 'none' })
- }
- },
- // 删除/取消心愿
- onDeleteWish(wish) {
- var self = this
- uni.showModal({
- title: '取消心愿',
- content: '确定要取消"' + wish.title + '"吗?',
- success: function(res) {
- if (res.confirm) {
- self.doDeleteWish(wish)
- }
- }
- })
- },
- async doDeleteWish(wish) {
- try {
- await cancelWish(wish.id, '不想兑换了')
- uni.showToast({ title: '已取消', icon: 'success' })
- this.loadData()
- } catch (e) {
- uni.showToast({ title: '取消失败', icon: 'none' })
- }
- },
- // 添加心愿弹窗
- closeAddModal() {
- this.showAddModal = false
- this.resetAddForm()
- },
- resetAddForm() {
- this.addForm = {
- title: '',
- category: '',
- emoji: '🎁',
- pointsRequired: ''
- }
- },
- onTitleInput() {
- // 仅用于触发字符计数更新(vue 双向绑定已处理)
- },
- async onAddWish() {
- if (!this.canSubmit) return
- var title = (this.addForm.title || '').trim()
- if (!title) {
- uni.showToast({ title: '请输入心愿名称', icon: 'none' })
- return
- }
- this.submittingWish = true
- var data
- try {
- data = {
- memberId: this.memberId,
- title: title,
- category: this.addForm.category || '其他'
- }
- // 如果填写了积分建议,一并提交
- if (this.addForm.pointsRequired) {
- data.pointsRequired = parseInt(this.addForm.pointsRequired, 10) || 0
- }
- await createWish(data)
- uni.showToast({ title: '心愿已许下 ✨', icon: 'success' })
- this.closeAddModal()
- this.loadData()
- } catch (e) {
- uni.showToast({ title: e.message || '添加失败', icon: 'none' })
- } finally {
- this.submittingWish = false
- }
- }
- }
- }
- </script>
- <style scoped lang="scss">
- /* ============================================================
- 页面容器
- ============================================================ */
- .page {
- min-height: 100vh;
- background: var(--bg, $uni-bg-color);
- padding-bottom: 180rpx;
- }
- /* ============================================================
- 积分卡片
- ============================================================ */
- .points-card {
- position: relative;
- margin: 24rpx 32rpx 16rpx;
- border-radius: 24rpx;
- overflow: hidden;
- }
- .points-card__glow {
- position: absolute;
- top: -50%;
- right: -30%;
- width: 300rpx;
- height: 300rpx;
- background: radial-gradient(circle, rgba(249,115,22,0.15), transparent 70%);
- pointer-events: none;
- }
- .points-card__inner {
- position: relative;
- padding: 32rpx 36rpx 28rpx;
- border-radius: 24rpx;
- border: 4rpx solid var(--border, $uni-border-color);
- background: linear-gradient(145deg, $app-surface, var(--bg-grey, $uni-bg-color-grey));
- box-shadow:
- inset -4rpx -4rpx 12rpx rgba(249,115,22,0.05),
- 6rpx 6rpx 18rpx rgba(249,115,22,0.10);
- }
- .points-card__header {
- display: flex;
- align-items: center;
- margin-bottom: 12rpx;
- }
- .points-card__icon {
- font-size: calc(36rpx * var(--font-scale, 1));
- margin-right: 12rpx;
- }
- .points-card__label {
- font-size: calc(28rpx * var(--font-scale, 1));
- font-weight: 600;
- color: var(--text-secondary, $uni-text-color-secondary);
- }
- .points-card__value {
- display: block;
- font-size: calc($uni-font-size-5xl * var(--font-scale, 1));
- font-weight: $uni-font-weight-extra-heavy;
- color: var(--color-primary, $brand-primary);
- line-height: 1.1;
- margin-bottom: 20rpx;
- letter-spacing: -2rpx;
- }
- /* 里程碑进度条 */
- .milestone {
- display: flex;
- flex-direction: column;
- }
- .milestone__track {
- height: 12rpx;
- background: var(--border-light, $uni-border-color-light);
- border-radius: 999rpx;
- overflow: hidden;
- margin-bottom: 12rpx;
- }
- .milestone__fill {
- height: 100%;
- border-radius: 999rpx;
- background: linear-gradient(90deg, var(--color-primary-light, $brand-primary-light), var(--color-primary, $brand-primary));
- transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
- }
- .milestone__text {
- font-size: calc(24rpx * var(--font-scale, 1));
- color: var(--text-secondary, $uni-text-color-secondary);
- line-height: 1.5;
- }
- /* ============================================================
- 筛选标签
- ============================================================ */
- .filter-tabs {
- margin: 8rpx 0 16rpx;
- white-space: nowrap;
- padding: 0 24rpx;
- }
- .filter-tabs__inner {
- display: flex;
- gap: 16rpx;
- padding: 4rpx 8rpx;
- }
- .filter-tab {
- position: relative;
- display: inline-flex;
- align-items: center;
- padding: 16rpx 28rpx;
- border-radius: 999rpx;
- background: var(--surface, $app-surface);
- border: 2rpx solid var(--border-light, $uni-border-color-light);
- font-size: calc(26rpx * var(--font-scale, 1));
- font-weight: 500;
- color: var(--text-secondary, $uni-text-color-secondary);
- transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
- flex-shrink: 0;
- }
- .filter-tab--active {
- background: var(--color-primary, $brand-primary);
- border-color: var(--color-primary, $brand-primary);
- color: $app-surface;
- box-shadow: 0 4rpx 16rpx rgba(249,115,22,0.25);
- }
- .filter-tab:active {
- transform: scale(0.96);
- }
- .filter-tab__count {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- min-width: 32rpx;
- height: 32rpx;
- padding: 0 8rpx;
- margin-left: 8rpx;
- border-radius: 999rpx;
- background: rgba(255, 255, 255, 0.25);
- color: inherit;
- font-size: calc(20rpx * var(--font-scale, 1));
- font-weight: 700;
- }
- .filter-tab--active .filter-tab__count {
- background: rgba(255, 255, 255, 0.3);
- color: $app-surface;
- }
- /* ============================================================
- 心愿列表
- ============================================================ */
- .wish-list {
- padding: 8rpx 32rpx 0;
- }
- .wish-item {
- margin-bottom: 24rpx;
- }
- .wish-list__spacer {
- height: 160rpx;
- }
- /* ============================================================
- 心愿卡片(内部布局)
- ============================================================ */
- .wish-card {
- display: flex;
- align-items: stretch;
- padding: 24rpx;
- min-height: 160rpx;
- }
- /* 左侧 emoji 区域 */
- .wish-card__icon-wrap {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 96rpx;
- min-height: 120rpx;
- margin-right: 20rpx;
- flex-shrink: 0;
- }
- .wish-card__emoji {
- font-size: calc($uni-font-size-display * var(--font-scale, 1));
- line-height: 1;
- }
- /* 中间内容区域 */
- .wish-card__body {
- flex: 1;
- display: flex;
- flex-direction: column;
- justify-content: center;
- min-width: 0;
- padding-right: 8rpx;
- }
- .wish-card__top {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 8rpx;
- gap: 12rpx;
- }
- .wish-card__title {
- font-size: calc(32rpx * var(--font-scale, 1));
- font-weight: 700;
- color: var(--text, $uni-text-color);
- flex: 1;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- line-height: 1.4;
- }
- /* 积分行 */
- .wish-card__points-row {
- display: flex;
- align-items: baseline;
- margin-bottom: 12rpx;
- gap: 6rpx;
- }
- .wish-card__points-label {
- font-size: calc(24rpx * var(--font-scale, 1));
- color: var(--text-secondary, $uni-text-color-secondary);
- }
- .wish-card__points-value {
- font-size: calc(40rpx * var(--font-scale, 1));
- font-weight: $uni-font-weight-extra-heavy;
- color: var(--color-accent, $uni-info);
- line-height: 1;
- }
- .wish-card__points-unit {
- font-size: calc(28rpx * var(--font-scale, 1));
- color: var(--color-accent, $uni-info);
- font-weight: 600;
- }
- /* 操作区域 */
- .wish-card__actions {
- display: flex;
- align-items: center;
- }
- /* 状态文本 */
- .wish-card__status-text {
- display: flex;
- align-items: center;
- gap: 8rpx;
- }
- .wish-card__status-emoji {
- font-size: calc(28rpx * var(--font-scale, 1));
- }
- .wish-card__status-msg {
- font-size: calc(24rpx * var(--font-scale, 1));
- font-weight: 500;
- color: var(--text-secondary, $uni-text-color-secondary);
- }
- .wish-card__status-text--warning .wish-card__status-msg {
- color: var(--color-warning, $dim-wealth);
- }
- .wish-card__status-text--info .wish-card__status-msg {
- color: var(--color-accent, $uni-info);
- }
- .wish-card__status-text--success .wish-card__status-msg {
- color: var(--color-success, $status-success-2);
- }
- .wish-card__status-text--error .wish-card__status-msg {
- color: var(--color-error, $status-danger);
- }
- /* 右侧删除按钮 */
- .wish-card__delete {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 48rpx;
- flex-shrink: 0;
- margin-left: 8rpx;
- }
- .wish-card__delete-icon {
- font-size: calc(28rpx * var(--font-scale, 1));
- color: var(--muted, $app-text-subtle);
- padding: 12rpx;
- }
- .wish-card__delete-icon:active {
- opacity: 0.5;
- }
- /* ============================================================
- 浮动操作按钮 (FAB)
- ============================================================ */
- .fab {
- position: fixed;
- right: 40rpx;
- bottom: 80rpx;
- width: 110rpx;
- height: 110rpx;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- background: linear-gradient(145deg, var(--color-primary-light, $brand-primary-light), var(--color-primary, $brand-primary));
- border: 4rpx solid var(--border, $uni-border-color);
- box-shadow:
- inset -3rpx -3rpx 10rpx rgba(255, 255, 255, 0.3),
- 4rpx 4rpx 16rpx rgba(249,115,22,0.3);
- z-index: 100;
- transition: transform 0.15s ease;
- }
- .fab:active {
- transform: scale(0.92);
- }
- .fab__pulse {
- position: absolute;
- inset: -8rpx;
- border-radius: 50%;
- background: rgba(249,115,22,0.15);
- animation: pulseGlow 2s ease-in-out infinite;
- pointer-events: none;
- }
- .fab__icon {
- font-size: calc($uni-font-size-display * var(--font-scale, 1));
- color: $app-surface;
- font-weight: 400;
- line-height: 1;
- margin-top: -4rpx;
- }
- /* ============================================================
- 添加心愿弹窗
- ============================================================ */
- .modal-overlay {
- position: fixed;
- inset: 0;
- background: rgba(0, 0, 0, 0.45);
- z-index: 999;
- display: flex;
- align-items: flex-end;
- justify-content: center;
- animation: fadeIn 0.2s ease both;
- }
- .modal {
- width: 100%;
- max-height: 80vh;
- background: var(--surface, $app-surface);
- border-radius: 24rpx 24rpx 0 0;
- padding: 40rpx 36rpx;
- padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
- animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
- overflow-y: auto;
- }
- .modal__header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- margin-bottom: 36rpx;
- }
- .modal__title {
- font-size: calc(36rpx * var(--font-scale, 1));
- font-weight: 700;
- color: var(--text, $uni-text-color);
- }
- .modal__close {
- font-size: calc(36rpx * var(--font-scale, 1));
- color: var(--muted, $app-text-subtle);
- padding: 12rpx;
- min-width: 60rpx;
- text-align: center;
- }
- .modal__close:active {
- opacity: 0.5;
- }
- /* 表单组 */
- .form-group {
- margin-bottom: 32rpx;
- }
- .form-group__label {
- display: block;
- font-size: calc(26rpx * var(--font-scale, 1));
- font-weight: 600;
- color: var(--text, $uni-text-color);
- margin-bottom: 16rpx;
- }
- /* 分类/表情选择器 */
- .emoji-grid {
- display: grid;
- grid-template-columns: repeat(3, 1fr);
- gap: 16rpx;
- }
- .emoji-item {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 20rpx 12rpx;
- border-radius: 24rpx;
- background: var(--bg, $uni-bg-color);
- border: 2rpx solid var(--border-light, $uni-border-color-light);
- transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
- }
- .emoji-item--active {
- background: linear-gradient(145deg, $app-surface, var(--bg-grey, $uni-bg-color-grey));
- border-color: var(--color-primary, $brand-primary);
- box-shadow: 0 4rpx 12rpx rgba(249,115,22,0.15);
- }
- .emoji-item:active {
- transform: scale(0.95);
- }
- .emoji-item__icon {
- font-size: calc(48rpx * var(--font-scale, 1));
- margin-bottom: 8rpx;
- line-height: 1;
- }
- .emoji-item__label {
- font-size: calc(24rpx * var(--font-scale, 1));
- color: var(--text-secondary, $uni-text-color-secondary);
- font-weight: 500;
- }
- .emoji-item--active .emoji-item__label {
- color: var(--color-primary, $brand-primary);
- font-weight: 600;
- }
- /* 输入框 */
- .form-input {
- width: 100%;
- background: var(--bg, $uni-bg-color);
- border: 2rpx solid var(--border-light, $uni-border-color-light);
- border-radius: 24rpx;
- padding: 24rpx 28rpx;
- font-size: calc(30rpx * var(--font-scale, 1));
- color: var(--text, $uni-text-color);
- box-sizing: border-box;
- }
- .form-input--number {
- padding-right: 80rpx;
- }
- .form-input__wrapper {
- position: relative;
- }
- .form-input__suffix {
- position: absolute;
- right: 28rpx;
- top: 50%;
- transform: translateY(-50%);
- font-size: calc(32rpx * var(--font-scale, 1));
- color: var(--color-accent, $uni-info);
- font-weight: 700;
- }
- .form-input__counter {
- display: block;
- text-align: right;
- font-size: calc(22rpx * var(--font-scale, 1));
- color: var(--muted, $app-text-subtle);
- margin-top: 8rpx;
- }
- </style>
|