You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
7.0 KiB
1 lines
7.0 KiB
import{$ as e,U as a,B as t,o as l,c as n,w as s,n as o,e as i,i as c,a as u,f as d,t as m,b as r,d as f,F as h,k as p,I as y,V as _,a4 as g,x as P,j as b}from"./index-ae8bbb19.js";import{_ as S}from"./u-modal.b5d074c6.js";import{r as I}from"./uni-app.es.ee1d5b08.js";import{P as T,p as C,a as v,e as x,b as w,c as U,d as k}from"./wechat.1e2bf9bf.js";import{_ as A}from"./_plugin-vue_export-helper.1b428a4d.js";import"./u-loading.01f91c7b.js";import"./u-popup.d74d5514.js";import"./u-icon.b463ad8a.js";const D="recharge/center",M="recharge/submit",V="recharge/tradeQuery";const E={[T.WECHAT.value]:"icon-wechat-pay",[T.ALIPAY.value]:"icon-alipay"},L={[T.WECHAT.value]:"微信",[T.ALIPAY.value]:"支付宝"};const N=A({data:()=>({isLoading:!0,disabled:!1,PayMethodEnum:T,PayMethodIconEnum:E,PayMethodClientNameEnum:L,personal:{balance:"0.00"},setting:{},planList:[],methods:[],selectedPlanId:0,inputValue:"",curPaymentItem:null,showConfirmModal:!1,tempUnifyData:{outTradeNo:"",method:""}}),onLoad(e){this.getPageData()},methods:{onSelectPlan(e){this.selectedPlanId=e,this.inputValue=""},onChangeMoney({detail:e}){this.inputValue=e.value,this.selectedPlanId=0},handleSelectPayType(e){this.curPaymentItem=this.methods[e]},getPageData(){const a=this;return a.isLoading=!0,new Promise(((t,l)=>{var n;(n={client:a.platform},e.get(D,n)).then((e=>{a.setting=e.data.setting,a.personal=e.data.personal,a.planList=e.data.planList,a.methods=e.data.paymentMethods,a.isLoading=!1,a.handleSelectPayType(0),this.performance()}))}))},performance(){this.alipayPerformance(),this.wechatPerformance()},alipayPerformance(){const e=this;e.tempUnifyData=C(),e.tempUnifyData&&e.onTradeQuery(e.tempUnifyData.outTradeNo,e.tempUnifyData.method)},wechatPerformance(){const e=this;e.tempUnifyData=v("recharge"),console.log("wechatPerformance",e.tempUnifyData),e.tempUnifyData&&(e.showConfirmModal=!0)},onSubmit(a){const t=this;var l;t.curPaymentItem?t.disabled||(t.disabled=!0,(l={planId:t.selectedPlanId,customMoney:t.inputValue?t.inputValue:"",method:t.curPaymentItem.method,client:t.platform,extra:t.getExtraAsUnify(t.curPaymentItem.method)},e.post(M,{form:l})).then((e=>t.onSubmitCallback(e))).finally((e=>{setTimeout((()=>t.disabled=!1),10)}))):t.$toast("您还没有选择支付方式")},getExtraAsUnify:e=>e===T.ALIPAY.value?x():e===T.WECHAT.value?w():{},onSubmitCallback(e){const a=this,t=a.curPaymentItem.method,l=e.data.payment;t===T.BALANCE.value&&a.onShowSuccess(e),t===T.ALIPAY.value&&(console.log("paymentData",l),U(l).then((e=>a.onPaySuccess(e))).catch((e=>a.onPayFail(e)))),t===T.WECHAT.value&&(console.log("paymentData",l),k({orderKey:"recharge",...l}).then((e=>a.onPaySuccess(e))).catch((e=>a.onPayFail(e))))},onPaySuccess({res:e,option:{isRequireQuery:a,outTradeNo:t,method:l}}){if(a)return this.onTradeQuery(t,l),!0;this.onShowSuccess(e)},onShowSuccess({message:e}){this.$toast(e||"订单支付成功"),this.onSuccessNav()},onPayFail(e){console.log("onPayFail",e);const a=e.message||"订单未支付";this.$error(a)},onTradeQuery(a,t){const l=this;var n;(n={outTradeNo:a,method:t,client:l.platform},e.get(V,n)).then((e=>e.data.isPay?l.onShowSuccess(e):l.onPayFail(e))).finally((()=>l.showConfirmModal=!1))},onSuccessNav(){const e=a(),l=e.length<2?null:e[e.length-2];l&&t(l.route,["pages/wallet/index"])?setTimeout((()=>uni.navigateBack()),1e3):setTimeout((()=>{this.$navTo("pages/wallet/index",{},"redirectTo")}),1200)}}},[["render",function(e,a,t,T,C,v){const x=p,w=c,U=y,k=_,A=g,D=I(P("u-modal"),S);return C.personal.user_id?(l(),n(w,{key:0,class:"container",style:o(e.appThemeStyle)},{default:s((()=>[u(w,{class:"account-panel dis-flex flex-y-center"},{default:s((()=>[u(w,{class:"panel-lable"},{default:s((()=>[u(x,null,{default:s((()=>[d("账户余额")])),_:1})])),_:1}),u(w,{class:"panel-balance flex-box"},{default:s((()=>[u(x,null,{default:s((()=>[d("¥"+m(C.personal.balance),1)])),_:1})])),_:1})])),_:1}),u(w,{class:"recharge-panel"},{default:s((()=>[u(w,{class:"recharge-label"},{default:s((()=>[u(x,null,{default:s((()=>[d("充值金额")])),_:1})])),_:1}),u(w,{class:"recharge-plan clearfix"},{default:s((()=>[(l(!0),r(h,null,f(C.planList,((e,a)=>(l(),n(w,{key:a,class:b(["recharge-plan_item",{active:C.selectedPlanId==e.plan_id}]),onClick:a=>v.onSelectPlan(e.plan_id)},{default:s((()=>[u(w,{class:"plan_money"},{default:s((()=>[u(x,null,{default:s((()=>[d(m(e.money),1)])),_:2},1024)])),_:2},1024),e.gift_money>0?(l(),n(w,{key:0,class:"plan_gift"},{default:s((()=>[u(x,null,{default:s((()=>[d("送"+m(e.gift_money),1)])),_:2},1024)])),_:2},1024)):i("",!0)])),_:2},1032,["class","onClick"])))),128))])),_:1}),1==C.setting.is_custom?(l(),n(w,{key:0,class:"recharge-input"},{default:s((()=>[u(U,{class:"input",type:"digit",placeholder:"可输入自定义充值金额",modelValue:C.inputValue,"onUpdate:modelValue":a[0]||(a[0]=e=>C.inputValue=e),onInput:v.onChangeMoney},null,8,["modelValue","onInput"])])),_:1})):i("",!0),u(w,{class:"recharge-label m-top60"},{default:s((()=>[u(x,null,{default:s((()=>[d("支付方式")])),_:1})])),_:1}),u(w,{class:"payment-method"},{default:s((()=>[(l(!0),r(h,null,f(C.methods,((e,a)=>(l(),n(w,{key:a,class:"pay-item dis-flex flex-x-between",onClick:e=>v.handleSelectPayType(a)},{default:s((()=>[u(w,{class:"item-left dis-flex flex-y-center"},{default:s((()=>[u(w,{class:b(["item-left_icon",[e.method]])},{default:s((()=>[u(x,{class:b(["iconfont",[C.PayMethodIconEnum[e.method]]])},null,8,["class"])])),_:2},1032,["class"]),u(w,{class:"item-left_text"},{default:s((()=>[u(x,null,{default:s((()=>[d(m(C.PayMethodEnum[e.method].name),1)])),_:2},1024)])),_:2},1024)])),_:2},1024),C.curPaymentItem&&C.curPaymentItem.method==e.method?(l(),n(w,{key:0,class:"item-right col-m"},{default:s((()=>[u(x,{class:"iconfont icon-check"})])),_:1})):i("",!0)])),_:2},1032,["onClick"])))),128))])),_:1}),u(w,{class:"recharge-submit btn-submit"},{default:s((()=>[u(A,{onSubmit:v.onSubmit},{default:s((()=>[u(k,{class:"button",formType:"submit",disabled:C.disabled},{default:s((()=>[d("立即充值")])),_:1},8,["disabled"])])),_:1},8,["onSubmit"])])),_:1})])),_:1}),u(w,{class:"describe-panel"},{default:s((()=>[u(w,{class:"recharge-label"},{default:s((()=>[u(x,null,{default:s((()=>[d("充值说明")])),_:1})])),_:1}),u(w,{class:"content"},{default:s((()=>[u(x,{space:"ensp"},{default:s((()=>[d(m(C.setting.describe),1)])),_:1})])),_:1})])),_:1}),C.tempUnifyData?(l(),n(D,{key:0,modelValue:C.showConfirmModal,"onUpdate:modelValue":a[1]||(a[1]=e=>C.showConfirmModal=e),title:"支付确认","show-cancel-button":"","confirm-text":"已完成支付","confirm-color":e.appTheme.mainBg,"negative-top":"100",asyncClose:!0,onConfirm:a[2]||(a[2]=e=>v.onTradeQuery(C.tempUnifyData.outTradeNo,C.tempUnifyData.method))},{default:s((()=>[u(w,{class:"modal-content"},{default:s((()=>[u(x,null,{default:s((()=>[d("请在"+m(C.PayMethodClientNameEnum[C.tempUnifyData.method])+"内完成支付,如果您已经支付成功,请点击“已完成支付”按钮",1)])),_:1})])),_:1})])),_:1},8,["modelValue","confirm-color"])):i("",!0)])),_:1},8,["style"])):i("",!0)}],["__scopeId","data-v-8c7f5fdc"]]);export{N as default};
|
|
|