1 |
- !function(){function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?e(Object(a),!0).forEach((function(e){n(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):e(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t,n,r,a,o,i){try{var u=e[o](i),c=u.value}catch(p){return void n(p)}u.done?t(c):Promise.resolve(c).then(r,a)}function a(e){return function(){var t=this,n=arguments;return new Promise((function(a,o){var i=e.apply(t,n);function u(e){r(i,a,o,u,c,"next",e)}function c(e){r(i,a,o,u,c,"throw",e)}u(void 0)}))}}var o=document.createElement("style");o.innerHTML="._payment_1us1e_1 .van-cell__title{font-size:.42667rem;padding-left:.26667rem}._payment_1us1e_1 .van-icon-cross{position:absolute;z-index:1;top:.34667rem;left:.34667rem;color:#ccc;cursor:pointer}._payment_1us1e_1 ._title_1us1e_13{background-color:#fff;font-size:.42667rem;font-weight:400;color:#1a1a1a;padding:.37333rem 0 .32rem;text-align:center}._payment_1us1e_1 ._payAmount_1us1e_21{background-color:#fff;padding:.53333rem 0;text-align:center}._payment_1us1e_1 ._payAmount_1us1e_21 p{font-size:.37333rem;color:#666;padding-bottom:.26667rem}._payment_1us1e_1 ._payAmount_1us1e_21 ._amount_1us1e_31{font-size:.74667rem;color:#000}._payment_1us1e_1 ._payAmount_1us1e_21 ._amount_1us1e_31 span{font-size:.48rem;padding-left:.08rem}._payment_1us1e_1 ._blank_1us1e_39{height:1.73333rem}._payment_1us1e_1 ._payBtn_1us1e_42{width:6.13333rem!important;margin:0 auto;font-size:.42667rem;font-weight:600;margin-bottom:.53333rem}\n",document.head.appendChild(o),System.register(["./index-legacy.f8641610.js","./index-legacy.fc510843.js","./index-legacy.c36297f9.js","./index-legacy.1dea7f77.js","./index-legacy.aee47fad.js","./hooks-legacy.1d4168e3.js"],(function(e){"use strict";var n,r,o,i,u,c,p,l,s,d,m,f,y,_,h,g,v;return{setters:[function(e){n=e.d,r=e.br,o=e.D,i=e.e,u=e.s,c=e.p,p=e.T,l=e.b1,s=e.i,d=e.N,m=e.A,f=e.B},function(e){y=e.C},function(e){_=e.C},function(e){h=e.R,g=e.a},function(){},function(e){v=e.u}],execute:function(){var b="_payment_1us1e_1",O="_title_1us1e_13",T="_payAmount_1us1e_21",w="_amount_1us1e_31",x="_blank_1us1e_39",P="_payBtn_1us1e_42",k="TEACHER"===u.platformType?"/api-teacher":"/api-student",j={goodsPay:{cancelUrl:"/api-mall-portal/order/cancelUserOrder",payUrl:"/api-mall-portal/payment/orderPay"},orderPay:{cancelUrl:k+"/userOrder/orderCancel",payUrl:k+"/userOrder/orderPay"}};e("P",n({name:"payment",props:{modelValue:{type:Boolean,default:!1},orderInfo:{type:Object,default:{orderNo:"",actualPrice:0}},onBackOut:{type:Function,default:function(){}},paymentType:{type:String,default:"orderPay"}},data:function(){return{payType:"ali_app",pay_channel:""}},unmounted:function(){r("paymentOperation",this.paymentOperation)},methods:{onClose:function(){var e=this;o.confirm({message:"是否放弃本次付款",confirmButtonText:"继续付款",cancelButtonText:"放弃"}).then((function(){})).catch(a(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.onCancel(),v("取消支付");case 2:case"end":return t.stop()}}),t)}))))},onCancel:function(e){var t=this;return a(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,i.post(j[t.paymentType].cancelUrl,{data:{orderNo:t.orderInfo.orderNo}});case 3:n.next=7;break;case 5:n.prev=5,n.t0=n.catch(0);case 7:t.$emit("update:modelValue",!1),!e&&t.$router.go(-1),t.onBackOut&&t.onBackOut();case 10:case"end":return n.stop()}}),n,null,[[0,5]])})))()},onSubmit:function(){var e=this;return a(regeneratorRuntime.mark((function n(){var r,a;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,r={orderNo:e.orderInfo.orderNo,payChannel:e.payType,paymentClient:null},"goodsPay"===e.paymentType&&(r.paymentClient=u.platformType),n.next=5,i.post(j[e.paymentType].payUrl,{data:t({},r)});case 5:a=n.sent,c({api:"paymentOrder",content:{orderNo:e.orderInfo.orderNo,payChannel:e.payType,payInfo:a.data.pay_info}}),p.loading({message:"支付中...",forbidClick:!0,duration:3e3,loadingType:"spinner"}),p.clear(),e.$emit("update:modelValue",!1),l("paymentOperation",(function(t){console.log(t,"init paymentOperation"),e.paymentOperation(null==t?void 0:t.content)})),n.next=16;break;case 13:n.prev=13,n.t0=n.catch(0),console.log(n.t0);case 16:v("购买支付");case 17:case"end":return n.stop()}}),n,null,[[0,13]])})))()},paymentOperation:function(e){var t=this;if(console.log(e,"paymentOperation",this.paymentType,this.orderInfo),"success"===e.status||"error"===e.status){if(p.clear(),this.$emit("update:modelValue",!1),"goodsPay"===this.paymentType)return void this.$router.replace({path:"/shopTrade",query:{orderNo:this.orderInfo.orderNo}});this.$router.replace({path:"/tradeDetail",query:{orderNo:this.orderInfo.orderNo}})}else if("cancel"===e.status)p.clear(),this.$emit("update:modelValue",!1);else if("fail"===e.status){var n="ali_app"===this.payType?"您尚未安装支付宝":"您尚未安装微信";o.alert({title:"提示",message:n}).then((function(){p.clear(),t.$emit("update:modelValue",!1)}))}}},render:function(){var e=this;return s("div",{class:b},[s(d,{onClick:this.onClose,name:"cross",size:20},null),s("div",{class:[O,"van-hairline--bottom"]},[m("选择支付方式")]),s("div",{class:T},[s("p",null,[m("应付金额")]),s("div",{class:w},[this.$filters.moneyFormat(this.orderInfo.actualPrice),s("span",null,[m("元")])])]),s(h,{modelValue:this.payType,"onUpdate:modelValue":function(t){return e.payType=t}},{default:function(){return[s(_,{border:!1},{default:function(){return[s(y,{title:"支付宝支付",border:!1,center:!0,onClick:function(){e.payType="ali_app"}},{icon:function(){return s(d,{name:"alipay",color:"#009fe9",size:22},null)},"right-icon":function(){return s(g,{name:"ali_app"},null)}}),s(y,{title:"微信支付",border:!1,center:!0,onClick:function(){e.payType="wx_app"}},{icon:function(){return s(d,{name:"wechat-pay",color:"#15c434",size:22},null)},"right-icon":function(){return s(g,{name:"wx_app"},null)}})]}})]}}),s("div",{class:x},null),s(f,{type:"primary",class:P,block:!0,round:!0,onClick:this.onSubmit},{default:function(){return[m("确认支付")]}})])}}))}}}))}();
|