Browse Source

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

wangxin 6 years ago
parent
commit
7cc15cb161
3 changed files with 11 additions and 3 deletions
  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();
 
     var that = this;
-
+console.log(url, param);
     dever.package('network').request(dever, url, param, {
       success: function(res){
         if (res.data.status == 1) {

+ 9 - 1
template/carts/index.js

@@ -134,6 +134,13 @@ Page({
     },{
       success:function(data, res){
         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({
           timeStamp: pay.time,
           nonceStr: pay.nonce_str,
@@ -150,8 +157,9 @@ Page({
             //跳转支付结果页
             app.redirect('pay/index?id=' + id);
           },
-          fail: function(){//微信支付失败
+          fail: function(res){//微信支付失败
             app.toast('支付失败!');
+            console.log('支付失败!', res);
           }
         })
       },

+ 1 - 1
template/login/index.js

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