import{_ as a,q as e,f as t,w as s,P as l,b as u}from"./index-4c745ab9.js";import{L as n,l as o,q as i,o as c,a as r,f as m,u as v,g as d,t as p,j as _,C as f,h as y,e as g,y as b}from"./vendor-edc0678f.js";import{u as N}from"./useFreeze-8df38998.js";import{D as h,P as k}from"./productDetail-a6cee236.js";import{f as C,a as w}from"./index-478984b7.js";const j={class:"columnFlex"},x={key:0},I={class:"introduction"},A={class:"title fw-bold"},L=["placeholder"],U={class:"buyNow"},D={class:"protocol"},F={key:1,class:"success"},P=a({__name:"buyFunds",setup(a){const{_isFreeze:P}=N(),{_toast:q,_showName:z}=e(),M=n(),O=o({leftName:t("starting-amount"),centerName:t("Investment_Limit"),rightName:t("Lock-up_days")}),R=o(""),V=o(""),$=o(""),B=o({}),E=o(!1),G=o(!1),H=o(-1),K=o(0),Q=o(0),J=()=>{if(!E.value)return q("please_agree_financial");if(Number(R.value)<K.value)return b(t("Can_buy_down_to")+" ".concat(K.value," ").concat($.value));if(Number(R.value)>Q.value)return b(z("Can_buy_up_to")+" ".concat(Q.value," ").concat($.value));if(!/^\d+(\.\d{1,4})?$/.test(R.value))return q("entet4_point");T()},S=()=>{l.includes(__config._APP_ENV)?P(l)&&J():J()},T=async()=>{const a=await w(M.params.id,R.value,V.value);200===a.code?(G.value=!0,H.value=-2):b(a.msg)},W=()=>{E.value=!E.value};return i(()=>{(async()=>{try{const a=await C(M.params.id);if(200===a.code){const{title:e,icon:t,avgRate:s,days:l,limitMin:u,limitMax:n,coin:o}=a.data;K.value=u,Q.value=n,$.value=o.toUpperCase(),V.value=l,O.value={title:e,icon:t,leftNum:u+" "+o.toUpperCase(),centerNum:n+" "+o.toUpperCase(),rightNum:l,...O.value};const{process:i,totalInvestAmount:c,remainAmount:r,timeLimit:m}=a.data;B.value={title:e,process:i,totalInvestAmount:c,remainAmount:r,timeLimit:m,avgRate:s,coin:o.toUpperCase()}}}catch(a){}})()}),(a,e)=>{const l=u;return c(),r("div",j,[m(s,{currentName:v(t)("buy_funds"),backwardNum:H.value},null,8,["currentName","backwardNum"]),G.value?g("",!0):(c(),r("div",x,[m(h,{headerObj:O.value},null,8,["headerObj"]),d("div",I,[d("div",A,p(v(t)("buy_limit")),1),_(d("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>R.value=a),type:"text",placeholder:v(t)("exchange.input"),class:"quota"},null,8,L),[[f,R.value]])]),m(k,{proDetail:B.value},null,8,["proDetail"]),d("div",U,[d("div",{class:"buyBtn",onClick:S},p(v(t)("to pay")),1),d("div",D,[E.value?g("",!0):(c(),y(l,{key:0,name:"gou",class:"protocolImg",onClick:W})),E.value?(c(),y(l,{key:1,name:"gouH",class:"protocolImg",onClick:W})):g("",!0),d("div",null,p(v(t)("read_and_confirm")),1),d("div",{class:"hightName",onClick:e[1]||(e[1]=e=>a.$router.push("/financialAgreement"))},p(v(t)("financial agreement")),1)])])])),G.value?(c(),r("div",F,[m(l,{name:"icon8",class:"successImg"}),d("div",null,p(v(t)("payment_successful")),1)])):g("",!0)])}}},[["__scopeId","data-v-f0949b88"]]);export{P as default};
