321
This commit is contained in:
parent
7d07782116
commit
ebed330367
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user