소스 검색

订单支付

twt 3 년 전
부모
커밋
a1637fb706
2개의 변경된 파일68개의 추가작업 그리고 50개의 파일을 삭제
  1. 35 26
      pages/order/myorder.vue
  2. 33 24
      pages/order/orderDetail.vue

+ 35 - 26
pages/order/myorder.vue

@@ -149,35 +149,44 @@
 			},
 			orderPay(item) {
 				uni.showLoading({});
-				this.$http('miniApp/maintainOrder/orderPay', {
+				var that=this;
+				this.$http('worldKeepCar/maintainOrder/orderPay', {
 					sheetID: item.ID
 				}, 'POST').then(res => {
 					uni.hideLoading();
-					var payInfo = JSON.parse(res.data.payInfo)
-					uni.requestPayment({
-						provider: 'wxpay',
-						// timeStamp: String(Date.now()),
-						timeStamp: payInfo.timeStamp,
-						nonceStr: payInfo.nonceStr,
-						package: payInfo.package,
-						signType: payInfo.signType,
-						paySign: payInfo.paySign,
-						success: function(res) {
-							console.log('success:' + JSON.stringify(res));
-							uni.showToast({
-								title: '支付成功',
-								icon: 'none',
-								duration: 2000
-							});
-							uni.switchTab({
-								url: '../index/index'
-							})
-						},
-						fail: function(err) {
-							console.log('fail:' + JSON.stringify(err));
-
-						}
-					});
+					if(res.isPay==0){
+						uni.showToast({
+							title: '支付成功',
+							icon: 'none',
+							duration: 2000
+						});	
+						that.getData()
+					}else{
+						var payInfo = JSON.parse(res.data.payInfo)
+						uni.requestPayment({
+							provider: 'wxpay',
+							// timeStamp: String(Date.now()),
+							timeStamp: payInfo.timeStamp,
+							nonceStr: payInfo.nonceStr,
+							package: payInfo.package,
+							signType: payInfo.signType,
+							paySign: payInfo.paySign,
+							success: function(res) {
+								console.log('success:' + JSON.stringify(res));
+								uni.showToast({
+									title: '支付成功',
+									icon: 'none',
+									duration: 2000
+								});
+								that.getData()
+							},
+							fail: function(err) {
+								console.log('fail:' + JSON.stringify(err));
+						
+							}
+						});
+					}
+					
 				})
 			},
 		},

+ 33 - 24
pages/order/orderDetail.vue

@@ -510,33 +510,42 @@
 			orderPay() {
 				uni.showLoading({});
 				var that = this;
-				this.$http('miniApp/maintainOrder/orderPay', {
+				this.$http('worldKeepCar/maintainOrder/orderPay', {
 					sheetID: this.orderData.ID
 				}, 'POST').then(res => {
 					uni.hideLoading();
-					var payInfo = JSON.parse(res.data.payInfo)
-					uni.requestPayment({
-						provider: 'wxpay',
-						// timeStamp: String(Date.now()),
-						timeStamp: payInfo.timeStamp,
-						nonceStr: payInfo.nonceStr,
-						package: payInfo.package,
-						signType: payInfo.signType,
-						paySign: payInfo.paySign,
-						success: function(res) {
-							console.log('success:' + JSON.stringify(res));
-							uni.showToast({
-								title: '支付成功',
-								icon: 'none',
-								duration: 2000
-							});
-							that.getData()
-						},
-						fail: function(err) {
-							console.log('fail:' + JSON.stringify(err));
-
-						}
-					});
+					if(res.isPay==0){
+						uni.showToast({
+							title: '支付成功',
+							icon: 'none',
+							duration: 2000
+						});	
+						that.getData()
+					}else{
+						var payInfo = JSON.parse(res.data.payInfo)
+						uni.requestPayment({
+							provider: 'wxpay',
+							// timeStamp: String(Date.now()),
+							timeStamp: payInfo.timeStamp,
+							nonceStr: payInfo.nonceStr,
+							package: payInfo.package,
+							signType: payInfo.signType,
+							paySign: payInfo.paySign,
+							success: function(res) {
+								console.log('success:' + JSON.stringify(res));
+								uni.showToast({
+									title: '支付成功',
+									icon: 'none',
+									duration: 2000
+								});
+								that.getData()
+							},
+							fail: function(err) {
+								console.log('fail:' + JSON.stringify(err));
+						
+							}
+						});
+					}
 				})
 			},
 			timeSfCk(item, index) {