(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["PayResult"],{ae54:function(e,t,a){"use strict";a.d(t,"a",(function(){return i})),a.d(t,"b",(function(){return s}));var r=a("4328"),n=a.n(r),o=a("981f").default;function i(e){return o({url:"/api-student/examOrder/executePayment",method:"post",data:n.a.stringify(e)})}function s(e){return o({url:"/api-student/examOrder/paymentResult",method:"get",params:e})}},bbea:function(e,t,a){"use strict";a.r(t);var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"payWxResult"},[e.browserStatus?a("div",{key:"browser"},[a("div",{staticClass:"container"},[a("van-cell-group",{attrs:{border:!1}},[a("van-cell",{attrs:{title:"订单金额",value:"￥"+e.amount}}),a("van-cell",{attrs:{title:"订单信息",value:e.payMap.orderBody}})],1)],1),a("div",{staticClass:"order-loading"},[a("p",[e._v(e._s("wx_pub"==e.payType?"微信支付":"支付宝支付"))]),a("van-loading",{attrs:{type:"spinner",color:"#14928A"}})],1)]):a("div",{key:"browser"},[a("div",{staticClass:"error-text"},[e.errorText?a("van-icon",{staticClass:"error-icon",attrs:{name:"warning-o"}}):e._e(),e._v("\n\t\t\t"+e._s(e.errorText)+"\n\t\t")],1)])])},n=[],o=a("ae54"),i=a("cf45"),s=a("6612"),c=a.n(s),d={name:"payWxResult",data:function(){var e=this.$route.query,t=e.payment?JSON.parse(e.payment):{},a=t.payMap;return{headerStatus:!1,browserStatus:!1,payType:e.payType,payMap:a,amount:Object(i["b"])(0),errorText:null}},mounted:function(){var e=this;if(this.payMap&&this.payType){this.amount=Object(i["b"])(this.payMap.amount);var t=window.navigator.userAgent.toLowerCase();"micromessenger"==t.match(/MicroMessenger/i)?(this.browserStatus=!0,this.getWxPay()):"alipayclient"==t.match(/AlipayClient/i)?(this.browserStatus=!0,this.getPayment()):(this.errorText="请在微信或支付宝客户端打开",document.title="ERROR")}else this.$dialog.alert({message:"支付订单信息错误请重新支付"}).then((function(){e.$router.back()}))},methods:{getPayment:function(){var e=this;try{if(!(parseFloat(this.amount)>0))return void this.$toast("支付金额异常");var t=this.payMap,a=t.orderNo,r=t.sign,n=t.amount,i=t.orderBody,s=t.orderSubject,d={orderNo:a,sign:r,amount:c()(n).format("0.00"),orderBody:i,orderSubject:s,payChannel:this.payType};"wx_pub"==this.payType&&(d.code=this.code),this.$toast.loading({duration:0,message:"加载中...",forbidClick:!0}),Object(o["a"])(d).then((function(t){e.$toast.clear();var a=t.data;if(200==a.code){var r=a.data;"succeeded"===r.status?e.scanCodePay(r):"failed"==r.status?(e.browserStatus=!1,e.errorText=r.error_msg,document.title="ERROR"):"pending"==r.status&&e.$dialog.alert({title:"提示",message:"订单处理中...",confirmButtonColor:"#269a93"})}else e.$dialog.alert({title:"提示",message:a.msg,confirmButtonColor:"#269a93"})})).catch((function(t){e.$toast.clear(),e.$dialog.alert({title:"提示",message:JSON.stringify(t),confirmButtonColor:"#269a93"})}))}catch(u){this.$dialog.alert({title:"提示",message:u.toString(),confirmButtonColor:"#269a93"})}},scanCodePay:function(e){if("alipay_wap"==this.payType)window.location.href=e.expend.pay_info;else if("wx_pub"==this.payType){var t=JSON.parse(e.expend.pay_info);this.payInfo=t,"undefined"==typeof WeixinJSBridge?document.addEventListener?document.addEventListener("WeixinJSBridgeReady",this.onBridgeReady,!1):document.attachEvent&&(document.attachEvent("WeixinJSBridgeReady",this.onBridgeReady),document.attachEvent("onWeixinJSBridgeReady",this.onBridgeReady)):this.onBridgeReady()}},onBridgeReady:function(){var e=this,t=this.payInfo;WeixinJSBridge.invoke("getBrandWCPayRequest",{appId:t.appId,timeStamp:t.timeStamp,nonceStr:t.nonceStr,package:t.package,signType:t.signType,paySign:t.paySign},(function(t){console.log(t);var a=e.payMap.orderNo;"get_brand_wcpay_request:cancel"==t.err_msg||"get_brand_wcpay_request:fail"==t.err_msg?e.$router.replace({path:"/paymentResult",query:{type:"error",orderNo:a,isBack:"off"}}):e.$router.replace({path:"/paymentResult",query:{orderNo:a,isBack:"off"}})}))},getWxPay:function(){var e=Object(i["c"])("code");e?(this.code=e,this.getPayment()):this.goAuth()},goAuth:function(){var e=encodeURIComponent(window.location.href),t="snsapi_base",a="wx751141096e75a4ee",r="https://open.weixin.qq.com/connect/oauth2/authorize?appid=".concat(a,"&redirect_uri=").concat(e,"&response_type=code&scope=").concat(t,"&state=STATE&connect_redirect=1#wechat_redirect");window.location.replace(r)}},destroyed:function(){this.$toast.clear(),this.$dialog.close()}},u=d,p=(a("fd97"),a("2877")),l=Object(p["a"])(u,r,n,!1,null,"a647acb8",null);t["default"]=l.exports},e179:function(e,t,a){},fd97:function(e,t,a){"use strict";var r=a("e179"),n=a.n(r);n.a}}]);