index.eaa81586.js 1.6 KB

1
  1. import{d as u,ag as y,aU as _,r as x,$ as w,c as n,a5 as f,e as s,bf as h}from"./index.13ca4bcb.js";const q="_payCenter_19c4e_1";var a={payCenter:q,"error-icon":"_error-icon_19c4e_5","error-text":"_error-text_19c4e_12"},b=u({name:"pay-center",setup(){const p=y(),r=_(),e=x({errorText:"",code:null,pay_channel:r.query.pay_channel,wxAppId:r.query.wxAppId,body:r.query.body,price:r.query.price,orderNo:r.query.orderNo,userId:r.query.userId}),i=()=>{const o=e.pay_channel;if(s().weixin)if(o==="wx_pub"){const t=h();console.log(t),t?(e.code=t,c()):d(),document.title="\u5FAE\u4FE1\u652F\u4ED8"}else o=="alipay_qr"&&(e.errorText="\u8BF7\u4F7F\u7528\u652F\u4ED8\u5B9D\u626B\u7801");else s().alipay?o==="wx_pub"?e.errorText="\u8BF7\u4F7F\u7528\u5FAE\u4FE1\u626B\u7801":o=="alipay_qr"&&(document.title="\u652F\u4ED8\u5B9D\u652F\u4ED8",c()):e.errorText="\u8BF7\u5728\u5FAE\u4FE1\u6216\u652F\u4ED8\u5B9D\u5BA2\u6237\u7AEF\u6253\u5F00";e.errorText&&(document.title="ERROR")},c=()=>{p.replace({path:"/payDefine",query:{pay_channel:e.pay_channel,wxAppId:e.wxAppId,body:e.body,price:e.price,code:e.code,orderNo:e.orderNo,userId:e.userId}})},d=()=>{const o=encodeURIComponent(window.location.href),t="snsapi_base",l=`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${e.wxAppId||"wx8654c671631cfade"}&redirect_uri=${o}&response_type=code&scope=${t}&state=STATE&connect_redirect=1#wechat_redirect`;window.location.replace(l)};return w(()=>{i()}),()=>n("div",{class:a.payCenter},[n("div",{class:a["error-text"]},[e.errorText&&n(f,{class:a["error-icon"],name:"warning-o"},null),e.errorText])])}});export{b as default};