|
@@ -18,7 +18,6 @@ Page({
|
|
|
* 生命周期函数--监听页面加载
|
|
|
*/
|
|
|
onLoad: function (options) {
|
|
|
- options.id=9
|
|
|
wx.request({
|
|
|
url: host + '/api/wx/signup',
|
|
|
method: 'GET',
|
|
@@ -42,7 +41,48 @@ Page({
|
|
|
})
|
|
|
};
|
|
|
},
|
|
|
-
|
|
|
+ pay:function(){
|
|
|
+ var data=this.data.data;
|
|
|
+ wx.showLoading({
|
|
|
+ title: '正在提交...',
|
|
|
+ })
|
|
|
+ wx.request({
|
|
|
+ url: host+'/api/wx/signup/pay',
|
|
|
+ method:'POST',
|
|
|
+ header: {
|
|
|
+ openid: app.globalData.openid
|
|
|
+ },
|
|
|
+ data:{
|
|
|
+ total_fee: data.price,
|
|
|
+ signup_id:data.id,
|
|
|
+ bill_type:1,
|
|
|
+ bill_no:'',
|
|
|
+ bill_mat:1
|
|
|
+ },
|
|
|
+ success:res=>{
|
|
|
+ console.log(res.data.data)
|
|
|
+ wx.hideLoading()
|
|
|
+ var timestamp = Date.parse(new Date());
|
|
|
+ var _data={
|
|
|
+ timeStamp: String(timestamp),
|
|
|
+ nonceStr: res.data.data.nonce_str,
|
|
|
+ package: 'prepay_id=' + res.data.data.prepay_id,
|
|
|
+ signType: 'MD5',
|
|
|
+ paySign: res.data.data.sign,
|
|
|
+ }
|
|
|
+ console.log(_data)
|
|
|
+ wx.requestPayment({
|
|
|
+ timeStamp: String(timestamp),
|
|
|
+ nonceStr: res.data.data.nonce_str,
|
|
|
+ package: 'prepay_id=' + res.data.data.prepay_id,
|
|
|
+ signType: 'MD5',
|
|
|
+ paySign: res.data.data.sign,
|
|
|
+ success(res) { console.log(res)},
|
|
|
+ fail(res) { console.log(res)}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|