修复红包失效逻辑

This commit is contained in:
tcubic 2022-08-08 19:27:11 +08:00
parent a67a865e35
commit 5f6b3f39d9
4 changed files with 113 additions and 107 deletions

View File

@ -109,7 +109,6 @@
<div class="ishas_service_box"></div> <div class="ishas_service_box"></div>
<div class="ishas_service_box_cls" @click="ishasServicePopHide"></div> <div class="ishas_service_box_cls" @click="ishasServicePopHide"></div>
</div> </div>
</template> </template>
<script setup> <script setup>
@ -174,18 +173,21 @@ const serviceLuckyMsg = reactive({
id: 1, id: 1,
}); });
//
const isLost1 = ref(false);
const isLost2 = ref(false);
const hideServiceLuckyPop = () => { const hideServiceLuckyPop = () => {
gsap.to(".serviceLuckyPop", { duration: 0.5, autoAlpha: 0 }); gsap.to(".serviceLuckyPop", { duration: 0.5, autoAlpha: 0 });
}; };
// //
const ishasServicePop = ()=>{ const ishasServicePop = () => {
gsap.to('.ishas_service_pop',{duration:0.5,autoAlpha:1}) gsap.to(".ishas_service_pop", { duration: 0.5, autoAlpha: 1 });
} };
const ishasServicePopHide = ()=>{ const ishasServicePopHide = () => {
gsap.to('.ishas_service_pop',{duration:0.5,autoAlpha:0}) gsap.to(".ishas_service_pop", { duration: 0.5, autoAlpha: 0 });
} };
// //
const getServiceLucky = () => { const getServiceLucky = () => {
@ -281,9 +283,6 @@ const activityList = reactive([
// //
onBeforeMount(() => { onBeforeMount(() => {
// //
let arr = store.state.userAccount.prizeList; let arr = store.state.userAccount.prizeList;
arr.forEach((element) => { arr.forEach((element) => {
@ -291,12 +290,18 @@ onBeforeMount(() => {
isDraw.value = true; isDraw.value = true;
gameOver.value = true; gameOver.value = true;
drawAmount.value = element.amount; drawAmount.value = element.amount;
if (element.receiveStatus == -2) {
isLost1.value = true;
}
} }
// //
if (element.type == 2) { if (element.type == 2) {
isGetedServiceLucky.value = true; isGetedServiceLucky.value = true;
if (element.receiveStatus == -2) {
isLost2.value = true;
}
} }
}); });
}); });
@ -380,12 +385,17 @@ onMounted(() => {
addPoint(); addPoint();
// ,,, // ,,,
if (store.state.userAccount.isAddCustomerBefore == 0 && !isGetedServiceLucky.value) { if (
store.state.userAccount.isAddCustomerBefore == 0 &&
!isGetedServiceLucky.value
) {
if ( if (
store.state.userAccount.isAddCustomer == 1 && store.state.userAccount.isAddCustomer == 1 &&
!isGetedServiceLucky.value !isGetedServiceLucky.value
) { ) {
getluckyBag2(2); if (!isLost2.value) {
getluckyBag2(2);
}
} }
} }
@ -405,7 +415,10 @@ const drawBtn = () => {
if (!isDraw.value) { if (!isDraw.value) {
// LuckyWheelCon.value.showDrawAni(3, true) // LuckyWheelCon.value.showDrawAni(3, true)
gsap.killTweensOf(".draw_btn"); gsap.killTweensOf(".draw_btn");
getluckyBag(1); //1 if (!isLost1.value) {
getluckyBag(1); //1
}
} else { } else {
Toast("您已经抽过奖"); Toast("您已经抽过奖");
} }
@ -422,19 +435,14 @@ const luckyWheelFn = () => {
const activityBtn = (item) => { const activityBtn = (item) => {
console.log(item.id); console.log(item.id);
console.log(wx); console.log(wx);
if (item.id == 1) { if (item.id == 1) {
if (store.state.userAccount.isAddCustomerBefore == 1) {
if(store.state.userAccount.isAddCustomerBefore == 1 ){
// Toast("") // Toast("")
ishasServicePop() ishasServicePop();
}else{ } else {
showServicePop.value = true; showServicePop.value = true;
} }
} }
if (item.id == 2) { if (item.id == 2) {
@ -454,7 +462,6 @@ const activityBtn = (item) => {
if (item.id == 4) { if (item.id == 4) {
console.log("牛牛杯"); console.log("牛牛杯");
window.location.href = window.location.href =
"https://appstatic.cmschina.com/activity/cmszhyxpt/bees/index.html?id=INT_SMKTC_uD5KUL2d"; "https://appstatic.cmschina.com/activity/cmszhyxpt/bees/index.html?id=INT_SMKTC_uD5KUL2d";
// setTimeout(()=>{ // setTimeout(()=>{
@ -1103,31 +1110,30 @@ const deleteData = (type) => {
} }
} }
.ishas_service_pop {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
background-color: rgba(0, 0, 0, 0.7);
visibility: hidden;
.ishas_service_pop{ .ishas_service_box {
width: 100%; @include box(573px, 362px);
height: 100%; @include bg_pos("../assets/img/pop/ishas_service.png");
position: fixed; }
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
background-color: rgba(0, 0, 0, 0.7);
visibility: hidden;
.ishas_service_box{ .ishas_service_box_cls {
@include box(573px, 362px); @include box(72px, 72px);
@include bg_pos("../assets/img/pop/ishas_service.png"); @include bg_pos("../assets/img/pop/cls_btn.png");
} margin-top: 50px;
}
.ishas_service_box_cls{
@include box(72px, 72px);
@include bg_pos("../assets/img/pop/cls_btn.png");
margin-top: 50px;
}
} }
</style> </style>

View File

@ -139,35 +139,13 @@ const hidePop = () => {
const getMoney = (val) => { const getMoney = (val) => {
console.log("val:", val); console.log("val:", val);
// //
if (val.type == 1) { if (val.isGeted == -2) {
console.log("牛卡号:", store.state.userAccount.nkh); Toast("红包已过24小时不能再提现啦");
if ( } else {
store.state.userAccount.nkh == "" || //
store.state.userAccount.nkh == undefined if (val.type == 1) {
) { console.log("牛卡号:", store.state.userAccount.nkh);
// Toast("");
Dialog.confirm({
title: "温馨提示",
message: "请先绑定牛卡号",
confirmButtonText: "前往绑定",
})
.then(() => {
wx.miniProgram.navigateTo({
url: "/subs/bind/pages/login/login?source=zszq",
});
})
.catch(() => {
console.log(2);
// on cancel
});
} else {
getLuckyBag(val.id);
}
}
if (val.type == 2) {
if (val.isGeted == 0) {
if ( if (
store.state.userAccount.nkh == "" || store.state.userAccount.nkh == "" ||
store.state.userAccount.nkh == undefined store.state.userAccount.nkh == undefined
@ -188,10 +166,37 @@ const getMoney = (val) => {
// on cancel // on cancel
}); });
} else { } else {
console.log("未领取", val);
getLuckyBag(val.id); getLuckyBag(val.id);
} }
} }
if (val.type == 2) {
if (val.isGeted == 0) {
if (
store.state.userAccount.nkh == "" ||
store.state.userAccount.nkh == undefined
) {
// Toast("");
Dialog.confirm({
title: "温馨提示",
message: "请先绑定牛卡号",
confirmButtonText: "前往绑定",
})
.then(() => {
wx.miniProgram.navigateTo({
url: "/subs/bind/pages/login/login?source=zszq",
});
})
.catch(() => {
console.log(2);
// on cancel
});
} else {
console.log("未领取", val);
getLuckyBag(val.id);
}
}
}
} }
}; };

View File

@ -46,7 +46,7 @@ import {
} from "vue"; } from "vue";
import gsap from "gsap"; import gsap from "gsap";
import axios from "axios"; import axios from "axios";
import { Toast,Dialog } from "vant"; import { Toast, Dialog } from "vant";
import { useStore } from "vuex"; import { useStore } from "vuex";
import service from "@/api/httpServe"; import service from "@/api/httpServe";
import qs from "qs"; import qs from "qs";
@ -67,18 +67,17 @@ const isBingo = ref(false); //是否中过奖
const noPrize = ref(false); // const noPrize = ref(false); //
const noFirstAdd = ref(false) const noFirstAdd = ref(false);
// //
const updateStaus = () => { const updateStaus = () => {
getIsAddService(); getIsAddService();
}; };
const isLost = ref(false);
// //
onBeforeMount(() => { onBeforeMount(() => {
let arr = store.state.userAccount.prizeList; let arr = store.state.userAccount.prizeList;
arr.forEach((element) => { arr.forEach((element) => {
@ -86,7 +85,10 @@ onBeforeMount(() => {
console.log("已经抽过》》》》》"); console.log("已经抽过》》》》》");
isgot.value = true; isgot.value = true;
isDraw.value = true; isDraw.value = true;
noFirstAdd.value = true noFirstAdd.value = true;
if (element.receiveStatus == -2) {
isLost.value = true;
}
} }
// if(element.amount != 0){ // if(element.amount != 0){
@ -94,8 +96,6 @@ onBeforeMount(() => {
// } // }
}); });
if (store.state.userAccount.isAddCustomer == 1) { if (store.state.userAccount.isAddCustomer == 1) {
isadd.value = 1; isadd.value = 1;
} }
@ -171,9 +171,12 @@ const draw = () => {
}); });
}; };
const getMoneyFn = () => {
const getMoneyFn = ()=>{ if (!isLost.value) {
if (store.state.userAccount.nkh == '' || store.state.userAccount.nkh == undefined) { if (
store.state.userAccount.nkh == "" ||
store.state.userAccount.nkh == undefined
) {
// Toast(""); // Toast("");
Dialog.confirm({ Dialog.confirm({
title: "温馨提示", title: "温馨提示",
@ -192,7 +195,8 @@ const getMoneyFn = ()=>{
// //
getLuckyBag(); getLuckyBag();
} }
} }
};
// //
const getLuckyBag = () => { const getLuckyBag = () => {

View File

@ -161,7 +161,7 @@ const apiAll = () => {
// //
onBeforeMount(() => { onBeforeMount(() => {
if (!h5plugin.isWX()) { if (!h5plugin.isWX()) {
// apiAll(); apiAll();
} }
console.log("link", window.location.href); console.log("link", window.location.href);
@ -169,14 +169,8 @@ onBeforeMount(() => {
console.log("code:", h5plugin.getQueryString("code")); console.log("code:", h5plugin.getQueryString("code"));
// //
if (h5plugin.isWX()) { if (h5plugin.isWX()) {
if (h5plugin.getQueryString("code")) { if (h5plugin.getQueryString("code")) {
// codeopenid // codeopenid
authCode.value = h5plugin.getQueryString("code"); authCode.value = h5plugin.getQueryString("code");
@ -191,6 +185,7 @@ onBeforeMount(() => {
onMounted(() => { onMounted(() => {
fontAdpat(); fontAdpat();
// stopBack() // stopBack()
goBackEvent()
}); });
// //
@ -198,11 +193,9 @@ const indexPage = (actions) => {
console.log("来自index组件", actions); console.log("来自index组件", actions);
}; };
const getCode = () => { const getCode = () => {
let redirect_uri = window.location.href; let redirect_uri = window.location.href;
// service.post(process.env.VUE_APP_API + '/cms-activity/cms88/zsApi/xfhdAuthorize?redirect_uri='+redirect_uri,
service service
.post(process.env.VUE_APP_API + "/cms-activity/cms88/zsApi/xfhdAuthorize", { .post(process.env.VUE_APP_API + "/cms-activity/cms88/zsApi/xfhdAuthorize", {
redirect_uri: redirect_uri, redirect_uri: redirect_uri,
@ -298,13 +291,11 @@ const stopBack = () => {
// 退 // 退
const goBackEvent = () => { const goBackEvent = () => {
if (window.history && window.history.pushState) { history.pushState({ page: 1 }, null, window.location.href);
window.onpopstate = function () { //popstate
//退 window.addEventListener("popstate", (event) => {
console.log("后退"); wx.miniProgram.navigateBack();
window.history.go(-1); });
};
}
}; };
</script> </script>