import{d as Y,r as u,a as C,o as j,g as i,c as B,k as K,e as a,w as t,f as k,t as b,l as D,O as P,s as T,b as x,aa as q,E as h,_ as F}from"./index-CUnFTKV2.js";import $ from"./RecoveryOrderTable-Dr1EvbFP.js";import A from"./RecoveryDetailDialog--DrgPKvG.js";import{j as G,k as H}from"./order-BSmesayL.js";const J={class:"page-container"},Q={class:"card-header"},W=Y({__name:"recovery",setup(X){const m=u(!1),I=u([]),V=u(0),v=u(!1),n=C({userId:"",mobile:""}),d=u(null),e=C({page:1,pageSize:20}),f=u(!1),_=u(null),c=async()=>{m.value=!0;try{const o=await G(e);I.value=o.data.list,V.value=o.data.total}catch(o){console.error("获取回收订单列表失败:",o),h.error("获取回收订单列表失败")}finally{m.value=!1}},g=()=>{if(e.userId=void 0,e.mobile=void 0,e.startDate=void 0,e.endDate=void 0,n.userId){const o=parseInt(n.userId);isNaN(o)||(e.userId=o)}n.mobile&&(e.mobile=n.mobile),d.value&&d.value.length===2&&(e.startDate=d.value[0],e.endDate=d.value[1]),e.page=1,c()},R=()=>{n.userId="",n.mobile="",d.value=null,e.userId=void 0,e.mobile=void 0,e.startDate=void 0,e.endDate=void 0,e.page=1,c()},U=o=>{e.page=o,c()},S=o=>{e.pageSize=o,e.page=1,c()},z=o=>{_.value=o,f.value=!0},O=()=>{_.value=null},L=async()=>{v.value=!0;try{const o=await H({userId:e.userId,mobile:e.mobile,startDate:e.startDate,endDate:e.endDate}),l=window.URL.createObjectURL(o),r=document.createElement("a");r.href=l,r.download=`回收订单_${new Date().toISOString().slice(0,10)}.csv`,document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(l),h.success("导出成功")}catch(o){console.error("导出失败:",o),h.error("导出失败")}finally{v.value=!1}};return j(()=>{c()}),(o,l)=>{const r=i("el-icon"),y=i("el-button"),w=i("el-input"),p=i("el-form-item"),E=i("el-date-picker"),N=i("el-form"),M=i("el-card");return K(),B("div",J,[a(M,null,{header:t(()=>[x("div",Q,[l[5]||(l[5]=x("span",null,"回收订单",-1)),a(y,{type:"primary",onClick:L,loading:v.value},{default:t(()=>[a(r,null,{default:t(()=>[a(D(q))]),_:1}),l[4]||(l[4]=b("导出 ",-1))]),_:1},8,["loading"])])]),default:t(()=>[a(N,{inline:!0,model:n,class:"search-form"},{default:t(()=>[a(p,{label:"用户ID"},{default:t(()=>[a(w,{modelValue:n.userId,"onUpdate:modelValue":l[0]||(l[0]=s=>n.userId=s),placeholder:"用户ID/UID",clearable:"",onKeyup:k(g,["enter"]),style:{width:"120px"}},null,8,["modelValue"])]),_:1}),a(p,{label:"手机号"},{default:t(()=>[a(w,{modelValue:n.mobile,"onUpdate:modelValue":l[1]||(l[1]=s=>n.mobile=s),placeholder:"手机号",clearable:"",onKeyup:k(g,["enter"]),style:{width:"140px"}},null,8,["modelValue"])]),_:1}),a(p,{label:"回收时间"},{default:t(()=>[a(E,{modelValue:d.value,"onUpdate:modelValue":l[2]||(l[2]=s=>d.value=s),type:"daterange","range-separator":"至","start-placeholder":"开始日期","end-placeholder":"结束日期","value-format":"YYYY-MM-DD",style:{width:"240px"}},null,8,["modelValue"])]),_:1}),a(p,null,{default:t(()=>[a(y,{type:"primary",onClick:g},{default:t(()=>[a(r,null,{default:t(()=>[a(D(P))]),_:1}),l[6]||(l[6]=b("查询 ",-1))]),_:1}),a(y,{onClick:R},{default:t(()=>[a(r,null,{default:t(()=>[a(D(T))]),_:1}),l[7]||(l[7]=b("重置 ",-1))]),_:1})]),_:1})]),_:1},8,["model"]),a($,{data:I.value,loading:m.value,total:V.value,page:e.page,"page-size":e.pageSize,onPageChange:U,onSizeChange:S,onViewDetail:z},null,8,["data","loading","total","page","page-size"])]),_:1}),a(A,{modelValue:f.value,"onUpdate:modelValue":l[3]||(l[3]=s=>f.value=s),"recovery-data":_.value,onClose:O},null,8,["modelValue","recovery-data"])])}}}),oe=F(W,[["__scopeId","data-v-3ddc8de9"]]);export{oe as default};
