!function(){function e(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function r(r){for(var t=1;t{o=e.d,a=e.q,i=e.P,l=e.x,d=e.y,c=e.a,p=e.F,u=e.U,s=e.L,y=e.I,_=e.V,f=e.R,b=e.bS,m=e.bU,g=e.E,h=e.D,v=e.bT},e=>{w=e.C},e=>{x=e.C}],execute:function(){var n=document.createElement("style");n.textContent="._paywxresult_1bih4_1{overflow:hidden;min-height:100vh}._paywxresult_1bih4_1 :gloabl ._van-cell_1bih4_5{padding:.32rem .42667rem}._paywxresult_1bih4_1 :gloabl ._van-cell__title_1bih4_8,._paywxresult_1bih4_1 :gloabl ._van-cell__value_1bih4_9{flex:auto;font-size:.42667rem;color:#4f4f4f}._paywxresult_1bih4_1 :gloabl ._van-button_1bih4_14{font-size:.42667rem;width:86%;margin:.53333rem auto}._paywxresult_1bih4_1 :gloabl ._van-loading__spinner_1bih4_19{width:1.33333rem;height:1.33333rem}._container_1bih4_23{background:#fff;padding:.4rem 0}._order-loading_1bih4_27{padding:.4rem 0;margin-top:.4rem;background-color:#fff;text-align:center;font-size:.4rem}._order-loading_1bih4_27>p{margin-bottom:.4rem}._error-text_1bih4_37{font-size:.4rem;width:100%;text-align:center;color:#3f3f3f;margin-top:2.66667rem}._error-icon_1bih4_44{display:block;color:#ffb07b;font-size:.58667rem;margin-bottom:.53333rem}\n",document.head.appendChild(n);const S="_paywxresult_1bih4_1",O="_container_1bih4_23",P="_order-loading_1bih4_27",j="_error-text_1bih4_37",q="_error-icon_1bih4_44";e("default",o({name:"pay-result",setup(){const e=a(),n=i(),o=l({errorText:"",browserStatus:!1,code:null,pay_channel:n.query.pay_channel,wxAppId:n.query.wxAppId,paymentType:n.query.paymentType,alipayAppId:n.query.alipayAppId,body:n.query.body,price:n.query.price,orderNo:n.query.orderNo,userId:n.query.userId,payInfo:{},isYeePay:!1}),I=function(){var e,n=(e=function*(){try{var e;if(parseFloat(o.price)<=0)return void g("支付金额异常");const n={merOrderNo:o.orderNo,paymentChannel:o.pay_channel,userId:o.userId,code:o.code},{data:t}=yield h.post("/edu-app/open/userOrder/executePayment",{data:r({},n)});o.isYeePay=-1!==(null===(e=t.paymentVender)||void 0===e?void 0:e.indexOf("yeepay")),console.log(t,"data"),B(t.reqParams)}catch(n){console.log(n),window.location.replace(location.origin+"/classroom-app/#/payment-result?orderNo="+o.orderNo)}},function(){var r=this,n=arguments;return new Promise((function(o,a){var i=e.apply(r,n);function l(e){t(i,o,a,l,d,"next",e)}function d(e){t(i,o,a,l,d,"throw",e)}l(void 0)}))});return function(){return n.apply(this,arguments)}}(),N=e=>{var r;r=function(){window.AlipayJSBridge.call("tradePay",{tradeNO:e},(function(e){e.resultCode,window.location.replace(location.origin+"/classroom-app/#/payment-result?orderNo="+o.orderNo),window.AlipayJSBridge.call("closeWebview")}))},window.AlipayJSBridge?r&&r():document.addEventListener("AlipayJSBridgeReady",r,!1)},B=e=>{if("alipay_qr"==o.pay_channel)if(o.isYeePay)N(e.tradeNO);else{var r,n;const t="false"===e.prod_mode?(null==e||null===(r=e.expend)||void 0===r?void 0:r.qrcode_url)+"?payment_id="+e.id+"&pay_channel="+e.pay_channel:null==e||null===(n=e.expend)||void 0===n?void 0:n.qrcode_url;window.location.href=t}else if("alipay_wap"==o.pay_channel){var t;window.location.href=null==e||null===(t=e.expend)||void 0===t?void 0:t.pay_info}else if("wx_pub"==o.pay_channel){var a;const r=o.isYeePay?JSON.parse(e.prePayTn):null!=e&&e.expend?JSON.parse(null==e||null===(a=e.expend)||void 0===a?void 0:a.pay_info):e;o.payInfo=r,void 0===window.WeixinJSBridge?document.addEventListener?document.addEventListener("WeixinJSBridgeReady",E,!1):document.attachEvent&&document.attachEvent("WeixinJSBridgeReady",E)(document).attachEvent("onWeixinJSBridgeReady",E):E()}},E=()=>{const e=o.payInfo;window.WeixinJSBridge.invoke("getBrandWCPayRequest",{appId:e.appId,timeStamp:e.timeStamp,nonceStr:e.nonceStr,package:e.package||e.packageValue,signType:e.signType,paySign:e.paySign},(e=>{"get_brand_wcpay_request:cancel"==e.err_msg||e.err_msg,window.location.replace(location.origin+"/classroom-app/#/payment-result?orderNo="+o.orderNo)}))},T=()=>{const e=b();e?(o.code=e,I()):v(o.wxAppId)};return d((()=>{(()=>{const r=n.query,t=-1!==o.paymentType.indexOf("yeepay");if(r.orderNo&&r.pay_channel)if(f().weixin)o.browserStatus=!0,T();else if(f().alipay)if(t){let e=b("auth_code");e?(o.code=e,o.browserStatus=!0,I()):m(o.alipayAppId)}else o.browserStatus=!0,I();else o.errorText="请在微信或支付宝客户端打开",document.title="ERROR";else _({message:"支付订单信息错误请重新支付",showCancelButton:!1}).then((()=>{e.back()}))})()})),()=>c("div",{class:S},[o.browserStatus&&c(p,null,[c("div",{class:O},[c(w,{border:!1},{default:()=>[c(x,{title:"订单金额",value:"¥ "+u(o.price)},null),c(x,{title:"订单信息",value:o.body},null)]})]),c("div",{class:P},[c("p",null,["wx_pub"==o.pay_channel?"微信支付":"支付宝支付"]),c(s,{type:"spinner",color:"#01C1B5"},null)])]),!o.browserStatus&&c("div",{class:j},[o.errorText&&c(y,{class:q,name:"warning-o"},null),o.errorText])])}}))}}}))}();