PayResult.9e8fbfe1.js 5.9 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["PayResult"],{2558:function(e,t,a){"use strict";var r=a("f0da"),n=a.n(r);n.a},"6e6e":function(e,t,a){"use strict";var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"mheader"},[a("header",{staticClass:"m-nav-header",class:[{fixed:e.isFixed},{headerColor:e.isColor}]},[a("div",{directives:[{name:"show",rawName:"v-show",value:e.isBack,expression:"isBack"}],staticClass:"m-nav-bar__left",on:{click:e.goBack}},[a("van-icon",{staticClass:"arrow-left",attrs:{name:"arrow-left"}})],1),a("div",{staticClass:"m-nav-bar__title"},[e._t("default",[e._v(e._s(e.name?e.name:e.$route.meta.description))])],2),a("div",{staticClass:"m-nav-bar__right"},[e._t("right")],2)])])},n=[],i={name:"mheader",props:{name:String,isBack:{type:Boolean,default:!0},isFixed:{type:Boolean,default:!0},isColor:{type:Boolean,default:!1},backUrl:{type:Object,default:function(){return{callBack:null,status:!1,path:"",params:{}}}}},data:function(){return{title:this.name,backUrlParams:this.backUrl}},methods:{goBack:function(){var e=this.backUrlParams;"function"==typeof e.callBack?e.callBack():e.status?this.$router.push({path:e.path,query:e.params}):history.go(-1)}}},o=i,s=(a("2558"),a("2877")),c=Object(s["a"])(o,r,n,!1,null,"9865a7b0",null);t["a"]=c.exports},"7ed7":function(e,t,a){"use strict";var r=a("f6a9"),n=a.n(r);n.a},ae54:function(e,t,a){"use strict";a.d(t,"a",(function(){return o})),a.d(t,"b",(function(){return s}));var r=a("4328"),n=a.n(r),i=a("981f").default;function o(e){return i({url:"/api-user/examOrder/executePayment",method:"post",data:n.a.stringify(e)})}function s(e){return i({url:"/api-user/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.headerStatus?a("m-header"):e._e(),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)])],1)},n=[],i=a("6e6e"),o=a("ae54"),s=a("cf45"),c={name:"payWxResult",components:{MHeader:i["a"]},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(s["b"])(0),errorText:null}},mounted:function(){var e=this;if(this.payMap&&this.payType){this.amount=Object(s["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,c={orderNo:a,sign:r,amount:n,orderBody:i,orderSubject:s,payChannel:this.payType};"wx_pub"==this.payType&&(c.code=this.code),this.$toast.loading({duration:0,message:"加载中...",forbidClick:!0}),Object(o["a"])(c).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(d){this.$dialog.alert({title:"提示",message:d.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(s["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()}},d=c,u=(a("7ed7"),a("2877")),l=Object(u["a"])(d,r,n,!1,null,"5cfada27",null);t["default"]=l.exports},f0da:function(e,t,a){},f6a9:function(e,t,a){}}]);