提交 6886d85e 编写于 作者: Yuanzhao.dai's avatar Yuanzhao.dai

完善瓜分弹框显示交互相关逻辑

上级 bfc3ff37
...@@ -13,14 +13,14 @@ ...@@ -13,14 +13,14 @@
v-bp="{ component_tag: '363#360015'}" v-bp="{ component_tag: '363#360015'}"
> >
</div> </div>
<div class="success-content carve-container" v-if="!isFirstCarve && carveData.status == 1"> <div class="success-content carve-container" v-if="!isFirstCarve && hasQualification ">
<div class="success-bg"> <div class="success-bg">
<p class="title"> <p class="title">
<span class="line1"></span> <span class="line1"></span>
<span class="text">恭喜您瓜分</span> <span class="text">恭喜您瓜分</span>
<span class="line2"></span> <span class="line2"></span>
</p> </p>
<p class="awards-num">{{carveData.totalBonus}}<span>云鹊豆</span></p> <p class="awards-num">{{beanCarveCount}}<span>云鹊豆</span></p>
<p class="tips">所获云鹊豆将在1分钟内到账</p> <p class="tips">所获云鹊豆将在1分钟内到账</p>
<div class="btn-content"> <div class="btn-content">
<div <div
...@@ -40,12 +40,12 @@ ...@@ -40,12 +40,12 @@
v-bp="{ component_tag: '363#360015'}" v-bp="{ component_tag: '363#360015'}"
> >
</div> </div>
<div class="defeat-content carve-container" v-if="!isFirstCarve && carveData.status != 1" > <div class="defeat-content carve-container" v-if="!isFirstCarve && !hasQualification" >
<div class="defeat-bg"> <div class="defeat-bg">
<div class="content content2" v-show="carveData.status == 3"> <div class="content content2" v-show="unableReason == 3 || unableReason == 4">
<p class="title">您未参加本次活动</p> <p class="title">您未参加本次活动</p>
</div> </div>
<div class="content content1" v-show="carveData.status == 3"> <div class="content content1" v-show="unableReason == 1 || unableReason == 2">
<p class="title">很遗憾</p> <p class="title">很遗憾</p>
<p class="text">您的勤奋分小于100不能瓜分云鹊豆</p> <p class="text">您的勤奋分小于100不能瓜分云鹊豆</p>
</div> </div>
...@@ -71,16 +71,28 @@ ...@@ -71,16 +71,28 @@
export default { export default {
name: "index", name: "index",
props: { props: {
carveData: { isFirstCarve: { //红包是否是未拆状态
type: Object, type: Boolean,
default() { default() {
return {} return true;
} }
}, },
isFirstCarve: { hasQualification: { //是否可瓜分云鹊豆
type: Boolean,
default() {
return true
}
},
beanCarveCount: { //可瓜分云鹊豆数量
type: Number,
default() {
return 0
}
},
unableReason: { //不可瓜分原因1或2是资格不够,3或4是未参加
type: Number, type: Number,
default() { default() {
return 1; return 0
} }
} }
}, },
......
...@@ -78,7 +78,10 @@ ...@@ -78,7 +78,10 @@
<!--瓜分云鹊豆模块———start--> <!--瓜分云鹊豆模块———start-->
<carve-up <carve-up
v-if="showCarveUp" v-if="showCarveUp"
:carveData="carveData" :isFirstCarve="isFirstCarve"
:hasQualification="hasQualification"
:beanCarveCount="beanCarveCount"
:unableReason="unableReason"
> >
</carve-up> </carve-up>
<!--瓜分云鹊豆模块 ————end--> <!--瓜分云鹊豆模块 ————end-->
...@@ -106,7 +109,8 @@ import { ...@@ -106,7 +109,8 @@ import {
getSelfAllScore, getSelfAllScore,
checkFirstEnter, checkFirstEnter,
getActivityTime, getActivityTime,
getCarveStatus } from "@/service"; getCarveStatus,
getRedPacketsLog } from "@/service";
import { setEventByModuleCode } from "@/utils" import { setEventByModuleCode } from "@/utils"
import { ENV_CONFIG } from '@/utils/enumerate'; import { ENV_CONFIG } from '@/utils/enumerate';
import { Base64 } from 'js-base64'; import { Base64 } from 'js-base64';
...@@ -160,7 +164,10 @@ export default { ...@@ -160,7 +164,10 @@ export default {
encryptId: '', encryptId: '',
showFirstEnter: false, //是否展示第一次进入获得勤奋分弹框 showFirstEnter: false, //是否展示第一次进入获得勤奋分弹框
beanNum: 0, //第一次进入奖励弹框的奖励额度 beanNum: 0, //第一次进入奖励弹框的奖励额度
carveData: {}, //云鹊豆瓜分结果 isFirstCarve: true, //红包是否是未拆状态
hasQualification: true, //是否有资格瓜分
beanCarveCount: 0, //可瓜分云鹊豆数量
unableReason: 0, //不可瓜分的原因,1或2是资格不够,3或4是未参加
} }
}, },
async asyncData({ $axios }) { async asyncData({ $axios }) {
...@@ -193,6 +200,11 @@ export default { ...@@ -193,6 +200,11 @@ export default {
if(lastTime < nowTime) { if(lastTime < nowTime) {
this.taskTimeFlag = false; this.taskTimeFlag = false;
} }
//判断是否到瓜分云鹊豆的时间
let carveTime = (new Date("2020/03/12 10:00:00")).getTime();//"2020/04/07 17:00:00"
if (carveTime <= nowTime) {
this.getRedPacketsLog();
}
} }
}); });
}, },
...@@ -377,11 +389,38 @@ export default { ...@@ -377,11 +389,38 @@ export default {
cancelFirstEnter(val) { //关闭首次进入活动奖励弹框 cancelFirstEnter(val) { //关闭首次进入活动奖励弹框
this.showFirstEnter = val; this.showFirstEnter = val;
}, },
getCarveStatus() { getCarveStatus() { //第一次拆红包
getCarveStatus({ getCarveStatus({
activityId: this.activityId activityId: this.activityId
}).then(res => { }).then(res => {
this.carveData = res.data this.isFirstCarve = false;
if(res.data.stauts == 1) { //可以参加
this.hasQualification = true;
this.beanCarveCount = res.data.totalBonus;
} else { //2分数不够,3未参加
this.hasQualification = false;
this.unableReason = res.data.status;
}
})
},
getRedPacketsLog() { //判断瓜分红包状态
getRedPacketsLog({
activityId: this.activityId
}).then(res => {
if(res.data.status == 2) { //红包未拆
this.isFirstCarve = true;
this.getCarveStatus(); //去拆红包
} else {
this.isFirstCarve = false;
if(res.data.status == 3) {
this.hasQualification = true;
this.beanCarveCount = res.data.totalBonus;
} else { //1分数不够,4未参加
this.hasQualification = false;
this.unableReason = res.data.status;
}
}
this.showCarveUp = true;//展示瓜分组件
}) })
} }
} }
......
...@@ -111,7 +111,7 @@ export const checkFirstEnter = ( data ) => { ...@@ -111,7 +111,7 @@ export const checkFirstEnter = ( data ) => {
withCredentials: true withCredentials: true
}) })
} }
// 获取用户云鹊豆瓜分情况 // 获取用户拆红包接口及插红包的结果
export const getCarveStatus = ( data ) => { export const getCarveStatus = ( data ) => {
return request({ return request({
url: `/campaign/redPackets/grantRedPackets`, url: `/campaign/redPackets/grantRedPackets`,
...@@ -119,4 +119,12 @@ export const getCarveStatus = ( data ) => { ...@@ -119,4 +119,12 @@ export const getCarveStatus = ( data ) => {
data: data, data: data,
withCredentials: true withCredentials: true
}) })
}
// 判断用户是否已经拆红包
export const getRedPacketsLog = ( params ) => {
return request({
url: `/campaign/redPackets/getRedPacketsLog`,
params: params,
withCredentials: true
})
} }
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册