diff --git a/js/dynCodePay.js b/js/dynCodePay.js index cb4645e..ab4613f 100644 --- a/js/dynCodePay.js +++ b/js/dynCodePay.js @@ -8,7 +8,7 @@ var webAppParams = null;//URL参数 var $btnObj = null; var $btnLoad = null; var webAppCode = null;//如果是微信,先获取微信code -var flag = 0; +// var flag = 0; window.onload = function () { $btnObj = getObjectByID("btnPayOK"); $btnLoad = getObjectByID("loading"); @@ -47,51 +47,7 @@ window.onload = function () { } /**/ var webAppClass = { - //优惠券兑换 - codediscountClick:function(tmpObj){ - discountVal = document.getElementById("discountBox").value; - // console.log(discountVal) - // console.log(discountVal.length) - if(discountVal.length > 0){ - $btnObj.style.display = "none"; - $btnLoad.style.display = "block"; - $discountBtn.disabled = true - console.log(webAppParams.orderId) - var url = webAppRoot + window.webAppH5.discountServer; - var discountParams = { - app_id:'1', - salt:'1', - deviceInfo:'1', - sign_type:'1', - sign:'1', - token:'1', - terminalSource:7, - orderId:webAppParams.orderId, - cardNo:discountVal, - codeType:1 - } - postRequest(url, discountParams, function (res) { - console.log(res) - if(res.code==0){ - document.getElementById("sumMoney").innerHTML = (res.data.orderFee/100) - document.getElementById("discountTip").innerHTML = res.data.couponDescribe - // document.getElementById("discountFee").innerHTML = (res.data.discountFee/100) - // document.getElementById("discountDesc").style.display="none" - $btnLoad.style.display = "none"; - $btnObj.style.display = "block"; - flag = 1 - webAppClass.okPay(tmpObj);//唤醒支付 - }else{ - $discountBtn.disabled = false - document.getElementById("discountTip").innerHTML = res.message - } - }) - - }else{ - return - } - }, discountClick: function(){ discountVal = document.getElementById("discountBox").value; // console.log(discountVal) @@ -125,7 +81,7 @@ var webAppClass = { $btnLoad.style.display = "none"; $btnObj.style.display = "block"; document.getElementById("discountBox").setAttribute('readonly','readonly'); - flag = 1 + // flag = 1 }else{ $discountBtn.disabled = false document.getElementById("discountTip").innerHTML = res.message @@ -148,9 +104,8 @@ var webAppClass = { //确定支付 okPay: function (params) { - if(flag == 1){ - webAppClass.codediscountClick(tmpObj); - } + console.log(params) + var orderID = params.orderId;//订单号 //第一首先判断当前哪种浏览器方式[微信内置、支付宝内置、第三方浏览器] var clientType = clientBrowserEx();