import{d as L,r as i,a as U,o as P,g as p,c as D,k as w,e as o,w as r,H as T,t as g,b as c,x as S,l as j,aa as F,E as u,D as M,_ as q}from"./index-CUnFTKV2.js";import H from"./ShippingSearchForm-D6HQfAG4.js";import $ from"./ShippingOrderTable-CVRDwZag.js";import A from"./ShippingDetailDialog-BNTDTATF.js";import{l as G,m as J,n as K,o as Q}from"./order-BSmesayL.js";import"./ShipDialog-D8f2yF8b.js";const W={class:"page-container"},X={class:"card-header"},Y={key:0,class:"stats-bar"},Z={class:"stats-value"},ee={class:"stats-value"},ae={class:"stats-value"},te=L({__name:"shipping",setup(oe){const m=i(!1),b=i([]),y=i(0),d=i(null),v=i(!1),e=U({page:1,pageSize:20}),h=i(!1),_=i(null),s=async()=>{m.value=!0;try{const[t,a]=await Promise.all([G(e),J(e)]);b.value=t.data.list,y.value=t.data.total,d.value=a.data}catch(t){console.error("获取发货订单列表失败:",t),u.error("获取发货订单列表失败")}finally{m.value=!1}},C=t=>{e.userId=void 0,e.mobile=void 0,e.sendNum=void 0,e.startDate=void 0,e.endDate=void 0,e.status=void 0,Object.assign(e,t),e.page=1,s()},x=()=>{e.userId=void 0,e.mobile=void 0,e.sendNum=void 0,e.startDate=void 0,e.endDate=void 0,e.status=void 0,e.page=1,s()},V=t=>{e.page=t,s()},z=t=>{e.pageSize=t,e.page=1,s()},k=t=>{_.value=t.id,h.value=!0},N=()=>{_.value=null},O=()=>{s()},R=async t=>{try{await M.confirm("确定要取消发货吗？取消后奖品将返回用户盒柜","取消发货确认",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}),await K(t.id),u.success("取消发货成功"),s()}catch(a){a!=="cancel"&&(console.error("取消发货失败:",a),u.error("取消发货失败"))}},I=async()=>{v.value=!0;try{const t=await Q({userId:e.userId,mobile:e.mobile,sendNum:e.sendNum,startDate:e.startDate,endDate:e.endDate,status:e.status}),a=window.URL.createObjectURL(t),n=document.createElement("a");n.href=a,n.download=`发货订单_${new Date().toISOString().slice(0,10)}.csv`,document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(a),u.success("导出成功")}catch(t){console.error("导出失败:",t),u.error("导出失败")}finally{v.value=!1}};return P(()=>{s()}),(t,a)=>{const n=p("el-icon"),B=p("el-button"),f=p("el-tag"),E=p("el-card");return w(),D("div",W,[o(E,null,{header:r(()=>[c("div",X,[a[2]||(a[2]=c("span",null,"发货订单",-1)),o(B,{type:"primary",onClick:I,loading:v.value},{default:r(()=>[o(n,null,{default:r(()=>[o(j(F))]),_:1}),a[1]||(a[1]=g("导出 ",-1))]),_:1},8,["loading"])])]),default:r(()=>[o(H,{onSearch:C,onReset:x}),d.value?(w(),D("div",Y,[o(f,{type:"info",size:"large"},{default:r(()=>[a[3]||(a[3]=g(" 数据条数: ",-1)),c("span",Z,S(d.value.totalCount),1)]),_:1}),o(f,{type:"warning",size:"large"},{default:r(()=>{var l;return[a[4]||(a[4]=g(" 全部价值: ",-1)),c("span",ee,"¥"+S(((l=d.value.totalValue)==null?void 0:l.toFixed(2))||"0.00"),1)]}),_:1}),o(f,{type:"success",size:"large"},{default:r(()=>{var l;return[a[5]||(a[5]=g(" 本页总发货价值: ",-1)),c("span",ae,"¥"+S(((l=d.value.pageValue)==null?void 0:l.toFixed(2))||"0.00"),1)]}),_:1})])):T("",!0),o($,{data:b.value,loading:m.value,total:y.value,page:e.page,"page-size":e.pageSize,onPageChange:V,onSizeChange:z,onViewDetail:k,onCancelShip:R},null,8,["data","loading","total","page","page-size"])]),_:1}),o(A,{modelValue:h.value,"onUpdate:modelValue":a[0]||(a[0]=l=>h.value=l),"send-id":_.value,onClose:N,onShipped:O},null,8,["modelValue","send-id"])])}}}),ce=q(te,[["__scopeId","data-v-8bfb7245"]]);export{ce as default};
