feat(兑换中心): 重构兑换中心页面并优化导航结构
- 修改导航栏标题为"兑换中心"和"积分兑换" - 将底部导航的兑换链接指向RewardCategories页面 - 移除页面头部组件,使用原生样式 - 增加积分选择高亮效果和排序功能 - 添加兑换详情页跳转功能 - 新增券详情图片资源
Showing
6 changed files
with
75 additions
and
13 deletions
src/assets/images/券详情.png
0 → 100644
157 KB
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-08-27 17:44:10 | 2 | * @Date: 2025-08-27 17:44:10 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-08-27 23:10:28 | 4 | + * @LastEditTime: 2025-08-27 23:55:50 |
| 5 | * @FilePath: /lls_program/src/components/BottomNav.vue | 5 | * @FilePath: /lls_program/src/components/BottomNav.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -31,7 +31,7 @@ import meIcon from '@/assets/images/icon/me.svg'; | ... | @@ -31,7 +31,7 @@ import meIcon from '@/assets/images/icon/me.svg'; |
| 31 | const navItems = shallowRef([ | 31 | const navItems = shallowRef([ |
| 32 | { path: '/pages/Dashboard/index', icon: homeIcon, label: '首页' }, | 32 | { path: '/pages/Dashboard/index', icon: homeIcon, label: '首页' }, |
| 33 | { path: '/pages/Activities/index', icon: activitiesIcon, label: '活动' }, | 33 | { path: '/pages/Activities/index', icon: activitiesIcon, label: '活动' }, |
| 34 | - { path: '/pages/Rewards/index', icon: rewardsIcon, label: '兑换' }, | 34 | + { path: '/pages/RewardCategories/index', icon: rewardsIcon, label: '兑换' }, |
| 35 | { path: '/pages/Profile/index', icon: meIcon, label: '我的' }, | 35 | { path: '/pages/Profile/index', icon: meIcon, label: '我的' }, |
| 36 | ]); | 36 | ]); |
| 37 | 37 | ... | ... |
| 1 | +/* | ||
| 2 | + * @Date: 2025-08-27 18:25:39 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2025-08-27 23:58:29 | ||
| 5 | + * @FilePath: /lls_program/src/pages/RewardCategories/index.config.js | ||
| 6 | + * @Description: 文件描述 | ||
| 7 | + */ | ||
| 1 | export default { | 8 | export default { |
| 2 | - navigationBarTitleText: '首页' | 9 | + navigationBarTitleText: '积分兑换' |
| 3 | } | 10 | } | ... | ... |
| 1 | <template> | 1 | <template> |
| 2 | <view class="min-h-screen flex flex-col bg-white"> | 2 | <view class="min-h-screen flex flex-col bg-white"> |
| 3 | - <AppHeader title="积分兑换" :showBack="false" /> | 3 | + <!-- <AppHeader title="积分兑换" :showBack="false" /> --> |
| 4 | <view class="flex-1 pb-20"> | 4 | <view class="flex-1 pb-20"> |
| 5 | <view class="p-4 space-y-4"> | 5 | <view class="p-4 space-y-4"> |
| 6 | <view v-for="category in categories" :key="category.id" class="rounded-lg overflow-hidden shadow-sm" @click="goToRewards"> | 6 | <view v-for="category in categories" :key="category.id" class="rounded-lg overflow-hidden shadow-sm" @click="goToRewards"> | ... | ... |
| 1 | +<!-- | ||
| 2 | + * @Date: 2025-08-27 17:47:26 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2025-08-28 00:10:13 | ||
| 5 | + * @FilePath: /lls_program/src/pages/Rewards/index.vue | ||
| 6 | + * @Description: 文件描述 | ||
| 7 | +--> | ||
| 8 | +<!-- | ||
| 9 | + * @Date: 2025-08-27 17:47:26 | ||
| 10 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 11 | + * @LastEditTime: 2025-08-27 23:57:38 | ||
| 12 | + * @FilePath: /lls_program/src/pages/Rewards/index.vue | ||
| 13 | + * @Description: 文件描述 | ||
| 14 | +--> | ||
| 1 | <template> | 15 | <template> |
| 2 | <view class="min-h-screen flex flex-col bg-white"> | 16 | <view class="min-h-screen flex flex-col bg-white"> |
| 3 | <!-- Blue header background --> | 17 | <!-- Blue header background --> |
| 4 | <view class="bg-blue-500 h-48 absolute w-full top-0 left-0 z-0"></view> | 18 | <view class="bg-blue-500 h-48 absolute w-full top-0 left-0 z-0"></view> |
| 5 | - <AppHeader title="兑换中心" :showBack="false" /> | 19 | + <!-- <AppHeader title="兑换中心" :showBack="false" /> --> |
| 6 | <!-- Content --> | 20 | <!-- Content --> |
| 7 | <view class="relative z-10 flex-1 pb-20"> | 21 | <view class="relative z-10 flex-1 pb-20"> |
| 8 | <!-- Points display --> | 22 | <!-- Points display --> |
| ... | @@ -14,14 +28,30 @@ | ... | @@ -14,14 +28,30 @@ |
| 14 | <view class="bg-white rounded-t-3xl px-4 pt-5"> | 28 | <view class="bg-white rounded-t-3xl px-4 pt-5"> |
| 15 | <!-- Quick exchange options --> | 29 | <!-- Quick exchange options --> |
| 16 | <view class="flex gap-3 mb-6"> | 30 | <view class="flex gap-3 mb-6"> |
| 17 | - <button v-for="option in quickExchangeOptions" :key="option.points" class="flex-1 py-3 bg-white border border-gray-200 rounded-lg text-center text-gray-700"> | 31 | + <view |
| 32 | + v-for="option in quickExchangeOptions" | ||
| 33 | + :key="option.points" | ||
| 34 | + @click="selectedPoints = option.points" | ||
| 35 | + :class="[ | ||
| 36 | + 'flex-1 py-3 rounded-lg border text-center', | ||
| 37 | + selectedPoints === option.points | ||
| 38 | + ? 'border-blue-500 bg-blue-50 text-blue-500' | ||
| 39 | + : 'border-gray-200 text-gray-700' | ||
| 40 | + ]" | ||
| 41 | + > | ||
| 18 | {{ option.label }} | 42 | {{ option.label }} |
| 19 | - </button> | ||
| 20 | </view> | 43 | </view> |
| 21 | - <h3 class="text-lg font-medium mb-4">可兑换列表</h3> | 44 | + </view> |
| 45 | + <view class="flex justify-between items-center mb-4"> | ||
| 46 | + <h3 class="text-lg font-medium">可兑换列表</h3> | ||
| 47 | + <view class="flex items-center text-gray-500 text-sm" @click="toggleSortOrder"> | ||
| 48 | + <span class="mr-1">{{ sortOrder === 'desc' ? '从高到低排列' : '从低到高排列' }}</span> | ||
| 49 | + <ScreenLittle /> | ||
| 50 | + </view> | ||
| 51 | + </view> | ||
| 22 | <!-- Rewards list --> | 52 | <!-- Rewards list --> |
| 23 | <view class="space-y-4"> | 53 | <view class="space-y-4"> |
| 24 | - <view v-for="reward in rewardItems" :key="reward.id" class="flex items-center border-b border-gray-100 pb-4"> | 54 | + <view v-for="reward in sortedRewardItems" :key="reward.id" class="flex items-center border-b border-gray-100 pb-4"> |
| 25 | <view class="w-12 h-12 mr-4 flex-shrink-0"> | 55 | <view class="w-12 h-12 mr-4 flex-shrink-0"> |
| 26 | <image :src="reward.logo" :alt="reward.title" class="w-full h-full object-contain" /> | 56 | <image :src="reward.logo" :alt="reward.title" class="w-full h-full object-contain" /> |
| 27 | </view> | 57 | </view> |
| ... | @@ -29,9 +59,9 @@ | ... | @@ -29,9 +59,9 @@ |
| 29 | <h4 class="font-medium">{{ reward.title }}</h4> | 59 | <h4 class="font-medium">{{ reward.title }}</h4> |
| 30 | <p class="text-gray-500 text-sm">{{ reward.points }}积分</p> | 60 | <p class="text-gray-500 text-sm">{{ reward.points }}积分</p> |
| 31 | </view> | 61 | </view> |
| 32 | - <button class="px-4 py-1 bg-blue-500 text-white rounded-full text-sm"> | 62 | + <view class="px-4 py-1 bg-blue-500 text-white rounded-full text-sm" @click="goToRewardDetail(reward)"> |
| 33 | 兑换 | 63 | 兑换 |
| 34 | - </button> | 64 | + </view> |
| 35 | </view> | 65 | </view> |
| 36 | </view> | 66 | </view> |
| 37 | </view> | 67 | </view> |
| ... | @@ -41,10 +71,29 @@ | ... | @@ -41,10 +71,29 @@ |
| 41 | </template> | 71 | </template> |
| 42 | 72 | ||
| 43 | <script setup> | 73 | <script setup> |
| 44 | -import { ref } from 'vue'; | 74 | +import { ref, computed } from 'vue'; |
| 75 | +import Taro from '@tarojs/taro'; | ||
| 76 | +import { ScreenLittle } from '@nutui/icons-vue-taro'; | ||
| 45 | import AppHeader from '../../components/AppHeader.vue'; | 77 | import AppHeader from '../../components/AppHeader.vue'; |
| 46 | import BottomNav from '../../components/BottomNav.vue'; | 78 | import BottomNav from '../../components/BottomNav.vue'; |
| 47 | 79 | ||
| 80 | +const selectedPoints = ref(null); | ||
| 81 | +const sortOrder = ref('desc'); // 'asc' or 'desc' | ||
| 82 | + | ||
| 83 | +const sortedRewardItems = computed(() => { | ||
| 84 | + return [...rewardItems.value].sort((a, b) => { | ||
| 85 | + if (sortOrder.value === 'asc') { | ||
| 86 | + return a.points - b.points; | ||
| 87 | + } else { | ||
| 88 | + return b.points - a.points; | ||
| 89 | + } | ||
| 90 | + }); | ||
| 91 | +}); | ||
| 92 | + | ||
| 93 | +const toggleSortOrder = () => { | ||
| 94 | + sortOrder.value = sortOrder.value === 'asc' ? 'desc' : 'asc'; | ||
| 95 | +}; | ||
| 96 | + | ||
| 48 | const rewardItems = ref([ | 97 | const rewardItems = ref([ |
| 49 | { | 98 | { |
| 50 | id: 1, | 99 | id: 1, |
| ... | @@ -83,4 +132,10 @@ const quickExchangeOptions = ref([ | ... | @@ -83,4 +132,10 @@ const quickExchangeOptions = ref([ |
| 83 | { points: 1000, label: '1000分可兑' }, | 132 | { points: 1000, label: '1000分可兑' }, |
| 84 | { points: 100, label: '100分可兑' } | 133 | { points: 100, label: '100分可兑' } |
| 85 | ]); | 134 | ]); |
| 135 | + | ||
| 136 | +const goToRewardDetail = (reward) => { | ||
| 137 | + Taro.navigateTo({ | ||
| 138 | + url: `/pages/RewardDetail/index?id=${reward.id}` | ||
| 139 | + }); | ||
| 140 | +}; | ||
| 86 | </script> | 141 | </script> | ... | ... |
-
Please register or login to post a comment