import{$ as e,H as t,L as n,P as r,V as i,Vt as a,Wt as o,_ as s,d as c,et as l,i as u,lt as d,p as f,st as p,u as m,v as h,z as g}from"./runtime-core.esm-bundler-DbRZbT7v.js";import{l as _,s as v}from"./index-Mgun2LFs.js";import"./request-DG5cMCYw.js";import{t as y}from"./finance-Cw6lAEm1.js";var b={class:`p-6 space-y-4`},x={class:`bg-white rounded-2xl border border-gray-100 shadow-sm p-4 flex items-center flex-wrap gap-3`},S={class:`bg-white rounded-2xl border border-gray-100 shadow-sm`},C={class:`flex items-center gap-3 px-5 py-4 border-b border-gray-50`},w={class:`px-2`},T={class:`text-gray-700`},E={class:`px-5 py-3 border-t border-gray-50`},D={__name:`index`,setup(D){let O=d([]),k=d(0),A=d(!1),j=p({account_id:``,type:``,date_from:``,date_to:``}),M=p({page:1,per_page:20}),N={deposit:`充值`,consume:`消费`,refund:`退款`,adjust:`调整`},P={deposit:`success`,consume:`danger`,refund:`warning`,adjust:`info`};async function F(){A.value=!0;try{let e=await y.getList({...j,...M});O.value=e.data?.list||e.data?.data||[],k.value=e.data?.total||0}catch{v.error(`获取流水列表失败`)}finally{A.value=!1}}function I(){M.page=1,F()}function L(){Object.assign(j,{account_id:``,type:``,date_from:``,date_to:``}),I()}function R(e){M.page=e,F()}function z(e){M.per_page=e,M.page=1,F()}function B(e){return[`deposit`,`refund`].includes(e.type)?`text-green-600 font-semibold`:`text-red-500 font-semibold`}function V(e){return[`deposit`,`refund`].includes(e.type)?`+`:`-`}return r(()=>F()),(r,d)=>{let p=i(`el-input`),v=i(`el-option`),y=i(`el-select`),D=i(`el-date-picker`),F=i(`el-button`),H=i(`el-tag`),U=i(`el-table-column`),W=i(`el-table`),G=i(`el-pagination`),K=t(`loading`);return n(),f(`div`,b,[m(`div`,x,[h(p,{modelValue:j.account_id,"onUpdate:modelValue":d[0]||=e=>j.account_id=e,placeholder:`账户ID`,style:{width:`150px`},clearable:``,onKeydown:_(I,[`enter`])},null,8,[`modelValue`]),h(y,{modelValue:j.type,"onUpdate:modelValue":d[1]||=e=>j.type=e,placeholder:`流水类型`,clearable:``,style:{width:`130px`}},{default:e(()=>[(n(),f(u,null,g(N,(e,t)=>h(v,{key:t,label:e,value:t},null,8,[`label`,`value`])),64))]),_:1},8,[`modelValue`]),h(D,{modelValue:j.date_from,"onUpdate:modelValue":d[2]||=e=>j.date_from=e,type:`date`,"value-format":`YYYY-MM-DD`,placeholder:`开始日期`,style:{width:`150px`}},null,8,[`modelValue`]),h(D,{modelValue:j.date_to,"onUpdate:modelValue":d[3]||=e=>j.date_to=e,type:`date`,"value-format":`YYYY-MM-DD`,placeholder:`结束日期`,style:{width:`150px`}},null,8,[`modelValue`]),h(F,{type:`primary`,onClick:I},{default:e(()=>[...d[6]||=[s(`查询`,-1)]]),_:1}),h(F,{onClick:L},{default:e(()=>[...d[7]||=[s(`重置`,-1)]]),_:1})]),m(`div`,S,[m(`div`,C,[d[9]||=m(`span`,{class:`w-1 h-5 bg-rose-500 rounded-full inline-block`},null,-1),d[10]||=m(`span`,{class:`font-medium text-gray-700`},`账户流水明细`,-1),h(H,{type:`info`,size:`small`,class:`ml-auto`},{default:e(()=>[...d[8]||=[s(`只读`,-1)]]),_:1})]),m(`div`,w,[l((n(),c(W,{data:O.value,style:{width:`100%`},stripe:``},{default:e(()=>[h(U,{prop:`id`,label:`流水ID`,width:`80`,align:`center`}),h(U,{prop:`customer_name`,label:`客户`,"min-width":`110`}),h(U,{label:`类型`,width:`90`,align:`center`},{default:e(({row:t})=>[h(H,{type:P[t.type],size:`small`},{default:e(()=>[s(o(N[t.type]||t.type),1)]),_:2},1032,[`type`])]),_:1}),h(U,{label:`金额`,width:`120`,align:`right`},{default:e(({row:e})=>[m(`span`,{class:a(B(e))},o(V(e))+o(Number(e.amount||0).toFixed(2)),3)]),_:1}),h(U,{label:`余额(后)`,width:`120`,align:`right`},{default:e(({row:e})=>[m(`span`,T,o(Number(e.balance_after||0).toFixed(2)),1)]),_:1}),h(U,{prop:`operator_name`,label:`操作人`,width:`100`,align:`center`}),h(U,{prop:`remark`,label:`备注`,"min-width":`140`,"show-overflow-tooltip":``}),h(U,{prop:`created_at`,label:`时间`,"min-width":`160`})]),_:1},8,[`data`])),[[K,A.value]])]),m(`div`,E,[h(G,{"current-page":M.page,"onUpdate:currentPage":d[4]||=e=>M.page=e,"page-size":M.per_page,"onUpdate:pageSize":d[5]||=e=>M.per_page=e,total:k.value,"page-sizes":[10,20,50],layout:`total,sizes,prev,pager,next,jumper`,background:``,onCurrentChange:R,onSizeChange:z},null,8,[`current-page`,`page-size`,`total`])])])])}}};export{D as default};