Commit c9a24b8b authored by spc's avatar spc

fixed

parent b7e90c1c
...@@ -40,7 +40,8 @@ data:{ ...@@ -40,7 +40,8 @@ data:{
receiveStatus:1,//优惠券状态 0-未领取 1-已领取 receiveStatus:1,//优惠券状态 0-未领取 1-已领取
receiveTime:1,//领取时间 receiveTime:1,//领取时间
} }
] ],
next2810Countdown:0,//2810活动倒计时
} }
*/ */
......
...@@ -15,11 +15,11 @@ const { ...@@ -15,11 +15,11 @@ const {
// request.js // request.js
// 通常可以吧 baseUrl 单独放在一个 js 文件了 // 通常可以吧 baseUrl 单独放在一个 js 文件了
// const baseUrl = "http://172.16.230.108:7777/pmall"; const baseUrl = "http://172.16.230.108:7777/pmall";
// const baseUrl = "https://momclub-uat.feihe.com/pmall";//测试环境 // const baseUrl = "https://momclub-uat.feihe.com/pmall";//测试环境
// let baseUrl = "https://momclub.feihe.com/pmall";//生产环境 // let baseUrl = "https://momclub.feihe.com/pmall";//生产环境
// const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock // const baseUrl = "https://docs.dui88.com/mock/1956/api";//mock
const baseUrl = "https://feihe.m.duibatest.com.cn/pmall" // const baseUrl = "https://feihe.m.duibatest.com.cn/pmall"
const request = (options = {}) => { const request = (options = {}) => {
// 在这里可以对请求头进行一些设置 // 在这里可以对请求头进行一些设置
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view class="babyclass"> <view class="babyclass">
<!-- 根据展示等级动态显示对应等级页面 --> <!-- 根据展示等级动态显示对应等级页面 -->
<view v-if="currentLevelName === 'diamond'" class="diamond"> <view v-if="currentLevelName === 'diamond'" class="diamond">
<image class="diamondbg" :src="`${$baseUrl}${BABY_CLASS_IMAGES.DIAMOND.BG}`" mode="aspectFit"></image> <image class="diamondbg" :src="`${$baseUrl}${BABY_CLASS_IMAGES.DIAMOND.BG}`"></image>
<image class="diamondtitle" :src="`${$baseUrl}${BABY_CLASS_IMAGES.DIAMOND.TITLE}`" mode="aspectFit"></image> <image class="diamondtitle" :src="`${$baseUrl}${BABY_CLASS_IMAGES.DIAMOND.TITLE}`" mode="aspectFit"></image>
<view class="diamondips"> <view class="diamondips">
<image class="diamondips1" :src="`${$baseUrl}${BABY_CLASS_IMAGES.DIAMOND.IPS1}`" mode="aspectFit"> <image class="diamondips1" :src="`${$baseUrl}${BABY_CLASS_IMAGES.DIAMOND.IPS1}`" mode="aspectFit">
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</view> </view>
<view v-if="currentLevelName === 'starshine'" class="starshine"> <view v-if="currentLevelName === 'starshine'" class="starshine">
<image class="starshinebg" :src="`${$baseUrl}${BABY_CLASS_IMAGES.STARSHINE.BG}`" mode="aspectFit"></image> <image class="starshinebg" :src="`${$baseUrl}${BABY_CLASS_IMAGES.STARSHINE.BG}`"></image>
<image class="starshinetitle" :src="`${$baseUrl}${BABY_CLASS_IMAGES.STARSHINE.TITLE}`" mode="aspectFit"> <image class="starshinetitle" :src="`${$baseUrl}${BABY_CLASS_IMAGES.STARSHINE.TITLE}`" mode="aspectFit">
</image> </image>
<view class="starshineips"> <view class="starshineips">
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</view> </view>
<view v-if="currentLevelName === 'starlight'" class="starlight"> <view v-if="currentLevelName === 'starlight'" class="starlight">
<image class="starlightbg" :src="`${$baseUrl}${BABY_CLASS_IMAGES.STARLIGHT.BG}`" mode="aspectFit"></image> <image class="starlightbg" :src="`${$baseUrl}${BABY_CLASS_IMAGES.STARLIGHT.BG}`"></image>
<image class="starlighttitle" :src="`${$baseUrl}${BABY_CLASS_IMAGES.STARLIGHT.TITLE}`" mode="aspectFit"> <image class="starlighttitle" :src="`${$baseUrl}${BABY_CLASS_IMAGES.STARLIGHT.TITLE}`" mode="aspectFit">
</image> </image>
<view class="starlightips"> <view class="starlightips">
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
</view> </view>
<view v-if="currentLevelName === 'gold'" class="gold"> <view v-if="currentLevelName === 'gold'" class="gold">
<image class="goldipsbg" :src="`${$baseUrl}${BABY_CLASS_IMAGES.GOLD.BG}`" mode="aspectFit"></image> <image class="goldipsbg" :src="`${$baseUrl}${BABY_CLASS_IMAGES.GOLD.BG}`"></image>
<image class="goldipstitle" :src="`${$baseUrl}${BABY_CLASS_IMAGES.GOLD.TITLE}`" mode="aspectFit"></image> <image class="goldipstitle" :src="`${$baseUrl}${BABY_CLASS_IMAGES.GOLD.TITLE}`" mode="aspectFit"></image>
<view class="goldips"> <view class="goldips">
<image class="goldips1" :src="`${$baseUrl}${BABY_CLASS_IMAGES.GOLD.IPS1}`" mode="aspectFit"></image> <image class="goldips1" :src="`${$baseUrl}${BABY_CLASS_IMAGES.GOLD.IPS1}`" mode="aspectFit"></image>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</view> </view>
<view v-if="currentLevelName === 'platinum'" class="platinum"> <view v-if="currentLevelName === 'platinum'" class="platinum">
<image class="platinumbg" :src="`${$baseUrl}${BABY_CLASS_IMAGES.PLATINUM.BG}`" mode="aspectFit"></image> <image class="platinumbg" :src="`${$baseUrl}${BABY_CLASS_IMAGES.PLATINUM.BG}`"></image>
<image class="platinumtitle" :src="`${$baseUrl}${BABY_CLASS_IMAGES.PLATINUM.TITLE}`" mode="aspectFit"> <image class="platinumtitle" :src="`${$baseUrl}${BABY_CLASS_IMAGES.PLATINUM.TITLE}`" mode="aspectFit">
</image> </image>
<view class="platinumips"> <view class="platinumips">
...@@ -138,18 +138,18 @@ const jump = (level) => { ...@@ -138,18 +138,18 @@ const jump = (level) => {
console.log(`跳转到 ${level} 等级页面`) console.log(`跳转到 ${level} 等级页面`)
// 检查用户等级是否符合要求 // 检查用户等级是否符合要求
const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine // const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine
const userLevelIndex = levelOrder.indexOf(props.userLevel); // const userLevelIndex = levelOrder.indexOf(props.userLevel);
const requiredLevelIndex = levelOrder.indexOf(props.currentLevel); // const requiredLevelIndex = levelOrder.indexOf(props.currentLevel);
if (userLevelIndex < requiredLevelIndex) { // if (userLevelIndex < requiredLevelIndex) {
uni.showToast({ // uni.showToast({
title: '等级不够,无法访问', // title: '等级不够,无法访问',
icon: 'none', // icon: 'none',
duration: 2000 // duration: 2000
}) // })
return; // return;
} // }
// 跳转到 H5 页面,地址暂时默认 https://www.baidu.com // 跳转到 H5 页面,地址暂时默认 https://www.baidu.com
// 可以根据不同等级跳转到不同的地址 // 可以根据不同等级跳转到不同的地址
...@@ -157,15 +157,15 @@ const jump = (level) => { ...@@ -157,15 +157,15 @@ const jump = (level) => {
// 使用 uni.navigateTo 跳转到 webview 页面 // 使用 uni.navigateTo 跳转到 webview 页面
uni.navigateTo({ uni.navigateTo({
url: `/pages/webview/webview?url=${encodeURIComponent(url)}&title=${level}等级页面` url: `/pages/webview/webview?url=${encodeURIComponent(url)}`
}) })
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.babyclass { .babyclass {
width: 635rpx; width: 655rpx;
height: 713rpx; height: 773rpx;
left: 0rpx; left: 0rpx;
top: 0rpx; top: 0rpx;
right: 0rpx; right: 0rpx;
...@@ -174,25 +174,26 @@ const jump = (level) => { ...@@ -174,25 +174,26 @@ const jump = (level) => {
.diamond { .diamond {
width: 635rpx; width: 635rpx;
height: 713rpx; height: 753rpx;
left: 0rpx; left: 10rpx;
top: 0rpx; top: 10rpx;
position: absolute; position: absolute;
.diamondbg { .diamondbg {
width: 635rpx; width: 655rpx;
height: 713rpx; height: 763rpx;
left: 0rpx; left: -10rpx;
top: 0rpx; top: -10rpx;
position: absolute; position: absolute;
opacity: 0.2; opacity: 0.2;
border-radius: 45rpx;
} }
.diamondtitle { .diamondtitle {
width: 126rpx; width: 126rpx;
height: 31rpx; height: 31rpx;
left: 4rpx; left: 8rpx;
top: 0rpx; top: 30rpx;
position: absolute; position: absolute;
} }
...@@ -200,7 +201,7 @@ const jump = (level) => { ...@@ -200,7 +201,7 @@ const jump = (level) => {
width: 610rpx; width: 610rpx;
height: 373rpx; height: 373rpx;
left: 13rpx; left: 13rpx;
top: 76rpx; top: 96rpx;
position: absolute; position: absolute;
.diamondips1 { .diamondips1 {
...@@ -240,9 +241,9 @@ const jump = (level) => { ...@@ -240,9 +241,9 @@ const jump = (level) => {
width: 442rpx; width: 442rpx;
height: 85rpx; height: 85rpx;
left: 97rpx; left: 97rpx;
top: 493rpx; top: 513rpx;
position: absolute; position: absolute;
cursor: pointer;
transition: transform 0.2s ease; transition: transform 0.2s ease;
&:active { &:active {
...@@ -254,23 +255,24 @@ const jump = (level) => { ...@@ -254,23 +255,24 @@ const jump = (level) => {
width: 635rpx; width: 635rpx;
height: 92rpx; height: 92rpx;
left: 0rpx; left: 0rpx;
top: 621rpx; top: 641rpx;
position: absolute; position: absolute;
} }
} }
.starshine { .starshine {
width: 635rpx; width: 635rpx;
height: 713rpx; height: 753rpx;
left: 0rpx; left: 10rpx;
top: 0rpx; top: 10rpx;
position: absolute; position: absolute;
.starshinebg { .starshinebg {
width: 635rpx; width: 655rpx;
height: 713rpx; height: 763rpx;
left: 0rpx; left: -10rpx;
top: 0rpx; top: -10rpx;
border-radius: 45rpx;
position: absolute; position: absolute;
opacity: 0.1; opacity: 0.1;
} }
...@@ -278,8 +280,8 @@ const jump = (level) => { ...@@ -278,8 +280,8 @@ const jump = (level) => {
.starshinetitle { .starshinetitle {
width: 126rpx; width: 126rpx;
height: 31rpx; height: 31rpx;
left: 4rpx; left: 8rpx;
top: 0rpx; top: 30rpx;
position: absolute; position: absolute;
} }
...@@ -287,7 +289,7 @@ const jump = (level) => { ...@@ -287,7 +289,7 @@ const jump = (level) => {
width: 610rpx; width: 610rpx;
height: 373rpx; height: 373rpx;
left: 13rpx; left: 13rpx;
top: 76rpx; top: 96rpx;
position: absolute; position: absolute;
.starshineips1 { .starshineips1 {
...@@ -327,9 +329,9 @@ const jump = (level) => { ...@@ -327,9 +329,9 @@ const jump = (level) => {
width: 442rpx; width: 442rpx;
height: 85rpx; height: 85rpx;
left: 97rpx; left: 97rpx;
top: 493rpx; top: 513rpx;
position: absolute; position: absolute;
cursor: pointer;
transition: transform 0.2s ease; transition: transform 0.2s ease;
&:active { &:active {
...@@ -341,23 +343,24 @@ const jump = (level) => { ...@@ -341,23 +343,24 @@ const jump = (level) => {
width: 635rpx; width: 635rpx;
height: 92rpx; height: 92rpx;
left: 0rpx; left: 0rpx;
top: 621rpx; top: 641rpx;
position: absolute; position: absolute;
} }
} }
.starlight { .starlight {
width: 635rpx; width: 635rpx;
height: 713rpx; height: 753rpx;
left: 0rpx; left: 10rpx;
top: 0rpx; top: 10rpx;
position: absolute; position: absolute;
.starlightbg { .starlightbg {
width: 635rpx; width: 655rpx;
height: 713rpx; height: 763rpx;
left: 0rpx; left: -10rpx;
top: 0rpx; top: -10rpx;
border-radius: 45rpx;
position: absolute; position: absolute;
opacity: 0.2; opacity: 0.2;
} }
...@@ -365,8 +368,8 @@ const jump = (level) => { ...@@ -365,8 +368,8 @@ const jump = (level) => {
.starlighttitle { .starlighttitle {
width: 126rpx; width: 126rpx;
height: 31rpx; height: 31rpx;
left: 4rpx; left: 8rpx;
top: 0rpx; top: 30rpx;
position: absolute; position: absolute;
} }
...@@ -374,7 +377,7 @@ const jump = (level) => { ...@@ -374,7 +377,7 @@ const jump = (level) => {
width: 610rpx; width: 610rpx;
height: 373rpx; height: 373rpx;
left: 13rpx; left: 13rpx;
top: 76rpx; top: 96rpx;
position: absolute; position: absolute;
.starlightips1 { .starlightips1 {
...@@ -414,9 +417,9 @@ const jump = (level) => { ...@@ -414,9 +417,9 @@ const jump = (level) => {
width: 442rpx; width: 442rpx;
height: 85rpx; height: 85rpx;
left: 97rpx; left: 97rpx;
top: 493rpx; top: 513rpx;
position: absolute; position: absolute;
cursor: pointer;
transition: transform 0.2s ease; transition: transform 0.2s ease;
&:active { &:active {
...@@ -428,32 +431,33 @@ const jump = (level) => { ...@@ -428,32 +431,33 @@ const jump = (level) => {
width: 635rpx; width: 635rpx;
height: 92rpx; height: 92rpx;
left: 0rpx; left: 0rpx;
top: 621rpx; top: 641rpx;
position: absolute; position: absolute;
} }
} }
.gold { .gold {
width: 635rpx; width: 635rpx;
height: 713rpx; height: 753rpx;
left: 0rpx; left: 10rpx;
top: 0rpx; top: 10rpx;
position: absolute; position: absolute;
.goldipsbg { .goldipsbg {
width: 635rpx; width: 655rpx;
height: 713rpx; height: 763rpx;
left: 0rpx; left: -10rpx;
top: 0rpx; top: -10rpx;
position: absolute; position: absolute;
border-radius: 45rpx;
opacity: 0.2; opacity: 0.2;
} }
.goldipstitle { .goldipstitle {
width: 126rpx; width: 126rpx;
height: 31rpx; height: 31rpx;
left: 4rpx; left: 8rpx;
top: 0rpx; top: 30rpx;
position: absolute; position: absolute;
} }
...@@ -461,7 +465,7 @@ const jump = (level) => { ...@@ -461,7 +465,7 @@ const jump = (level) => {
width: 610rpx; width: 610rpx;
height: 373rpx; height: 373rpx;
left: 13rpx; left: 13rpx;
top: 76rpx; top: 96rpx;
position: absolute; position: absolute;
.goldips1 { .goldips1 {
...@@ -501,9 +505,9 @@ const jump = (level) => { ...@@ -501,9 +505,9 @@ const jump = (level) => {
width: 442rpx; width: 442rpx;
height: 85rpx; height: 85rpx;
left: 97rpx; left: 97rpx;
top: 493rpx; top: 513rpx;
position: absolute; position: absolute;
cursor: pointer;
transition: transform 0.2s ease; transition: transform 0.2s ease;
&:active { &:active {
...@@ -515,23 +519,24 @@ const jump = (level) => { ...@@ -515,23 +519,24 @@ const jump = (level) => {
width: 634rpx; width: 634rpx;
height: 57rpx; height: 57rpx;
left: 1rpx; left: 1rpx;
top: 621rpx; top: 641rpx;
position: absolute; position: absolute;
} }
} }
.platinum { .platinum {
width: 635rpx; width: 635rpx;
height: 713rpx; height: 753rpx;
left: 0rpx; left: 10rpx;
top: 0rpx; top: 10rpx;
position: absolute; position: absolute;
.platinumbg { .platinumbg {
width: 635rpx; width: 655rpx;
height: 713rpx; height: 763rpx;
left: 0rpx; left: -10rpx;
top: 0rpx; top: -10rpx;
border-radius: 45rpx;
position: absolute; position: absolute;
opacity: 0.2; opacity: 0.2;
} }
...@@ -539,8 +544,8 @@ const jump = (level) => { ...@@ -539,8 +544,8 @@ const jump = (level) => {
.platinumtitle { .platinumtitle {
width: 126rpx; width: 126rpx;
height: 31rpx; height: 31rpx;
left: 4rpx; left: 8rpx;
top: 0rpx; top: 30rpx;
position: absolute; position: absolute;
} }
...@@ -548,7 +553,7 @@ const jump = (level) => { ...@@ -548,7 +553,7 @@ const jump = (level) => {
width: 610rpx; width: 610rpx;
height: 373rpx; height: 373rpx;
left: 13rpx; left: 13rpx;
top: 76rpx; top: 96rpx;
position: absolute; position: absolute;
.platinumips1 { .platinumips1 {
...@@ -588,9 +593,9 @@ const jump = (level) => { ...@@ -588,9 +593,9 @@ const jump = (level) => {
width: 442rpx; width: 442rpx;
height: 85rpx; height: 85rpx;
left: 97rpx; left: 97rpx;
top: 493rpx; top: 513rpx;
position: absolute; position: absolute;
cursor: pointer;
transition: transform 0.2s ease; transition: transform 0.2s ease;
&:active { &:active {
...@@ -602,14 +607,14 @@ const jump = (level) => { ...@@ -602,14 +607,14 @@ const jump = (level) => {
width: 635rpx; width: 635rpx;
height: 92rpx; height: 92rpx;
left: 0rpx; left: 0rpx;
top: 621rpx; top: 641rpx;
position: absolute; position: absolute;
} }
} }
.default-text { .default-text {
width: 635rpx; width: 635rpx;
height: 713rpx; height: 753rpx;
left: 0rpx; left: 0rpx;
top: 0rpx; top: 0rpx;
position: absolute; position: absolute;
......
...@@ -463,7 +463,7 @@ ...@@ -463,7 +463,7 @@
</template> </template>
<script setup> <script setup>
import { getCurrentInstance, reactive, computed, onMounted, watch } from 'vue' import { getCurrentInstance, reactive, computed, onMounted, watch, onUnmounted } from 'vue'
import { MONTH_GIFT_IMAGES } from './monthGiftImages.js' import { MONTH_GIFT_IMAGES } from './monthGiftImages.js'
import { monthlyGiftIndex, monthlyGiftDrawOne, monthlyGiftDrawAll } from '../../api/monthGift.js' import { monthlyGiftIndex, monthlyGiftDrawOne, monthlyGiftDrawAll } from '../../api/monthGift.js'
...@@ -551,7 +551,10 @@ const state = reactive({ ...@@ -551,7 +551,10 @@ const state = reactive({
// 新增:batchCoupon 数据 - 根据接口返回结构调整 // 新增:batchCoupon 数据 - 根据接口返回结构调整
batchCoupon: [], // 改为数组,因为接口返回的是数组 batchCoupon: [], // 改为数组,因为接口返回的是数组
// 新增:equityCouponList 数据 // 新增:equityCouponList 数据
equityCouponList: [] equityCouponList: [],
// 新增:倒计时相关状态
next2810Countdown: -1,
countdownTimer: null
}) })
// 等级映射常量 // 等级映射常量
...@@ -610,30 +613,97 @@ const handleCouponClick = async (level) => { ...@@ -610,30 +613,97 @@ const handleCouponClick = async (level) => {
const handleBuyClick = async (level) => { const handleBuyClick = async (level) => {
console.log(`Clicked buy for ${level}`) console.log(`Clicked buy for ${level}`)
// 检查用户等级是否符合领取条件 // 检查用户等级是否符合领取条件(优先级最高)
const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine
const userLevelIndex = levelOrder.indexOf(props.userLevel) const userLevelIndex = levelOrder.indexOf(props.userLevel * 1)
const diamondIndex = levelOrder.indexOf(2); // Diamond level is 2 const diamondIndex = levelOrder.indexOf(2); // Diamond level is 2
// 如果用户等级不够,显示提示 // 如果用户等级不够,显示提示
if (userLevelIndex < diamondIndex) { if (userLevelIndex < diamondIndex) {
//点击跳转升级攻略页面
uni.navigateTo({
url: '/pages/webview/webview?url=https://member.feihe.com/memberH5/#/coupon'
});
return
}
// 检查倒计时状态(其次)
if (state.next2810Countdown !== -1) {
uni.showToast({ uni.showToast({
title: '等级不够,无法领取', title: '活动暂未开启',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000
}) });
return return
} }
// 可以购买,执行购买逻辑 console.log("state.buyStatus", state.buyStatus, level)
if (state.buyStatus[level] === 'unlocked') {
// 在 next2810Countdown == -1 的情况下
const currentTimeSlot = state.timeSlots[state.selectedTimeSlot]
// 如果已领取,跳转到使用页面
if (currentTimeSlot.received) {
uni.navigateTo({
url: '/pages/webview/webview?url=https://member.feihe.com/memberH5/#/coupon'
});
return
}
// 根据 status 处理不同状态
if (currentTimeSlot.status === 0) {
// status = 0,显示"活动暂未开启"
uni.showToast({
title: '活动暂未开启',
icon: 'none',
duration: 2000
});
return
} else if (currentTimeSlot.status === 1) {
// status = 1,一键完成领取
try { try {
// 调用API领取限时1分购,不需要传递参数 const equityCouponInfoId = currentTimeSlot.equityCouponInfoId
const result = await monthlyGiftDrawOne() const stockBatchId = currentTimeSlot.stockBatchId
console.log("equityCouponInfoId", equityCouponInfoId, stockBatchId)
const result = await monthlyGiftDrawOne({ equityCouponInfoId, stockBatchId })
if (result.success) {
// 购买成功,更新时间段状态
currentTimeSlot.status = 'purchased'
currentTimeSlot.received = true
state.buyStatus[level] = 'purchased'
uni.showToast({
title: '领取成功!',
icon: 'success',
duration: 2000
})
} else {
uni.showToast({
title: result.message || '领取失败',
icon: 'none',
duration: 2000
})
}
} catch (error) {
console.error('领取限时1分购失败:', error)
uni.showToast({
title: '网络错误,请重试',
icon: 'none',
duration: 2000
})
}
} else if (currentTimeSlot.status === 2) {
// status = 2,一键完成领取
try {
const equityCouponInfoId = currentTimeSlot.equityCouponInfoId
const stockBatchId = currentTimeSlot.stockBatchId
console.log("equityCouponInfoId", equityCouponInfoId, stockBatchId)
const result = await monthlyGiftDrawOne({ equityCouponInfoId, stockBatchId })
if (result.success) { if (result.success) {
// 购买成功,更新时间段状态 // 购买成功,更新时间段状态
const currentTimeSlot = state.timeSlots[state.selectedTimeSlot]
currentTimeSlot.status = 'purchased' currentTimeSlot.status = 'purchased'
currentTimeSlot.received = true currentTimeSlot.received = true
state.buyStatus[level] = 'purchased' state.buyStatus[level] = 'purchased'
...@@ -673,7 +743,7 @@ const getCouponButtonText = (level) => { ...@@ -673,7 +743,7 @@ const getCouponButtonText = (level) => {
return '去使用' return '去使用'
} }
const levelOrder = [0, 1, 2, 3, 4]; const levelOrder = [0, 1, 2, 3, 4];
const userLevelIndex = levelOrder.indexOf(props.userLevel) const userLevelIndex = levelOrder.indexOf(props.userLevel * 1)
const goldIndex = levelOrder.indexOf(0) // Gold level is 0 const goldIndex = levelOrder.indexOf(0) // Gold level is 0
if (userLevelIndex < goldIndex) { if (userLevelIndex < goldIndex) {
return '待解锁' return '待解锁'
...@@ -689,7 +759,7 @@ const getCouponButtonClass = () => { ...@@ -689,7 +759,7 @@ const getCouponButtonClass = () => {
return 'coupon-btn-purchased-' + levelName return 'coupon-btn-purchased-' + levelName
} }
const levelOrder = [0, 1, 2, 3, 4]; const levelOrder = [0, 1, 2, 3, 4];
const userLevelIndex = levelOrder.indexOf(props.userLevel) const userLevelIndex = levelOrder.indexOf(props.userLevel * 1)
const goldIndex = levelOrder.indexOf(0) // Gold level is 0 const goldIndex = levelOrder.indexOf(0) // Gold level is 0
if (userLevelIndex < goldIndex) { if (userLevelIndex < goldIndex) {
return 'coupon-btn-locked' return 'coupon-btn-locked'
...@@ -701,44 +771,66 @@ const getCouponButtonClass = () => { ...@@ -701,44 +771,66 @@ const getCouponButtonClass = () => {
const getBuyButtonText = (level) => { const getBuyButtonText = (level) => {
// 检查用户等级是否符合领取条件 // 检查用户等级是否符合领取条件
const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine
const userLevelIndex = levelOrder.indexOf(props.userLevel) const userLevelIndex = levelOrder.indexOf(props.userLevel * 1)
const diamondIndex = levelOrder.indexOf(2) // Diamond level is 2 const diamondIndex = levelOrder.indexOf(2) // Diamond level is 2
// 如果用户等级不够,显示"待解锁" // 如果用户等级不够,显示"去升级"(优先级最高)
if (userLevelIndex < diamondIndex) { if (userLevelIndex < diamondIndex) {
return '待解锁' return '去升级'
} }
// 检查时间段状态,如果有时间段状态为 'unlocked',则显示 '立即领取' // 检查倒计时状态(其次)
const hasUnlockedTimeSlot = state.timeSlots.some(timeSlot => timeSlot.status === 'unlocked') if (state.next2810Countdown !== -1) {
return '待开启'
}
if (hasUnlockedTimeSlot) { // 在 next2810Countdown == -1 的情况下
return '立即领取' // 检查当前选中的时间段状态
} else if (state.buyStatus[level] === 'purchased') { const currentTimeSlot = state.timeSlots[state.selectedTimeSlot]
return '已领取'
} else { // 如果已领取,显示"去使用"
if (currentTimeSlot.received) {
return '去使用'
}
// 根据 stockBatchList 对应 index 的 status 显示按钮文本
if (currentTimeSlot.status === 0) {
return '待开启' return '待开启'
} else if (currentTimeSlot.status === 1) {
return '立即领取'
} else if (currentTimeSlot.status === 2) {
return '已结束'
} }
return '待开启'
} }
// 获取限时1分购按钮样式类 // 获取限时1分购按钮样式类
const getBuyButtonClass = (level) => { const getBuyButtonClass = (level) => {
const levelName = currentLevelName.value const levelName = currentLevelName.value
const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine
const userLevelIndex = levelOrder.indexOf(props.userLevel) const userLevelIndex = levelOrder.indexOf(props.userLevel * 1)
const diamondIndex = levelOrder.indexOf(2); // Diamond level is 2 const diamondIndex = levelOrder.indexOf(2); // Diamond level is 2
console.log("userLevelIndex", userLevelIndex, diamondIndex)
if (userLevelIndex < diamondIndex) { if (userLevelIndex < diamondIndex) {
return 'buy-btn-upgrade-' + levelName return 'buy-btn-upgrade-' + levelName
} }
if (state.buyStatus[level] === 'unlocked') { // 检查倒计时状态
return 'buy-btn-unlocked-' + levelName if (state.next2810Countdown !== -1) {
} else if (state.buyStatus[level] === 'purchased') { return 'buy-btn-locked-' + levelName
return 'buy-btn-purchased-' + levelName
} }
return 'buy-btn-locked-' + levelName const currentTimeSlot = state.timeSlots[state.selectedTimeSlot]
if (currentTimeSlot.received) {
return 'buy-btn-purchased-' + levelName
} else if (currentTimeSlot.status === 1) {
return 'buy-btn-unlocked-' + levelName
} else {
return 'buy-btn-locked-' + levelName
}
} }
...@@ -788,7 +880,7 @@ const fetchMonthlyGiftData = async () => { ...@@ -788,7 +880,7 @@ const fetchMonthlyGiftData = async () => {
// 保存 batchCoupon 数据 - 根据接口结构调整 // 保存 batchCoupon 数据 - 根据接口结构调整
if (data.batchCoupon) { if (data.batchCoupon) {
console.log('batchCoupon:', data.batchCoupon) console.log('batchCoupon:', data.batchCoupon)
state.batchCoupon = data.batchCoupon // 直接保存数组 state.batchCoupon = data.batchCoupon // 直接保存对象
// 根据 batchCoupon 更新限时1分购状态和时间段状态 // 根据 batchCoupon 更新限时1分购状态和时间段状态
updateBuyStatusAndTimeSlots(data.batchCoupon) updateBuyStatusAndTimeSlots(data.batchCoupon)
} }
...@@ -797,12 +889,44 @@ const fetchMonthlyGiftData = async () => { ...@@ -797,12 +889,44 @@ const fetchMonthlyGiftData = async () => {
if (data.currentTimeSlot !== undefined) { if (data.currentTimeSlot !== undefined) {
state.selectedTimeSlot = data.currentTimeSlot state.selectedTimeSlot = data.currentTimeSlot
} }
// 处理倒计时逻辑
if (data.next2810Countdown !== undefined) {
state.next2810Countdown = data.next2810Countdown
if (data.next2810Countdown !== -1) {
startCountdown(data.next2810Countdown)
}
}
} }
} catch (error) { } catch (error) {
console.error('获取月礼包数据失败:', error) console.error('获取月礼包数据失败:', error)
} }
} }
// 倒计时处理函数
const startCountdown = (milliseconds) => {
// 清除之前的定时器
if (state.countdownTimer) {
clearTimeout(state.countdownTimer)
}
// 设置倒计时
state.countdownTimer = setTimeout(() => {
console.log('倒计时结束,1秒后刷新页面')
// 延时1秒后刷新页面接口
setTimeout(() => {
fetchMonthlyGiftData()
}, 1000)
}, milliseconds)
}
// 清理定时器
onUnmounted(() => {
if (state.countdownTimer) {
clearTimeout(state.countdownTimer)
}
})
// 初始化 // 初始化
onMounted(async () => { onMounted(async () => {
console.log('MonthGift component mounted, current level:', props.currentLevel, props.userLevel) console.log('MonthGift component mounted, current level:', props.currentLevel, props.userLevel)
...@@ -839,7 +963,7 @@ const updateCouponStatus = (equityCouponList) => { ...@@ -839,7 +963,7 @@ const updateCouponStatus = (equityCouponList) => {
} }
// 根据 batchCoupon 更新限时1分购状态和时间段状态 // 根据 batchCoupon 更新限时1分购状态和时间段状态
const updateBuyStatusAndTimeSlots = (batchCouponArray) => { const updateBuyStatusAndTimeSlots = (batchCouponData) => {
// 重置所有等级的购买状态 // 重置所有等级的购买状态
Object.keys(state.buyStatus).forEach(level => { Object.keys(state.buyStatus).forEach(level => {
state.buyStatus[level] = 'locked' state.buyStatus[level] = 'locked'
...@@ -847,7 +971,7 @@ const updateBuyStatusAndTimeSlots = (batchCouponArray) => { ...@@ -847,7 +971,7 @@ const updateBuyStatusAndTimeSlots = (batchCouponArray) => {
// 根据用户等级解锁相应等级及以下的功能 // 根据用户等级解锁相应等级及以下的功能
const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine
const userLevelIndex = levelOrder.indexOf(props.userLevel); const userLevelIndex = levelOrder.indexOf(props.userLevel * 1);
// 解锁用户等级及以下的所有等级 // 解锁用户等级及以下的所有等级
for (let i = 0; i <= userLevelIndex; i++) { for (let i = 0; i <= userLevelIndex; i++) {
...@@ -857,92 +981,83 @@ const updateBuyStatusAndTimeSlots = (batchCouponArray) => { ...@@ -857,92 +981,83 @@ const updateBuyStatusAndTimeSlots = (batchCouponArray) => {
} }
} }
// 处理 batchCoupon 数组数 // 处理 batchCoupon 数据
if (batchCouponArray && batchCouponArray.length > 0) { if (batchCouponData) {
console.log('Processing batchCoupon array:', batchCouponArray) console.log('Processing batchCoupon data:', batchCouponData)
// 找到当前展示等级对应的 batchCoupon // 更新限时1分购状态
const currentLevelBatchCoupon = batchCouponArray.find(item => { if (batchCouponData.gradeAllow !== undefined) {
// 这里需要根据实际业务逻辑来判断哪个 batchCoupon 对应当前展示等级 const level = currentLevelName.value
// 暂时使用第一个,或者根据其他字段判断 if (state.buyStatus.hasOwnProperty(level)) {
return true // 如果用户等级足够,保持unlocked状态;否则设为locked
}) if (userLevelIndex >= levelOrder.indexOf(props.currentLevel * 1)) {
state.buyStatus[level] = batchCouponData.gradeAllow ? 'unlocked' : 'locked'
if (currentLevelBatchCoupon) {
console.log('Current level batchCoupon:', currentLevelBatchCoupon)
// 更新限时1分购状态
if (currentLevelBatchCoupon.gradeAllow !== undefined) {
const level = currentLevelName.value
if (state.buyStatus.hasOwnProperty(level)) {
// 如果用户等级足够,保持unlocked状态;否则设为locked
if (userLevelIndex >= levelOrder.indexOf(props.currentLevel)) {
state.buyStatus[level] = currentLevelBatchCoupon.gradeAllow ? 'unlocked' : 'locked'
}
} }
} }
}
// 更新限时1分购状态(如果已领取) // 更新限时1分购状态(如果已领取)
if (currentLevelBatchCoupon.received !== undefined) { if (batchCouponData.received !== undefined) {
const level = currentLevelName.value const level = currentLevelName.value
if (state.buyStatus.hasOwnProperty(level) && currentLevelBatchCoupon.received) { if (state.buyStatus.hasOwnProperty(level) && batchCouponData.received) {
state.buyStatus[level] = 'purchased' state.buyStatus[level] = 'purchased'
}
} }
}
// 处理 stockBatchList 数据,更新时间段状态 // 处理 stockBatchList 数据,更新时间段状态
if (currentLevelBatchCoupon.stockBatchList && currentLevelBatchCoupon.stockBatchList.length > 0) { if (batchCouponData.stockBatchList && batchCouponData.stockBatchList.length > 0) {
console.log('Processing stockBatchList:', currentLevelBatchCoupon.stockBatchList) console.log('Processing stockBatchList:', batchCouponData.stockBatchList)
// 根据实际的时间段数据更新,而不是硬编码的4个时间段 // 根据实际的时间段数据更新,而不是硬编码的4个时间段
currentLevelBatchCoupon.stockBatchList.forEach((batch, index) => { batchCouponData.stockBatchList.forEach((batch, index) => {
console.log(`Processing batch ${index}:`, batch) console.log(`Processing batch ${index}:`, batch)
// 确保 timeSlots 数组有足够的元素 // 确保 timeSlots 数组有足够的元素
while (state.timeSlots.length <= index) { while (state.timeSlots.length <= index) {
state.timeSlots.push({ state.timeSlots.push({
time: '', // 动态时间,从API获取 time: '', // 动态时间,从API获取
status: 'locked', status: 'locked',
stockBatchId: null, stockBatchId: null,
startTime: '', equityCouponInfoId: null, // 添加这个字段
endTime: '', startTime: '',
stockUsage: 0, endTime: '',
stockLimit: 0, stockUsage: 0,
received: false stockLimit: 0,
}) received: false
} })
}
// 更新时间段信息
const mappedStatus = getBatchStatus(batch.status) // 更新时间段信息
console.log(`Batch ${index} status: ${batch.status} -> mapped to: ${mappedStatus}`) const mappedStatus = getBatchStatus(batch.status)
console.log(`Batch ${index} status: ${batch.status} -> mapped to: ${mappedStatus}`)
state.timeSlots[index] = {
...state.timeSlots[index], state.timeSlots[index] = {
stockBatchId: batch.stockBatchId, ...state.timeSlots[index],
startTime: batch.startTime, stockBatchId: batch.stockBatchId,
endTime: batch.endTime || '', equityCouponInfoId: batchCouponData.equityCouponInfoId, // 从 batchCoupon 对象中获取
stockUsage: currentLevelBatchCoupon.stockUsage || 0, startTime: batch.startTime,
stockLimit: currentLevelBatchCoupon.stockLimit || 0, endTime: batch.endTime || '',
received: currentLevelBatchCoupon.received || false, stockUsage: batchCouponData.stockUsage || 0,
status: mappedStatus stockLimit: batchCouponData.stockLimit || 0,
} received: batchCouponData.received || false,
status: batch.status // 直接使用原始 status 值
console.log(`Updated timeSlot ${index}:`, state.timeSlots[index]) }
})
console.log(`Updated timeSlot ${index}:`, state.timeSlots[index])
})
// 如果API返回的时间段少于4个,保持原有的4个时间段结构 // 如果API返回的时间段少于4个,保持原有的4个时间段结构
if (currentLevelBatchCoupon.stockBatchList.length < 4) { if (batchCouponData.stockBatchList.length < 4) {
// 保持原有的4个时间段,未返回的保持默认状态 // 保持原有的4个时间段,未返回的保持默认状态
for (let i = currentLevelBatchCoupon.stockBatchList.length; i < 4; i++) { for (let i = batchCouponData.stockBatchList.length; i < 4; i++) {
if (state.timeSlots[i]) { if (state.timeSlots[i]) {
state.timeSlots[i].status = 'locked' state.timeSlots[i].status = 'locked'
state.timeSlots[i].time = getDefaultTimeText(i) state.timeSlots[i].time = getDefaultTimeText(i)
}
} }
} }
console.log('Final timeSlots state:', state.timeSlots)
} }
console.log('Final timeSlots state:', state.timeSlots)
} }
} }
...@@ -988,7 +1103,7 @@ const getDefaultTimeText = (index) => { ...@@ -988,7 +1103,7 @@ const getDefaultTimeText = (index) => {
// 检查用户等级是否足够 // 检查用户等级是否足够
const isLevelSufficient = () => { const isLevelSufficient = () => {
const levelOrder = [2, 3, 4]; // gold, platinum, diamond, starlight, starshine const levelOrder = [2, 3, 4]; // gold, platinum, diamond, starlight, starshine
const userLevelIndex = levelOrder.indexOf(props.userLevel); const userLevelIndex = levelOrder.indexOf(props.userLevel * 1);
return userLevelIndex >= 0; return userLevelIndex >= 0;
} }
...@@ -1017,8 +1132,8 @@ const getTimeSlotStatusText = (index) => { ...@@ -1017,8 +1132,8 @@ const getTimeSlotStatusText = (index) => {
// 检查用户等级是否符合要求 - 用户等级必须等于或高于要操作的等级 // 检查用户等级是否符合要求 - 用户等级必须等于或高于要操作的等级
const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine
const userLevelIndex = levelOrder.indexOf(props.userLevel) const userLevelIndex = levelOrder.indexOf(props.userLevel * 1)
const requiredLevelIndex = levelOrder.indexOf(props.currentLevel) const requiredLevelIndex = levelOrder.indexOf(props.currentLevel * 1)
console.log(`User level: ${props.userLevel} (${userLevelName.value}), Required level: ${props.currentLevel} (${currentLevelName.value})`) console.log(`User level: ${props.userLevel} (${userLevelName.value}), Required level: ${props.currentLevel} (${currentLevelName.value})`)
console.log(`User level index: ${userLevelIndex}, Required level index: ${requiredLevelIndex}`) console.log(`User level index: ${userLevelIndex}, Required level index: ${requiredLevelIndex}`)
...@@ -1051,14 +1166,18 @@ const getTimeSlotStatusText = (index) => { ...@@ -1051,14 +1166,18 @@ const getTimeSlotStatusText = (index) => {
.monthgift { .monthgift {
width: 663rpx; width: 663rpx;
height: 1084rpx; height: 1084rpx;
left: 0rpx;
top: 0rpx;
right: 0rpx;
margin: auto;
position: relative; position: relative;
margin: 0 auto;
.diamond { .diamond {
width: 663rpx; width: 663rpx;
height: 1084rpx; height: 1084rpx;
left: 0rpx; left: 0rpx;
top: 0rpx; top: 0rpx;
position: absolute; position: absolute;
.diamondbg { .diamondbg {
...@@ -1067,6 +1186,8 @@ const getTimeSlotStatusText = (index) => { ...@@ -1067,6 +1186,8 @@ const getTimeSlotStatusText = (index) => {
left: 0rpx; left: 0rpx;
top: 0rpx; top: 0rpx;
position: absolute; position: absolute;
border-radius: 45rpx 0 45rpx 45rpx;
opacity: 0.2; opacity: 0.2;
} }
...@@ -1300,6 +1421,8 @@ const getTimeSlotStatusText = (index) => { ...@@ -1300,6 +1421,8 @@ const getTimeSlotStatusText = (index) => {
left: 0rpx; left: 0rpx;
top: 0rpx; top: 0rpx;
position: absolute; position: absolute;
border-radius: 45rpx 0 45rpx 45rpx;
opacity: 0.1; opacity: 0.1;
} }
...@@ -1589,6 +1712,8 @@ const getTimeSlotStatusText = (index) => { ...@@ -1589,6 +1712,8 @@ const getTimeSlotStatusText = (index) => {
height: 1084rpx; height: 1084rpx;
left: 0rpx; left: 0rpx;
top: 0rpx; top: 0rpx;
border-radius: 45rpx 0 45rpx 45rpx;
position: absolute; position: absolute;
opacity: 0.2; opacity: 0.2;
} }
...@@ -1878,6 +2003,7 @@ const getTimeSlotStatusText = (index) => { ...@@ -1878,6 +2003,7 @@ const getTimeSlotStatusText = (index) => {
width: 663rpx; width: 663rpx;
height: 1084rpx; height: 1084rpx;
left: 0rpx; left: 0rpx;
border-radius: 45rpx 0 45rpx 45rpx;
top: 0rpx; top: 0rpx;
position: absolute; position: absolute;
opacity: 0.2; opacity: 0.2;
...@@ -2175,6 +2301,7 @@ const getTimeSlotStatusText = (index) => { ...@@ -2175,6 +2301,7 @@ const getTimeSlotStatusText = (index) => {
.platinumbg { .platinumbg {
width: 663rpx; width: 663rpx;
height: 1084rpx; height: 1084rpx;
border-radius: 45rpx 0 45rpx 45rpx;
left: 0rpx; left: 0rpx;
top: 0rpx; top: 0rpx;
position: absolute; position: absolute;
...@@ -2643,27 +2770,27 @@ const getTimeSlotStatusText = (index) => { ...@@ -2643,27 +2770,27 @@ const getTimeSlotStatusText = (index) => {
&.buy-btn-locked-gold { &.buy-btn-locked-gold {
background: linear-gradient(135deg, #503404, #6a4505); background: linear-gradient(135deg, #503404, #6a4505);
color: #99662e; color: #fff;
} }
&.buy-btn-locked-platinum { &.buy-btn-locked-platinum {
background: linear-gradient(135deg, #284a6c, #3a5e80); background: linear-gradient(135deg, #284a6c, #3a5e80);
color: #284a6c; color: #fff;
} }
&.buy-btn-locked-diamond { &.buy-btn-locked-diamond {
background: linear-gradient(135deg, #503404, #6a4505); background: linear-gradient(135deg, #503404, #6a4505);
color: #503404; color: #fff;
} }
&.buy-btn-locked-starlight { &.buy-btn-locked-starlight {
background: linear-gradient(135deg, #503404, #6a4505); background: linear-gradient(135deg, #503404, #6a4505);
color: #503404; color: #fff;
} }
&.buy-btn-locked-starshine { &.buy-btn-locked-starshine {
background: linear-gradient(135deg, #f7d1a0, #f9dca8); background: linear-gradient(135deg, #f7d1a0, #f9dca8);
color: #241b15; color: #000;
} }
&.buy-btn-upgrade-gold { &.buy-btn-upgrade-gold {
...@@ -2698,7 +2825,6 @@ const getTimeSlotStatusText = (index) => { ...@@ -2698,7 +2825,6 @@ const getTimeSlotStatusText = (index) => {
.diamond1buycomtime2, .diamond1buycomtime2,
.diamond1buycomtime3, .diamond1buycomtime3,
.diamond1buycomtime4 { .diamond1buycomtime4 {
cursor: pointer;
transition: all 0.3s ease; transition: all 0.3s ease;
......
...@@ -22,10 +22,9 @@ ...@@ -22,10 +22,9 @@
<image class="diamondthreeaward" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.DIAMOND.THREE.AWARD}`" <image class="diamondthreeaward" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.DIAMOND.THREE.AWARD}`"
mode="aspectFit"> mode="aspectFit">
</image> </image>
<image class="diamondthreebtn" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.DIAMOND.THREE.BTN}`" <view class="diamondthreebtn active" @click="handleButtonClick('diamond')">
mode="aspectFit" @click="handleButtonClick('diamond')"> <text>{{ buttonInfo.text }}</text>
</image> </view>
</view> </view>
</view> </view>
...@@ -52,10 +51,9 @@ ...@@ -52,10 +51,9 @@
</image> </image>
<image class="starshinethreeaward" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.STARSHINE.THREE.AWARD}`" <image class="starshinethreeaward" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.STARSHINE.THREE.AWARD}`"
mode="aspectFit"></image> mode="aspectFit"></image>
<image class="starshinethreebtn" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.STARSHINE.THREE.BTN}`" <view class="starshinethreebtn starshine" @click="handleButtonClick('starshine')">
mode="aspectFit" @click="handleButtonClick('starshine')"> <text>{{ buttonInfo.text }}</text>
</image> </view>
</view> </view>
</view> </view>
...@@ -82,10 +80,9 @@ ...@@ -82,10 +80,9 @@
</image> </image>
<image class="starlightthreeaward" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.STARLIGHT.THREE.AWARD}`" <image class="starlightthreeaward" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.STARLIGHT.THREE.AWARD}`"
mode="aspectFit"></image> mode="aspectFit"></image>
<image class="starlightthreebtn" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.STARLIGHT.THREE.BTN}`" <view class="starlightthreebtn starlight" @click="handleButtonClick('starlight')">
mode="aspectFit" @click="handleButtonClick('starlight')"> <text>{{ buttonInfo.text }}</text>
</image> </view>
</view> </view>
</view> </view>
...@@ -106,9 +103,9 @@ ...@@ -106,9 +103,9 @@
</image> </image>
<image class="goldthreeaward" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.GOLD.THREE.AWARD}`" mode="aspectFit"> <image class="goldthreeaward" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.GOLD.THREE.AWARD}`" mode="aspectFit">
</image> </image>
<image class="goldthreebtn" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.GOLD.THREE.BTN}`" mode="aspectFit" <view class="goldthreebtn gold" @click="handleButtonClick('gold')">
@click="handleButtonClick('gold')"></image> <text>{{ buttonInfo.text }}</text>
</view>
</view> </view>
<image class="goldlocktip" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.GOLD.LOCKTIP}`" mode="aspectFit"></image> <image class="goldlocktip" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.GOLD.LOCKTIP}`" mode="aspectFit"></image>
</view> </view>
...@@ -138,10 +135,9 @@ ...@@ -138,10 +135,9 @@
<image class="platinumthreebg" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.PLATINUM.THREE.BG}`" <image class="platinumthreebg" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.PLATINUM.THREE.BG}`"
mode="aspectFit"> mode="aspectFit">
</image> </image>
<image class="platinumthreebtn" :src="`${$baseUrl}${YEAR_GIFT_IMAGES.PLATINUM.THREE.BTN}`" <view class="platinumthreebtn platinum" @click="handleButtonClick('platinum')">
mode="aspectFit" @click="handleButtonClick('platinum')"> <text>{{ buttonInfo.text }}</text>
</image> </view>
</view> </view>
</view> </view>
</view> </view>
...@@ -188,48 +184,34 @@ const userLevelName = computed(() => LEVEL_MAP[props.userLevel]) ...@@ -188,48 +184,34 @@ const userLevelName = computed(() => LEVEL_MAP[props.userLevel])
const buttonInfo = computed(() => { const buttonInfo = computed(() => {
const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine
const userLevelIndex = levelOrder.indexOf(props.userLevel); const userLevelIndex = levelOrder.indexOf(props.userLevel);
const requiredLevelIndex = levelOrder.indexOf(props.currentLevel); const diamondIndex = levelOrder.indexOf(2); // Diamond level
const platinumIndex = levelOrder.indexOf(1); // Platinum level
if (userLevelIndex < requiredLevelIndex) {
return { if (userLevelIndex <= platinumIndex) {
text: '待解锁',
action: 'none'
};
} else if (state.isReceived) {
return { return {
text: '已领取', text: '去升级',
action: 'none' action: 'upgrade'
}; };
} else { } else if (userLevelIndex >= diamondIndex) {
return { return {
text: '立即领取', text: '去查看',
action: 'receive' action: 'view'
}; };
} }
}) })
// 按钮点击事件处理 // 按钮点击事件处理
const handleButtonClick = () => { const handleButtonClick = () => {
if (buttonInfo.value.action === 'receive') { if (buttonInfo.value.action === 'upgrade') {
// 检查用户等级是否符合领取条件
const levelOrder = [0, 1, 2, 3, 4]; // gold, platinum, diamond, starlight, starshine
const userLevelIndex = levelOrder.indexOf(props.userLevel);
const requiredLevelIndex = levelOrder.indexOf(props.currentLevel);
if (userLevelIndex < requiredLevelIndex) {
uni.showToast({
title: '等级不够,无法领取',
icon: 'none',
duration: 2000
});
return;
}
receiveYearGift();
} else if (buttonInfo.value.action === 'upgrade') {
// 跳转到升级页面 // 跳转到升级页面
uni.navigateTo({ uni.navigateTo({
url: '/pages/upgrade/upgradeGuide' url: '/pages/upgrade/upgradeGuide'
}); });
} else if (buttonInfo.value.action === 'view') {
// 跳转到查看页面
uni.navigateTo({
url: '/pages/webview/webview?url=https://member.feihe.com/memberH5/#/coupon'
});
} }
} }
</script> </script>
...@@ -237,7 +219,7 @@ const handleButtonClick = () => { ...@@ -237,7 +219,7 @@ const handleButtonClick = () => {
<style lang="less" scoped> <style lang="less" scoped>
.yeargift { .yeargift {
width: 686rpx; width: 686rpx;
height: 1139rpx; height: 1218rpx;
left: 0rpx; left: 0rpx;
top: 0rpx; top: 0rpx;
right: 0rpx; right: 0rpx;
...@@ -358,7 +340,7 @@ const handleButtonClick = () => { ...@@ -358,7 +340,7 @@ const handleButtonClick = () => {
left: 61rpx; left: 61rpx;
top: 436rpx; top: 436rpx;
position: absolute; position: absolute;
cursor: pointer;
transition: transform 0.2s ease; transition: transform 0.2s ease;
&:active { &:active {
...@@ -473,7 +455,7 @@ const handleButtonClick = () => { ...@@ -473,7 +455,7 @@ const handleButtonClick = () => {
left: 61rpx; left: 61rpx;
top: 436rpx; top: 436rpx;
position: absolute; position: absolute;
cursor: pointer;
transition: transform 0.2s ease; transition: transform 0.2s ease;
&:active { &:active {
...@@ -588,7 +570,7 @@ const handleButtonClick = () => { ...@@ -588,7 +570,7 @@ const handleButtonClick = () => {
left: 61rpx; left: 61rpx;
top: 436rpx; top: 436rpx;
position: absolute; position: absolute;
cursor: pointer;
transition: transform 0.2s ease; transition: transform 0.2s ease;
&:active { &:active {
...@@ -703,7 +685,7 @@ const handleButtonClick = () => { ...@@ -703,7 +685,7 @@ const handleButtonClick = () => {
left: 61rpx; left: 61rpx;
top: 436rpx; top: 436rpx;
position: absolute; position: absolute;
cursor: pointer;
transition: transform 0.2s ease; transition: transform 0.2s ease;
&:active { &:active {
...@@ -833,7 +815,7 @@ const handleButtonClick = () => { ...@@ -833,7 +815,7 @@ const handleButtonClick = () => {
left: 61rpx; left: 61rpx;
top: 436rpx; top: 436rpx;
position: absolute; position: absolute;
cursor: pointer;
transition: transform 0.2s ease; transition: transform 0.2s ease;
&:active { &:active {
...@@ -845,4 +827,79 @@ const handleButtonClick = () => { ...@@ -845,4 +827,79 @@ const handleButtonClick = () => {
} }
} }
} }
/* 按钮样式 */
.diamondthreebtn,
.starshinethreebtn,
.starlightthreebtn,
.goldthreebtn,
.platinumthreebtn {
display: flex;
align-items: center;
justify-content: center;
border-radius: 42.5rpx;
font-size: 32rpx;
font-weight: bold;
transition: transform 0.2s ease;
&.active {
background: linear-gradient(to right, #7253a5, #9879cc);
/* 钻石 */
color: #fff;
box-shadow: 0 4rpx 12rpx rgba(114, 83, 165, 0.3);
&:active {
transform: scale(0.95);
box-shadow: 0 2rpx 8rpx rgba(114, 83, 165, 0.4);
}
}
&.starshine {
background: linear-gradient(to right, #000000, #2c1600);
/* 星耀 */
color: #fff;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.3);
&:active {
transform: scale(0.95);
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.4);
}
}
&.starlight {
background: linear-gradient(to right, #cda36b, #e0b97d);
/* 星光 */
color: #fff;
box-shadow: 0 4rpx 12rpx rgba(205, 163, 107, 0.3);
&:active {
transform: scale(0.95);
box-shadow: 0 2rpx 8rpx rgba(205, 163, 107, 0.4);
}
}
&.gold {
background: linear-gradient(to right, #906632, #ab7a44);
/* 黄金 */
color: #fff;
box-shadow: 0 4rpx 12rpx rgba(144, 102, 50, 0.3);
&:active {
transform: scale(0.95);
box-shadow: 0 2rpx 8rpx rgba(144, 102, 50, 0.4);
}
}
&.platinum {
background: linear-gradient(to right, #5189c0, #6fa2d5);
/* 白金 */
color: #fff;
box-shadow: 0 4rpx 12rpx rgba(81, 137, 192, 0.3);
&:active {
transform: scale(0.95);
box-shadow: 0 2rpx 8rpx rgba(81, 137, 192, 0.4);
}
}
}
</style> </style>
...@@ -15,7 +15,7 @@ export const YEAR_GIFT_IMAGES = { ...@@ -15,7 +15,7 @@ export const YEAR_GIFT_IMAGES = {
}, },
THREE: { THREE: {
BG: `pointRights/YearGift/${version}/diamondThreeBg.png`, BG: `pointRights/YearGift/${version}/diamondThreeBg.png`,
AWARD: `pointRights/YearGift/${version}/diamondThreeAward.png`, AWARD: `pointRights/YearGift/${version}/goldThreeAward2.png`,
BTN: `pointRights/YearGift/${version}/diamondThreeBtn.png` BTN: `pointRights/YearGift/${version}/diamondThreeBtn.png`
} }
}, },
...@@ -33,7 +33,7 @@ export const YEAR_GIFT_IMAGES = { ...@@ -33,7 +33,7 @@ export const YEAR_GIFT_IMAGES = {
}, },
THREE: { THREE: {
BG: `pointRights/YearGift/${version}/starshineThreeBg.png`, BG: `pointRights/YearGift/${version}/starshineThreeBg.png`,
AWARD: `pointRights/YearGift/${version}/starshineThreeAward.png`, AWARD: `pointRights/YearGift/${version}/goldThreeAward2.png`,
BTN: `pointRights/YearGift/${version}/starshineThreeBtn.png` BTN: `pointRights/YearGift/${version}/starshineThreeBtn.png`
} }
}, },
...@@ -51,7 +51,7 @@ export const YEAR_GIFT_IMAGES = { ...@@ -51,7 +51,7 @@ export const YEAR_GIFT_IMAGES = {
}, },
THREE: { THREE: {
BG: `pointRights/YearGift/${version}/starlightThreeBg.png`, BG: `pointRights/YearGift/${version}/starlightThreeBg.png`,
AWARD: `pointRights/YearGift/${version}/starlightThreeAward.png`, AWARD: `pointRights/YearGift/${version}/goldThreeAward2.png`,
BTN: `pointRights/YearGift/${version}/starlightThreeBtn.png` BTN: `pointRights/YearGift/${version}/starlightThreeBtn.png`
} }
}, },
...@@ -69,7 +69,7 @@ export const YEAR_GIFT_IMAGES = { ...@@ -69,7 +69,7 @@ export const YEAR_GIFT_IMAGES = {
}, },
THREE: { THREE: {
BG: `pointRights/YearGift/${version}/goldThreeBg.png`, BG: `pointRights/YearGift/${version}/goldThreeBg.png`,
AWARD: `pointRights/YearGift/${version}/goldThreeAward.png`, AWARD: `pointRights/YearGift/${version}/goldThreeAward2.png`,
BTN: `pointRights/YearGift/${version}/goldThreeBtn.png` BTN: `pointRights/YearGift/${version}/goldThreeBtn.png`
}, },
LOCKTIP: `pointRights/YearGift/${version}/goldLockTip.png` LOCKTIP: `pointRights/YearGift/${version}/goldLockTip.png`
...@@ -89,7 +89,7 @@ export const YEAR_GIFT_IMAGES = { ...@@ -89,7 +89,7 @@ export const YEAR_GIFT_IMAGES = {
}, },
THREE: { THREE: {
BG: `pointRights/YearGift/${version}/platinumThreeBg.png`, BG: `pointRights/YearGift/${version}/platinumThreeBg.png`,
AWARD: `pointRights/YearGift/${version}/platinumThreeAward.png`, AWARD: `pointRights/YearGift/${version}/goldThreeAward2.png`,
BTN: `pointRights/YearGift/${version}/platinumThreeBtn.png` BTN: `pointRights/YearGift/${version}/platinumThreeBtn.png`
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment