邮储app唤起微信小程序
This commit is contained in:
parent
f5106f778c
commit
f86fee2718
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* @author 何杰
|
||||
* @date 2016-08-01 12:00:00
|
||||
* @address www.yitong.com.cn
|
||||
* @mail hj@yitong.com.cn
|
||||
* @desc: 屹通客户端组件api
|
||||
*/
|
||||
var Fw = {};
|
||||
Fw.device = {};
|
||||
Fw.device.Device = function () {
|
||||
var userAgent = navigator.userAgent;
|
||||
//ios 事件队列
|
||||
var eventQueue = [];
|
||||
return {
|
||||
//是否iOS设备
|
||||
is_ios: userAgent.indexOf('iPhone') > -1 || userAgent.indexOf('iPad') > -1,
|
||||
//是否Android设备
|
||||
is_android: userAgent.indexOf('Android') > -1,
|
||||
/**
|
||||
* ios
|
||||
* 注册事件
|
||||
* @param code 事件编码
|
||||
* @param options 参数
|
||||
*/
|
||||
addEvent: function (code, options) {
|
||||
if (options && code) {
|
||||
eventQueue.push(JSON.stringify({
|
||||
code: code,
|
||||
name: options
|
||||
}));
|
||||
}
|
||||
},
|
||||
/**
|
||||
* ios
|
||||
* 原生调用,从队列中获取事件
|
||||
* @returns {string}
|
||||
*/
|
||||
getEvent: function () {
|
||||
return eventQueue.length > 0 ? eventQueue.shift() : '0';
|
||||
}
|
||||
};
|
||||
}();
|
||||
/**
|
||||
* 供第三方调用API
|
||||
*/
|
||||
Fw.device.api = function () {
|
||||
var device = Fw.device.Device;
|
||||
return {
|
||||
/**
|
||||
* @brief app跳转微信小程序
|
||||
*/
|
||||
openWXMiniProgram: function (param) {
|
||||
if (!device.is_ios && !device.is_android) {
|
||||
alert("请在ios/android设备上使用!");
|
||||
return;
|
||||
}
|
||||
device.is_ios && device.addEvent("openWXMiniProgram", JSON.stringify(param));
|
||||
device.is_android && GetInfoJs.openWXMiniProgram(JSON.stringify(param));
|
||||
},
|
||||
}
|
||||
}();
|
|
@ -14,6 +14,7 @@
|
|||
</script>
|
||||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js?v=1000"></script>
|
||||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js?v=sdfhksdfklwrwer"></script>
|
||||
<script src="./YT_Client_api.js"></script>
|
||||
<style>
|
||||
body,
|
||||
html {
|
||||
|
@ -548,7 +549,20 @@
|
|||
this.publicCollection();
|
||||
} else {
|
||||
/* 小程序 */
|
||||
window.location.replace(res.data.redirect_url);
|
||||
let ua = navigator.userAgent;
|
||||
// 邮储-唤起微信小程序
|
||||
if (ua.indexOf("CreditCardAppNew UnionPay/1.0") > -1) {
|
||||
Fw.device.api.openWXMiniProgram({
|
||||
programID: "wx9ed74283ad25bca1",
|
||||
path: "pages/index/index",
|
||||
miniType: 2, // 1 开发版 2 体验版
|
||||
extJson: {
|
||||
order_number: res.data.order_number
|
||||
}
|
||||
})
|
||||
} else {
|
||||
window.location.replace(res.data.redirect_url);
|
||||
}
|
||||
this.getProductDetail();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js?v=1000">
|
||||
</script>
|
||||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js"></script>
|
||||
<script src="../YT_Client_api.js"></script>
|
||||
<style>
|
||||
body,
|
||||
html {
|
||||
|
@ -564,7 +565,20 @@
|
|||
this.publicCollection();
|
||||
} else {
|
||||
/* 小程序 */
|
||||
window.location.replace(res.data.redirect_url);
|
||||
let ua = navigator.userAgent;
|
||||
// 邮储-唤起微信小程序
|
||||
if (ua.indexOf("CreditCardAppNew UnionPay/1.0") > -1) {
|
||||
return Fw.device.api.openWXMiniProgram({
|
||||
programID: "wx9ed74283ad25bca1",
|
||||
path: "pages/index/index",
|
||||
miniType: 2, // 1 开发版 2 体验版
|
||||
extJson: {
|
||||
order_number: res.data.order_number
|
||||
}
|
||||
})
|
||||
} else {
|
||||
window.location.replace(res.data.redirect_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<link rel="stylesheet" href="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/css/homepage2_0.css" />
|
||||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js?v=1000"></script>
|
||||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js"></script>
|
||||
<script src="../YT_Client_api.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0 auto;
|
||||
|
@ -253,7 +254,7 @@
|
|||
|
||||
sessionStorage.setItem("lastid", self.goodInfo.product_id);
|
||||
this.orderId = res.data.order_number;
|
||||
let ua = navigator.userAgent.toLowerCase(); //判断用户打开链接环境
|
||||
let ua = navigator.userAgent; //判断用户打开链接环境
|
||||
|
||||
setTimeout(() => {
|
||||
if (self.plaflam == 1) {
|
||||
|
@ -261,6 +262,16 @@
|
|||
self.toLinkAlipay();
|
||||
}
|
||||
if (self.plaflam == 2) {
|
||||
if (ua.indexOf("CreditCardAppNew UnionPay/1.0") > -1) {
|
||||
return Fw.device.api.openWXMiniProgram({
|
||||
programID: "wx9ed74283ad25bca1",
|
||||
path: "pages/index/index",
|
||||
miniType: 2, // 1 开发版 2 体验版
|
||||
extJson: {
|
||||
order_number: res.data.order_number
|
||||
}
|
||||
})
|
||||
}
|
||||
//微信
|
||||
// if (ua.indexOf("dingtalk") > -1) {
|
||||
// //在钉钉内置环境打开,不能唤起微信小程序
|
||||
|
|
14
reduce.html
14
reduce.html
|
@ -15,6 +15,7 @@
|
|||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js?v=sdfhksdfklwrwer"></script>
|
||||
<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="./YT_Client_api.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0 auto;
|
||||
|
@ -251,12 +252,23 @@
|
|||
if (res.code == 200) {
|
||||
sessionStorage.setItem("lastid", self.goodInfo.product_id);
|
||||
this.orderId = res.data.order_number;
|
||||
let ua = navigator.userAgent.toLowerCase(); //判断用户打开链接环境
|
||||
let ua = navigator.userAgent; //判断用户打开链接环境
|
||||
if (self.plaflam == 1) {
|
||||
//支付宝-微信环境中不能唤起支付宝
|
||||
self.toLinkAlipay();
|
||||
}
|
||||
if (self.plaflam == 2) {
|
||||
// 邮储-唤起微信小程序
|
||||
if (ua.indexOf("CreditCardAppNew UnionPay/1.0") > -1) {
|
||||
return Fw.device.api.openWXMiniProgram({
|
||||
programID: "wx9ed74283ad25bca1",
|
||||
path: "pages/index/index",
|
||||
miniType: 2, // 1 开发版 2 体验版
|
||||
extJson: {
|
||||
order_number: res.data.order_number
|
||||
}
|
||||
})
|
||||
}
|
||||
//微信
|
||||
// if (ua.indexOf("dingtalk") > -1) {
|
||||
// //在钉钉内置环境打开,不能唤起微信小程序
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js?v=sdfhksdfklwrwer"></script>
|
||||
<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="../YT_Client_api.js"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0 auto;
|
||||
|
@ -264,7 +265,20 @@
|
|||
} else {
|
||||
// 第二步:其它环境 微信小程序
|
||||
this.loading = false;
|
||||
window.location.replace(res.data.redirect_url);
|
||||
let ua = navigator.userAgent;
|
||||
// 邮储-唤起微信小程序
|
||||
if (ua.indexOf("CreditCardAppNew UnionPay/1.0") > -1) {
|
||||
return Fw.device.api.openWXMiniProgram({
|
||||
programID: "wx9ed74283ad25bca1",
|
||||
path: "pages/index/index",
|
||||
miniType: 2, // 1 开发版 2 体验版
|
||||
extJson: {
|
||||
order_number: res.data.order_number
|
||||
}
|
||||
})
|
||||
} else {
|
||||
window.location.replace(res.data.redirect_url);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.loading = false;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/lodash.min.js"></script>
|
||||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/api2_0.js?v=232323"></script>
|
||||
<script src="https://lsxdemall.oss-cn-beijing.aliyuncs.com/MarketingSystem/js/libs.js?v=sdfhksdfklwrwer"></script>
|
||||
<script src="../YT_Client_api.js"></script>
|
||||
<style>
|
||||
body,
|
||||
html {
|
||||
|
@ -514,7 +515,20 @@
|
|||
self.publicCollection(res.data.order_number);
|
||||
} else {
|
||||
/* 小程序 */
|
||||
window.location.replace(res.data.redirect_url);
|
||||
// 邮储-唤起微信小程序
|
||||
let ua = navigator.userAgent;
|
||||
if (ua.indexOf("CreditCardAppNew UnionPay/1.0") > -1) {
|
||||
Fw.device.api.openWXMiniProgram({
|
||||
programID: "wx9ed74283ad25bca1",
|
||||
path: "pages/index/index",
|
||||
miniType: 2, // 1 开发版 2 体验版
|
||||
extJson: {
|
||||
order_number: res.data.order_number
|
||||
}
|
||||
})
|
||||
} else {
|
||||
window.location.replace(res.data.redirect_url);
|
||||
}
|
||||
self.timeGet = setInterval(() => {
|
||||
self.getProductDetail(); //
|
||||
// self.groupProductVoucherDetail(); // 没有返回值,解决不了
|
||||
|
|
Loading…
Reference in New Issue