This commit is contained in:
gpu 2026-02-02 21:09:46 +08:00
parent 7d07782116
commit ebed330367
2 changed files with 22 additions and 4 deletions

View File

@ -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);
}

View File

@ -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);