From ea6deea758f1c7866c694f63a04730e86a463264 Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Wed, 29 Oct 2025 09:05:43 +0800
Subject: [PATCH] Merge branch 'master' of http://git.zlxm286.com/r/companyProjecet

---
 mobile/pages/branch/activity/detail/popup/reg.vue |   73 ++++++++++++++++++++++++++++++++----
 1 files changed, 65 insertions(+), 8 deletions(-)

diff --git a/mobile/pages/branch/activity/detail/popup/reg.vue b/mobile/pages/branch/activity/detail/popup/reg.vue
index f217c86..7bbce7d 100644
--- a/mobile/pages/branch/activity/detail/popup/reg.vue
+++ b/mobile/pages/branch/activity/detail/popup/reg.vue
@@ -106,6 +106,7 @@
 </template>
 
 <script>
+	import { pay } from '@/common/pay.js';
 	import PointsForm from './points'; // 积分选择弹窗
 	export default {
 		components: {
@@ -141,11 +142,22 @@
 				activityData: {},
 				isOpenPoints: false, // 是否打开积分弹窗
 				validate: false,
+				payData: [], // 半屏小程序相关
+				isFirst: false,
 			};
 		},
 		props: ['isOpenReg', 'in_radius'],
 
 		onLoad() {},
+		onShow() {
+			let self = this;
+			let options = wx.getEnterOptionsSync();
+			// 从半屏小程序返回时执行
+			if (options.scene == '1038' && self.isFirst == true) {
+				self.isFirst = false;
+				self.onPayResult(options.referrerInfo.extraData);
+			}
+		},
 		mounted() {
 			this.init();
 		},
@@ -197,6 +209,37 @@
 				}
 			},
 			
+			// 半屏小程序返回
+			onPayResult(e) {
+				let self = this;
+				self.loading = false;
+				uni.hideLoading();
+				self.isFirst = false;
+				if (e.pay_result == 'success') {
+					self.paySuccess(self.payData);
+				} else {
+					if(self.order_id > 0){
+						//兼容重新付款
+					}else{
+						self.payError(self.payData);
+					}	
+				}
+			},
+			
+			paySuccess(result) {
+				let self = this;
+				self.showSuccess("支付成功", function() {
+					self.$emit('close', 1);
+				})
+		
+			},
+			payError(result) {
+				let self = this;
+				self.showSuccess("支付成功", function() {
+					self.$emit('close', 2);
+				})
+			},
+			
 			// 是否使用余额支付
 			onUseBalance(e) {
 				if (e.target.value == true) {
@@ -238,15 +281,29 @@
 								in_radius: self.in_radius ? 1 : 0 // 如果为1,报名成功后直接签到
 							})
 						)
-					}, function(result) {
+					}, function(res) {
 						uni.hideLoading();
-						if (result.data.online_money) {
-							pay(result, self, function() {
-								
-							}, function() {
-								reg_success = 2; // 失败
-							}); 
-						} else if (result.code != 1) {
+						if (res.data.online_money) {
+							// 半屏小程序支付 by lyzflash
+							if (res.data.payment.is_embed) {
+								// console.log(res.data.payment);
+								self.isFirst = true;
+								uni.openEmbeddedMiniProgram({
+									appId: res.data.payment.embed_app_id,
+									path: res.data.payment.embed_path,
+									extraData: res.data.payment.extraData,
+									envVersion: 'release', // develop开发版 trial体验版 release正式版 
+									success:function() {
+										console.log('打开半屏小程序成功');
+									},
+									fail:function() {
+										console.log('打开半屏小程序失败');
+									}
+								});
+								return;
+							}
+							pay(res, self, self.paySuccess, self.payError); 
+						} else if (res.code != 1) {
 							reg_success = 2; // 失败
 						}
 						self.$emit('close', reg_success);

--
Gitblit v1.9.2