Commit 26a71087a1b387cacb66053c8af0a763db258a12

Authored by Andy
1 parent 0f3b6581

add 兑换券

Showing 1 changed file with 4 additions and 49 deletions
js/dynCodePay.js
@@ -8,7 +8,7 @@ var webAppParams = null;//URL参数 @@ -8,7 +8,7 @@ var webAppParams = null;//URL参数
8 var $btnObj = null; 8 var $btnObj = null;
9 var $btnLoad = null; 9 var $btnLoad = null;
10 var webAppCode = null;//如果是微信,先获取微信code 10 var webAppCode = null;//如果是微信,先获取微信code
11 -var flag = 0; 11 +// var flag = 0;
12 window.onload = function () { 12 window.onload = function () {
13 $btnObj = getObjectByID("btnPayOK"); 13 $btnObj = getObjectByID("btnPayOK");
14 $btnLoad = getObjectByID("loading"); 14 $btnLoad = getObjectByID("loading");
@@ -47,51 +47,7 @@ window.onload = function () { @@ -47,51 +47,7 @@ window.onload = function () {
47 } 47 }
48 /**/ 48 /**/
49 var webAppClass = { 49 var webAppClass = {
50 - //优惠券兑换  
51 - codediscountClick:function(tmpObj){  
52 - discountVal = document.getElementById("discountBox").value;  
53 - // console.log(discountVal)  
54 - // console.log(discountVal.length)  
55 - if(discountVal.length > 0){  
56 - $btnObj.style.display = "none";  
57 - $btnLoad.style.display = "block";  
58 - $discountBtn.disabled = true  
59 - console.log(webAppParams.orderId)  
60 - var url = webAppRoot + window.webAppH5.discountServer;  
61 - var discountParams = {  
62 - app_id:'1',  
63 - salt:'1',  
64 - deviceInfo:'1',  
65 - sign_type:'1',  
66 - sign:'1',  
67 - token:'1',  
68 - terminalSource:7,  
69 - orderId:webAppParams.orderId,  
70 - cardNo:discountVal,  
71 - codeType:1  
72 - }  
73 - postRequest(url, discountParams, function (res) {  
74 - console.log(res)  
75 - if(res.code==0){  
76 50
77 - document.getElementById("sumMoney").innerHTML = (res.data.orderFee/100)  
78 - document.getElementById("discountTip").innerHTML = res.data.couponDescribe  
79 - // document.getElementById("discountFee").innerHTML = (res.data.discountFee/100)  
80 - // document.getElementById("discountDesc").style.display="none"  
81 - $btnLoad.style.display = "none";  
82 - $btnObj.style.display = "block";  
83 - flag = 1  
84 - webAppClass.okPay(tmpObj);//唤醒支付  
85 - }else{  
86 - $discountBtn.disabled = false  
87 - document.getElementById("discountTip").innerHTML = res.message  
88 - }  
89 - })  
90 -  
91 - }else{  
92 - return  
93 - }  
94 - },  
95 discountClick: function(){ 51 discountClick: function(){
96 discountVal = document.getElementById("discountBox").value; 52 discountVal = document.getElementById("discountBox").value;
97 // console.log(discountVal) 53 // console.log(discountVal)
@@ -125,7 +81,7 @@ var webAppClass = { @@ -125,7 +81,7 @@ var webAppClass = {
125 $btnLoad.style.display = "none"; 81 $btnLoad.style.display = "none";
126 $btnObj.style.display = "block"; 82 $btnObj.style.display = "block";
127 document.getElementById("discountBox").setAttribute('readonly','readonly'); 83 document.getElementById("discountBox").setAttribute('readonly','readonly');
128 - flag = 1 84 + // flag = 1
129 }else{ 85 }else{
130 $discountBtn.disabled = false 86 $discountBtn.disabled = false
131 document.getElementById("discountTip").innerHTML = res.message 87 document.getElementById("discountTip").innerHTML = res.message
@@ -148,9 +104,8 @@ var webAppClass = { @@ -148,9 +104,8 @@ var webAppClass = {
148 104
149 //确定支付 105 //确定支付
150 okPay: function (params) { 106 okPay: function (params) {
151 - if(flag == 1){  
152 - webAppClass.codediscountClick(tmpObj);  
153 - } 107 + console.log(params)
  108 +
154 var orderID = params.orderId;//订单号 109 var orderID = params.orderId;//订单号
155 //第一首先判断当前哪种浏览器方式[微信内置、支付宝内置、第三方浏览器] 110 //第一首先判断当前哪种浏览器方式[微信内置、支付宝内置、第三方浏览器]
156 var clientType = clientBrowserEx(); 111 var clientType = clientBrowserEx();