feat: 新增支付宝H5领取逻辑

This commit is contained in:
wangsongsole 2023-11-17 18:02:54 +08:00
parent 66f3694277
commit 253878afba
2 changed files with 33 additions and 19 deletions

View File

@ -165,19 +165,25 @@
return this.popFunction({ title: '温馨提示', text: '立减金领取过期', status: 2, b_text: '我知道了', show: true });
}
if (item.channel == 1) {
let bankLink = encodeURIComponent(
window.location.origin +
"/alipay.html?orderNumber=" + data.order_number
);
let link = "http://openapi.1688sup.com/alipay/oauth?jump=" + bankLink;
let ua = navigator.userAgent.toLowerCase(); //判断用户打开链接环境
if (ua.indexOf("micromessenger") > -1 || ua.indexOf("baiduboxapp") > -1 || ua.indexOf("firefox") > -1) {
//在微信内置环境、百度app打开不能唤起支付宝
this.href = link;
this.popFunction({ title: '温馨提示', text: `请复制链接,在其他浏览器打开`, status: 2, b_text: '点击复制', show: true });
if (item.goods.entity.receive_mode === 2) { /* H5 领取 */
item.goods.available = 1;
sessionStorage.setItem('goodsInfo', JSON.stringify(item.goods));
location.href = './zfb-reduce.html';
} else {
//唤起支付宝
window.location.replace(link);
let bankLink = encodeURIComponent(
window.location.origin +
"/alipay.html?orderNumber=" + data.order_number
);
let link = "http://openapi.1688sup.com/alipay/oauth?jump=" + bankLink;
let ua = navigator.userAgent.toLowerCase(); //判断用户打开链接环境
if (ua.indexOf("micromessenger") > -1 || ua.indexOf("baiduboxapp") > -1 || ua.indexOf("firefox") > -1) {
//在微信内置环境、百度app打开不能唤起支付宝
this.href = link;
this.popFunction({ title: '温馨提示', text: `请复制链接,在其他浏览器打开`, status: 2, b_text: '点击复制', show: true });
} else {
//唤起支付宝
window.location.replace(link);
}
}
}
@ -194,12 +200,18 @@
/* 红包领取 */
if (item.type === 3) {
if (item.channel === 1) {
const aliPaysUrl = `alipays://platformapi/startapp?appId=2021004100663111&page=pages/index/index?order_number=${encodeURIComponent(window.btoa(data.order_number))}`;
if (isWx() || (ua.indexOf("android") > -1 && ua.indexOf("baiduboxapp") > -1) || ua.indexOf("windows") > -1) {
this.href = aliPaysUrl;
this.popFunction({ title: '温馨提示', text: `请复制链接,在其他浏览器打开`, status: 2, b_text: '点击复制', show: true });
if (item.goods.entity.receive_mode === 2) { /* H5 领取 */
item.goods.available = 1;
sessionStorage.setItem('goodsInfo', JSON.stringify(item.goods));
location.href = './zfb-redPackets.html';
} else {
location.replace(aliPaysUrl);
const aliPaysUrl = `alipays://platformapi/startapp?appId=2021004100663111&page=pages/index/index?order_number=${encodeURIComponent(window.btoa(data.order_number))}`;
if (isWx() || (ua.indexOf("android") > -1 && ua.indexOf("baiduboxapp") > -1) || ua.indexOf("windows") > -1) {
this.href = aliPaysUrl;
this.popFunction({ title: '温馨提示', text: `请复制链接,在其他浏览器打开`, status: 2, b_text: '点击复制', show: true });
} else {
location.replace(aliPaysUrl);
}
}
}
@ -365,6 +377,7 @@
const channel = product.entity.channel;
newItem['product_name'] = product.entity.batch_goods_name;
newItem['channel'] = channel;
newItem['goods'] = product;
if (channel === 1) {
newItem['src'] = 'https://lsxdemall.oss-cn-beijing.aliyuncs.com/commonproductlogo/zfbreduce.png';
}
@ -379,6 +392,7 @@
const channels = product.entity.channel;
newItem['product_name'] = product.entity.batch_goods_name;
newItem['channel'] = channels;
newItem['goods'] = product;
if (channels === 1) {
newItem['src'] = 'https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/img/redPacktes/alipay_icon.png';
}

View File

@ -162,7 +162,7 @@
.then(({ code, data, message }) => {
if (code == 200) {
this.loading = false;
this.judgeEnvironment(data.order_number);
this.judgeEnvironment(data.original_order_number);
} else {
this.loading = false;
this.tip(message, 2, '关闭');
@ -175,7 +175,7 @@
req.axiosPost(`/alipay/cash/receive/${order_number}`, this.form)
.then(({ code, data, message }) => {
if (code == 200) {
this.tip(message, 1, '关闭');
} else {
if (code == 403) {
if (this.backAble) {