Ver código fonte

修复微信支付参数packge添加prepay_id=前缀

wangxin 6 anos atrás
pai
commit
7cc15cb161
3 arquivos alterados com 11 adições e 3 exclusões
  1. 1 1
      app.js
  2. 9 1
      template/carts/index.js
  3. 1 1
      template/login/index.js

+ 1 - 1
app.js

@@ -169,7 +169,7 @@ App({
     param['signature'] = dever.getSign();
     param['signature'] = dever.getSign();
 
 
     var that = this;
     var that = this;
-
+console.log(url, param);
     dever.package('network').request(dever, url, param, {
     dever.package('network').request(dever, url, param, {
       success: function(res){
       success: function(res){
         if (res.data.status == 1) {
         if (res.data.status == 1) {

+ 9 - 1
template/carts/index.js

@@ -134,6 +134,13 @@ Page({
     },{
     },{
       success:function(data, res){
       success:function(data, res){
         var pay = data.pay;
         var pay = data.pay;
+        console.log('requestPayment-1', pay);
+        console.log('requestPayment-2', {
+          timeStamp: pay.time,
+          nonceStr: pay.nonce_str,
+          package: 'prepay_id='+ pay.prepay_id,
+          signType: pay.sign_type,
+          paySign: pay.sign});
         wx.requestPayment({
         wx.requestPayment({
           timeStamp: pay.time,
           timeStamp: pay.time,
           nonceStr: pay.nonce_str,
           nonceStr: pay.nonce_str,
@@ -150,8 +157,9 @@ Page({
             //跳转支付结果页
             //跳转支付结果页
             app.redirect('pay/index?id=' + id);
             app.redirect('pay/index?id=' + id);
           },
           },
-          fail: function(){//微信支付失败
+          fail: function(res){//微信支付失败
             app.toast('支付失败!');
             app.toast('支付失败!');
+            console.log('支付失败!', res);
           }
           }
         })
         })
       },
       },

+ 1 - 1
template/login/index.js

@@ -67,7 +67,7 @@ Page({
     var userInfo = wxObj.userInfo;
     var userInfo = wxObj.userInfo;
     var loginInfo = app.getLoginInfo();
     var loginInfo = app.getLoginInfo();
     app.request('passport.applet.update',{
     app.request('passport.applet.update',{
-        nickname: encodeURIComponent(userInfo.nickName),
+        nickname: userInfo.nickName,
         avatarurl: userInfo.avatarUrl,
         avatarurl: userInfo.avatarUrl,
         iv: wxObj.iv,
         iv: wxObj.iv,
         encryptedData: wxObj.encryptedData,
         encryptedData: wxObj.encryptedData,