Explorar o código

fix: 增加paying字段

carver hai 1 ano
pai
achega
a7dcf5e375

+ 13 - 12
antbuilder/industry/hospitalV2/components/hospital-payment-detail-yibao/index.js

@@ -11,17 +11,9 @@ import { createSubscribe } from "applet-page-component";
 
 Component(
 	createSubscribe({
-		onShow(options) {
-			console.log("onshow opt start ===>");
-			console.log(
-				"onshow opt ===> referrerInfo",
-				options && options.referrerInfo
-			);
-			console.log("onshow options ===> path", options && options.path);
-			console.log("onshow options ===> scene", options && options.scene);
-			console.log("onshow options ===> query", options && options.query);
-			console.log("onshow opt end ===>");
+		onShow() {
 			this.init("onShow");
+			console.log("onShow this._paying", this._paying);
 		},
 	})({
 		props: {},
@@ -37,9 +29,12 @@ Component(
 
 		didMount() {
 			this.init("didMount");
+			console.log("didMount this._paying", this._paying);
 		},
 
-		didUnmount() {},
+		didUnmount() {
+			this._paying = false;
+		},
 
 		methods: {
 			init(type) {
@@ -52,6 +47,7 @@ Component(
 			},
 
 			async hanldeGetPayAuthInfo(type) {
+				if (this._paying) return;
 				const app = getApp();
 				const {
 					hisOrderNo: hisOrdNum,
@@ -117,7 +113,8 @@ Component(
 						// 跳转医保授权页面
 						my.ap.openURL({
 							url: result.authUrl,
-							fail() {
+							fail(e) {
+								console.log("err", e);
 								my.navigateBack();
 							},
 						});
@@ -280,6 +277,7 @@ Component(
 			async onPay(e) {
 				const { canPay } = this.data;
 				if (!canPay) return;
+				this._paying = true;
 				const {
 					hisPatientId,
 					age,
@@ -351,6 +349,7 @@ Component(
 				}
 
 				if (result) {
+					this._paying = false;
 					console.log("pay result ===>", result);
 					// 支付成功后返回列表页
 					// my.navigateBack();
@@ -360,6 +359,8 @@ Component(
 						query: {},
 						pageType: "hospital-payment-detail-yibao-result",
 					});
+				} else {
+					this._paying = false;
 				}
 			},
 		},