index-legacy-8f68b57a.js 5.7 KB

1
  1. !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<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?e(Object(o),!0).forEach((function(e){n(r,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}function n(e,r,n){return(r=function(e){var r=function(e,r){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var t=n.call(e,r||"default");if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==typeof r?r:String(r)}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function t(e,r,n,t,o,a,i){try{var p=e[a](i),c=p.value}catch(l){return void n(l)}p.done?r(c):Promise.resolve(c).then(t,o)}System.register(["./index-legacy-e6be1dcb.js","./index-legacy-fc299f0c.js","./index-legacy-72ad1f03.js"],(function(e,n){"use strict";var o,a,i,p,c,l,d,u,y,s,f,m,_,g,v,h,b;return{setters:[e=>{o=e.d,a=e.P,i=e.x,p=e.y,c=e.a,l=e.A,d=e.W,u=e.C,y=e.I,s=e.N,f=e.D,m=e.S,_=e.bi,g=e.bk,v=e.bY},e=>{h=e.C},e=>{b=e.C}],execute:function(){var n=document.createElement("style");n.textContent="._paydefine_gyhp9_1{overflow:hidden;background:#fff;min-height:100vh}._paydefine_gyhp9_1 .van-cell__title,._paydefine_gyhp9_1 .van-cell__value{font-size:.4rem;color:#4f4f4f}._paydefine_gyhp9_1 .van-button{font-size:.42667rem;width:86%;margin:.53333rem auto}._amount_gyhp9_16{padding:.93333rem 0 1.46667rem;font-size:1.09333rem;font-weight:700;color:#333;line-height:.96rem;text-align:center}._amount_gyhp9_16 span{font-size:.82667rem}._error-text_gyhp9_27{font-size:.4rem;width:100%;text-align:center;color:#3f3f3f;margin-top:2.66667rem}._error-icon_gyhp9_34{display:block;color:#ffb07b;font-size:.42667rem;margin-bottom:.53333rem}\n",document.head.appendChild(n);const w={paydefine:"_paydefine_gyhp9_1",amount:"_amount_gyhp9_16","error-text":"_error-text_gyhp9_27","error-icon":"_error-icon_gyhp9_34"};e("default",o({name:"pay-define",setup(){const e=a(),n=i({browserStatus:!1,errorText:"",code:null,pay_channel:e.query.pay_channel,wxAppId:e.query.wxAppId,paymentType:e.query.paymentType,alipayAppId:e.query.alipayAppId,body:e.query.body,price:e.query.price,orderNo:e.query.orderNo,userId:e.query.userId,payInfo:{},isYeePay:!1}),o=function(){var e,o=(e=function*(){try{var e;if(parseFloat(n.price)<=0)return void s("支付金额异常");const t={merOrderNo:n.orderNo,paymentChannel:n.pay_channel,userId:n.userId,code:n.code},{data:o}=yield f.post("/edu-app/open/userOrder/executePayment",{hideLoading:!1,data:r({},t)});n.isYeePay=-1!==(null===(e=o.paymentVender)||void 0===e?void 0:e.indexOf("yeepay")),x(o.reqParams)}catch(t){console.log(t)}},function(){var r=this,n=arguments;return new Promise((function(o,a){var i=e.apply(r,n);function p(e){t(i,o,a,p,c,"next",e)}function c(e){t(i,o,a,p,c,"throw",e)}p(void 0)}))});return function(){return o.apply(this,arguments)}}(),x=e=>{if("alipay_qr"==n.pay_channel)if(n.isYeePay)S(e.prePayTn);else{const r="false"===e.prod_mode?e.expend.qrcode_url+"?payment_id="+e.id+"&pay_channel="+e.pay_channel:e.expend.qrcode_url;window.location.href=r}else if("wx_pub"==n.pay_channel){const r=n.isYeePay?JSON.parse(e.prePayTn):JSON.parse(e.expend.pay_info);n.payInfo=r,void 0===window.WeixinJSBridge?document.addEventListener?document.addEventListener("WeixinJSBridgeReady",O,!1):document.attachEvent&&document.attachEvent("WeixinJSBridgeReady",O)(document).attachEvent("onWeixinJSBridgeReady",O):O()}},S=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="+n.orderNo),window.AlipayJSBridge.call("closeWebview")}))},window.AlipayJSBridge?r&&r():document.addEventListener("AlipayJSBridgeReady",r,!1)},O=()=>{const e=n.payInfo;window.WeixinJSBridge.invoke("getBrandWCPayRequest",{appId:e.appId,timeStamp:e.timeStamp,nonceStr:e.nonceStr,package:e.package,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="+n.orderNo)}))};return p((()=>{console.log(n),(()=>{const e=n.pay_channel,r=-1!==n.paymentType.indexOf("yeepay");if(m().weixin)if("wx_pub"===e){const e=_();e?n.code=e:g(n.wxAppId),n.browserStatus=!0,document.title="微信支付"}else"alipay_qr"==e&&(n.errorText="请使用支付宝扫码");else if(m().alipay){if("wx_pub"===e)n.errorText="请使用微信扫码";else if("alipay_qr"==e){if(r){const e=_("auth_code");e?n.code=e:v(n.alipayAppId)}n.browserStatus=!0,document.title="支付宝支付"}}else n.errorText="请在微信或支付宝客户端打开";n.errorText&&(document.title="ERROR")})()})),()=>c("div",{class:w.paydefine},[n.browserStatus&&c("div",{class:w.container},[c("div",{class:w.amount},[c("span",null,[l("¥ ")]),d(n.price)]),c(h,{inset:!0},{default:()=>[c(b,{title:"订单信息",value:n.body,valueClass:w.values},null),c(b,{title:"支付方式",value:"wx_pub"===n.pay_channel?"微信":"支付宝"},null),c(b,{title:"实付金额",value:`¥ ${d(n.price)}元`},null)]}),c(u,{type:"primary",block:!0,size:"large",onClick:o,round:!0},{default:()=>[l("立即支付")]})]),!n.browserStatus&&c("div",{class:w.container},[c("div",{class:w["error-text"]},[n.errorText&&c(y,{class:w["error-icon"],name:"warning-o"},null),n.errorText])])])}}))}}}))}();