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

View File

@ -5,15 +5,6 @@
--> -->
<template> <template>
<view class="content"> <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="navLeft align-center" :style="{ top: statusBarHeight + 'px' }" @tap="jumapSlots()">
<view class="flex column" style="width: 100%"> <view class="flex column" style="width: 100%">
<view class="title1 row" style="height: 64rpx; margin-top: 5rpx;"> <view class="title1 row" style="height: 64rpx; margin-top: 5rpx;">
@ -135,7 +126,7 @@
</uni-popup> </uni-popup>
<rule-pop ref="rulePop"></rule-pop> <rule-pop ref="rulePop"></rule-pop>
<rule-pop ref="appNotice" notice-check></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 --> <!-- #ifdef MP -->
<!-- 隐私政策弹窗 --> <!-- 隐私政策弹窗 -->
@ -158,8 +149,7 @@
import PrizeDetailPopup from "@/components/prize-detail-popup/prize-detail-popup.vue"; import PrizeDetailPopup from "@/components/prize-detail-popup/prize-detail-popup.vue";
import { import {
getAdvert, getAdvert,
getDanYe, getDanYe
getFloatBall
} from "@/common/server/config"; } from "@/common/server/config";
import { import {
getGoodsList getGoodsList
@ -210,7 +200,6 @@
couponData: "", couponData: "",
canGetCoupon: false, canGetCoupon: false,
pendingCouponCount: 0, // pendingCouponCount: 0, //
couponFloatBallImage: "", //
swCur: 0, swCur: 0,
statusBarHeight statusBarHeight
}; };
@ -244,7 +233,6 @@
this.aa = true; this.aa = true;
this.getCoupon(); this.getCoupon();
this.fetchPendingCouponCount(); // this.fetchPendingCouponCount(); //
this.fetchCouponFloatBall(); //
if (!this.isLoading) { if (!this.isLoading) {
this.getnews(); this.getnews();
} }
@ -289,33 +277,14 @@
}, },
/** /**
* @description: 点击待领取优惠券入口 * @description: 点击优惠券悬浮球来自FloatBall组件
* Requirements: 1.1.0 - 待领取优惠券固定入口 * Requirements: 1.1.0 - 待领取优惠券固定入口
*/ */
onPendingCouponClick() { onCouponFloatBallClick(item) {
// //
this.getCoupon(); 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: 获取中奖公告列表 * @description: 获取中奖公告列表
* @return {*} * @return {*}
@ -509,25 +478,6 @@
</script> </script>
<style lang="scss"> <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 { .title1 {
width: 100%; width: 100%;
display: flex; display: flex;