Przeglądaj źródła

需求:app核保成功后增加跳转支付码页面功能

@dongkboy 3 tygodni temu
rodzic
commit
ab7decb6ab
2 zmienionych plików z 41 dodań i 1 usunięć
  1. 1 1
      pages/quote/paymentCode.vue
  2. 40 0
      pages/quote/quoteRecordDetail.vue

+ 1 - 1
pages/quote/paymentCode.vue

@@ -115,7 +115,7 @@
 		},
 		async onLoad(options) {
 			if (options.ordersNo) {
-				let res = await this.$http.get('/order/qrCode/getQrCode?orderNo=' + options.ordersNo)
+				let res = await this.$http.get('/order/qrCode/getQrCode?orderNo=' + encodeURIComponent(options.ordersNo))
 				if (res.code == '200') {
 					this.info = res.data;
 					let res1 = await this.$http.get('/supplementOrder/getOrderDetail?ordersNo=' + options.ordersNo);

+ 40 - 0
pages/quote/quoteRecordDetail.vue

@@ -736,6 +736,9 @@
 			},
 			//调用核保接口
 			async underwritingEvent() {
+				if (this.loadingShow) {
+					return; //防重入:loading期间忽略重复触发
+				}
 				this.underwritingShow = false; //关闭弹窗
 				this.loadingText = "核保中";
 				this.loadingShow = true; //加载loading
@@ -778,6 +781,10 @@
 							icon: 'none',
 							title: '核保成功'
 						})
+						// 核保成功后查询支付码并跳转支付码页面
+						if (this.orderStatus != 3) { //人工处理已跳转,不再查询支付码
+							await this.queryPaymentCode();
+						}
 					} else {
 						this.loadingShow = false;
 						uni.showToast({
@@ -794,6 +801,39 @@
 					})
 				}
 			},
+			//查询支付码并跳转(含延时过渡与异常兜底)
+			async queryPaymentCode() {
+				this.loadingText = "查询支付码中";
+				this.loadingShow = true;
+				try {
+					const preDelay = 1000; //查询前loading「查询支付码中」展示时长(毫秒)
+					const navDelay = 1000; //成功后「正在前往支付页面」展示时长(毫秒)
+					// 查询前:loading「查询支付码中」转1秒再请求接口
+					await new Promise(resolve => setTimeout(resolve, preDelay));
+					let qrCode = await this.$http.get('/order/qrCode/getQrCode?orderNo=' + this.ordersNo);
+					if (qrCode.code == '200') {
+						// 成功后:loading文字改为"正在前往支付页面",再转1秒后跳转
+						this.loadingText = "正在前往支付页面";
+						await new Promise(resolve => setTimeout(resolve, navDelay));
+						this.loadingShow = false;
+						uni.navigateTo({
+							url: '/pages/quote/paymentCode?ordersNo=' + encodeURIComponent(this.ordersNo),
+						})
+					} else {
+						this.loadingShow = false;
+						uni.showToast({
+							icon: 'none',
+							title: qrCode.msg
+						})
+					}
+				} catch (error) {
+					this.loadingShow = false;
+					uni.showToast({
+						icon: 'none',
+						title: '支付码查询失败'
+					})
+				}
+			},
 			//影像资料
 			mediaFiles() {
 				uni.navigateTo({