Ver código fonte

修改现金支付

lyb 4 anos atrás
pai
commit
ae31f7ce52
2 arquivos alterados com 30 adições e 28 exclusões
  1. 15 15
      pages/activity/activityDetail.vue
  2. 15 13
      pages/shop/detail.vue

+ 15 - 15
pages/activity/activityDetail.vue

@@ -127,18 +127,6 @@
 
 			this.getActivitySetting();
 		},
-		onShow() {
-			let that = this
-			uni.$on('updateData',function(payStatus){
-				that.payStatus = payStatus;
-				that.voteSuccess();
-				console.log('作品投票监听到事件来自 updateData,携带参数为:' + payStatus);
-			})
-		},
-		onUnload() {
-			//移除监听事件
-			uni.$off('updateData')
-		},
 		computed: {
 			content() {
 				return decodeURIComponent(this.activity.content)
@@ -200,8 +188,7 @@
 				},
 				//活动设置
 				activitySetting: {},
-				//支付状态
-				payStatus: ''
+				interval: '',
 			}
 		},
 		onShareAppMessage(res) {
@@ -414,16 +401,29 @@
 				}
 				let res = await this.$api.order.cashExchange(params)
 				if (res.data.success) {
-					this.payStatus = ''; //创建新订单,清空订单状态
 					// uni.navigateTo({
 					// 	url: `/pages/webview/payOrder?url=${res.data.data.qrCodeUrl}&orderId=${res.data.data.id}`
 					// })
+					this.queryOrder(res.data.data.id)
 					window.location.href = res.data.data.qrCodeUrl
 				} else {
 					this.$refs.toast.error(res.data.msg)
 				}
 				this.$refs.votePopup.hideVote();
 			},
+			//查询订单状态
+			queryOrder(orderId){
+				let params = {
+					id: orderId
+				}
+				this.interval = setInterval(() => {
+				  let res = this.$api.order.orderDetail(params)
+				  if(res.data.success && res.data.data.payStatus === '付款成功'){
+					  this.voteSuccess();
+					  clearInterval(this.interval)
+				  }
+				}, 1500)
+			},
 			async cmccVote(item) {
 				this.$refs.smsAlert.hideSms()
 				let params = {

+ 15 - 13
pages/shop/detail.vue

@@ -165,7 +165,7 @@
 				confirmStyle: {
 					color: 'white',
 				},
-				payStatus: '', //支付状态
+				interval: '',
 			}
 		},
 		onLoad(options) {
@@ -186,17 +186,6 @@
 				this.getAddress()
 				return
 			}
-			
-			let that = this;
-			uni.$on('updateData',function(payStatus){
-				that.payStatus = payStatus;
-				that.$refs.exchangeSuccess.showSuccess(that.detail.imgUrl);
-				console.log('积分商城监听到事件来自 updateData ,携带参数为:' + payStatus);
-			})
-		},
-		onUnload() {
-			//移除监听事件
-			uni.$off('updateData')
 		},
 		computed: {
 			pointValue: {
@@ -306,10 +295,10 @@
 								this.$refs.exchangeSuccess.showSuccess(this.detail.imgUrl)
 								return;
 							}
-							this.payStatus = ''; //创建新订单,清空订单状态
 							// uni.navigateTo({
 							// 	url: `/pages/webview/payOrder?url=${res.data.data.qrCodeUrl}&orderId=${res.data.data.id}`
 							// })
+							this.queryOrder(res.data.data.id)
 							window.location.href = res.data.data.qrCodeUrl
 						}
 						
@@ -318,6 +307,19 @@
 					console.log(error);
 				})
 			},
+			//查询订单状态
+			queryOrder(orderId){
+				let params = {
+					id: orderId
+				}
+				this.interval = setInterval(() => {
+				  let res = this.$api.order.orderDetail(params)
+				  if(res.data.success && res.data.data.payStatus === '付款成功'){
+					  that.$refs.exchangeSuccess.showSuccess(that.detail.imgUrl);
+					  clearInterval(this.interval)
+				  }
+				}, 1500)
+			},
 			pufaPointChange(e) {
 				this.exChangeData.point = e.value
 			},