Commit 2c6d2448 by 穆启卓

1

parent ed5f5fe8
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" /> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<title>每天读书打卡</title> <title>步数打卡</title>
</head> </head>
<body> <body>
<noscript> <noscript>
......
...@@ -309,19 +309,19 @@ ...@@ -309,19 +309,19 @@
joinFree() { joinFree() {
let days = this.days || 0 let days = this.days || 0
// this.queryPayImage(); // this.queryPayImage();
dakaPay(days, 1).then(response => { // dakaPay(days, 1).then(response => {
console.log("报名状态", response); // console.log("报名状态", response);
if (response.code == 1) { // if (response.code == 1) {
this.showModal("温馨提示", response.msg); // this.showModal("温馨提示", response.msg);
return; // return;
} // }
if (response.code == 0) { // if (response.code == 0) {
this.$emit("close", true); // this.$emit("close", true);
this.$emit("success") // this.$emit("success")
// localStorage.setItem("is_every", 0) // // localStorage.setItem("is_every", 0)
// location.replace("#/Success"); // // location.replace("#/Success");
} // }
}); // });
}, },
getPlatform() { getPlatform() {
var u = navigator.userAgent, var u = navigator.userAgent,
......
<template> <template>
<div class="hello"> <div class="hello"></div>
</div>
</template> </template>
<script> <script>
import {jssdk, shareContent} from "@/components/axios/api"; import {jssdk, shareContent, select_user_signup} from "@/components/axios/api";
export default { export default {
name: "HelloWorld", name: "HelloWorld",
...@@ -13,6 +12,7 @@ ...@@ -13,6 +12,7 @@
}, },
mounted() { mounted() {
this.getConfig(); this.getConfig();
this.checkUserJoin();
}, },
methods: { methods: {
// 微信分参数 // 微信分参数
...@@ -162,10 +162,19 @@ ...@@ -162,10 +162,19 @@
// this.getConfig(); // this.getConfig();
// } // }
// }, 1000); // }, 1000);
},
// 判断用户是否参加了比赛
checkUserJoin() {
select_user_signup().then(res => {
if (res.code === 0) {
sessionStorage.setItem('userHaveJoinGame', String(res.data.daka_signup));
} else {
sessionStorage.setItem('userHaveJoinGame', 'false');
}
}).catch(err => {
sessionStorage.setItem('userHaveJoinGame', 'false');
})
} }
} }
}; };
</script> </script>
\ No newline at end of file
<style scoped>
</style>
...@@ -151,7 +151,7 @@ export function ocFollow() { //lookOption是你要调用接口的名字,issuer ...@@ -151,7 +151,7 @@ export function ocFollow() { //lookOption是你要调用接口的名字,issuer
} }
// 报名支付 // 报名支付
export function dakaPay(days,use_contract) { export function dakaPay(grade,days,use_contract) {
let now = new Date(); let now = new Date();
let year = now.getFullYear(); let year = now.getFullYear();
let month = now.getMonth() + 1; let month = now.getMonth() + 1;
...@@ -173,7 +173,8 @@ export function dakaPay(days,use_contract) { ...@@ -173,7 +173,8 @@ export function dakaPay(days,use_contract) {
use_contract: use_contract || 0, use_contract: use_contract || 0,
inviter_id: inviter || '', inviter_id: inviter || '',
from_type: from_type || '', from_type: from_type || '',
days: days || 0 days: days || 0,
grade: grade || 0
} }
}) })
} }
...@@ -391,6 +392,28 @@ export function daka_index(grade) { ...@@ -391,6 +392,28 @@ export function daka_index(grade) {
}) })
} }
// 判断用户是否参与比赛
export function select_user_signup() {
return fetch({
url: api.select_user_signup,
method: 'GET',
params: {
}
})
}
// 比赛详情
export function daka_status_detail(week, grade) {
return fetch({
url: api.daka_status_detail,
method: 'GET',
params: {
week: week,
grade: grade
}
})
}
//有新接口的时候像上面那样再来一次 //有新接口的时候像上面那样再来一次
// //修改昵称接口 // //修改昵称接口
......
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
ocFollowPath: `${api}/api/v1/oc_follow`, ocFollowPath: `${api}/api/v1/oc_follow`,
//10 报名支付 GET /api/v1/daka_pay //10 报名支付 GET /api/v1/daka_pay
dakaPayPath: `${api}/api/v1/daka_pay`, dakaPayPath: `${api}/api/v1/daka_pay`,
//11 jssdk注入 GET /api/v1/daka_pay //11 jssdk注入
jssdkPath: `${api}/api/v1/config/jssdk`, jssdkPath: `${api}/api/v1/config/jssdk`,
// 12 提现banner GET /api/v1/config/withdraw_banner // 12 提现banner GET /api/v1/config/withdraw_banner
withdrawBannerPath: `${api}/api/v1/config/withdraw_banner`, withdrawBannerPath: `${api}/api/v1/config/withdraw_banner`,
...@@ -83,4 +83,8 @@ export default { ...@@ -83,4 +83,8 @@ export default {
withdraw_log: `${api}/api/v1/withdraw_log`, withdraw_log: `${api}/api/v1/withdraw_log`,
// 首页数据 // 首页数据
daka_index: `${api}/api/v1/daka_index`, daka_index: `${api}/api/v1/daka_index`,
// 判断用户是否参与比赛
select_user_signup: `${api}/api/v1/select_user_signup`,
// 比赛详情
daka_status_detail: `${api}/api/v1/daka_status/detail`,
} }
...@@ -60,9 +60,24 @@ router.beforeEach((to, from, next) => { ...@@ -60,9 +60,24 @@ router.beforeEach((to, from, next) => {
next('/author') next('/author')
// location.replace('#/author') // location.replace('#/author')
} }
} else if (to.name === 'MainPagePartakeChallenge' || to.name === 'MainPageHaveJoinedGame') {
// 处理tabbar去‘当前比赛’时,根据用户有没有参赛导向对应也页面
const userHaveJoinGame = sessionStorage.getItem('userHaveJoinGame');
if (userHaveJoinGame === 'true') {
if (to.name === 'MainPageHaveJoinedGame') {
next();
} else {
next({name: 'MainPageHaveJoinedGame'});
}
} else {
if (to.name === 'MainPagePartakeChallenge') {
next();
} else {
next({name: 'MainPagePartakeChallenge'});
}
}
} else { } else {
next() next();
// location.replace(`#${to.path}`)
} }
}) })
......
...@@ -135,5 +135,9 @@ export default new Router({ ...@@ -135,5 +135,9 @@ export default new Router({
}, },
] ]
}, },
{
path:"*",
redirect:"/MainPage/SignUp"
},
] ]
}) })
<template> <template>
<div class="partake-challenge-page"> <div class="partake-challenge-page">
<Title class="page-title" title=" " v-on:goback="goback" show_back="true"></Title> <Title class="page-title" title=" " v-on:goback="goback" show_back="true"></Title>
<div class="game-rule-container"> <div class="game-rule-container" @click="goOtherPage('Rule')">
<img src="../images/ChallengeDetail/ic_que.png"> <img src="../images/ChallengeDetail/ic_que.png">
活动规则 活动规则
</div> </div>
<div class="game-bonus-container"> <div class="game-bonus-container">
<div class="bonus-title">本期累计奖励金(元)</div> <div class="bonus-title">本期累计奖励金(元)</div>
<div class="bonus-amount">6.86</div> <div class="bonus-amount">{{pageData.bet_bonus}}</div>
</div> </div>
<div class="game-title">5000步七日耐力赛</div> <div class="game-title">{{pageData.target_step}}步三日耐力赛</div>
<div class="game-time">开赛时间:3月11日 00:00-3月17日24:00</div> <div class="game-time">开赛时间:{{pageData.start_format}}{{pageData.end_format}}</div>
<div class="hr"></div> <div class="hr"></div>
<div class="game-info-container"> <div class="game-info-container">
<div class="game-info-section"> <div class="game-info-section">
<div class="section-item"> <div class="section-item">
<div class="item-value">5636.26</div> <div class="item-value">{{pageData.total_money}}</div>
<div class="item-key">总奖励金(元)</div> <div class="item-key">总奖励金(元)</div>
</div> </div>
<div class="section-item"> <div class="section-item">
<div class="item-value">26.8%</div> <div class="item-value">{{pageData.bet_rate}}</div>
<div class="item-key">收益率</div> <div class="item-key">收益率</div>
</div> </div>
</div> </div>
<div class="game-info-section"> <div class="game-info-section">
<div class="section-item"> <div class="section-item">
<div class="item-value">70964</div> <div class="item-value">{{pageData.people_cnt}}</div>
<div class="item-key">达标人数</div> <div class="item-key">达标人数</div>
</div> </div>
<div class="section-item"> <div class="section-item">
<div class="item-value">111858</div> <div class="item-value">{{pageData.total_signup}}</div>
<div class="item-key">参赛人数</div> <div class="item-key">参赛人数</div>
</div> </div>
</div> </div>
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
}, },
data() { data() {
return { return {
pageData: JSON.parse(sessionStorage.getItem('ChallengeDetailData'))
} }
}, },
created() { created() {
...@@ -55,6 +56,9 @@ ...@@ -55,6 +56,9 @@
goback() { goback() {
history.go(-1); history.go(-1);
}, },
goOtherPage(pageName) {
this.$router.push({name: pageName});
},
} }
} }
</script> </script>
......
...@@ -303,58 +303,58 @@ ...@@ -303,58 +303,58 @@
}, },
payToSign() { payToSign() {
let days = this.userStatus.days || 0 let days = this.userStatus.days || 0
dakaPay(days).then(response => { // dakaPay(days).then(response => {
this.current_date = new Date(response.date); // this.current_date = new Date(response.date);
if (response.code == 1) { // if (response.code == 1) {
this.showModal("温馨提示", response.msg); // this.showModal("温馨提示", response.msg);
return; // return;
} // }
let result = response.data; // let result = response.data;
console.log("请求打卡支付数据", result); // console.log("请求打卡支付数据", result);
if (result) { // if (result) {
WeixinJSBridge.invoke( // WeixinJSBridge.invoke(
"getBrandWCPayRequest", // "getBrandWCPayRequest",
{ // {
appId: result.appId, //公众号名称,由商户传入 // appId: result.appId, //公众号名称,由商户传入
timeStamp: `${result.timeStamp}`, //时间戳,自1970年以来的秒数 // timeStamp: `${result.timeStamp}`, //时间戳,自1970年以来的秒数
nonceStr: result.nonceStr, //随机串 // nonceStr: result.nonceStr, //随机串
package: result.package, // package: result.package,
signType: result.signType, //微信签名方式: // signType: result.signType, //微信签名方式:
paySign: result.paySign //微信签名 // paySign: result.paySign //微信签名
}, // },
// result, // // result,
res => { // res => {
console.log("支付调用结果", res); // console.log("支付调用结果", res);
if (res.err_msg == "get_brand_wcpay_request:ok") { // if (res.err_msg == "get_brand_wcpay_request:ok") {
// 使用以上方式判断前端返回,微信团队郑重提示: // // 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。 // //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
// 支付成功后的回调函数 // // 支付成功后的回调函数
console.log("支付成功"); // console.log("支付成功");
this.showModal("温馨提示", "报名成功", { // this.showModal("温馨提示", "报名成功", {
scb: () => { // scb: () => {
if (this.isFollow == 1) { // if (this.isFollow == 1) {
this.$router.push({name: "Read"}) // this.$router.push({name: "Read"})
} else { // } else {
this.$router.push({name: "Success"}) // this.$router.push({name: "Success"})
} // }
} // }
}); // });
// this.dateSelect(2); // // this.dateSelect(2);
// localStorage.setItem("is_every", 0) // // localStorage.setItem("is_every", 0)
// location.replace("#/Success"); // // location.replace("#/Success");
} // }
if (res.err_msg == "get_brand_wcpay_request:fail") { // if (res.err_msg == "get_brand_wcpay_request:fail") {
this.togglePayFail() // this.togglePayFail()
// this.showModal("温馨提示", "支付服务繁忙,请稍后重试"); // // this.showModal("温馨提示", "支付服务繁忙,请稍后重试");
} // }
if (res.err_msg == "get_brand_wcpay_request:cancel") { // if (res.err_msg == "get_brand_wcpay_request:cancel") {
this.togglePayFail() // this.togglePayFail()
console.log("支付取消"); // console.log("支付取消");
} // }
} // }
); // );
} // }
}); // });
}, },
stopPop(e) { stopPop(e) {
e.stopPropagation() e.stopPropagation()
......
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
<script> <script>
import Title from "@/components/Title.vue"; import Title from "@/components/Title.vue";
import {daka_status_detail} from "@/components/axios/api";
export default { export default {
name: "HaveJoinedGame", name: "HaveJoinedGame",
components: { components: {
...@@ -126,6 +127,7 @@ ...@@ -126,6 +127,7 @@
} }
}, },
created() { created() {
this.getPageData();
}, },
methods: { methods: {
goback() { goback() {
...@@ -136,6 +138,12 @@ ...@@ -136,6 +138,12 @@
}, },
currentPage() { currentPage() {
return this.$router.history.current.name; return this.$router.history.current.name;
},
getPageData() {
console.log(this.$route)
daka_status_detail().then(res => {
console.log(res)
});
} }
} }
} }
......
...@@ -47,20 +47,48 @@ ...@@ -47,20 +47,48 @@
<div class="text1">我同意</div> <div class="text1">我同意</div>
<div class="text2" @click="goOtherPage('Rule')">《步数打卡的挑战规则协议》</div> <div class="text2" @click="goOtherPage('Rule')">《步数打卡的挑战规则协议》</div>
</div> </div>
<div class="partake-btn">立即报名</div> <div class="partake-btn" @click="payToSign()">立即报名</div>
</div>
<PayFailModal v-if="isShowPayFail" @close="togglePayFail()"></PayFailModal>
<div class="modal" v-if="modalShown">
<Modal v-on:close="closeModal" v-on:confirmModal="confirmModal" v-bind:title="modalTitle" v-bind:desc="modalDesc" :option="modalOption"></Modal>
</div>
<div class="modal" v-if="showFreeModal">
<Free
v-bind:page_type="1"
v-on:close="closeFree"
v-bind:v_data="contract_data"
@showModal="showModal"
@success="showSuccess"
:days="0"
></Free>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import Title from "@/components/Title.vue"; import Title from "@/components/Title.vue";
import PayFailModal from "@/components/PayFailModal.vue";
import Free from "@/components/Free.vue";
import Modal from "@/components/Modal.vue";
import {
dakaPay
} from "@/components/axios/api";
export default { export default {
name: "PartakeChallenge", name: "PartakeChallenge",
components: { components: {
Title Title,
PayFailModal,
Modal,
Free
}, },
data() { data() {
return { return {
isShowPayFail: false,
showFreeModal: false,
modalTitle: "",
modalDesc: "",
modalShown: false,
} }
}, },
created() { created() {
...@@ -74,7 +102,79 @@ ...@@ -74,7 +102,79 @@
}, },
currentPage() { currentPage() {
return this.$router.history.current.name; return this.$router.history.current.name;
} },
togglePayFail() {
this.isShowPayFail = !this.isShowPayFail
},
payToSign() {
dakaPay(1).then(response => {
if (response.code == 1) {
this.showModal("温馨提示", response.msg);
return;
}
let result = response.data;
console.log("请求打卡支付数据", result);
if (result) {
WeixinJSBridge.invoke(
"getBrandWCPayRequest",
{
appId: result.appId, //公众号名称,由商户传入
timeStamp: result.timeStamp, //时间戳,自1970年以来的秒数
nonceStr: result.nonceStr, //随机串
package: result.package,
signType: result.signType, //微信签名方式:
paySign: result.paySign //微信签名
},
// result,
res => {
console.log("支付调用结果", res);
if (res.err_msg == "get_brand_wcpay_request:ok") {
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
// 支付成功后的回调函数
console.log("支付成功");
this.showSuccess();
// this.dateSelect(2);
// localStorage.setItem("is_every", 0)
// location.replace("#/Success");
}
if (res.err_msg == "get_brand_wcpay_request:fail") {
// this.showModal("温馨提示", "支付服务繁忙,请稍后重试");
this.togglePayFail()
}
if (res.err_msg == "get_brand_wcpay_request:cancel") {
// console.log("支付取消");
this.togglePayFail()
}
}
);
}
});
},
showModal(title, desc, option) {
this.modalTitle = title || "";
this.modalDesc = desc || "";
this.modalOption = option || {}
this.modalShown = true;
},
showSuccess() {
this.showModal("温馨提示", "报名成功", {
scb: () => {
sessionStorage.setItem('userHaveJoinGame', 'true');
this.$router.push({name: "HaveJoinedGame"});
}
});
},
closeFree() {
this.showFreeModal = false;
},
closeModal() {
this.modalShown = false;
},
confirmModal(scb) {
scb && scb()
this.modalShown = false;
},
} }
} }
</script> </script>
......
<template> <template>
<div class="sign-up-page"> <div class="sign-up-page">
<!-- <PayFailModal v-if="isShowPayFail" @close="togglePayFail"></PayFailModal>
<div class="modal" v-if="modalShown">
<Modal v-on:close="closeModal" v-on:confirmModal="confirmModal" v-bind:title="modalTitle" v-bind:desc="modalDesc"
:option="modalOption"></Modal>
</div>
<div class="modal" v-if="showFreeModal">
<Free
v-bind:page_type="1"
v-on:close="closeFree"
v-bind:v_data="contract_data"
@showModal="showModal"
@success="showSuccess"
:days="0"
></Free>
</div> -->
<!-- 顶部步数级别选择 --> <!-- 顶部步数级别选择 -->
<div class="top-nav-level"> <div class="top-nav-level">
<div :class="['level-item', choosedLevel===0?'active':'']" @click="chooseGameLevel(0)">3000步赛</div> <div :class="['level-item', choosedLevel===1?'active':'']" @click="chooseGameLevel(1)">3000步赛</div>
<div :class="['level-item', choosedLevel===1?'active':'']" @click="chooseGameLevel(1)">5000步赛</div> <div :class="['level-item', choosedLevel===2?'active':'']" @click="chooseGameLevel(2)">5000步赛</div>
<div :class="['level-item', choosedLevel===2?'active':'']" @click="chooseGameLevel(2)">8000步赛</div> <div :class="['level-item', choosedLevel===3?'active':'']" @click="chooseGameLevel(3)">8000步赛</div>
</div> </div>
<!-- 左上角查看步数按钮 --> <!-- 左上角查看步数按钮 -->
<img class="view-steps-btn" src="../images/SignUp/sy_bushu.png"> <!-- <img class="view-steps-btn" src="../images/SignUp/sy_bushu.png"> -->
<!-- 信息广播 --> <!-- 信息广播 -->
<NoticeBonus class="notice-broadcast"></NoticeBonus> <NoticeBonus class="notice-broadcast"></NoticeBonus>
<!-- 挑战赛卡片 --> <!-- 挑战赛卡片 -->
...@@ -32,7 +16,7 @@ ...@@ -32,7 +16,7 @@
<img class="corner-marker" src="../images/SignUp/home_tag_zmz.png" v-if="item.status===1"> <img class="corner-marker" src="../images/SignUp/home_tag_zmz.png" v-if="item.status===1">
<img class="corner-marker" src="../images/SignUp/home_tag_yjs.png" v-if="item.status===2"> <img class="corner-marker" src="../images/SignUp/home_tag_yjs.png" v-if="item.status===2">
<div class="card-title">3天健步挑战赛</div> <div class="card-title">3天健步挑战赛</div>
<div class="card-time"><{{item.already_join===1?'已参赛':'未参赛'}} {{item.period_start}}——{{item.period_end}}></div> <div class="card-time"><{{item.already_join===1?'已参赛':'未参赛'}} {{item.period_start}}{{item.period_end}}></div>
<div class="card-info"> <div class="card-info">
<div class="info-item" v-if="item.status===0||item.status===2"> <div class="info-item" v-if="item.status===0||item.status===2">
<div class="item-title">达标人数</div> <div class="item-title">达标人数</div>
...@@ -47,22 +31,18 @@ ...@@ -47,22 +31,18 @@
<div class="item-money">{{item.total_money || '0.00'}}</div> <div class="item-money">{{item.total_money || '0.00'}}</div>
</div> </div>
</div> </div>
<div class="card-btn" v-if="item.status===1" @click="goOtherPage('PartakeChallenge')"> <div class="card-btn" v-if="item.status===1&&item.already_join===0" @click="goOtherPage('PartakeChallenge')">
<div>参与挑战</div> <div>参与挑战</div>
<div class="card-btn-tip">(每日目标{{item.target_step}}步)</div> <div class="card-btn-tip">(每日目标{{item.target_step}}步)</div>
</div> </div>
<div class="card-btn" style="background:#32A1F6;" v-else @click="goOtherPage('HaveJoinedGame')">查看详情</div> <div class="card-btn" :style="item.status!==1?'background:#32A1F6;':''" v-else @click="goWhereDetail(item)">{{item.status===1?'已报名':'查看详情'}}</div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import NoticeBonus from "@/components/NoticeBonus.vue"; import NoticeBonus from "@/components/NoticeBonus.vue";
import Free from "@/components/Free.vue";
import Modal from "@/components/Modal.vue";
import PayFailModal from "@/components/PayFailModal.vue";
import { import {
dakaPay,
track, track,
userCards, userCards,
daka_index daka_index
...@@ -71,24 +51,16 @@ ...@@ -71,24 +51,16 @@
export default { export default {
name: "SignUp", name: "SignUp",
components: { components: {
NoticeBonus, NoticeBonus
Modal,
Free,
PayFailModal
}, },
data() { data() {
return { return {
contract_data: {}, contract_data: {},
showFreeModal: false,
modalTitle: "",
modalDesc: "",
modalShown: false,
current_date: {}, current_date: {},
isShowPayFail: false,
isFollow: false, isFollow: false,
gameList: [], gameList: [],
choosedLevel: 0 choosedLevel: 2
} }
}, },
created() { created() {
...@@ -97,36 +69,40 @@ ...@@ -97,36 +69,40 @@
methods: { methods: {
chooseGameLevel(level) { chooseGameLevel(level) {
this.choosedLevel = level; this.choosedLevel = level;
this.getPageData(level);
}, },
goOtherPage(pageName) { goOtherPage(pageName) {
this.$router.push({name: pageName}); this.$router.push({name: pageName});
}, },
goWhereDetail(item) {
if (item.status===1&&item.already_join===1) { // 已报名
this.$router.push({
name: 'HaveJoinedGame',
query: {
week: item.week
}
});
} else { // 比赛中或者已结束
if (item.already_join===1) { // 已报名
this.$router.push({
name: 'HaveJoinedGame',
query: {
week: item.week
}
});
} else { // 未报名
sessionStorage.setItem('ChallengeDetailData', JSON.stringify(item));
this.$router.push({name: 'ChallengeDetail'});
}
}
},
getPageData(grade = 1) { getPageData(grade = 1) {
daka_index(grade).then(res => { daka_index(grade).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.gameList = res.data; this.gameList = res.data;
console.log(this.gameList)
} }
}) })
}, },
togglePayFail() {
this.isShowPayFail = !this.isShowPayFail
},
showSuccess() {
this.showModal("温馨提示", "报名成功", {
scb: () => {
if (this.isFollow == 1) {
this.$router.push({name: "Read"})
} else {
this.$router.push({name: "Success"})
}
}
});
},
confirmModal(scb) {
scb && scb()
this.modalShown = false;
},
showFree(e) { showFree(e) {
e.stopPropagation(); e.stopPropagation();
track("free_contract_show"); track("free_contract_show");
...@@ -159,72 +135,6 @@ ...@@ -159,72 +135,6 @@
this.showFreeModal = true; this.showFreeModal = true;
}); });
}, },
closeFree() {
this.showFreeModal = false;
},
showModal(title, desc, option) {
this.modalTitle = title || "";
this.modalDesc = desc || "";
this.modalOption = option || {}
this.modalShown = true;
},
closeModal() {
this.modalShown = false;
},
payToSign() {
dakaPay().then(response => {
this.current_date = new Date(response.date);
if (response.code == 1) {
this.showModal("温馨提示", response.msg);
return;
}
let result = response.data;
console.log("请求打卡支付数据", result);
if (result) {
WeixinJSBridge.invoke(
"getBrandWCPayRequest",
{
appId: result.appId, //公众号名称,由商户传入
timeStamp: `${result.timeStamp}`, //时间戳,自1970年以来的秒数
nonceStr: result.nonceStr, //随机串
package: result.package,
signType: result.signType, //微信签名方式:
paySign: result.paySign //微信签名
},
// result,
res => {
console.log("支付调用结果", res);
if (res.err_msg == "get_brand_wcpay_request:ok") {
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
// 支付成功后的回调函数
console.log("支付成功");
this.showModal("温馨提示", "报名成功", {
scb: () => {
if (this.isFollow == 1) {
this.$router.push({name: "Read"})
} else {
this.$router.push({name: "Success"})
}
}
});
// this.dateSelect(2);
// localStorage.setItem("is_every", 0)
// location.replace("#/Success");
}
if (res.err_msg == "get_brand_wcpay_request:fail") {
// this.showModal("温馨提示", "支付服务繁忙,请稍后重试");
this.togglePayFail()
}
if (res.err_msg == "get_brand_wcpay_request:cancel") {
// console.log("支付取消");
this.togglePayFail()
}
}
);
}
});
},
} }
} }
</script> </script>
......
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