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

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

View File

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

@ -15,7 +15,7 @@
<!-- 红包中奖 -->
<div class="has_service_box" v-if="isadd == 1 && !isgot && !noPrize">
<div class="money">{{ moneyNum }}</div>
<div class="get_luckybag" @click="getLuckyBag"></div>
<div class="get_luckybag" @click="getMoneyFn"></div>
</div>
<!-- 红包未中奖 -->
@ -46,7 +46,7 @@ import {
} from "vue";
import gsap from "gsap";
import axios from "axios";
import { Toast } from "vant";
import { Toast,Dialog } from "vant";
import { useStore } from "vuex";
import service from "@/api/httpServe";
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 = () => {
service
@ -178,6 +201,7 @@ const getLuckyBag = () => {
if (data.code == 0) {
gsap.to(".serviceCon", { duration: 0.5, autoAlpha: 0 });
gsap.to(".getMoneyCon", { duration: 0.5, autoAlpha: 1 });
getMyPrizeRecored();
} else {
Toast(data.msg);