Authored by 郭成尧

wechat-pay

... ... @@ -7,10 +7,10 @@ var loading = require('../plugin/loading'),
// 点击微信显示加载
var $loadingToast = $(".loading-toast");
var $loadingToast = $('.loading-toast');
/* TODO 影响加载此段 JS */
// var theOrderCode = document.getElementById('ordercode').value;
var theOrderCode = document.getElementById('ordercode').value;
var wxPayEl = document.getElementById('weixin'),
wxHammer = wxPayEl && new Hammer(wxPayEl);
... ... @@ -36,9 +36,9 @@ if ($('#goods-list').length === 0) {
$('.maybe-like').hide();
}
//隐藏微信分享选项
// 隐藏微信分享选项
if (window.wx) {
wx.hideOptionMenu();
window.wx.hideOptionMenu();
}
function onBridgeReady() {
... ... @@ -61,14 +61,13 @@ if (typeof WeixinJSBridge === undefined) {
// 调用微信JS api 支付
function jsApiCall(orderCode, jsApiParameters) {
$loadingToast.addClass("hide");
$loadingToast.addClass('hide');
// 防止重复操作弹框
window.WeixinJSBridge && window.WeixinJSBridge.invoke(
'getBrandWCPayRequest',
jsApiParameters,
function(res) {
function() {
window.location.href = '/home/orders/detail?order_code=' + orderCode + '&openId=true';
}
);
... ... @@ -78,7 +77,7 @@ function jsApiCall(orderCode, jsApiParameters) {
function callpay(orderCode) {
var jsApiParameters;
$loadingToast.removeClass("hide");
$loadingToast.removeClass('hide');
if (typeof WeixinJSBridge === undefined) {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
... ... @@ -91,7 +90,7 @@ function callpay(orderCode) {
type: 'GET',
url: '/shopping/pay/wechatwapapi',
data: {
'order_code': orderCode
order_code: orderCode
},
dataType: 'json',
success: function(res) {
... ... @@ -106,7 +105,7 @@ function callpay(orderCode) {
tip.show('请刷新本页面,完成微信支付');
},
complete: function() {
$loadingToast.addClass("hide");
$loadingToast.addClass('hide');
}
});
}
... ... @@ -177,7 +176,7 @@ function showPage() {
function bindTouchedEvent() {
var $boxs = $('.box');
$boxs.on('touchstart', function(e) {
$boxs.on('touchstart', function() {
$(this).addClass('bytouch');
}).on('touchend touchcancel', function() {
$boxs.removeClass('bytouch');
... ...