zqwang 1 year ago
parent
commit
eea77729d6
1 changed files with 22 additions and 6 deletions
  1. 22 6
      pages/client/components/pay/recharge.vue

+ 22 - 6
pages/client/components/pay/recharge.vue

@@ -98,7 +98,10 @@
 				})
 				})
 			},
 			},
 			selectItem(item) {
 			selectItem(item) {
-				this.select = item;
+				this.select = item;
+				if(this.is_player){
+					this.toPay();
+				}
 			},async toPay(){
 			},async toPay(){
 				if(this.select.lenght <  1){
 				if(this.select.lenght <  1){
 					uni.showToast({ title: '请选择要充值的项',icon:"none" });
 					uni.showToast({ title: '请选择要充值的项',icon:"none" });
@@ -109,14 +112,27 @@
 					video_id:this.video_info && this.video_info.video_id ? this.video_info.video_id :0,
 					video_id:this.video_info && this.video_info.video_id ? this.video_info.video_id :0,
 					video_series_sequence:this.video_info && this.video_info.video_series_sequence  ? this.video_info.video_series_sequence :0,
 					video_series_sequence:this.video_info && this.video_info.video_series_sequence  ? this.video_info.video_series_sequence :0,
 				};
 				};
+				let result = false;
 				// #ifdef MP-WEIXIN  
 				// #ifdef MP-WEIXIN  
-				
 					let res = await getPayInfo(params);
 					let res = await getPayInfo(params);
-					return this.$emit();
+					if(res){
+						uni.requestPayment({
+						    "provider": "wxpay", 
+						    "orderInfo":res,
+						    success(res) {
+								result = true;
+								console.log('success:' + JSON.stringify(res));
+							},
+						    fail(e) {
+								return false;
+								console.log('success:' + JSON.stringify(e));
+							}
+						})
+					}
+					
+					return this.$emit('is_pay',result);
 				// #endif
 				// #endif
-				
-				return this.$emit();
-				// console.log('getPayInfo',res);
+				return this.$emit('is_pay',result);
 			}
 			}
 		}
 		}
 	}
 	}