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

5 lines
7.7 KiB
JavaScript

import{_ as U,k as B,r,w as T,c as f,l as v,m as h,q as o,b as t,t as i,v as x,F as E,x as H,y as N,z as S,A as k,B as V,C as G,u as R,j as p,D as $,E as L,G as F,H as W,I as J}from"./index-CIAVq8iD-1776148658686.js";import{_ as q}from"./help-BgsLqEJs-1776148658686.js";import{s as A,a as l,b as O,c as Y}from"./toast-aIWCznBB-1776148658686.js";import{u as K}from"./pageConfig-BUpLPO7w-1776148658686.js";import{h as I}from"./imageHandler-DstQGL3Z-1776148658686.js";import{G as Q}from"./GeneralHeader-ClI1i1Ud-1776148658686.js";import{G as C}from"./GradientBorder-CfwSeIMB-1776148658686.js";const X={class:"apply-view"},Z={class:"content",style:{padding:"16px 10px"}},ee={class:"reminder-section",style:{"margin-bottom":"20px"}},te={class:"reminder-title",style:{display:"flex","align-items":"center","justify-content":"space-between"}},se={style:{"margin-bottom":"4px","font-weight":"600",color:"rgba(0, 0, 0, 0.4)"}},ae={style:{"font-size":"0.9em","font-weight":"510"}},oe={style:{display:"flex",gap:"8px"}},ie={class:"input-group",style:{padding:"8px",display:"flex","align-items":"center"}},ne={style:{display:"block","font-weight":"600"}},le=["placeholder"],re=["disabled"],ce={style:{color:"white","font-weight":"600"}},de={key:0,class:"records-section",style:{padding:"20px","border-radius":"8px","margin-top":"20px"}},pe={style:{margin:"0 0 16px 0","font-weight":"600",color:"#333"}},fe={class:"record-list",style:{display:"flex","flex-direction":"column",gap:"12px"}},ue={style:{display:"flex","justify-content":"space-between","align-items":"center",padding:"12px",position:"relative"}},ge={class:"record-status",style:{"font-size":"0.9em","font-weight":"600",color:"#ff3d40"}},ye={style:{flex:"1","min-width":"0"}},_e={style:{display:"flex","align-items":"center",gap:"8px","text-align":"start"}},me=["src"],he={style:{flex:"1","min-width":"0",display:"flex","flex-direction":"column",gap:"4px"}},xe={style:{"font-size":"0.9em","font-weight":"500",color:"#333",width:"100%",overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"}},be={style:{"font-size":"0.7em",color:"#666"}},we={style:{"align-self":"stretch",display:"flex","align-items":"flex-end",gap:"8px"}},ve=["onClick"],ke={style:{color:"white","font-weight":"600"}},Ae={style:{color:"rgba(0, 0, 0, 0.8)","font-weight":"700","font-size":"1.3em"}},Ie={style:{color:"rgba(0, 0, 0, 0.8)","font-weight":"600","font-size":"1.1em","text-align":"center"}},Ce={__name:"ApplyView",setup(Pe){const{t:a,locale:P}=B();R();const c=r(""),u=r(""),y=r(!1),_=r(!1),d=r([]),g=r(null);r(Array.from({length:10},(s,e)=>({messageId:`msg_${Date.now()}_${e}`,ownUserProfile:{userAvatar:"",userNickname:`用户昵称${e+1}`,account:`U${1e3+e}`}}))),T(P,s=>{J(s)});const m=async()=>{try{const s=await G();s.status&&s.body&&(d.value=[s.body])}catch(s){console.error("获取申请记录失败:",s),d.value=[],Y(s.errorMsg)}},D=async s=>{try{const e=await W(s.messageId);e.status?(A(a("application_cancelled")),d.value=[],await m()):l(e.message||a("cancellation_failed"))}catch(e){if(console.error("撤销申请失败:",e),e instanceof k)if(e.type==="business")switch(e.errorCode){case 6404:l(a("application_record_not_found"),a("cancellation_failed"));break;case 6003:l(a("application_processed_cannot_cancel"),a("cancellation_failed"));break;default:l(e.errorMsg||e.message||"Cancellation failed, please try again","Cancellation failed")}else l(a("network_error"),a("cancellation_failed"));else l(a("cancellation_failed_try_again"))}},z=async s=>{try{console.debug("🔍 Searching team account:",s);const e=await V(s);if(e.status&&e.body&&e.body.teamProfile)return g.value=e.body,console.debug("✅ Team found:",e.body.teamProfile),e.body.teamProfile.id;g.value=null,l(e.errorMsg)}catch(e){g.value=null,l(e.errorMsg)}},M=async()=>{if(!c.value.trim()){u.value="Please enter agency ID";return}y.value=!0,u.value="";try{const s=await z(c.value.trim());if(!s){u.value="Account not found or not an agency";return}console.debug("✅ Team ID found:",s),console.debug("📝 Step 2: Submitting application...");const n=await S({teamId:s,reason:"JOIN"});n.status?(A(a("application_submitted")),await m(),c.value="",g.value=null):u.value=n.message||"Application failed. Please try again."}catch(s){s instanceof k&&(s.type==="business"?l("business error!"+s.errorMsg):s.type==="http"?s.status===406?O(s.errorMsg):l(s.message||"Unknown error, please try again"):l("Unknown error, please try again"))}finally{y.value=!1}},j=()=>{_.value=!0},b=()=>{_.value=!1};return K("APPLY",{forceRefresh:!0,onDataLoaded:()=>{m()}}),(s,e)=>(p(),f("div",X,[v(Q,{isHomePage:!0,showBack:!1,title:o(a)("apply_join_team"),color:"black"},{extraFunction:h(()=>[t("img",{src:q,alt:"",style:{width:"16px","aspect-ratio":"1/1",cursor:"pointer"},onClick:j})]),_:1},8,["title"]),t("div",Z,[t("div",ee,[t("div",te,[t("h3",se,i(o(a)("apply_reminder")),1)]),t("p",ae,i(o(a)("apply_reminder_detail")),1)]),t("div",oe,[v(C,{style:{flex:"1","min-width":"0"}},{default:h(()=>[t("div",ie,[t("label",ne,i(o(a)("apply_id")),1),$(t("input",{"onUpdate:modelValue":e[0]||(e[0]=n=>c.value=n),type:"text",placeholder:o(a)("enter_agent_id"),class:"agency-input",style:{flex:"1","min-width":"0","background-color":"transparent",padding:"4px",border:"none",outline:"none","border-radius":"6px","box-sizing":"border-box",color:"rgba(0, 0, 0, 0.4)"}},null,8,le),[[L,c.value]])])]),_:1}),d.value.length===0?(p(),f("div",{key:0,onClick:M,disabled:!c.value.trim()||y.value,style:{padding:"8px 16px","border-radius":"169px",background:"linear-gradient(269deg, #feb219 7.04%, #ff9326 96.78%)","box-shadow":"0 0 4px 0 rgba(198, 112, 255, 0.25)",display:"flex","align-items":"center","justify-content":"center"}},[t("div",ce,i(o(a)("apply")),1)],8,re)):x("",!0)])]),d.value.length>0?(p(),f("div",de,[t("h3",pe,i(o(a)("application_records")),1),t("div",fe,[(p(!0),f(E,null,H(d.value,n=>(p(),F(C,{key:n.messageId,style:{}},{default:h(()=>[t("div",ue,[t("div",ge,i(o(a)("pending")),1),t("div",ye,[t("div",null,[t("div",_e,[t("img",{src:n.ownUserProfile.userAvatar||"",style:{display:"block","object-fit":"cover",width:"20%","aspect-ratio":"1/1","border-radius":"50%"},onError:e[1]||(e[1]=(...w)=>o(I)&&o(I)(...w))},null,40,me),t("div",he,[t("p",xe,i(n.ownUserProfile?.userNickname),1),t("p",be,i(o(a)("user_id_prefix"))+" "+i(n.ownUserProfile?.ownSpecialId?.account||n.ownUserProfile?.account),1)])])])]),t("div",we,[t("div",{onClick:w=>D(n),style:{padding:"4px 8px","border-radius":"169px",background:"linear-gradient(269deg, #feb219 7.04%, #ff9326 96.78%)","box-shadow":"0 0 4px 0 rgba(198, 112, 255, 0.25)",display:"flex","align-items":"center","justify-content":"center"}},[t("div",ke,i(o(a)("cancel")),1)],8,ve)])])]),_:2},1024))),128))])])):x("",!0),_.value?(p(),f("div",{key:1,class:"help-modal",onClick:b,style:{position:"fixed",top:"0",left:"0",right:"0",bottom:"0","background-color":"rgba(0, 0, 0, 0.5)",display:"flex","align-items":"center","justify-content":"center","z-index":"1000",padding:"20px"}},[t("div",{class:"help-content",onClick:e[2]||(e[2]=N(()=>{},["stop"])),style:{background:"#fff","border-radius":"12px",padding:"12px",display:"flex","flex-direction":"column","align-items":"center",gap:"4px",width:"100%"}},[t("h3",Ae,i(o(a)("application_help")),1),t("p",Ie,i(o(a)("application_help_detail")),1),t("div",{class:"close-btn",onClick:b,style:{width:"80%",display:"flex","justify-content":"center","align-items":"center","border-radius":"999999px",background:"linear-gradient(269deg, #feb219 7.04%, #ff9326 96.78%)","box-shadow":`-1px 0 5px 0 rgba(255, 255, 255, 0.7) inset,
-3.5px 0 7.5px 0 rgba(255, 255, 255, 0.2) inset,
1px 0 5px 0 rgba(255, 255, 255, 0.7) inset,
3.5px 0 7.5px 0 rgba(255, 255, 255, 0.2) inset`,color:"#fff","font-weight":"800",padding:"8px 12px"}},i(o(a)("got_it")),1)])])):x("",!0)]))}},Ee=U(Ce,[["__scopeId","data-v-2ff310c0"]]);export{Ee as default};