1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > ASP微信头像保存到服务器 asp微信小程序获取用户头像和微信名-asp写的服务端...

ASP微信头像保存到服务器 asp微信小程序获取用户头像和微信名-asp写的服务端...

时间:2020-01-11 18:03:11

相关推荐

ASP微信头像保存到服务器 asp微信小程序获取用户头像和微信名-asp写的服务端...

//index.js

//获取应用实例

var app = getApp()

Page({

data: {

paydata: { title: "支付测试", total_fee:1},

userInfo: {}

},

onLoad: function () {

console.log(‘onLoad‘);

//判断是否获取到了详细信息

if (!wx.getStorageSync("userInfo")) {

wx.navigateTo({ url: ‘/pages/login/index‘})

}

},

// 监听输入

bindKeyInput: function (e) {

console.log(e.detail.value);

this.setData({

‘paydata.total_fee‘: e.detail.value

})

},

//

payoff: function(e){

var that = this;

//获取openid

app.wxlogin(function (re) {

console.log(re);

//判断有无openid

if (re) {

that.setData({ ‘paydata.openid‘:re })

//下单

that.xiadan();

}

});

},

//下单

xiadan: function (){

var that = this;

wx.request({

url: app.globalData.apiurl+‘c=payorder‘,

method: ‘POST‘,

header: { ‘content-type‘: ‘application/x-www-form-urlencoded‘ },

data: that.data.paydata,

success: function(res) {

console.log(res);

if(res.data.code=="0"){

//发起支付

that.requestPayment(res.data.data);

}else{

wx.showModal({

title: ‘提示‘,

content: ‘支付发起失败‘,

showCancel:false

});

}

}

})

},

//申请支付

requestPayment: function(obj){

console.log(obj);

var that=this;

wx.requestPayment({

‘timeStamp‘: obj.timeStamp,

‘nonceStr‘: obj.nonceStr,

‘package‘: obj.package,

‘signType‘: obj.signType,

‘paySign‘: obj.paySign,

‘success‘:function(res){

wx.showModal({

title: ‘提示‘,

content: ‘成功支付:‘ + that.data.paydata.total_fee+‘分‘,

showCancel: false

});

},

‘fail‘:function(res){

wx.showModal({

title: ‘提示‘,

content: ‘支付失败‘,

showCancel: false

});

}

})

},

})

=============================================

互相学习电话微信:18611436777(加微信注明事由)

原文:/lytocnc/p/9855593.html

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。