hookehuyr

fix 回调页面调整

1 <!-- 1 <!--
2 * @Date: 2024-01-26 10:24:45 2 * @Date: 2024-01-26 10:24:45
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-01-26 17:21:40 4 + * @LastEditTime: 2024-01-29 13:44:24
5 * @FilePath: /xysBooking/src/views/callback.vue 5 * @FilePath: /xysBooking/src/views/callback.vue
6 * @Description: 反馈页面 6 * @Description: 反馈页面
7 --> 7 -->
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
21 <div class="visit-time">参访时间:<span>{{ billInfo?.datetime }}</span></div> 21 <div class="visit-time">参访时间:<span>{{ billInfo?.datetime }}</span></div>
22 <div class="payment-amount">支付金额:<span>¥ {{ billInfo?.total_amt }}</span></div> 22 <div class="payment-amount">支付金额:<span>¥ {{ billInfo?.total_amt }}</span></div>
23 </div> 23 </div>
24 + <div style="border-bottom: 1px dashed #A67939; padding: 0.5rem; display: flex; justify-content: center;">
25 + <van-button color="#A67939" size="small" @click="returnMerchant()">返回商户</van-button>
26 + </div>
24 <!-- <div class="appointment-notice"> 27 <!-- <div class="appointment-notice">
25 <p style="margin-bottom: 0.25rem;"><van-icon name="info-o" />&nbsp;温馨提示</p> 28 <p style="margin-bottom: 0.25rem;"><van-icon name="info-o" />&nbsp;温馨提示</p>
26 <p style="font-size: 0.85rem;">1. 一人一码,或拿身份证,扫码或识别身份证成功后进入</p> 29 <p style="font-size: 0.85rem;">1. 一人一码,或拿身份证,扫码或识别身份证成功后进入</p>
...@@ -58,19 +61,48 @@ const PAY_STATUS = { ...@@ -58,19 +61,48 @@ const PAY_STATUS = {
58 } 61 }
59 const pay_status = ref('1'); 62 const pay_status = ref('1');
60 63
61 -onMounted(async () => { 64 +//获取url中返回参数
62 - // 获取订单ID 65 +function getQueryString(name) {
63 - const { code, data } = await icbcOrderQryAPI({ out_trade_no: $route.query.out_trade_no }); 66 + var query = window.location.search.substring(1);
64 - if (code) { 67 + var vars = query.split("&");
65 - pay_status.value = data.pay_status; 68 + for (var i = 0; i < vars.length; i++) {
69 + var pair = vars[i].split("=");
70 + if (pair[0] == name) {
71 + return pair[1];
72 + }
73 + }
74 + return null;
75 +}
76 +
77 +
78 +const out_trade_no = getQueryString('out_trade_no');
79 +
80 +const callback = async () => {
66 // 获取订单详情 81 // 获取订单详情
67 - const { code:code_pay, data:data_pay } = await onAuthBillInfoAPI({ pay_id: data.pay_id }); 82 + const { code:code_pay, data:data_pay } = await onAuthBillInfoAPI({ pay_id: out_trade_no });
68 if (code_pay) { 83 if (code_pay) {
69 // 84 //
70 data_pay.datetime = data_pay && formatDatetime(data_pay); 85 data_pay.datetime = data_pay && formatDatetime(data_pay);
71 billInfo.value = data_pay; 86 billInfo.value = data_pay;
87 +
88 + var mchData = { action: 'onIframeReady', displayStyle: 'SHOW_CUSTOM_PAGE', height: 404 };
89 + let postData = JSON.stringify(mchData);
90 + top.postMessage(postData, '*');
72 } 91 }
92 +}
93 +
94 +const returnMerchant = () => {
95 + var mchData = {
96 + action: 'jumpOut',
97 + jumpOutUrl: window.location.origin + window.location.pathname //跳转的页面
73 } 98 }
99 + console.log('调用成功',mchData);
100 + var postData = JSON.stringify(mchData)
101 + top.postMessage(postData, "*")
102 +}
103 +callback();
104 +
105 +onMounted(async () => {
74 }) 106 })
75 </script> 107 </script>
76 108
...@@ -82,10 +114,10 @@ onMounted(async () => { ...@@ -82,10 +114,10 @@ onMounted(async () => {
82 display: flex; 114 display: flex;
83 align-items: center; 115 align-items: center;
84 justify-content: center; 116 justify-content: center;
85 - height: 35vh; 117 + height: 20vh;
86 flex-direction: column; 118 flex-direction: column;
87 img { 119 img {
88 - width: 50vw; 120 + width: 30vw;
89 } 121 }
90 .text { 122 .text {
91 color: #A67939; 123 color: #A67939;
...@@ -94,9 +126,9 @@ onMounted(async () => { ...@@ -94,9 +126,9 @@ onMounted(async () => {
94 } 126 }
95 } 127 }
96 .appointment-information { 128 .appointment-information {
97 - padding: 2rem 1rem; 129 + padding: 1rem;
98 - border-bottom: 1px dashed #A67939;
99 line-height: 2; 130 line-height: 2;
131 + padding-bottom: 0;
100 .number-of-visitors { 132 .number-of-visitors {
101 span { 133 span {
102 color: #A67939; 134 color: #A67939;
......