1 |
- import{d as b,ag as v,ah as S,r as N,$ as q,c as r,F as I,ba as P,L as A,a5 as B,bd as C,f as y,bh as u,bU as J,o as R,m as T,bk as O}from"./index.5f7ffb46.js";import{C as W}from"./index.052b3caa.js";import{C as _}from"./index.abd668f7.js";const E="_paywxresult_1bih4_1",L="_container_1bih4_23";var s={paywxresult:E,"van-cell":"_van-cell_1bih4_5","van-cell__title":"_van-cell__title_1bih4_8","van-cell__value":"_van-cell__value_1bih4_9","van-button":"_van-button_1bih4_14","van-loading__spinner":"_van-loading__spinner_1bih4_19",container:L,"order-loading":"_order-loading_1bih4_27","error-text":"_error-text_1bih4_37","error-icon":"_error-icon_1bih4_44"},V=b({name:"pay-result",setup(){const w=v(),a=S(),n=N({errorText:"",browserStatus:!1,code:null,paymentType:a.query.paymentType,pay_channel:a.query.pay_channel,wxAppId:a.query.wxAppId,alipayAppId:a.query.alipayAppId,body:a.query.body,price:a.query.price,orderNo:a.query.orderNo,userId:a.query.userId,payInfo:{},isYeePay:!1}),f=()=>{var t;const e=a.query;console.log(e);const o=((t=n.paymentType)==null?void 0:t.indexOf("yeepay"))!==-1;if(!e.orderNo||!e.pay_channel)C({message:"\u652F\u4ED8\u8BA2\u5355\u4FE1\u606F\u9519\u8BEF\u8BF7\u91CD\u65B0\u652F\u4ED8",showCancelButton:!1}).then(()=>{w.back()});else if(y().weixin)n.browserStatus=!0,x();else if(y().alipay)if(o){const i=u("auth_code")||a.query.auth_code;i?(n.code=i,n.browserStatus=!0,c()):J(n.alipayAppId)}else n.browserStatus=!0,c();else n.errorText="\u8BF7\u5728\u5FAE\u4FE1\u6216\u652F\u4ED8\u5B9D\u5BA2\u6237\u7AEF\u6253\u5F00",document.title="ERROR"},c=async()=>{var e;try{if(parseFloat(n.price)<=0){R("\u652F\u4ED8\u91D1\u989D\u5F02\u5E38");return}const o={merOrderNo:n.orderNo,paymentChannel:n.pay_channel,userId:n.userId};n.pay_channel=="wx_pub"&&(o.code=n.code);const{data:t}=await T.post("/api-student/open/userOrder/executePayment",{data:{...o}});n.isYeePay=((e=t.paymentVender)==null?void 0:e.indexOf("yeepay"))!==-1,console.log(t,"payment",n.pay_channel),h(t.reqParams)}catch(o){console.log(o),window.location.replace(location.origin+"/orchestra-student/#/payment-result?orderNo="+n.orderNo)}},g=e=>{window.AlipayJSBridge?e&&e():document.addEventListener("AlipayJSBridgeReady",e,!1)},m=e=>{g(function(){window.AlipayJSBridge.call("tradePay",{tradeNO:e},function(o){o.resultCode=="9000",window.location.replace(location.origin+"/orchestra-student/#/payment-result?orderNo="+n.orderNo),window.AlipayJSBridge.call("closeWebview")})})},h=e=>{var o,t,i,d;if(n.pay_channel=="alipay_qr")if(n.isYeePay)m(e.tradeNO);else{const p=e.prod_mode==="false"?((o=e==null?void 0:e.expend)==null?void 0:o.qrcode_url)+"?payment_id="+e.id+"&pay_channel="+e.pay_channel:(t=e==null?void 0:e.expend)==null?void 0:t.qrcode_url;window.location.href=p}else if(n.pay_channel=="alipay_wap")window.location.href=(i=e==null?void 0:e.expend)==null?void 0:i.pay_info;else if(n.pay_channel=="wx_pub"){const p=n.isYeePay?JSON.parse(e.prePayTn):e!=null&&e.expend?JSON.parse((d=e==null?void 0:e.expend)==null?void 0:d.pay_info):e;n.payInfo=p,typeof window.WeixinJSBridge=="undefined"?document.addEventListener?document.addEventListener("WeixinJSBridgeReady",l,!1):document.attachEvent&&document.attachEvent("WeixinJSBridgeReady",l)(document).attachEvent("onWeixinJSBridgeReady",l):l()}},l=()=>{const e=n.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},o=>{o.err_msg=="get_brand_wcpay_request:cancel"||o.err_msg=="get_brand_wcpay_request:fail",window.location.replace(location.origin+"/orchestra-student/#/payment-result?orderNo="+n.orderNo)})},x=()=>{const e=u();e?(n.code=e,c()):O(n.wxAppId)};return q(()=>{f()}),()=>r("div",{class:s.paywxresult},[n.browserStatus&&r(I,null,[r("div",{class:s.container},[r(W,{border:!1},{default:()=>[r(_,{title:"\u8BA2\u5355\u91D1\u989D",value:"\uFFE5 "+P(n.price)},null),r(_,{title:"\u8BA2\u5355\u4FE1\u606F",value:n.body},null)]})]),r("div",{class:s["order-loading"]},[r("p",null,[n.pay_channel=="wx_pub"?"\u5FAE\u4FE1\u652F\u4ED8":"\u652F\u4ED8\u5B9D\u652F\u4ED8"]),r(A,{type:"spinner",color:"#01C1B5"},null)])]),!n.browserStatus&&r("div",{class:s["error-text"]},[n.errorText&&r(B,{class:s["error-icon"],name:"warning-o"},null),n.errorText])])}});export{V as default};
|