|
@@ -27,18 +27,38 @@ Page({
|
|
|
selectedAmount: null,
|
|
|
customAmount: '',
|
|
|
inputFocus: false,
|
|
|
+ zdId:"",
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- // 接收从homepage传递的账单信息
|
|
|
- if (options.billInfo) {
|
|
|
- const billInfo = JSON.parse(decodeURIComponent(options.billInfo));
|
|
|
- debugger
|
|
|
- this.setData({
|
|
|
- amount: billInfo.amount, // 默认实缴金额为应缴金额
|
|
|
- actualAmount: billInfo.amountDue, // 设置应缴金额
|
|
|
- balance: billInfo.balance //余额
|
|
|
- });
|
|
|
- }
|
|
|
+ const _this=this;
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.interfaceUrls.pendingBill + app.globalData.currentAccountInfo.usernumber,
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'content-type': 'application/json',
|
|
|
+ 'token': app.globalData.userWxInfo.token,
|
|
|
+ 'source': "wc",
|
|
|
+ '!SAAS_LOGIN_TOKEN_!': app.globalData.currentAccountInfo.dsKey
|
|
|
+ },
|
|
|
+ success(res) {
|
|
|
+ wx.hideLoading();
|
|
|
+ let apiReturnData = res.data;
|
|
|
+ _this.setData({
|
|
|
+ amount: apiReturnData.data.yj, // 默认实缴金额为应缴金额
|
|
|
+ actualAmount: apiReturnData.data.yj, // 设置应缴金额
|
|
|
+ balance: apiReturnData.data.ye, //余额
|
|
|
+ zdId: apiReturnData.data.zdId // 对应的账单记录
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail(error) {
|
|
|
+ wx.hideLoading();
|
|
|
+ wx.showToast({
|
|
|
+ title: '数据加载失败,请稍后再试',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
this.setData({
|
|
|
images: {
|
|
@@ -87,25 +107,32 @@ Page({
|
|
|
},
|
|
|
data: {
|
|
|
openId: app.globalData.userWxInfo.openid,
|
|
|
- totalAmount: 1,
|
|
|
- description: '测试订单',
|
|
|
+ totalAmount: this.data.amount*100,
|
|
|
+ dskey: app.globalData.currentAccountInfo.dsKey
|
|
|
},
|
|
|
success: res => {
|
|
|
wx.hideLoading();
|
|
|
console.log('预下单', res);
|
|
|
+ let orderNo=res.data.data.orderNo;
|
|
|
wx.requestPayment({
|
|
|
- timeStamp: res.data.data.timeStamp,
|
|
|
- nonceStr: res.data.data.nonceStr,
|
|
|
- package: res.data.data.packageVal,
|
|
|
+ timeStamp: res.data.data.paymentSign.timeStamp,
|
|
|
+ nonceStr: res.data.data.paymentSign.nonceStr,
|
|
|
+ package: res.data.data.paymentSign.packageVal,
|
|
|
signType: 'RSA',
|
|
|
- paySign: res.data.data.paySign,
|
|
|
+ paySign: res.data.data.paymentSign.paySign,
|
|
|
success: res => {
|
|
|
- console.log('支付结果', res)
|
|
|
+ console.log('支付结果', res);
|
|
|
+ this.createWeChatPayMentRecord(orderNo,this.data.amount);
|
|
|
+ },
|
|
|
+ fail (res) {
|
|
|
+ console.log("fail",res);
|
|
|
},
|
|
|
complete: () => {
|
|
|
-
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
// 模拟支付
|
|
@@ -278,6 +305,40 @@ Page({
|
|
|
inputFocus: false
|
|
|
});
|
|
|
},
|
|
|
+ // 创建微信付款记录
|
|
|
+ createWeChatPayMentRecord:function(orderNo,paymentAmount){
|
|
|
+ wx.request({
|
|
|
+ url: app.globalData.interfaceUrls.createPaymentRecord,
|
|
|
+ method: 'POST',
|
|
|
+ header: {
|
|
|
+ 'content-type': 'application/json',
|
|
|
+ 'token': app.globalData.userWxInfo.token,
|
|
|
+ 'source': "wc",
|
|
|
+ '!SAAS_LOGIN_TOKEN_!': app.globalData.currentAccountInfo.dsKey
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ orderNo: orderNo,
|
|
|
+ paymentAmount: paymentAmount,
|
|
|
+ zdId: this.data.zdId,
|
|
|
+ userNumber: app.globalData.currentAccountInfo.usernumber,
|
|
|
+ dsKey: app.globalData.currentAccountInfo.dsKey
|
|
|
+ },
|
|
|
+ success(res) {
|
|
|
+ wx.hideLoading();
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/jiaofeiSuccess/jiaofeiSuccess',
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail(error) {
|
|
|
+ wx.hideLoading();
|
|
|
+ wx.showToast({
|
|
|
+ title: '数据加载失败,请稍后再试',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
// 从接口获取支付数据
|
|
|
fetchPaymentData: function() {
|
|
@@ -291,10 +352,10 @@ Page({
|
|
|
// });
|
|
|
// }
|
|
|
// });
|
|
|
-
|
|
|
+
|
|
|
// this.setData({
|
|
|
// amountDue: 150.00,
|
|
|
// balance: 200.50
|
|
|
// });
|
|
|
},
|
|
|
-})
|
|
|
+})
|