chatapp-h5/h5/js/TeamBill-B-iuEoY1-1776148658686.js
2026-04-14 17:58:21 +08:00

2 lines
14 KiB
JavaScript
Raw Permalink 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 O,k as R,I as U,P as H,w as T,o as q,j as y,c as g,b as e,t as o,q as i,n as C,D as X,E as Z,a7 as ee,l as L,ac as te,v as B,F as Q,x as W,K as V,r as d,S as Y,m as oe,y as A,G as ae}from"./index-CIAVq8iD-1776148658686.js";import{_ as le}from"./help-BgsLqEJs-1776148658686.js";import{d as J,a as se,e as ne}from"./teamBill-BWXvrc1S-1776148658686.js";import{G as ie}from"./GeneralHeader-ClI1i1Ud-1776148658686.js";import{_ as re}from"./search-D2xJuklA-1776148658686.js";import{_ as ce}from"./coin-Dqu2_ND9-1776148658686.js";import{h as K}from"./imageHandler-DstQGL3Z-1776148658686.js";import{G as de}from"./GradientBorder-CfwSeIMB-1776148658686.js";const ue={style:{background:"white","border-radius":"16px 16px 0 0","max-height":"80vh",overflow:"hidden",display:"flex","flex-direction":"column",gap:"10px",padding:"15px 10px"}},pe={style:{padding:"0 5px",display:"flex","justify-content":"center","align-items":"center"}},fe={style:{margin:"0","font-size":"18px","font-weight":"600",color:"#333"}},ye={style:{padding:"0 5px",display:"flex","justify-content":"space-between","align-items":"center"}},ge={style:{color:"rgba(0, 0, 0, 0.5)","font-weight":"600","font-size":"1.3em"}},me={style:{padding:"0 5px",display:"flex","align-items":"center",gap:"8px"}},ve={style:{flex:"1","min-width":"0","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"}},he=["placeholder"],_e={key:0,class:"loading-container"},xe={key:1,class:"members-list"},we={style:{flex:"1","min-width":"0",display:"flex","align-items":"center","justify-content":"space-around",gap:"4px"}},be={style:{width:"20%"}},Se=["src","alt"],ke={style:{flex:"1","min-width":"0",display:"flex","flex-direction":"column",gap:"4px"}},Fe={style:{"font-weight":"700",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","font-size":"0.9em"}},De={style:{color:"rgba(0, 0, 0, 0.4)","font-weight":"500",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","font-size":"0.9em"}},Pe={style:{display:"flex","align-items":"center"}},$e={style:{"border-radius":"4px",background:"linear-gradient(269deg, #feb219 7.04%, #ff9326 96.78%)",color:"#fff",padding:"2px 4px","font-weight":"500",border:"1px solid #d1d5db",overflow:"hidden","white-space":"nowrap","font-size":"0.8em"}},Be={style:{"min-width":"0",display:"flex","justify-content":"flex-end"}},Ie={style:{width:"100%",display:"flex","flex-direction":"column"}},Te={style:{width:"100%",display:"flex","align-items":"center",gap:"2px"}},Ce={style:{flex:"1","min-width":"0",color:"#ffb627","font-weight":"510","white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis","font-size":"0.9em"}},Ee={style:{width:"100%","min-width":"0",color:"rgba(0, 0, 0, 0.4)","font-weight":"510","white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis","font-size":"0.7em"}},Me={key:2,class:"empty-state"},Le={__name:"TeamBillMore",props:{billData:{type:Object,required:!0}},emits:["close"],setup(w){const{t:a,locale:l}=R();l.value&&U(l.value);const u=w,k=d(!1),h=d(null),m=d(!1),f=d(""),c=d([]),F=d(!1),_=d(!1),S=d(""),p=d(""),P=d(""),I=H(),$=Y(()=>u.billData?.members||[]),E=async()=>{if(console.log("searchQuery.value:",f.value),!f.value.trim()){c.value=$.value;return}F.value=!0,_.value=!1;let t=$.value.find(r=>r.memberProfile.account==f.value.trim());t?c.value=[t]:c.value=[],F.value=!1,_.value=!0},M=()=>{_.value=!1,f.value="",c.value=$.value},z=async()=>{try{m.value=!0;const t=V();if(!t){console.warn("No team ID available");return}const r=await J(t);r&&r.status&&r.body&&(h.value=r.body,console.debug("Policy data loaded:",h.value))}catch(t){console.error("Failed to fetch policy data:",t)}finally{m.value=!1}},n=t=>{if(!h.value?.policy||!t)return"N/A";const r=parseFloat(t);if(isNaN(r))return"N/A";const N=[...h.value.policy].sort((D,j)=>parseFloat(j.target)-parseFloat(D.target));for(const D of N)if(r>=parseFloat(D.target))return D.level;return Math.min(...h.value.policy.map(D=>D.level))},s=t=>{if(m.value)return a("loading")+"...";const r=n(t);return`${a("target")}: ${r}`},x=t=>{switch(t){case"Completed":return a("completed");case"Pending":return a("pending");case"Out of account":return a("out_of_account");case"In Progress":return a("in_progress");default:return statusInfo.textKey}},v=t=>{if(!t||t==="0")return"0";if(typeof t=="string"&&(t.includes("K")||t.includes("M")))return t.replace(/[^0-9KM.]/g,"");const r=parseInt(t);return isNaN(r)?"0":r.toLocaleString()},G=()=>{console.log("更新展示类型");let t=u.billData?.status;t=="In Progress"?P.value=a("in_progress"):t=="Pending"?P.value=a("pending"):t=="Completed"?P.value=a("completed"):t=="Out of account"&&(P.value=a("out_of_account"))};return T(()=>I.selectedLang,t=>{console.log("Language changed in header:",t),G()},{deep:!0}),T(()=>f.value,t=>{_.value&&(_.value=!1),t.trim()||(c.value=$.value)},{immediate:!0}),T(()=>u.billData?.status,t=>{G(),t=="In Progress"&&(p.value="0 0 1px 0 #6085FF",S.value="rgba(61, 115, 255, 1)"),t=="Pending"&&(p.value="0 0 1px 0 #FF6062",S.value="rgba(255, 61, 64, 1)"),t=="Completed"&&(p.value="0 0 1px 0 #60FF65",S.value="rgba(61, 255, 84, 1)"),t=="Out of account"&&(p.value="0 0 1px 0 #6A6161",S.value="rgba(174, 174, 174, 1)")},{immediate:!0}),q(()=>{console.log("locale.value:",l.value),z()}),(t,r)=>{const N=te;return y(),g("div",ue,[e("div",pe,[e("div",fe,o(i(a)("team_member")),1)]),e("div",ye,[e("div",ge,o(w.billData?.date),1),e("div",{style:C([{padding:"0 8px","border-radius":"4px",display:"flex","align-items":"center"},{boxShadow:p.value}])},[e("div",{style:C([{"font-weight":"500"},{color:S.value}])},o(x(w.billData?.status)),5)],4)]),e("div",me,[e("div",ve,[r[2]||(r[2]=e("img",{src:re,alt:"",width:"24px",style:{opacity:"0.6"}},null,-1)),X(e("input",{"onUpdate:modelValue":r[0]||(r[0]=b=>f.value=b),type:"text",placeholder:i(a)("enter_host_id"),style:{width:"100%",outline:"none",border:"none","background-color":"transparent",color:"black",padding:"10px 8px"},onKeyup:ee(E,["enter"])},null,40,he),[[Z,f.value]])]),!_.value&&f.value?(y(),g("div",{key:0,style:{"font-size":"1.2em","font-weight":"600"},onClick:E},o(i(a)("search")),1)):(y(),g("div",{key:1,style:{"font-size":"1.2em","font-weight":"600"},onClick:M},o(i(a)("cancel")),1))]),k.value?(y(),g("div",_e,[L(N),e("p",null,o(i(a)("loading"))+"...",1)])):B("",!0),c.value&&c.value.length>0?(y(),g("div",xe,[(y(!0),g(Q,null,W(c.value,(b,D)=>(y(),g("div",{key:b.memberProfile?.id||D,style:{"background-color":"white",padding:"16px","border-radius":"12px","box-shadow":"0 2px 8px rgba(0, 0, 0, 0.1)",display:"flex","align-items":"center","justify-content":"space-between",gap:"4px"}},[e("div",we,[e("div",be,[e("img",{src:b.memberProfile?.userAvatar||"",alt:b.memberProfile?.userNickname,onError:r[1]||(r[1]=(...j)=>i(K)&&i(K)(...j)),style:{display:"block",width:"100%","aspect-ratio":"1/1","border-radius":"50%","object-fit":"cover"}},null,40,Se)]),e("div",ke,[e("div",Fe,o(b.memberProfile?.userNickname||i(a)("unknown_user")),1),e("div",De,o(i(a)("user_id_prefix"))+" "+o(b.memberProfile?.account||"N/A"),1)]),e("div",Pe,[e("div",$e,o(s(b.target?.acceptGiftValue)),1)])]),e("div",Be,[e("div",Ie,[e("div",Te,[r[3]||(r[3]=e("img",{src:ce,alt:"",style:{display:"block","object-fit":"cover",width:"1.5em","aspect-ratio":"1/1"}},null,-1)),e("div",Ce,o(v(b.target?.acceptGiftValue)),1)]),e("div",Ee,o(i(a)("time_days"))+":"+o(b.target?.effectiveDay),1)])])]))),128))])):(y(),g("div",Me,[e("p",null,o(i(a)("no_data_available")),1)]))])}}},ze=O(Le,[["__scopeId","data-v-6c051d8a"]]),Ne={style:{padding:"16px 8px 25px"}},je={style:{height:"100%",display:"flex","flex-direction":"column","justify-content":"space-around"}},Ae={class:"contentTime"},Ve={style:{display:"grid","grid-template-columns":"repeat(2, 1fr)"}},Oe={class:"contentText"},Re={class:"contentText"},Ge={style:{display:"grid","grid-template-columns":"repeat(2, 1fr)"}},Ke={class:"contentText"},Ue={__name:"workReportBox",props:{type:{type:String,default:""},date:{type:String,default:""},hostSalary:{type:String,default:""},agencySalary:{type:String,default:""},totalSalary:{type:String,default:""},more:{type:Boolean,default:!1}},emits:["showMore"],setup(w,{emit:a}){const{t:l}=R(),u=w,k=a,h=()=>{k("showMore")},m=d(""),f=d(""),c=d(""),F=H();T(()=>F.selectedLang,p=>{console.log("Language changed in header:",p),_()},{deep:!0});const _=()=>{console.log("更新展示类型"),u.type=="In Progress"?c.value=l("in_progress"):u.type=="Pending"?c.value=l("pending"):u.type=="Completed"?c.value=l("completed"):u.type=="Out of account"&&(c.value=l("out_of_account"))},S=Y(()=>{if(u.type=="In Progress"||u.type==l("in_progress"))return"background: linear-gradient(248deg, #759CFF 5.66%, #3D73FF 42.49%);";if(u.type=="Pending"||u.type==l("pending"))return"background: linear-gradient(248deg, #FF7578 5.66%, #FF3D40 42.49%), linear-gradient(248deg, #759CFF 5.66%, #3D73FF 42.49%);";if(u.type=="Completed"||u.type==l("completed"))return"background: linear-gradient(248deg, #75FF98 5.66%, #3DFF54 42.49%), linear-gradient(248deg, #759CFF 5.66%, #3D73FF 42.49%);";if(u.type=="Out of account"||u.type==l("out_of_account"))return"background: linear-gradient(248deg, #BDBDBD 5.66%, #AEAEAE 42.49%), linear-gradient(248deg, #759CFF 5.66%, #3D73FF 42.49%);"});return T(()=>u.type,p=>{console.log("newType:",p),_(),p=="In Progress"||p==l("in_progress")?(m.value="#EBF1FD",f.value="0.9em",c.value=l("in_progress")):p=="Pending"||p==l("pending")?(m.value="#FEEBEF",f.value="1em",c.value=l("pending")):p=="Completed"||p==l("completed")?(m.value="#E8FAED",f.value="1em",c.value=l("completed")):p=="Out of account"||p==l("out_of_account")?(m.value="#E9E9E9",f.value="0.7em",c.value=l("out_of_account")):(m.value="#EBF1FD",f.value="0.9em",c.value="")},{immediate:!0}),(p,P)=>(y(),g("div",{style:C([{position:"relative",width:"100%","border-radius":"8px"},{background:m.value}])},[e("div",{class:"status-background",style:C(S.value)},[e("div",{style:C([{color:"#fff","font-weight":"600"},{fontSize:f.value}])},o(c.value),5)],4),e("div",Ne,[e("div",je,[e("div",Ae,o(w.date),1),e("div",Ve,[e("div",Oe,o(i(l)("host_salary"))+": "+o(w.hostSalary),1),e("div",Re,o(i(l)("agent_salary"))+": $"+o(w.agencySalary),1)]),e("div",Ge,[e("div",Ke,o(i(l)("total"))+": "+o(w.totalSalary),1)])]),w.more?(y(),g("div",{key:0,class:"moreBt",onClick:h},o(i(l)("more")),1)):B("",!0)])],4))}},He=O(Ue,[["__scopeId","data-v-ae26a587"]]),qe={class:"team-bill"},Qe={class:"content"},We={style:{padding:"16px"}},Ye={style:{display:"flex","justify-content":"space-between",gap:"10px"}},Je={style:{"font-size":"1em","font-weight":"700"}},Xe={style:{"font-size":"1.5em","font-weight":"500"}},Ze={style:{"margin-bottom":"20px"}},et={style:{margin:"10px 1%","font-weight":"600",color:"rgba(0, 0, 0, 0.8)"}},tt={key:0,style:{display:"flex","flex-direction":"column",gap:"12px"}},ot={style:{display:"flex","justify-content":"center","align-items":"center",padding:"16px",position:"relative"}},at={style:{margin:"0","font-size":"18px","font-weight":"700",color:"#333"}},lt={style:{padding:"0 20px 20px","overflow-y":"auto"},class:"help-modal-body"},st={__name:"TeamBill",setup(w){const{t:a,locale:l}=R();l.value&&U(l.value);const u=d(!1),k=d(!1),h=d(!1),m=d(null),f=d(null),c=d(!1),F=d([]),_=d(0),S=n=>({SETTLED:"Completed",UNPAID:"In Progress",HANG_UP:"Out of account",PAY_OUT:"Completed"})[n]||n,p=async n=>{try{u.value=!0;const s=await se(n);if(s.status&&s.body){let x=0;F.value=s.body.map(v=>(v.status=="SETTLED"&&(x+=v.settleResult?.totalSalary||0),{...v,date:v.billTitle,status:S(v.status),hostSalary:I(v.settleResult?.memberSalary||0)||"-",agencySalary:I(v.settleResult?.ownSalary||0)||"-",totalSalary:I(v.settleResult?.totalSalary||0)||"-",createTimeFormatted:new Date(v.createTime).toLocaleDateString(),updateTimeFormatted:new Date(v.updateTime).toLocaleDateString()})),_.value=x.toFixed(2)}}catch(s){console.error("Failed to fetch team bill:",s)}finally{u.value=!1}},P=async()=>{try{c.value=!0;const n=V();if(!n){console.warn("No team ID available");return}const s=await J(n);s&&s.status&&s.body&&(f.value=s.body,console.debug("Policy data loaded:",f.value))}catch(n){console.error("Failed to fetch policy data:",n)}finally{c.value=!1}},I=n=>!n||n==="0"||n===0?"0.00":parseFloat(n).toFixed(2),$=async n=>{try{const s=await ne(n);return s.status&&s.body?s.body:[]}catch(s){return console.error("Failed to fetch bill work members:",s),[]}},E=async n=>{const s=await $(n.id);m.value={...n,members:s},h.value=!0},M=()=>{h.value=!1,k.value=!1,m.value=null},z=()=>{k.value=!0};return q(()=>{const n=V();n?p(n):console.warn("未找到团队ID"),P()}),(n,s)=>(y(),g("div",qe,[L(ie,{showLanguageList:!0,title:i(a)("team_bill"),color:"black"},null,8,["title"]),e("div",Qe,[L(de,{radius:"20px",style:{margin:"0 1%","margin-bottom":"12px"}},{default:oe(()=>[e("div",We,[e("div",Ye,[e("div",Je,o(i(a)("history_team_income")),1),e("img",{src:le,alt:"",style:{display:"block",width:"1.2em","aspect-ratio":"1/1","object-fit":"contain"},onClick:A(z,["stop"])})]),e("div",Xe,"$"+o(_.value),1)])]),_:1}),e("div",Ze,[e("div",et,o(i(a)("work_report")),1),F.value.length>0?(y(),g("div",tt,[(y(!0),g(Q,null,W(F.value,x=>(y(),ae(He,{key:x.id,type:x.status,date:x.date,hostSalary:x.hostSalary,agencySalary:x.agencySalary,totalSalary:x.totalSalary,more:!0,onShowMore:v=>E(x)},null,8,["type","date","hostSalary","agencySalary","totalSalary","onShowMore"]))),128))])):B("",!0)])]),k.value||h.value?(y(),g("div",{key:0,class:"modal-overlay",onClick:M},[k.value?(y(),g("div",{key:0,style:{"background-color":"white","border-radius":"12px",width:"90%","max-width":"400px","max-height":"80vh",overflow:"hidden",display:"flex","flex-direction":"column"},onClick:s[0]||(s[0]=A(()=>{},["stop"]))},[e("div",ot,[e("div",at,o(i(a)("help")),1),e("div",{style:{position:"absolute",right:"10px",color:"black","font-size":"24px",display:"flex","align-items":"center","justify-content":"center"},onClick:M}," × ")]),e("div",lt,[e("p",null,o(i(a)("work_report_description")),1),e("p",null,o(i(a)("status_description")),1),e("p",null,o(i(a)("status_completed")),1),e("p",null,o(i(a)("status_pending")),1),e("p",null,o(i(a)("status_out_of_account")),1),e("p",null,o(i(a)("status_in_progress")),1)])])):B("",!0),h.value?(y(),g("div",{key:1,style:{position:"fixed",bottom:"0",width:"100%"},onClick:s[1]||(s[1]=A(()=>{},["stop"]))},[L(ze,{billData:m.value},null,8,["billData"])])):B("",!0)])):B("",!0)]))}},yt=O(st,[["__scopeId","data-v-02840930"]]);export{yt as default};