fix(奖励页面): 修复页面参数传递问题并优化优惠券列表查询
添加页面参数处理逻辑,确保category和id参数正确传递 更新优惠券列表接口,添加id参数支持 移除未使用的积分攻略展开收起功能
Showing
4 changed files
with
25 additions
and
9 deletions
| ... | @@ -19,7 +19,6 @@ declare module 'vue' { | ... | @@ -19,7 +19,6 @@ declare module 'vue' { |
| 19 | NutDialog: typeof import('@nutui/nutui-taro')['Dialog'] | 19 | NutDialog: typeof import('@nutui/nutui-taro')['Dialog'] |
| 20 | NutImagePreview: typeof import('@nutui/nutui-taro')['ImagePreview'] | 20 | NutImagePreview: typeof import('@nutui/nutui-taro')['ImagePreview'] |
| 21 | NutInput: typeof import('@nutui/nutui-taro')['Input'] | 21 | NutInput: typeof import('@nutui/nutui-taro')['Input'] |
| 22 | - NutLoading: typeof import('@nutui/nutui-taro')['Loading'] | ||
| 23 | NutPicker: typeof import('@nutui/nutui-taro')['Picker'] | 22 | NutPicker: typeof import('@nutui/nutui-taro')['Picker'] |
| 24 | NutPopup: typeof import('@nutui/nutui-taro')['Popup'] | 23 | NutPopup: typeof import('@nutui/nutui-taro')['Popup'] |
| 25 | NutRow: typeof import('@nutui/nutui-taro')['Row'] | 24 | NutRow: typeof import('@nutui/nutui-taro')['Row'] | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2024-01-01 00:00:00 | 2 | * @Date: 2024-01-01 00:00:00 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-09-08 12:10:33 | 4 | + * @LastEditTime: 2025-09-08 13:15:39 |
| 5 | * @FilePath: /lls_program/src/api/coupon.js | 5 | * @FilePath: /lls_program/src/api/coupon.js |
| 6 | * @Description: 优惠券相关接口 | 6 | * @Description: 优惠券相关接口 |
| 7 | */ | 7 | */ |
| ... | @@ -46,6 +46,7 @@ export const getPointRangesAPI = (params) => fn(fetch.get(Api.POINT_RANGES, para | ... | @@ -46,6 +46,7 @@ export const getPointRangesAPI = (params) => fn(fetch.get(Api.POINT_RANGES, para |
| 46 | /** | 46 | /** |
| 47 | * @description: 获取优惠券列表 | 47 | * @description: 获取优惠券列表 |
| 48 | * @param {Object} params - 查询参数 | 48 | * @param {Object} params - 查询参数 |
| 49 | + * @param {string} params.id - 优惠模块ID | ||
| 49 | * @param {string} params.keyword - 搜索关键词(可选) | 50 | * @param {string} params.keyword - 搜索关键词(可选) |
| 50 | * @param {string} params.point_range - 积分范围(可选) | 51 | * @param {string} params.point_range - 积分范围(可选) |
| 51 | * @param {string} params.sort - 排序字段(可选)ASC=从小到大,DESC=从大到小 | 52 | * @param {string} params.sort - 排序字段(可选)ASC=从小到大,DESC=从大到小 | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-08-27 17:47:03 | 2 | * @Date: 2025-08-27 17:47:03 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-09-08 12:13:02 | 4 | + * @LastEditTime: 2025-09-08 13:36:16 |
| 5 | * @FilePath: /lls_program/src/pages/RewardCategories/index.vue | 5 | * @FilePath: /lls_program/src/pages/RewardCategories/index.vue |
| 6 | * @Description: 积分兑换分类 | 6 | * @Description: 积分兑换分类 |
| 7 | --> | 7 | --> |
| ... | @@ -37,7 +37,7 @@ const categories = ref([]); | ... | @@ -37,7 +37,7 @@ const categories = ref([]); |
| 37 | 37 | ||
| 38 | const goToRewards = (category) => { | 38 | const goToRewards = (category) => { |
| 39 | if (!category.tips) { | 39 | if (!category.tips) { |
| 40 | - Taro.navigateTo({ url: '/pages/Rewards/index?category=' + category.id }); | 40 | + Taro.navigateTo({ url: '/pages/Rewards/index?id=' + category.id + '&category=' + category.id }); |
| 41 | } else { | 41 | } else { |
| 42 | // 弹出确认提示框, 不用进行操作, 只是文本提示用户进行线下兑换 | 42 | // 弹出确认提示框, 不用进行操作, 只是文本提示用户进行线下兑换 |
| 43 | Taro.showModal({ | 43 | Taro.showModal({ | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2025-08-27 17:47:26 | 2 | * @Date: 2025-08-27 17:47:26 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2025-09-08 12:25:56 | 4 | + * @LastEditTime: 2025-09-08 13:37:45 |
| 5 | * @FilePath: /lls_program/src/pages/Rewards/index.vue | 5 | * @FilePath: /lls_program/src/pages/Rewards/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -167,6 +167,12 @@ const totalPoints = ref(0); | ... | @@ -167,6 +167,12 @@ const totalPoints = ref(0); |
| 167 | const isCreator = ref(false); | 167 | const isCreator = ref(false); |
| 168 | const isStrategyExpanded = ref(false); // 积分攻略展开状态,默认收起 | 168 | const isStrategyExpanded = ref(false); // 积分攻略展开状态,默认收起 |
| 169 | 169 | ||
| 170 | +// 页面参数 | ||
| 171 | +const pageParams = ref({ | ||
| 172 | + category: '', | ||
| 173 | + id: '' | ||
| 174 | +}); | ||
| 175 | + | ||
| 170 | // API数据状态 | 176 | // API数据状态 |
| 171 | const pointRanges = ref([]); | 177 | const pointRanges = ref([]); |
| 172 | const couponList = ref([]); | 178 | const couponList = ref([]); |
| ... | @@ -239,9 +245,9 @@ const handleViewAll = () => { | ... | @@ -239,9 +245,9 @@ const handleViewAll = () => { |
| 239 | /** | 245 | /** |
| 240 | * 切换积分攻略展开收起状态 | 246 | * 切换积分攻略展开收起状态 |
| 241 | */ | 247 | */ |
| 242 | -const toggleStrategyExpand = () => { | 248 | +// const toggleStrategyExpand = () => { |
| 243 | - isStrategyExpanded.value = !isStrategyExpanded.value; | 249 | +// isStrategyExpanded.value = !isStrategyExpanded.value; |
| 244 | -}; | 250 | +// }; |
| 245 | 251 | ||
| 246 | /** | 252 | /** |
| 247 | * 获取积分范围 | 253 | * 获取积分范围 |
| ... | @@ -271,7 +277,8 @@ const fetchCouponList = async (reset = false) => { | ... | @@ -271,7 +277,8 @@ const fetchCouponList = async (reset = false) => { |
| 271 | point_range: selectedPoints.value || undefined, | 277 | point_range: selectedPoints.value || undefined, |
| 272 | sort: sortOrder.value.toUpperCase(), | 278 | sort: sortOrder.value.toUpperCase(), |
| 273 | page: reset ? 0 : currentPage.value, | 279 | page: reset ? 0 : currentPage.value, |
| 274 | - limit: 10 | 280 | + limit: 10, |
| 281 | + id: pageParams.value.id || undefined | ||
| 275 | }; | 282 | }; |
| 276 | 283 | ||
| 277 | const { code, data } = await getCouponListAPI(params); | 284 | const { code, data } = await getCouponListAPI(params); |
| ... | @@ -296,6 +303,15 @@ const fetchCouponList = async (reset = false) => { | ... | @@ -296,6 +303,15 @@ const fetchCouponList = async (reset = false) => { |
| 296 | }; | 303 | }; |
| 297 | 304 | ||
| 298 | const initData = async () => { | 305 | const initData = async () => { |
| 306 | + // 获取页面参数 | ||
| 307 | + const instance = Taro.getCurrentInstance(); | ||
| 308 | + const params = instance.router?.params || {}; | ||
| 309 | + | ||
| 310 | + pageParams.value = { | ||
| 311 | + category: params.category || '', | ||
| 312 | + id: params.id || '' | ||
| 313 | + }; | ||
| 314 | + | ||
| 299 | // 获取用户信息,判断是否为创建者 | 315 | // 获取用户信息,判断是否为创建者 |
| 300 | try { | 316 | try { |
| 301 | const { code, data } = await getUserProfileAPI(); | 317 | const { code, data } = await getUserProfileAPI(); | ... | ... |
-
Please register or login to post a comment