From ebed3303671a642794bdf814482da57c3aafdf84 Mon Sep 17 00:00:00 2001 From: gpu Date: Mon, 2 Feb 2026 21:09:46 +0800 Subject: [PATCH] 321 --- honey_box/components/float-ball/FloatBall.vue | 16 +++++++++++++--- honey_box/pages/shouye/index.vue | 10 +++++++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/honey_box/components/float-ball/FloatBall.vue b/honey_box/components/float-ball/FloatBall.vue index 41744d3c..bcff0c30 100644 --- a/honey_box/components/float-ball/FloatBall.vue +++ b/honey_box/components/float-ball/FloatBall.vue @@ -44,14 +44,22 @@ export default { computed: { // 过滤后的悬浮球列表(根据showCouponBall控制优惠券悬浮球显示) displayFloatBalls() { - if (!this.floatBall) return []; - return this.floatBall.filter(item => { + if (!this.floatBall) { + console.log('[FloatBall] floatBall为空'); + return []; + } + console.log('[FloatBall] 计算displayFloatBalls, showCouponBall=', this.showCouponBall, ', floatBall数量=', this.floatBall.length); + const result = this.floatBall.filter(item => { // 如果是优惠券悬浮球,根据showCouponBall决定是否显示 - if (item.link_url && item.link_url.toLowerCase().includes('coupon')) { + const isCouponBall = item.link_url && item.link_url.toLowerCase().includes('coupon'); + if (isCouponBall) { + console.log('[FloatBall] 发现优惠券悬浮球, showCouponBall=', this.showCouponBall, ', 是否显示=', this.showCouponBall); return this.showCouponBall; } return true; }); + console.log('[FloatBall] 过滤后悬浮球数量=', result.length); + return result; }, getBallStyle() { return (item) => { @@ -111,8 +119,10 @@ export default { }, async getFloatBall() { const { status, data, msg } = await this.$request.get("getFloatBall"); + console.log('[FloatBall] getFloatBall响应: status=', status, ', data=', JSON.stringify(data)); if (status == 1) { this.floatBall = data; + console.log('[FloatBall] 设置floatBall, 数量=', data ? data.length : 0); // 通知父组件悬浮球数据已加载 this.$emit('loaded', data); } diff --git a/honey_box/pages/shouye/index.vue b/honey_box/pages/shouye/index.vue index c267662b..68ebad28 100644 --- a/honey_box/pages/shouye/index.vue +++ b/honey_box/pages/shouye/index.vue @@ -265,10 +265,18 @@ async fetchPendingCouponCount() { try { const res = await getPendingCouponCount(); - if (res && res.count !== undefined) { + console.log('获取待领取优惠券数量响应:', JSON.stringify(res)); + // 返回格式: { data: { count: xxx }, status: 1, msg: "success" } + if (res && res.data && res.data.count !== undefined) { + this.pendingCouponCount = res.data.count; + console.log('设置pendingCouponCount (from res.data.count):', this.pendingCouponCount); + } else if (res && res.count !== undefined) { + // 兼容直接返回 { count: xxx } 的格式 this.pendingCouponCount = res.count; + console.log('设置pendingCouponCount (from res.count):', this.pendingCouponCount); } else { this.pendingCouponCount = 0; + console.log('设置pendingCouponCount为0,响应格式不匹配'); } } catch (error) { console.log('获取待领取优惠券数量失败', error);