feat: 增加红包

This commit is contained in:
zhangds 2024-05-11 15:35:57 +08:00
parent 5d94239d51
commit 9ce76d9597
2 changed files with 56 additions and 17 deletions

View File

@ -621,10 +621,16 @@
window.location.replace("./ysf.html");
} else if (entity.channel === 1 && entity.receive_mode === 2) {
window.location.replace("./zfb-redPackets.html");
} else {
// 判断 在那个环境打开 如果是微信 获取openid
if (navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1) {
let auth_url = `https://openapi.1688sup.com/wechat/oauth?payment_subject=bale&jump=${location.origin}/redPackets.html`
window.location.replace(auth_url);
} else {
window.location.replace("./redPackets.html");
}
}
}
},
/* banner外链跳转 */

View File

@ -11,8 +11,9 @@
<script type="text/javascript" src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/axios.js?v=1367936144322">
</script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js?v=1000"></script>
<link rel="stylesheet" href="./homepage2_0.css" />
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/modelPop.js"></script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js?v=sdfhksdfklwrwer"></script>
<style>
* {
margin: 0 auto;
@ -31,6 +32,7 @@
font-size: .14rem;
}
</style>
<link rel="stylesheet" href="./homepage2_0.css" />
</head>
<body>
@ -131,13 +133,19 @@
copyLink: '',
goodsInfo: JSON.parse(sessionStorage.getItem('goodsInfo')),
backAble: sessionStorage.getItem('goodsCount') > 1,
loading: false
loading: false,
openid: ""
};
},
components: {
modelPop
},
created() {
let openid = getQueryString("openid");
if (openid) {
this.openid = openid;
}
},
mounted() {
document.title = localStorage.getItem('title');
},
@ -176,11 +184,32 @@
})
.catch((err) => { this.loading = false; });
},
// 红包 结算
publicCollection(order_number) {
let params = {
order_number,
open_id: this.openId,
subject: "bale"
};
req.axiosPost("/wechat/cash/receive", params)
.then((res) => {
this.loading = false;
if (res.code == 200) {
this.tip("领取成功", 2, '关闭');
this.goodInfo.available = 9;
localStorage.setItem('goodInfo', JSON.stringify(this.goodInfo));
} else {
this.tip(res.message, 2, '关闭');
}
})
.catch((err) => { this.loading = false; });
},
/* 根据环境进行下一步操作 1 支付宝 2 微信 */
judgeEnvironment(order_number, weiXinUrl) {
let ua = window.navigator.userAgent.toLowerCase();
/* 判断如果是微信/安卓百度浏览器 则复制链接 */
/* 支付宝:判断如果是微信/安卓百度浏览器 则复制链接 */
if (this.goodsInfo.entity.channel === 1) {
const aliPaysUrl = `alipays://platformapi/startapp?appId=2021004100663111&page=pages/index/index?order_number=${encodeURIComponent(window.btoa(order_number))}`;
if (isWx() || (ua.indexOf("android") > -1 && ua.indexOf("baiduboxapp") > -1) || ua.indexOf("windows") > -1) {
@ -189,14 +218,18 @@
} else {
location.replace(aliPaysUrl);
}
return
}
/* 微信 */
if (this.goodsInfo.entity.channel === 2) {
if (ua.indexOf("windows") > -1) {
this.copyLink = weiXinUrl;
this.tip('请点击下方[复制]按钮,复制链接到浏览器打开!', 1, '点击复制');
// 第一步:是否是微信环境 -> 公众号授权
if (this.openId && ua.indexOf('micromessenger') !== -1) {
this.publicCollection(order_number);
} else {
location.replace(weiXinUrl);
// 第二步:其它环境 微信小程序
window.location.replace(weiXinUrl);
}
return
}
},