Files
peko-h5/view/peko/modules/pay/js/result.js
2024-02-01 14:46:45 +08:00

96 lines
3.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;//订单号
var chargeStatus = 0;
var isApp = 0;
$(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();
chargeStatus = 1;
} else {
chargeStatus = 0;
$('.result span').text(`原因:${res.message}`);
$('.err').show();
hideLoading(layerIndex);
}
hideLoading(layerIndex);
},
error (err) {
hideLoading(layerIndex);
toastMsg('網絡錯誤');
}
});
}
$('.result .but').click(function () {
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}`;
}
} 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'
}
});
})