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

@ -122,7 +122,7 @@
const bm_obj_data = sessionStorage.getItem("bm_auth") ? JSON.parse(sessionStorage.getItem("bm_auth")) : null;
new Vue({
el: "#redPacketsViews",
data () {
data() {
return {
promptShow: false,
popShow: false,
@ -133,20 +133,26 @@
copyLink: '',
goodsInfo: JSON.parse(sessionStorage.getItem('goodsInfo')),
backAble: sessionStorage.getItem('goodsCount') > 1,
loading: false
loading: false,
openid: ""
};
},
components: {
modelPop
},
mounted () {
created() {
let openid = getQueryString("openid");
if (openid) {
this.openid = openid;
}
},
mounted() {
document.title = localStorage.getItem('title');
},
methods: {
/* 立即领取 */
receive () {
receive() {
if (this.loading) return;
this.loading = true;
let data = {
@ -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) {
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,19 +229,23 @@
} 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
}
},
/* 复制文本 */
copyFn () {
copyFn() {
if (this.popBt === '关闭') {
return this.popShow = false;
}
@ -229,7 +264,7 @@
},
/* 触发提示 */
tip (text, status, bt) {
tip(text, status, bt) {
this.popText = text;
this.popStatus = status; /*1 成功 2提示 3失败 */
this.popBt = bt;
@ -237,7 +272,7 @@
},
/* 返回 */
backGoodsFn () {
backGoodsFn() {
if (this.backAble) {
locationReplace('./homepage.html');
} else {
@ -246,7 +281,7 @@
},
/* 动态font */
fonts () {
fonts() {
const { cash_amount_type, min_denomination, max_denomination } = this.goodsInfo.entity;
const defaultCss = { b: '0.2rem', a: '0.32rem' };
if (cash_amount_type === '2') {

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>