2 lines
6.9 KiB
JavaScript
2 lines
6.9 KiB
JavaScript
import{_ as $,k as W,I as q,r as a,U as M,aa as O,ab as Q,o as H,c as u,l as D,q as n,b as o,D as A,E as X,a7 as Y,t as l,F as T,x as j,ac as J,Y as N,v as P,ad as Z,S as R,X as ee,j as c,n as te,G as oe,m as ne}from"./index-CIAVq8iD-1776148658686.js";import{_ as se}from"./search-D2xJuklA-1776148658686.js";import{f as ae}from"./utcFormat-Cl3Lb3s0-1776148658686.js";import{h as U}from"./imageHandler-DstQGL3Z-1776148658686.js";import{G as le}from"./GeneralHeader-ClI1i1Ud-1776148658686.js";import{G as ie}from"./GradientBorder-CfwSeIMB-1776148658686.js";const re={class:"seller-records"},ce={style:{padding:"16px",position:"relative","z-index":"2"}},ue={style:{display:"flex",gap:"4px"}},de={style:{flex:"1","background-color":"transparent","border-radius":"32px",border:"1px solid #fff","box-shadow":"0 0 4px 0 rgba(0, 0, 0, 0.25)",display:"flex","align-items":"center",gap:"4px",padding:"4px 12px"}},pe=["placeholder"],fe={style:{display:"flex",position:"relative","margin-bottom":"16px"}},ve=["onClick"],ge={key:0,style:{display:"flex","flex-direction":"column","align-items":"center","justify-content":"center",padding:"60px 20px",color:"#666"}},me={style:{margin:"0","font-size":"14px"}},ye={key:1,style:{display:"flex","flex-direction":"column",gap:"12px"}},he={style:{padding:"16px",display:"flex","align-items":"center","justify-content":"space-between",gap:"4px"}},_e={style:{flex:"1","min-width":"0","align-self":"stretch",display:"flex","align-items":"center",gap:"4px"}},xe={style:{width:"3.5em","align-self":"stretch",display:"flex","align-items":"center","justify-content":"center"}},be=["src"],we={style:{flex:"1","min-width":"0","align-self":"stretch",display:"flex","flex-direction":"column","justify-content":"space-around",gap:"4px"}},ke={style:{"font-size":"0.9em","font-weight":"600",color:"#333",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap"}},Ie={style:{"font-size":"0.8em","font-weight":"590",color:"rgba(0, 0, 0, 0.4)"}},Le={style:{width:"auto","min-width":"0","align-self":"stretch",display:"flex","flex-direction":"column","align-items":"flex-end",gap:"4px"}},Se={style:{"font-size":"0.9em",color:"rgba(0, 0, 0, 0.4)","font-weight":"510"}},ze={style:{"font-size":"0.8em","font-weight":"510",color:"rgba(0, 0, 0, 0.4)",direction:"ltr"}},Ae={key:2,style:{display:"flex","flex-direction":"column","align-items":"center","justify-content":"center",padding:"60px 20px",color:"#666","text-align":"center"}},Ke={style:{margin:"0 0 8px 0","font-size":"16px","font-weight":"500"}},Ce={style:{"font-size":"14px",color:"#9ca3af"}},De={__name:"SellerRecordsView",setup(Te){const{t:r,locale:I}=W();I.value&&q(I.value);const K=a(M()),m=a(!1),y=a([]),h=a([]),v=R(()=>p.value.langKey==="income"?y.value:h.value),_=a(null),x=a(null),d=a(""),L=a(!1),S=a([]),p=a({id:0,langKey:"income"}),z=a([]),V=a([{id:0,langKey:"income"},{id:1,langKey:"expenditure"}]),B=async s=>{p.value=s,await g(),k()},E=R(()=>{console.log("计算属性");const s=I.value;if(console.log("当前语言:",s),z.value.length===0)return{};const t=z.value[p.value.id];return console.log("选中元素的左边距",t.offsetLeft),{position:"absolute",left:`${t.offsetLeft+t.offsetWidth/2-15/2}px`,bottom:"0",transition:"left 0.3s ease"}}),F=(s,t)=>`${s===0?"+":"-"}${t}`,g=async(s="")=>{m.value=!0;try{if(!K.value){console.error("无法获取用户ID");return}if(v.value.length!=0&&s=="")return;let t={userId:K.value,type:p.value.id,searchId:d.value,lastId:s};const i=await Z(t);if(i&&i.status&&i.body){let e=i.body.map(f=>({...f,amount:F(f.type,f.quantity),time:ae(f.createTime)}));p.value.id==1?h.value.push(...e):y.value.push(...e)}}catch(t){console.error("获取记录失败:",t)}finally{m.value=!1,console.log("加载完毕")}},G=async()=>{L.value=!1,d.value="",S.value=[],y.value=[],h.value=[],await g(),k()},b=O(async()=>{if(console.log("searchQuery.value:",d.value),!d.value.trim()){S.value=[];return}m.value||(L.value=!0,S.value=[],d.value.trim()&&(y.value=[],h.value=[],await g(),k()))},500,!0),C=ee(s=>{s()},1e3),w=new IntersectionObserver(s=>{s.forEach(t=>{if(t.intersectionRatio>0){console.log("监控到底部");let i=v.value[v.value.length-1].id;console.log("lastId:",i),t.target===_.value&&(console.log("incomeLoadmore"),C(()=>{g(i)})),t.target===x.value&&(console.log("expenditureLoadmore"),C(()=>{g(i)}))}})}),k=()=>{Q(()=>{_.value&&(w.unobserve(_.value),w.observe(_.value)),x.value&&(w.unobserve(x.value),w.observe(x.value))})};return H(async()=>{await g(),E.value,k()}),(s,t)=>{const i=J;return c(),u("div",re,[D(le,{showLanguageList:!0,title:n(r)("transaction_records"),color:"black"},null,8,["title"]),o("div",ce,[o("div",ue,[o("div",de,[t[4]||(t[4]=o("img",{src:se,alt:"",style:{width:"1.5em",opacity:"0.6"}},null,-1)),A(o("input",{"onUpdate:modelValue":t[0]||(t[0]=e=>d.value=e),type:"text",placeholder:n(r)("enter_user_id"),class:"search-input",style:{flex:"1",border:"none",padding:"4px 0",background:"transparent",outline:"none",width:"100%"},onKeyup:t[1]||(t[1]=Y((...e)=>n(b)&&n(b)(...e),["enter"]))},null,40,pe),[[X,d.value]])]),!L.value&&d.value?(c(),u("button",{key:0,style:{border:"none",color:"rgba(0, 0, 0, 0.4)","font-weight":"600","background-color":"transparent"},onClick:t[2]||(t[2]=(...e)=>n(b)&&n(b)(...e))},l(n(r)("search")),1)):(c(),u("button",{key:1,style:{border:"none","font-weight":"600","background-color":"transparent"},onClick:G},l(n(r)("cancel")),1))]),o("div",fe,[(c(!0),u(T,null,j(V.value,e=>(c(),u("button",{key:e.id,ref_for:!0,ref_key:"tabItems",ref:z,onClick:f=>B(e),style:te({padding:"8px 16px",background:"transparent",border:"none",fontWeight:"600",fontSize:"14px",color:p.value.id===e.id?"rgba(0, 0, 0, 0.80)":"rgba(0, 0, 0, 0.40)",cursor:"pointer",transition:"all 0.3s",position:"relative"})},l(n(r)(e.langKey)),13,ve))),128))]),m.value&&!v.value.length?(c(),u("div",ge,[D(i,{margin:"0 auto 16px"}),o("p",me,l(n(r)("loading"))+"...",1)])):(c(),u("div",ye,[(c(!0),u(T,null,j(v.value,e=>(c(),oe(ie,{key:e.id,style:{"margin-bottom":"0"}},{default:ne(()=>[o("div",he,[o("div",_e,[o("div",xe,[o("img",{src:(e.type?e.acceptUserAccount.userAvatar:e.userAccount.userAvatar)||"",alt:"",style:{display:"block",width:"100%","aspect-ratio":"1/1","border-radius":"50%","object-fit":"cover"},onError:t[3]||(t[3]=(...f)=>n(U)&&n(U)(...f))},null,40,be)]),o("div",we,[o("div",ke,l(e.type?e.acceptUserAccount.userNickName:e.userAccount.userNickName),1),o("div",Ie,l(n(r)("user_id_prefix"))+" "+l(e.type?e.acceptUserAccount.account:e.userAccount.account),1)])]),o("div",Le,[o("div",Se,l(e.amount)+" "+l(n(r)("coins")),1),o("div",ze,l(e.time),1)])])]),_:2},1024))),128)),A(o("div",{ref_key:"incomeLoadmore",ref:_},null,512),[[N,y.value.length!=0&&p.value?.langKey==="income"]]),A(o("div",{ref_key:"expenditureLoadmore",ref:x},null,512),[[N,h.value.length!=0&&p.value?.langKey==="expenditure"]])])),!m.value&&v.value.length===0?(c(),u("div",Ae,[o("p",Ke,l(n(r)("no_transaction_records")),1),o("span",Ce,l(n(r)("no_selling_records_yet")),1)])):P("",!0)])])}}},Ee=$(De,[["__scopeId","data-v-cd60a2c1"]]);export{Ee as default};
|