新增添加企微需绑定牛卡号逻辑

This commit is contained in:
tcubic 2022-08-05 21:35:49 +08:00
parent 26dba43e0c
commit f45b6731c2
4 changed files with 149 additions and 62 deletions

View File

@ -92,7 +92,7 @@
<div class="serviceLuckyPop_container"> <div class="serviceLuckyPop_container">
<!-- 企微中奖弹窗 --> <!-- 企微中奖弹窗 -->
<div class="serviceLuckyPop_box" v-if="serviceLuckyPopBox"> <div class="serviceLuckyPop_box" v-if="serviceLuckyPopBox">
<div class="money">{{serviceLuckyMsg.money}}</div> <div class="money">{{ serviceLuckyMsg.money }}</div>
<div class="get_luckybag" @click="getServiceLucky"></div> <div class="get_luckybag" @click="getServiceLucky"></div>
</div> </div>
@ -100,6 +100,8 @@
<div class="serviceLuckyPop_get_box" v-if="!serviceLuckyPopBox"> <div class="serviceLuckyPop_get_box" v-if="!serviceLuckyPopBox">
<div class="go_index_btn" @click="hideServiceLuckyPop"></div> <div class="go_index_btn" @click="hideServiceLuckyPop"></div>
</div> </div>
<div class="cls_btn" @click="hideServiceLuckyPop"></div>
</div> </div>
</div> </div>
</template> </template>
@ -157,24 +159,46 @@ const prizeMsg = reactive({
amount: 0, amount: 0,
id: 1, id: 1,
}); });
const serviceLuckyPopBox = ref(true) const serviceLuckyPopBox = ref(true);
// //
const isGetedServiceLucky = ref(false) const isGetedServiceLucky = ref(false);
const serviceLuckyMsg = reactive({ const serviceLuckyMsg = reactive({
money: 0, money: 0,
id: 1, id: 1,
}) });
const hideServiceLuckyPop = ()=>{ const hideServiceLuckyPop = () => {
gsap.to('.serviceLuckyPop',{duration:0.5,autoAlpha:0}) gsap.to(".serviceLuckyPop", { duration: 0.5, autoAlpha: 0 });
}
};
// //
const getServiceLucky = ()=>{ const getServiceLucky = () => {
console.log("getServiceLucky:",serviceLuckyMsg); if (
redpacket(serviceLuckyMsg.id) 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(() => {
// on cancel
});
} else {
//
console.log("getServiceLucky:", serviceLuckyMsg);
redpacket(serviceLuckyMsg.id);
}
};
// //
const redpacket = (prizeId) => { const redpacket = (prizeId) => {
@ -190,12 +214,10 @@ const redpacket = (prizeId) => {
console.log("领取红包结果", res); console.log("领取红包结果", res);
let data = res.data; let data = res.data;
if (data.code == 0) { if (data.code == 0) {
serviceLuckyPopBox.value = false serviceLuckyPopBox.value = false;
getMyPrizeRecored(); // getMyPrizeRecored(); //
} else { } else {
Toast(data.msg); Toast(data.msg);
} }
}); });
}; };
@ -253,14 +275,10 @@ onBeforeMount(() => {
} }
// //
if(element.type == 2){ if (element.type == 2) {
isGetedServiceLucky.value = true isGetedServiceLucky.value = true;
} }
}); });
}); });
// //
@ -284,7 +302,12 @@ const animationIndex = () => {
autoAlpha: 0, autoAlpha: 0,
}); });
gsap.from(".LuckyWheelCon", { duration: 0.5, autoAlpha: 0, delay: 1 }); gsap.from(".LuckyWheelCon", { duration: 0.5, autoAlpha: 0, delay: 1 });
gsap.from(".activity_li", { duration: 1, autoAlpha: 0, y:150,stagger: 0.1 }); gsap.from(".activity_li", {
duration: 1,
autoAlpha: 0,
y: 150,
stagger: 0.1,
});
gsap.from( gsap.from(
".activityCon,.zhuanpan,.select_box,.draw_btn,.rule_btn,.rule_btn_text,.prize_btn,.prize_btn_text", ".activityCon,.zhuanpan,.select_box,.draw_btn,.rule_btn,.rule_btn_text,.prize_btn,.prize_btn_text",
@ -306,7 +329,7 @@ const animationIndex = () => {
scale: 1.2, scale: 1.2,
repeat: -1, repeat: -1,
yoyo: true, yoyo: true,
ease: 'Bounce.easeIn' ease: "Bounce.easeIn",
}); });
gsap.from(".luckybag_right", { gsap.from(".luckybag_right", {
duration: 1, duration: 1,
@ -314,7 +337,7 @@ const animationIndex = () => {
scale: 1.2, scale: 1.2,
repeat: -1, repeat: -1,
yoyo: true, yoyo: true,
ease: 'Bounce.easeInOut' ease: "Bounce.easeInOut",
}); });
gsap.to(".title_main", { gsap.to(".title_main", {
duration: 2, duration: 2,
@ -334,24 +357,32 @@ onMounted(() => {
animationIndex(); animationIndex();
// //
addPoint() addPoint();
// ,,, // ,,,
if (store.state.userAccount.isAddCustomer == 1 && !isGetedServiceLucky.value) { if (
getluckyBag2(2) store.state.userAccount.isAddCustomer == 1 &&
!isGetedServiceLucky.value
) {
getluckyBag2(2);
} }
if(!isDraw.value){ if (!isDraw.value) {
gsap.to('.draw_btn',{duration:0.5,scale:1.1,repeat:-1,yoyo:true,ease:'Bounce.easeIn'}) gsap.to(".draw_btn", {
duration: 0.5,
scale: 1.1,
repeat: -1,
yoyo: true,
ease: "Bounce.easeIn",
});
} }
}); });
// //
const drawBtn = () => { 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 getluckyBag(1); //1
} else { } else {
Toast("您已经抽过奖"); Toast("您已经抽过奖");
@ -514,7 +545,7 @@ const getluckyBag = (id) => {
drawAmount.value = res.data.data.amount; drawAmount.value = res.data.data.amount;
prizeMsg.amount = res.data.data.amount; prizeMsg.amount = res.data.data.amount;
prizeMsg.id = res.data.data.id; prizeMsg.id = res.data.data.id;
gsap.set('.LuckyWheel_zz',{autoAlpha:0}) gsap.set(".LuckyWheel_zz", { autoAlpha: 0 });
// //
if (prizeNum == 0) { if (prizeNum == 0) {
@ -555,21 +586,27 @@ const getluckyBag2 = (id) => {
.then((res) => { .then((res) => {
console.log("抽取红包结果2", res); console.log("抽取红包结果2", res);
if (res.data.code == 0) { if (res.data.code == 0) {
// //
if(res.data.data.amount != 0){ if (res.data.data.amount != 0) {
serviceLuckyMsg.money = res.data.data.amount serviceLuckyMsg.money = res.data.data.amount;
serviceLuckyMsg.id = res.data.data.id serviceLuckyMsg.id = res.data.data.id;
console.log("企微中奖"); console.log("企微中奖");
gsap.to('.serviceLuckyPop',{duration:0.5,autoAlpha:1}) gsap.to(".serviceLuckyPop", { duration: 0.5, autoAlpha: 1 });
gsap.from('.serviceLuckyPop_box',{duration:0.5,autoAlpha:0,scale:0}) gsap.from(".serviceLuckyPop_box", {
duration: 0.5,
}else{ autoAlpha: 0,
scale: 0,
});
gsap.from(".cls_btn", {
duration: 0.5,
autoAlpha: 0,
y: 50,
delay:0.5
});
} else {
console.log("企微不中奖"); console.log("企微不中奖");
} }
getMyPrizeRecored(); // getMyPrizeRecored(); //
} else { } else {
Toast(res.data.msg); Toast(res.data.msg);
@ -577,7 +614,6 @@ const getluckyBag2 = (id) => {
}); });
}; };
// //
const getActivityNum = () => { const getActivityNum = () => {
service service
@ -604,25 +640,21 @@ const getBrithday = () => {
}); });
}; };
// //
const addPoint = ()=>{ const addPoint = () => {
service service
.post( .post(
process.env.VUE_APP_API + "/action/application/action/event/user/brows", process.env.VUE_APP_API + "/action/application/action/event/user/brows",
{ {
actionType: 24, actionType: 24,
actionId: 20220805, actionId: 20220805,
cardId: store.state.userAccount.cardId cardId: store.state.userAccount.cardId,
} }
) )
.then((res) => { .then((res) => {
console.log("埋点成功:",res); console.log("埋点成功:", res);
}); });
} };
const deleteNum = ref(0); const deleteNum = ref(0);
// //
@ -709,7 +741,7 @@ const deleteData = (type) => {
pointer-events: none; pointer-events: none;
} }
.LuckyWheel_zz{ .LuckyWheel_zz {
@include pos(750px, 496px, 0px, 657px); @include pos(750px, 496px, 0px, 657px);
@include bg_pos("../assets/img/zz.png"); @include bg_pos("../assets/img/zz.png");
pointer-events: none; pointer-events: none;
@ -981,6 +1013,7 @@ const deleteData = (type) => {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
flex-direction: column;
background-color: rgba(0, 0, 0, 0.7); background-color: rgba(0, 0, 0, 0.7);
visibility: hidden; visibility: hidden;
@ -1011,16 +1044,22 @@ const deleteData = (type) => {
@include bg_pos("../assets/img/pop/get_luckyBag_btn.png"); @include bg_pos("../assets/img/pop/get_luckyBag_btn.png");
} }
} }
.cls_btn {
@include box(72px, 72px);
@include bg_pos("../assets/img/pop/cls_btn.png");
margin-top: 50px;
}
} }
.serviceLuckyPop_get_box{ .serviceLuckyPop_get_box {
@include box(530px, 594px); @include box(530px, 594px);
@include bg_pos("../assets/img/pop/got_luckyBag_pop.png"); @include bg_pos("../assets/img/pop/got_luckyBag_pop.png");
position: relative; position: relative;
.go_index_btn { .go_index_btn {
@include pos(394px, 92px, 79px, 389px); @include pos(394px, 92px, 79px, 389px);
@include bg_pos("../assets/img/pop/to_index_btn.png"); @include bg_pos("../assets/img/pop/to_index_btn.png");
} }
} }
} }
</style> </style>

View File

@ -141,8 +141,11 @@ const getMoney = (val) => {
// //
if (val.type == 1) { if (val.type == 1) {
console.log("牛卡号:",store.state.userAccount.nkh); console.log("牛卡号:", store.state.userAccount.nkh);
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: "温馨提示",
@ -165,8 +168,29 @@ const getMoney = (val) => {
if (val.type == 2) { if (val.type == 2) {
if (val.isGeted == 0) { if (val.isGeted == 0) {
console.log("未领取", val); if (
getLuckyBag(val.id); 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

@ -15,7 +15,7 @@
<!-- 红包中奖 --> <!-- 红包中奖 -->
<div class="has_service_box" v-if="isadd == 1 && !isgot && !noPrize"> <div class="has_service_box" v-if="isadd == 1 && !isgot && !noPrize">
<div class="money">{{ moneyNum }}</div> <div class="money">{{ moneyNum }}</div>
<div class="get_luckybag" @click="getLuckyBag"></div> <div class="get_luckybag" @click="getMoneyFn"></div>
</div> </div>
<!-- 红包未中奖 --> <!-- 红包未中奖 -->
@ -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 } 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";
@ -163,6 +163,29 @@ const draw = () => {
}); });
}; };
const getMoneyFn = ()=>{
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(() => {
// on cancel
});
} else {
//
getLuckyBag();
}
}
// //
const getLuckyBag = () => { const getLuckyBag = () => {
service service
@ -178,6 +201,7 @@ const getLuckyBag = () => {
if (data.code == 0) { if (data.code == 0) {
gsap.to(".serviceCon", { duration: 0.5, autoAlpha: 0 }); gsap.to(".serviceCon", { duration: 0.5, autoAlpha: 0 });
gsap.to(".getMoneyCon", { duration: 0.5, autoAlpha: 1 }); gsap.to(".getMoneyCon", { duration: 0.5, autoAlpha: 1 });
getMyPrizeRecored(); getMyPrizeRecored();
} else { } else {
Toast(data.msg); Toast(data.msg);