fix: 增加包码结算

This commit is contained in:
zhangds 2024-05-13 11:17:01 +08:00
parent a14af9088c
commit 27df7f0ce1
5 changed files with 57 additions and 19 deletions

View File

@ -17,7 +17,6 @@
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/loading.css">
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/loading.js"></script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js?v=1000"></script>
<!-- <script src="./api2_0.js"></script> -->
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/common/tabs.js"></script>
</head>

View File

@ -14,7 +14,6 @@
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/index.css">
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/loading.js"></script>
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js?v=1000"></script>
<!-- <script src="./api2_0.js"></script> -->
<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>

View File

@ -616,7 +616,13 @@
} else if (entity.channel === 1 && entity.receive_mode === 2) {
locationReplace("./zfb-redPackets.html");
} else {
locationReplace("./redPackets.html");
// 判断 在那个环境打开 如果是微信 获取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");
}
}
}
},

View File

@ -133,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');
},
@ -185,11 +191,36 @@
})
.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) {
// 领取成功结算 5
if (bm_obj_data && !bm_obj_data.settlement_data.is_settlement && bm_obj_data.settlement_data.settlement_type === 5) {
settlementFun(bm_obj_data.token, bm_obj_data.settlement_data.settlement_type);
}
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) {
@ -198,14 +229,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
}
},

View File

@ -11,7 +11,6 @@
<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>
<!-- <script src="./api2_0.js"></script> -->
<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>