This commit is contained in:
gpu 2026-02-02 20:41:41 +08:00
parent 21c9bf7201
commit 7d07782116
2 changed files with 31 additions and 55 deletions

View File

@ -2,7 +2,7 @@
<view>
<!-- 悬浮球 -->
<template v-if="floatBall">
<view v-for="(item, index) in floatBall" :style="[getBallStyle(item)]" :key="index" class="group-fixed1"
<view v-for="(item, index) in displayFloatBalls" :style="[getBallStyle(item)]" :key="index" class="group-fixed1"
@click="BallClick(item)">
<image :src="item.image"></image>
</view>
@ -28,6 +28,13 @@
<script>
export default {
name: 'FloatBall',
props: {
//
showCouponBall: {
type: Boolean,
default: true
}
},
data() {
return {
floatBall: [],
@ -35,6 +42,17 @@ export default {
}
},
computed: {
// showCouponBall
displayFloatBalls() {
if (!this.floatBall) return [];
return this.floatBall.filter(item => {
// showCouponBall
if (item.link_url && item.link_url.toLowerCase().includes('coupon')) {
return this.showCouponBall;
}
return true;
});
},
getBallStyle() {
return (item) => {
let s = {
@ -76,6 +94,12 @@ export default {
},
methods: {
BallClick(item) {
// -
if (item.link_url && item.link_url.toLowerCase().includes('coupon')) {
this.$emit('coupon-click', item);
return;
}
if (item.type == 2) {
this.$c.nav(item.link_url);
return;
@ -89,6 +113,8 @@ export default {
const { status, data, msg } = await this.$request.get("getFloatBall");
if (status == 1) {
this.floatBall = data;
//
this.$emit('loaded', data);
}
}
},

View File

@ -5,15 +5,6 @@
-->
<template>
<view class="content">
<!-- 待领取优惠券悬浮球 - Requirements 1.1.0 -->
<view
v-if="pendingCouponCount > 0"
class="coupon-float-ball"
@tap="onPendingCouponClick"
>
<image :src="couponFloatBallImage || 'https://youdas-1308826010.cos.ap-shanghai.myqcloud.com/static/web/static/common/quan.png'" class="coupon-ball-icon" mode="aspectFit"></image>
</view>
<view class="navLeft align-center" :style="{ top: statusBarHeight + 'px' }" @tap="jumapSlots()">
<view class="flex column" style="width: 100%">
<view class="title1 row" style="height: 64rpx; margin-top: 5rpx;">
@ -135,7 +126,7 @@
</uni-popup>
<rule-pop ref="rulePop"></rule-pop>
<rule-pop ref="appNotice" notice-check></rule-pop>
<float-ball v-if="!$config.GetVersion()"></float-ball>
<float-ball v-if="!$config.GetVersion()" :show-coupon-ball="pendingCouponCount > 0" @coupon-click="onCouponFloatBallClick"></float-ball>
<!-- #ifdef MP -->
<!-- 隐私政策弹窗 -->
@ -158,8 +149,7 @@
import PrizeDetailPopup from "@/components/prize-detail-popup/prize-detail-popup.vue";
import {
getAdvert,
getDanYe,
getFloatBall
getDanYe
} from "@/common/server/config";
import {
getGoodsList
@ -210,7 +200,6 @@
couponData: "",
canGetCoupon: false,
pendingCouponCount: 0, //
couponFloatBallImage: "", //
swCur: 0,
statusBarHeight
};
@ -244,7 +233,6 @@
this.aa = true;
this.getCoupon();
this.fetchPendingCouponCount(); //
this.fetchCouponFloatBall(); //
if (!this.isLoading) {
this.getnews();
}
@ -289,33 +277,14 @@
},
/**
* @description: 点击待领取优惠券入口
* @description: 点击优惠券悬浮球来自FloatBall组件
* Requirements: 1.1.0 - 待领取优惠券固定入口
*/
onPendingCouponClick() {
onCouponFloatBallClick(item) {
//
this.getCoupon();
},
/**
* @description: 获取优惠券悬浮球配置
* Requirements: 1.1.0 - 待领取优惠券固定入口
*/
async fetchCouponFloatBall() {
try {
const floatBalls = await getFloatBall();
// link_urlcoupon
const couponBall = floatBalls.find(ball =>
ball.link_url && ball.link_url.toLowerCase().includes('coupon')
);
if (couponBall && couponBall.image) {
this.couponFloatBallImage = couponBall.image;
}
} catch (error) {
console.log('获取优惠券悬浮球配置失败', error);
}
},
/**
* @description: 获取中奖公告列表
* @return {*}
@ -509,25 +478,6 @@
</script>
<style lang="scss">
/* 待领取优惠券悬浮球样式 - Requirements 1.1.0 三 */
.coupon-float-ball {
position: fixed;
right: 0;
top: 50%;
transform: translateY(-50%);
z-index: 999;
width: 80rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
.coupon-ball-icon {
width: 80rpx;
height: 80rpx;
}
}
.title1 {
width: 100%;
display: flex;