Files
peko-h5/view/peko/modules/pay/js/result.js

96 lines
3.0 KiB
JavaScript
Raw Normal View History

2024-01-06 16:11:00 +08:00
var browser = checkVersion();
const urlPrefix = getUrlPrefix();
var getUrl = getQueryString();
// 封裝layer消息提醒框
let layerIndex
const showLoading = (content = '加載中...') => {
layer.open({
type: 2,
shadeClose: false,
content,
success (e) {
layerIndex = $(e).attr('index')
}
})
}
const hideLoading = (index) => {
layer.close(index)
}
const toastMsg = (content = '操作完成', time = 2) => {
layer.open({
content,
time,
skin: 'msg'
})
}
var chargeRecordId = null;//订单号
2024-02-01 11:55:34 +08:00
var chargeStatus = 0;
2024-02-01 14:46:45 +08:00
var isApp = 0;
2024-01-06 16:11:00 +08:00
$(function () {
if (EnvCheck() == 'test') {//degBug
new VConsole();
}
getInfoFromClient();//请求依赖
chargeRecordId = getUrl.chargeRecordId;
setTimeout(function () {
getChargeResult();
}, 100)
})
// 获取充值结果
function getChargeResult () {
showLoading();
networkRequest({
type: 'GET',
url: urlPrefix + '/chargeRecord/getChargeResult',
data: { chargeRecordId },
success: function (res) {
if (res.code == 200) {
$('.success').show();
2024-02-01 11:55:34 +08:00
chargeStatus = 1;
2024-01-06 16:11:00 +08:00
} else {
2024-02-01 11:55:34 +08:00
chargeStatus = 0;
2024-01-06 16:11:00 +08:00
$('.result span').text(`原因:${res.message}`);
$('.err').show();
hideLoading(layerIndex);
}
hideLoading(layerIndex);
},
error (err) {
hideLoading(layerIndex);
toastMsg('網絡錯誤');
}
});
}
2024-02-01 11:55:34 +08:00
$('.result .but').click(function () {
2024-02-01 14:46:45 +08:00
isApp = getUrl.app;
if (isApp == 1) {
if (browser.app) {
window.location.href = urlPrefix + '/peko/modules/pay/index.html?channelType=4';
} else {
window.location.href = `pekoapp://payment/result?status=${chargeStatus}`;
}
2024-02-01 11:55:34 +08:00
} else {
window.location.href = urlPrefix + '/peko/modules/pay/index.html?channelType=4';
}
return
var qs = AppRedirect.queryString;
// Here we initiate the redirect process
AppRedirect.redirect({
iosApp: 'twitter://post?message=' + qs['message'],
iosAppStore: 'https://itunes.apple.com/il/app/twitter/id333903271?mt=8&message=' + qs['message'],
// 为此,你的应用需要有一个类别过滤器:android.intent.category.BROWSABLE
android: {
// 'host': 'post/?message=' + encodeURIComponent(qs['message']), // 自定义方案URL中的Host/path/querystring部分
// 'action': " //相当于intent中的action
// 'category': ' //相当于intent中的category
// 'component': ' //相当于intent中的component
// 'scheme': 'twitter', // 自定义方案URL中的方案部分
// 'package': 'com.twitter.android', // Play store中的包名
// 'fallback': 'https://play.google.com/store/apps/details?id=com.twitter.android&hl=en&message=' + qs['message']
'scheme': 'pekoapp',
'host': 'payment/result'
}
});
})