| 
																	
																	
																		
																	
																	
																 | 
																@@ -17,6 +17,8 @@ Page({ | 
															
														
														
													
														
															
																 | 
																 | 
																    }) | 
																 | 
																 | 
																    }) | 
															
														
														
													
														
															
																 | 
																 | 
																  }, | 
																 | 
																 | 
																  }, | 
															
														
														
													
														
															
																 | 
																 | 
																  orderfunc(){ | 
																 | 
																 | 
																  orderfunc(){ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    var orderId = ''; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    var payOrderId = ''; | 
															
														
														
													
														
															
																 | 
																 | 
																    wx.showLoading({ | 
																 | 
																 | 
																    wx.showLoading({ | 
															
														
														
													
														
															
																 | 
																 | 
																        title: '加载中...', | 
																 | 
																 | 
																        title: '加载中...', | 
															
														
														
													
														
															
																 | 
																 | 
																    }) | 
																 | 
																 | 
																    }) | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -26,9 +28,22 @@ Page({ | 
															
														
														
													
														
															
																 | 
																 | 
																      wx.hideLoading(); | 
																 | 
																 | 
																      wx.hideLoading(); | 
															
														
														
													
														
															
																 | 
																 | 
																      console.log(res) | 
																 | 
																 | 
																      console.log(res) | 
															
														
														
													
														
															
																 | 
																 | 
																      if (res.data.code == 200) { | 
																 | 
																 | 
																      if (res.data.code == 200) { | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        Common.payOrderCreate('' + res.data.data.id) | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        .then(res =>{ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																          return res; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        } else { | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																          wx.showToast({ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            title: res.data.message, | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																            duration: 3000 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																          }) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        } | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																      }) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																      .then(res => { | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        orderId = '' + res.data.data.id; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        return Common.payOrderCreate(orderId) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																      }) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																      .then(res => { | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        console.log(res) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        payOrderId = res.data.data.payOrderId; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        if (res.data.code == 200) { | 
															
														
														
													
														
															
																 | 
																 | 
																          wx.requestPayment({ | 
																 | 
																 | 
																          wx.requestPayment({ | 
															
														
														
													
														
															
																 | 
																 | 
																            timeStamp: res.data.data.timeStamp, | 
																 | 
																 | 
																            timeStamp: res.data.data.timeStamp, | 
															
														
														
													
														
															
																 | 
																 | 
																            nonceStr: res.data.data.nonceStr, | 
																 | 
																 | 
																            nonceStr: res.data.data.nonceStr, | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -36,6 +51,8 @@ Page({ | 
															
														
														
													
														
															
																 | 
																 | 
																            signType: 'MD5', | 
																 | 
																 | 
																            signType: 'MD5', | 
															
														
														
													
														
															
																 | 
																 | 
																            paySign: res.data.data.paySign, | 
																 | 
																 | 
																            paySign: res.data.data.paySign, | 
															
														
														
													
														
															
																 | 
																 | 
																            'success': function (res) { | 
																 | 
																 | 
																            'success': function (res) { | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																              Common.payOrderUpdate(orderId, payOrderId, 1); // 支付成功 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																              console.log(res); | 
															
														
														
													
														
															
																 | 
																 | 
																              console.log('支付成功'); | 
																 | 
																 | 
																              console.log('支付成功'); | 
															
														
														
													
														
															
																 | 
																 | 
																              wx.showToast({ | 
																 | 
																 | 
																              wx.showToast({ | 
															
														
														
													
														
															
																 | 
																 | 
																                title: '购买成功', | 
																 | 
																 | 
																                title: '购买成功', | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -46,11 +63,13 @@ Page({ | 
															
														
														
													
														
															
																 | 
																 | 
																              }) | 
																 | 
																 | 
																              }) | 
															
														
														
													
														
															
																 | 
																 | 
																            }, | 
																 | 
																 | 
																            }, | 
															
														
														
													
														
															
																 | 
																 | 
																            'fail': function (res) { | 
																 | 
																 | 
																            'fail': function (res) { | 
															
														
														
													
														
															
																 | 
																 | 
																              console.log('支付失败'); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																              Common.payOrderUpdate(orderId, payOrderId, 2); // 支付失败 | 
															
														
														
													
														
															
																 | 
																 | 
																              console.log(res) | 
																 | 
																 | 
																              console.log(res) | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																              console.log('支付失败'); | 
															
														
														
													
														
															
																 | 
																 | 
																              return; | 
																 | 
																 | 
																              return; | 
															
														
														
													
														
															
																 | 
																 | 
																            }, | 
																 | 
																 | 
																            }, | 
															
														
														
													
														
															
																 | 
																 | 
																            'complete': function (res) { | 
																 | 
																 | 
																            'complete': function (res) { | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																              console.log(res); | 
															
														
														
													
														
															
																 | 
																 | 
																              console.log('支付完成'); | 
																 | 
																 | 
																              console.log('支付完成'); | 
															
														
														
													
														
															
																 | 
																 | 
																              var url = that.data.url; | 
																 | 
																 | 
																              var url = that.data.url; | 
															
														
														
													
														
															
																 | 
																 | 
																              console.log('get url', url) | 
																 | 
																 | 
																              console.log('get url', url) | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -70,19 +89,16 @@ Page({ | 
															
														
														
													
														
															
																 | 
																 | 
																                    wx.navigateBack() | 
																 | 
																 | 
																                    wx.navigateBack() | 
															
														
														
													
														
															
																 | 
																 | 
																                  }, 2000) | 
																 | 
																 | 
																                  }, 2000) | 
															
														
														
													
														
															
																 | 
																 | 
																                } | 
																 | 
																 | 
																                } | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																              } else { | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                wx.showModal({ | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                  title: '错误提示', | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                  content: res.errMsg  | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																                }); | 
															
														
														
													
														
															
																 | 
																 | 
																              } | 
																 | 
																 | 
																              } | 
															
														
														
													
														
															
																 | 
																 | 
																              return; | 
																 | 
																 | 
																              return; | 
															
														
														
													
														
															
																 | 
																 | 
																            } | 
																 | 
																 | 
																            } | 
															
														
														
													
														
															
																 | 
																 | 
																          }) | 
																 | 
																 | 
																          }) | 
															
														
														
													
														
															
																 | 
																 | 
																           | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        }) | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																         | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																      } else { | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        wx.showToast({ | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																          title: res.data.message, | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																          duration: 3000 | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        }) | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																      } | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																    }) | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        } | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																      }) | 
															
														
														
													
														
															
																 | 
																 | 
																  } | 
																 | 
																 | 
																  } | 
															
														
														
													
														
															
																 | 
																 | 
																}) | 
																 | 
																 | 
																}) |