PayDefine.0722fc4c.js 7.0 KB

1
  1. (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["PayDefine"],{2558:function(e,t,a){"use strict";var r=a("f0da"),n=a.n(r);n.a},4162:function(e,t,a){"use strict";var r=a("9f28"),n=a.n(r);n.a},"67ec":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:"payDefine"},[e.headerStatus?a("m-header"):e._e(),e.browserStatus?a("div",{staticClass:"container"},[a("div",{staticClass:"amount"},[e._v("¥"+e._s(e.amount))]),a("van-cell-group",{attrs:{border:!0}},[a("van-cell",{attrs:{title:"订单信息",value:e.orderBody}}),a("van-cell",{attrs:{title:"支付方式",value:e.payTypeString}}),a("van-cell",{attrs:{title:"实付金额",value:"¥"+e.amount+"元"}})],1),a("van-button",{attrs:{type:"primary",block:"",size:"large",round:"",color:"#14928A"},on:{click:e.getPayment}},[e._v("立即支付")])],1):e._e(),a("div",{staticClass:"container",attrs:{else:""}},[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=[],o=a("a34a"),i=a.n(o),s=a("6e6e"),c=a("ae54"),d=a("cf45");function u(e,t,a,r,n,o,i){try{var s=e[o](i),c=s.value}catch(d){return void a(d)}s.done?t(c):Promise.resolve(c).then(r,n)}function l(e){return function(){var t=this,a=arguments;return new Promise((function(r,n){var o=e.apply(t,a);function i(e){u(o,r,n,i,s,"next",e)}function s(e){u(o,r,n,i,s,"throw",e)}i(void 0)}))}}a("981f").default;var p={name:"payDefine",components:{MHeader:s["a"]},data:function(){var e=this.$route.query;return{headerStatus:!1,browserStatus:!1,amount:Object(d["b"])(e.amount),orderNo:e.orderNo,sign:e.sign,payType:e.payType,payTypeString:"wx_pub"==e.payType?"微信":"支付宝",errorText:null,orderBody:e.orderBody,orderSubject:e.orderSubject,code:e.code}},mounted:function(){window.location.href.indexOf("?#")<0&&(window.location.href=window.location.href.replace("#","?#"));var e=this.payType,t=window.navigator.userAgent.toLowerCase();if("micromessenger"==t.match(/MicroMessenger/i))if("wx_pub"===e){var a=Object(d["c"])("code");a&&(this.code=a),this.browserStatus=!0,document.title="微信支付"}else"alipay_qr"==e&&(this.errorText="请使用支付宝扫码");else"alipayclient"==t.match(/AlipayClient/i)?"wx_pub"===e?this.errorText="请使用微信扫码":"alipay_qr"==e&&(this.browserStatus=!0,document.title="支付宝支付"):this.errorText="请在微信或支付宝客户端打开";this.errorText&&(document.title="ERROR")},methods:{getPayment:function(){var e=l(i.a.mark((function e(){var t,a=this;return i.a.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(e.prev=0,parseFloat(this.amount)>0){e.next=4;break}return this.$toast("支付金额异常"),e.abrupt("return");case 4:return this,t={orderNo:this.orderNo,sign:this.sign,amount:this.amount,payChannel:this.payType,orderBody:this.orderBody,orderSubject:this.orderSubject},"wx_pub"==this.payType&&(t.code=this.code),this.$toast.loading({duration:0,message:"加载中...",forbidClick:!0}),e.next=9,Object(c["a"])(t).then((function(e){a.$toast.clear();var t=e.data;if(200==t.code){var r=t.data;"succeeded"===r.status?a.scanCodePay(r):"failed"==r.status?(a.browserStatus=!1,a.errorText=r.error_msg,document.title="ERROR"):"pending"==r.status&&a.$dialog.alert({title:"提示",message:"订单处理中...",confirmButtonColor:"#269a93"})}else a.$dialog.alert({title:"提示",message:t.msg,confirmButtonColor:"#269a93"})})).catch((function(e){a.$toast.clear(),a.$dialog.alert({title:"提示",message:JSON.stringify(e),confirmButtonColor:"#269a93"})}));case 9:e.next=14;break;case 11:e.prev=11,e.t0=e["catch"](0),this.$dialog.alert({title:"提示",message:"网络异常,请检查网络连接",confirmButtonColor:"#269a93"});case 14:case"end":return e.stop()}}),e,this,[[0,11]])})));function t(){return e.apply(this,arguments)}return t}(),scanCodePay:function(e){if("alipay_qr"==this.payType){var t="false"===e.prod_mode?e.expend.qrcode_url+"?payment_id="+e.id+"&pay_channel="+e.pay_channel:e.expend.qrcode_url;window.location.href=t}else if("wx_pub"==this.payType){var a=JSON.parse(e.expend.pay_info);this.payInfo=a,"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,a=this.orderNo;WeixinJSBridge.invoke("getBrandWCPayRequest",{appId:t.appId,timeStamp:t.timeStamp,nonceStr:t.nonceStr,package:t.package,signType:t.signType,paySign:t.paySign},(function(t){"get_brand_wcpay_request:cancel"==t.err_msg||"get_brand_wcpay_request:fail"==t.err_msg?e.$router.replace({path:"/paymentResult",query:{type:"FAILED",orderNo:a,isBack:"off"}}):e.$router.replace({path:"/paymentResult",query:{orderNo:e.orderNo,isBack:"off"}})}))},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(),document.title="酷乐秀"}},f=p,h=(a("4162"),a("2877")),m=Object(h["a"])(f,r,n,!1,null,"e3526d64",null);t["default"]=m.exports},"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=[],o={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)}}},i=o,s=(a("2558"),a("2877")),c=Object(s["a"])(i,r,n,!1,null,"9865a7b0",null);t["a"]=c.exports},"9f28":function(e,t,a){},a34a:function(e,t,a){e.exports=a("96cf")},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-user/examOrder/executePayment",method:"post",data:n.a.stringify(e)})}function s(e){return o({url:"/api-user/examOrder/paymentResult",method:"get",params:e})}},f0da:function(e,t,a){}}]);