import{k as z,H as i,L as _,P as t,M as s,O as c,V as M,F as C,ab as D,I as B,X as N,e as m,ag as n,ah as F,c as I,az as L,Y as y,Z as r,u as R}from"./vendor-DeEI1rpK.js";import{b as S}from"./element-plus-pbz_d-qS.js";import{r as U}from"./request-BEmSsgoM.js";import{_ as $}from"./index-CxJCpQ-E.js";const j={class:"vehicles-page"},q={class:"filter-bar"},E={class:"vehicle-list"},H=["onClick"],O={class:"vehicle-img"},X={class:"vehicle-info"},Y={class:"tags"},Z={class:"price-row"},A={class:"price"},G={class:"deposit"},J={class:"vehicle-arrow"},K={__name:"Vehicles",setup(Q){const b=L(),u=m(!1),v=m([]),d=m(""),p=m(""),V=l=>{const a=l.purchasePrice||3e3;return Math.round(a/100)},f=I(()=>v.value.filter(l=>{const a=!d.value||l.batteryType===d.value,o=!p.value||l.status===p.value;return a&&o})),P=async()=>{u.value=!0;try{const l=await U.get("/vehicles");l.success&&(v.value=l.data)}catch{v.value=[{_id:"1",model:"黑骑士",color:"黑色",batteryType:"锂电池",purchasePrice:3500,status:"空闲"},{_id:"2",model:"黑骑士",color:"白色",batteryType:"锂电池",purchasePrice:3500,status:"空闲"},{_id:"3",model:"电动车",color:"蓝色",batteryType:"铅酸电池",purchasePrice:2800,status:"空闲"},{_id:"4",model:"高端豪车",color:"红色",batteryType:"锂电池",purchasePrice:8e3,status:"空闲"},{_id:"5",model:"普通标准套餐",color:"绿色",batteryType:"铅酸电池",purchasePrice:2500,status:"在租"}]}finally{u.value=!1}},w=l=>{b.push(`/vehicle/${l}`)};return z(()=>{P()}),(l,a)=>{const o=n("el-option"),g=n("el-select"),h=n("el-tag"),T=n("el-icon"),k=n("el-empty"),x=F("loading");return i(),_("div",j,[a[3]||(a[3]=t("div",{class:"page-header"},[t("h2",null,"选择车型"),t("p",null,"浏览全部可用车辆")],-1)),t("div",q,[s(g,{modelValue:d.value,"onUpdate:modelValue":a[0]||(a[0]=e=>d.value=e),placeholder:"电池类型",size:"small",style:{width:"100px"}},{default:c(()=>[s(o,{label:"全部",value:""}),s(o,{label:"锂电池",value:"锂电池"}),s(o,{label:"铅酸电池",value:"铅酸电池"})]),_:1},8,["modelValue"]),s(g,{modelValue:p.value,"onUpdate:modelValue":a[1]||(a[1]=e=>p.value=e),placeholder:"状态",size:"small",style:{width:"100px"}},{default:c(()=>[s(o,{label:"全部",value:""}),s(o,{label:"空闲",value:"空闲"}),s(o,{label:"在租",value:"在租"})]),_:1},8,["modelValue"])]),M((i(),_("div",E,[(i(!0),_(C,null,D(f.value,e=>(i(),_("div",{key:e._id,class:"vehicle-card",onClick:W=>w(e._id)},[t("div",O,[a[2]||(a[2]=t("span",{class:"emoji"},"🛵",-1)),s(h,{type:e.status==="空闲"?"success":"warning",class:"status-tag",size:"small"},{default:c(()=>[y(r(e.status),1)]),_:2},1032,["type"])]),t("div",X,[t("h4",null,r(e.model),1),t("div",Y,[s(h,{size:"small",type:"info"},{default:c(()=>[y(r(e.color),1)]),_:2},1024),s(h,{size:"small",type:"info"},{default:c(()=>[y(r(e.batteryType),1)]),_:2},1024)]),t("div",Z,[t("span",A,"¥"+r(V(e))+"/天",1),t("span",G,"押金: ¥"+r(e.purchasePrice?Math.round(e.purchasePrice*.1):200),1)])]),t("div",J,[s(T,null,{default:c(()=>[s(R(S))]),_:1})])],8,H))),128)),!u.value&&f.value.length===0?(i(),B(k,{key:0,description:"暂无车辆"})):N("",!0)])),[[x,u.value]])])}}},le=$(K,[["__scopeId","data-v-5ef92e98"]]);export{le as default};
