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

2 lines
5.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as S,k as j,I as M,aa as R,o as E,c as r,l as N,q as i,b as s,D as C,E as B,a7 as V,v,t as c,F,x as G,r as p,S as K,an as Q,j as l,Q as T}from"./index-CIAVq8iD-1776148658686.js";import{_ as $}from"./search-D2xJuklA-1776148658686.js";import{a as m,s as A}from"./toast-aIWCznBB-1776148658686.js";import{h as P}from"./imageHandler-DstQGL3Z-1776148658686.js";import{G as q}from"./GeneralHeader-ClI1i1Ud-1776148658686.js";import{s as H}from"./userInfo-gLO2xl8i-1776148658686.js";import{g as J,h as O,j as W}from"./admin-BlNjNFbv-1776148658686.js";const X={class:"fullPage"},Y={style:{padding:"16px",position:"relative"}},Z={style:{display:"flex","align-items":"center",gap:"8px","margin-bottom":"8px"}},ee={style:{flex:"1","border-radius":"32px",border:"1px solid #fff","box-shadow":"0 0 4px 0 rgba(0, 0, 0, 0.25)",padding:"0 8px",display:"flex","align-items":"center",height:"max-content"}},te={src:$,alt:"",style:{display:"block",width:"2em","aspect-ratio":"1/1",opacity:"0.6"}},se=["placeholder"],oe=["disabled"],ie={key:0,style:{margin:"16px 0",display:"flex","flex-direction":"column",gap:"12px"}},ae=["onClick"],ne={key:0,style:{position:"absolute","z-index":"3",top:"-2px",right:"-2px"}},re={key:0,style:{"background-image":"linear-gradient(112deg, #759cff 5.66%, #3d73ff 42.49%)",padding:"4px 8px","border-radius":"0 12px",color:"white","font-weight":"600"}},le={key:1,style:{"background-image":"linear-gradient(112deg, #75ff98 5.66%, #3dff54 42.49%)",padding:"4px 8px","border-radius":"0 12px",color:"white","font-weight":"600"}},ce={style:{"font-weight":"600"}},de={style:{display:"flex","align-items":"center","justify-content":"space-between"}},ue={style:{display:"flex","align-items":"center",gap:"4px",flex:"1","min-width":"0"}},pe={style:{width:"3em","aspect-ratio":"1/1",display:"flex","align-items":"center","justify-content":"center"}},ge=["src","alt"],ve={style:{"min-width":"0",flex:"1"}},fe={style:{"margin-bottom":"4px","font-weight":"700",color:"#333",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},_e={style:{"font-size":"0.9em",color:"rgba(0, 0, 0, 0.4)","font-weight":"500"}},he={style:{display:"flex","justify-content":"center","align-items":"center"}},ye=["onClick"],me={key:1,class:"no-data"},xe={__name:"inviteRechargeAgency",setup(be){const{t:o,locale:x}=j();x.value&&M(x.value);const n=p(""),b=p([]),g=p([]),u=p(!0),d=p({}),_=p(!1),w=K(()=>n.value?g.value:b.value),k=()=>{n.value="",g.value=[],d.value={},u.value=!0,f()},U=()=>{n.value.trim()||(g.value=[],d.value={},u.value=!0,f())},I=R(async()=>{if(!_.value){_.value=!0,console.log("搜索用户id",n.value),g.value=[],d.value={},u.value=!0;try{if(n.value.trim()){const e=await H(n.value);if(e.status&&e.body){let a={userProfile:e.body};g.value.push(a)}}}catch(e){m(e.response?.errorMsg)}finally{_.value=!1}}},500,!0),L=e=>{console.log("选择用户:",e),n.value&&(d.value?.id==e.userProfile.id?(d.value={},u.value=!0):(d.value=e.userProfile,e.status==0||e.status==1?u.value=!0:u.value=!1))},z=async()=>{console.log("点击邀请代理");try{let e={inviteUserId:d.value.id};(await O(e)).status&&A(o("invitation_submitted"))}catch(e){m(e.response?.errorMsg||o("something_went_wrong"))}k()},f=async()=>{const e=await J();console.log("已邀请列表:",e),e.status&&e.body&&(b.value=e.body)},D=async e=>{console.log("取消邀请用户id:",e);try{(await W(e)).status&&(A(o("application_cancelled")),f())}catch(a){let h=a.response?.errorMsg?.replace(/^.*\]\s*/,"")||o("cancellation_failed_try_again");m(h)}};return E(()=>{f()}),(e,a)=>{const h=Q("smart-img");return l(),r("div",X,[N(q,{showLanguageList:!0,title:i(o)("invite_recharge_agent"),color:"black",style:{"box-shadow":"0 0 10px rgba(0, 0, 0, 0.1)","z-index":"999"}},null,8,["title"]),s("div",Y,[s("div",Z,[s("div",ee,[C(s("img",te,null,512),[[h]]),C(s("input",{"onUpdate:modelValue":a[0]||(a[0]=t=>n.value=t),type:"text",name:"",id:"",placeholder:i(o)("enter_user_id"),onKeyup:a[1]||(a[1]=V((...t)=>i(I)&&i(I)(...t),["enter"])),onInput:U,style:{width:"100%",color:"rgba(0, 0, 0, 0.4)","font-weight":"600",outline:"none",border:"none","background-color":"transparent",padding:"8px"}},null,40,se),[[B,n.value]]),n.value?(l(),r("button",{key:0,onClick:k,style:{background:"none",border:"none",color:"#9ca3af",cursor:"pointer",padding:"0 8px"}}," × ")):v("",!0)]),s("button",{style:{"font-weight":"600"},class:"invite-btn",onClick:z,disabled:u.value},c(i(o)("invite")),9,oe)]),w.value.length>0?(l(),r("div",ie,[(l(!0),r(F,null,G(w.value,t=>(l(),r("div",{key:t.id,style:{position:"relative","background-color":"white",padding:"4px 10px","border-radius":"12px","box-sizing":"border-box",border:"2px solid transparent","box-shadow":"0 0 4px 0 rgba(0, 0, 0, 0.25)",transition:"all 0.2s"},onClick:y=>L(t)},[s("div",{style:{position:"absolute",inset:"-2px","border-radius":"12px","z-index":"2"},class:T({selected:d.value?.id===t.userProfile.id})},null,2),t.status==0||t.status==1?(l(),r("div",ne,[t.status==0?(l(),r("div",re,c(i(o)("pending")),1)):v("",!0),t.status==1?(l(),r("div",le,c(i(o)("success")),1)):v("",!0)])):v("",!0),s("div",ce,c(i(o)("information"))+":",1),s("div",de,[s("div",ue,[s("div",pe,[s("img",{src:t.userProfile.userAvatar||"",alt:t.userProfile.userNickname,style:{display:"block","object-fit":"cover",width:"100%","aspect-ratio":"1/1","border-radius":"50%"},onError:a[2]||(a[2]=(...y)=>i(P)&&i(P)(...y))},null,40,ge)]),s("div",ve,[s("div",fe,c(t.userProfile.userNickname),1),s("div",_e,c(i(o)("user_id_prefix"))+" "+c(t.userProfile.account),1)])]),s("div",he,[t.status==0?(l(),r("div",{key:0,style:{padding:"4px 8px","border-radius":"32px","background-color":"red",color:"white","font-weight":"600","z-index":"5"},onClick:y=>D(t.id)},c(i(o)("cancel")),9,ye)):v("",!0)])])],8,ae))),128))])):(l(),r("div",me,c(i(o)("no_users_found")),1))])])}}},Le=S(xe,[["__scopeId","data-v-bd43a668"]]);export{Le as default};