var v=(L,i,e)=>new Promise((w,p)=>{var A=c=>{try{n(e.next(c))}catch(f){p(f)}},h=c=>{try{n(e.throw(c))}catch(f){p(f)}},n=c=>c.done?w(c.value):Promise.resolve(c.value).then(A,h);n((e=e.apply(L,i)).next())});import{d as q,r as x,bx as H,R as d,K as N,v as U,u as j,w as O,f as P,g as o,z as Q,B as k,X,D as C,Y,o as g,h as r,j as Z,L as m,M as _,G as D,H as B,I as R,F as a,n as S,l as J,a4 as W,P as ee,Q as $,Z as b,q as te}from"./index-q8TQmcfk.js";import{_ as ae}from"./z-paging.qf1jZGzy.js";import{p as oe,c as re,d as ne}from"./wallet.DKnOUjfT.js";const le=q({name:"Recharge",__name:"recharge",setup(L){const i=x(0),e=x({methodId:"",id:"",amount:"",customAmount:""}),w={BKASH:"/static/icons/bkash.png",NAGAD:"/static/icons/nagad.png",ROCKET:"/static/icons/rocket.png"};H(t=>{t.text===d("wallet.recharge.record")&&N({url:"/pages/wallet/rechargeRecord"})});const p=x([]);function A(){return v(this,null,function*(){const t=yield oe();p.value=t.data,yield c()})}const h=x([]),n=x({maxPrice:0,miniPrice:0});function c(t){return v(this,null,function*(){e.value.methodId=t||p.value[0].id;const l=yield re({id:e.value.methodId});l.code==="200"&&(h.value=l.data.list,n.value={maxPrice:l.data.maxPrice,miniPrice:i.value||l.data.miniPrice})})}function f(t){e.value.id=t.id,e.value.amount=t.amount,e.value.customAmount=""}function z(){e.value.id="",e.value.amount=""}const y=x(!1);function G(){return v(this,null,function*(){const t=Number(e.value.customAmount||e.value.amount);if(!t){b.info(d("wallet.recharge.enterAmount"));return}if(t<n.value.miniPrice){b.info(d("wallet.recharge.minAmount",{minAmount:n.value.miniPrice}));return}if(t>n.value.maxPrice){b.info(d("wallet.recharge.maxAmount",{maxAmount:n.value.maxPrice}));return}y.value=!0;try{const l=yield ne({amount:t,methodId:e.value.methodId});l.code==="200"&&N({url:"/pages/webLink/webLink",params:{link:l.data.payUrl,title:d("orderDetail.payDialog.title")},isRedirect:!0})}finally{y.value=!1}})}return U(()=>{A()}),j(t=>{i.value=t.price||0}),O(()=>e.value.customAmount,t=>{if(!t)return;const l=t.toString().replace(/\D/g,"");if(l!==t){e.value.customAmount=l;return}Number(l)>n.value.maxPrice&&(e.value.customAmount=n.value.maxPrice.toString(),b.info(d("wallet.recharge.maxAmount",{maxAmount:n.value.maxPrice})))}),(t,l)=>{const u=Z,M=J,I=ee,V=k(C("wd-input"),X),E=k(C("wd-button"),Y),F=k(C("z-paging"),ae),K=Q("layout-default-uni");return g(),P(K,null,{default:o(()=>[r(F,null,{bottom:o(()=>[r(u,{class:"mb-20rpx px-24rpx text-24rpx text-#5A5A5A"},{default:o(()=>[m(_(t.$t("wallet.recharge.reminder")),1)]),_:1}),r(u,{class:"bg-white/60 px-28rpx py-30rpx backdrop-blur-20"},{default:o(()=>[r(E,{block:"",disabled:!a(e).amount&&!a(e).customAmount,loading:a(y),onClick:G},{default:o(()=>[m(_(t.$t("wallet.recharge.submit")),1)]),_:1},8,["disabled","loading"])]),_:1})]),default:o(()=>[r(u,{class:"px-24rpx pt-36rpx"},{default:o(()=>[r(u,{class:"mb-24rpx text-24rpx font-bold"},{default:o(()=>[m(_(t.$t("wallet.recharge.selectProvider")),1)]),_:1}),r(u,{class:"grid grid-cols-3 mb-30rpx gap-20rpx"},{default:o(()=>[(g(!0),D(B,null,R(a(p),s=>(g(),P(u,{key:s.id,style:S({borderColor:s.id===a(e).methodId?"var(--wot-color-theme)":""}),class:"border-1 border-transparent rounded-16rpx border-solid bg-white py-30rpx text-center shadow-[0rpx_2rpx_8rpx_0rpx_rgba(184,184,184,0.5)]",onClick:T=>c(s.id)},{default:o(()=>[r(M,{src:w[s.methodName],class:"mb-20rpx h-120rpx w-120rpx"},null,8,["src"]),r(u,{class:"text-28rpx"},{default:o(()=>[m(_(s.methodName),1)]),_:2},1024)]),_:2},1032,["style","onClick"]))),128))]),_:1}),r(u,{class:"mb-24rpx text-24rpx font-bold"},{default:o(()=>[m(_(t.$t("wallet.recharge.depositAmount")),1)]),_:1}),r(u,{class:"grid grid-cols-3 mb-20rpx gap-20rpx"},{default:o(()=>[(g(!0),D(B,null,R(a(h),s=>(g(),P(u,{key:s.id,class:W(["amount-item border-1 border-transparent rounded-12rpx border-solid bg-white py-22rpx text-center",{disabled:a(i)&&s.amount<a(i)}]),style:S({borderColor:s.id===a(e).id?"var(--wot-color-theme)":""}),onClick:T=>!a(i)||s.amount>=a(i)?f(s):null},{default:o(()=>[r(u,null,{default:o(()=>[r(I,{class:"text-24rpx"},{default:o(()=>[m(" ৳ ")]),_:1}),r(I,{class:"text-36rpx"},{default:o(()=>[m(_(a($)(s.amount)),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,["class","style","onClick"]))),128))]),_:1}),r(V,{modelValue:a(e).customAmount,"onUpdate:modelValue":l[0]||(l[0]=s=>a(e).customAmount=s),"no-border":"",placeholder:`${a(d)("wallet.recharge.minAmount",{minAmount:a($)(a(n).miniPrice)})} ~ ${a(d)("wallet.recharge.maxAmount",{maxAmount:a($)(a(n).maxPrice)})}`,"custom-class":"bandhu-auth-input-field",onFocus:z},null,8,["modelValue","placeholder"])]),_:1})]),_:1})]),_:1})}}}),de=te(le,[["__scopeId","data-v-a3df1c33"]]);export{de as default};
