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,bv as H,P as d,K as I,v as O,u as U,w as j,f as P,g as o,z as W,B as k,V as X,D as C,W as J,o as g,h as r,j as Q,L as m,M as _,G as D,H as B,I as S,F as a,n as R,l as Y,a2 as Z,N as ee,O as $,X as b,q as te}from"./index-C8qz7c0N.js";import{_ as ae}from"./z-paging.Dxcf6OUf.js";import{p as oe,c as re,d as ne}from"./wallet.DtqW6x-g.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")&&I({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 V(){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"&&I({url:"/pages/webLink/webLink",params:{link:l.data.payUrl,title:d("orderDetail.payDialog.title")},isRedirect:!0})}finally{y.value=!1}})}return O(()=>{A()}),U(t=>{i.value=t.price||0}),j(()=>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=Q,G=Y,N=ee,M=k(C("wd-input"),X),E=k(C("wd-button"),J),F=k(C("z-paging"),ae),K=W("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:V},{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,S(a(p),s=>(g(),P(u,{key:s.id,style:R({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(G,{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,S(a(h),s=>(g(),P(u,{key:s.id,class:Z(["amount-item border-1 border-transparent rounded-12rpx border-solid bg-white py-22rpx text-center",{disabled:a(i)&&s.amount<a(i)}]),style:R({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(N,{class:"text-24rpx"},{default:o(()=>[m(" ৳ ")]),_:1}),r(N,{class:"text-36rpx"},{default:o(()=>[m(_(a($)(s.amount)),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,["class","style","onClick"]))),128))]),_:1}),r(M,{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};
