chatapp-h5/h5/js/Transfer-BbExxGUV-1776148658686.js
2026-04-14 17:58:21 +08:00

2 lines
5.2 KiB
JavaScript

import{_ as I}from"./arrow-Cf0JWzXk-1776148658686.js";import{_ as z}from"./dollar-B_xazKD_-1776148658686.js";import{_ as A,k as E,I as F,o as N,a as T,c,l as u,q as n,b as e,t as a,m,ap as G,aN as H,r as y,a9 as k,u as L,j as d,F as M,x as O,Q as R}from"./index-CIAVq8iD-1776148658686.js";import{a as f,s as U}from"./toast-aIWCznBB-1776148658686.js";import{h as C}from"./imageHandler-DstQGL3Z-1776148658686.js";import{g as V,c as $}from"./payeeStore-BUBSCe8t-1776148658686.js";import{G as q}from"./GeneralHeader-ClI1i1Ud-1776148658686.js";import{G as g}from"./GradientBorder-CfwSeIMB-1776148658686.js";const K={class:"transfer"},Q={class:"content"},J={style:{display:"flex","justify-content":"space-between","align-items":"center","margin-bottom":"10px"}},W={style:{"font-weight":"600"}},X={style:{color:"rgba(0, 0, 0, 0.4)"}},Y={style:{padding:"16px"}},Z={style:{"font-weight":"510","font-size":"1em"}},ee={key:0,class:"loading-text"},te={key:1,style:{"font-weight":"700",color:"#333","font-size":"1.1em"}},se={style:{"font-weight":"600","margin-bottom":"10px"}},ae={style:{padding:"16px",display:"flex","align-items":"center","justify-content":"center",cursor:"pointer"}},oe={key:0,style:{width:"100%"}},ie={style:{display:"flex","align-items":"center",gap:"4px","margin-bottom":"4px"}},ne={style:{position:"relative",width:"3.5em",display:"flex","align-items":"center","justify-content":"center"}},re=["src","alt"],le={style:{flex:"1","min-width":"0"}},ce={style:{"margin-bottom":"4px","font-weight":"600",color:"#333",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},de={style:{"font-size":"0.9em",color:"#666"}},pe={key:1,style:{display:"flex","justify-content":"center","align-items":"center"}},ue={style:{padding:"16px"}},fe={style:{display:"grid","grid-template-columns":"repeat(3, 1fr)",gap:"12px"}},_e=["onClick"],me={style:{"font-weight":"500",color:"#131111"}},ye={style:{display:"flex","justify-content":"center","margin-top":"10px"}},ge=["disabled"],he={__name:"Transfer",setup(ve){const{t:s,locale:h}=E(),v=L();h.value&&F(h.value);const p=y("0"),r=y(null),_=y(!1),o=k({id:null,account:"",name:"",avatar:"",type:"",isHost:!1,isAgency:!1,hasSalary:!1}),B=()=>{const t=V();t&&Object.assign(o,t)},x=k([{id:1,amount:10500,price:1},{id:2,amount:52500,price:5},{id:3,amount:105e3,price:10},{id:4,amount:525e3,price:50},{id:5,amount:105e4,price:100},{id:6,amount:21e5,price:200}]),b=async()=>{_.value=!0;try{const t=await G();t.status&&typeof t.body=="number"?p.value=t.body.toFixed(2):p.value="0.00"}catch(t){console.error("Failed to fetch bank balance:",t),p.value="0.00",f(s("failed_to_load_balance"))}finally{_.value=!1}},j=()=>{v.push("/information-details")},w=()=>{v.push("/search-payee")},S=()=>{Object.assign(o,{id:null,account:"",name:"",avatar:"",type:"",isHost:!1,isAgency:!1,hasSalary:!1}),$()},D=t=>{r.value===t.id?r.value=null:r.value=t.id},P=async()=>{if(!r.value){f(s("please_select_amount"));return}if(!o.id){f(s("please_select_payee"));return}const t=x.find(i=>i.id===r.value),l={amount:t.price,acceptUserId:o.id,acceptMethod:"BANK_TRANSFER"};try{(await H(l)).status&&(U(s("transfer_dollar_success",{price:t.price,name:o.name})),r.value=null,await b())}catch(i){console.error("Transfer failed:",i),f(i.response?.errorMsg)}};return N(()=>{b(),B()}),T(()=>{S()}),(t,l)=>(d(),c("div",K,[u(q,{showLanguageList:!0,title:n(s)("transfer"),color:"black"},null,8,["title"]),e("div",Q,[e("div",null,[e("div",J,[e("div",W,a(n(s)("information")),1),e("div",{style:{display:"flex","align-items":"center"},onClick:j},[e("div",X,a(n(s)("details")),1),l[1]||(l[1]=e("img",{src:I,alt:"",width:"16px",style:{"margin-left":"4px"},class:"rtl-flip"},null,-1))])]),u(g,{style:{"margin-bottom":"12px"}},{default:m(()=>[e("div",Y,[e("span",Z,a(n(s)("available_salaries")),1),_.value?(d(),c("span",ee,a(n(s)("loading"))+"...",1)):(d(),c("span",te,a(p.value),1))])]),_:1})]),e("div",null,[e("div",se,a(n(s)("transfer_to_others")),1),u(g,{style:{"margin-bottom":"12px"}},{default:m(()=>[e("div",ae,[o.id?(d(),c("div",oe,[e("div",ie,[e("div",ne,[e("img",{src:o.avatar||"",alt:o.name,style:{display:"block",width:"100%","aspect-ratio":"1/1","border-radius":"50%","object-fit":"cover"},onError:l[0]||(l[0]=(...i)=>n(C)&&n(C)(...i))},null,40,re)]),e("div",le,[e("div",ce,a(o.name),1),e("div",de,a(n(s)("user_id_prefix"))+" "+a(o.goodID||o.account),1)]),e("button",{style:{"border-radius":"12px",border:"1px solid #e6e6e6",color:"rgba(0, 0, 0, 0.4)","font-weight":"500",padding:"2px 8px",background:"none"},onClick:w},a(n(s)("change")),1)])])):(d(),c("div",pe,[e("div",{style:{"font-weight":"590",color:"rgba(0, 0, 0, 0.8)",padding:"10px 16px","border-radius":"8px",background:"#ffe5a1"},onClick:w},a(n(s)("search")),1)]))])]),_:1})]),e("div",null,[u(g,{style:{"margin-bottom":"12px"}},{default:m(()=>[e("div",ue,[e("div",fe,[(d(!0),c(M,null,O(x,i=>(d(),c("div",{key:i.id,onClick:xe=>D(i),class:R(["coin-item",{selected:r.value===i.id}])},[l[2]||(l[2]=e("img",{src:z,alt:"",style:{width:"40%"}},null,-1)),e("div",me,"$"+a(i.price),1)],10,_e))),128))])])]),_:1}),e("div",ye,[e("button",{style:{"border-radius":"32px"},class:"transfer-btn",onClick:P,disabled:!r.value||!o.id},a(n(s)("transfer")),9,ge)])])])]))}},Pe=A(he,[["__scopeId","data-v-4898b25d"]]);export{Pe as default};