hookehuyr

fix(奖励页面): 修复页面参数传递问题并优化优惠券列表查询

添加页面参数处理逻辑,确保category和id参数正确传递
更新优惠券列表接口,添加id参数支持
移除未使用的积分攻略展开收起功能
......@@ -19,7 +19,6 @@ declare module 'vue' {
NutDialog: typeof import('@nutui/nutui-taro')['Dialog']
NutImagePreview: typeof import('@nutui/nutui-taro')['ImagePreview']
NutInput: typeof import('@nutui/nutui-taro')['Input']
NutLoading: typeof import('@nutui/nutui-taro')['Loading']
NutPicker: typeof import('@nutui/nutui-taro')['Picker']
NutPopup: typeof import('@nutui/nutui-taro')['Popup']
NutRow: typeof import('@nutui/nutui-taro')['Row']
......
/*
* @Date: 2024-01-01 00:00:00
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-08 12:10:33
* @LastEditTime: 2025-09-08 13:15:39
* @FilePath: /lls_program/src/api/coupon.js
* @Description: 优惠券相关接口
*/
......@@ -46,6 +46,7 @@ export const getPointRangesAPI = (params) => fn(fetch.get(Api.POINT_RANGES, para
/**
* @description: 获取优惠券列表
* @param {Object} params - 查询参数
* @param {string} params.id - 优惠模块ID
* @param {string} params.keyword - 搜索关键词(可选)
* @param {string} params.point_range - 积分范围(可选)
* @param {string} params.sort - 排序字段(可选)ASC=从小到大,DESC=从大到小
......
<!--
* @Date: 2025-08-27 17:47:03
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-08 12:13:02
* @LastEditTime: 2025-09-08 13:36:16
* @FilePath: /lls_program/src/pages/RewardCategories/index.vue
* @Description: 积分兑换分类
-->
......@@ -37,7 +37,7 @@ const categories = ref([]);
const goToRewards = (category) => {
if (!category.tips) {
Taro.navigateTo({ url: '/pages/Rewards/index?category=' + category.id });
Taro.navigateTo({ url: '/pages/Rewards/index?id=' + category.id + '&category=' + category.id });
} else {
// 弹出确认提示框, 不用进行操作, 只是文本提示用户进行线下兑换
Taro.showModal({
......
<!--
* @Date: 2025-08-27 17:47:26
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-09-08 12:25:56
* @LastEditTime: 2025-09-08 13:37:45
* @FilePath: /lls_program/src/pages/Rewards/index.vue
* @Description: 文件描述
-->
......@@ -167,6 +167,12 @@ const totalPoints = ref(0);
const isCreator = ref(false);
const isStrategyExpanded = ref(false); // 积分攻略展开状态,默认收起
// 页面参数
const pageParams = ref({
category: '',
id: ''
});
// API数据状态
const pointRanges = ref([]);
const couponList = ref([]);
......@@ -239,9 +245,9 @@ const handleViewAll = () => {
/**
* 切换积分攻略展开收起状态
*/
const toggleStrategyExpand = () => {
isStrategyExpanded.value = !isStrategyExpanded.value;
};
// const toggleStrategyExpand = () => {
// isStrategyExpanded.value = !isStrategyExpanded.value;
// };
/**
* 获取积分范围
......@@ -271,7 +277,8 @@ const fetchCouponList = async (reset = false) => {
point_range: selectedPoints.value || undefined,
sort: sortOrder.value.toUpperCase(),
page: reset ? 0 : currentPage.value,
limit: 10
limit: 10,
id: pageParams.value.id || undefined
};
const { code, data } = await getCouponListAPI(params);
......@@ -296,6 +303,15 @@ const fetchCouponList = async (reset = false) => {
};
const initData = async () => {
// 获取页面参数
const instance = Taro.getCurrentInstance();
const params = instance.router?.params || {};
pageParams.value = {
category: params.category || '',
id: params.id || ''
};
// 获取用户信息,判断是否为创建者
try {
const { code, data } = await getUserProfileAPI();
......