import{d as A,r as v,G as b,g as o,J as E,c as z,k as g,K as $,e as a,z as C,w as n,b as x,x as u,t as c,l as j,L as G,_ as J}from"./index-CUnFTKV2.js";const K={class:"diamond-table"},L={class:"money"},O={class:"image-error"},q={key:1,class:"text-muted"},H=A({__name:"DiamondTable",props:{data:{},loading:{type:Boolean},total:{},page:{},pageSize:{}},emits:["page-change","size-change","edit","delete","status-change"],setup(d,{emit:y}){const p=d,r=y,_=v(p.page),m=v(p.pageSize);b(()=>p.page,t=>{_.value=t}),b(()=>p.pageSize,t=>{m.value=t});const h=t=>t.isFirst===1&&t.firstChargeImage?t.firstChargeImage:t.normalImage||"",k=t=>{r("page-change",t)},w=t=>{r("size-change",t)},S=t=>{r("edit",t)},D=t=>{r("delete",t)},I=(t,i)=>{r("status-change",t,i)};return(t,i)=>{const l=o("el-table-column"),V=o("el-tag"),B=o("el-icon"),F=o("el-image"),P=o("el-switch"),f=o("el-button"),U=o("el-table"),N=o("el-pagination"),T=E("loading");return g(),z("div",K,[$((g(),C(U,{data:d.data,border:"",stripe:""},{default:n(()=>[a(l,{prop:"id",label:"ID",width:"80",align:"center"}),a(l,{prop:"name",label:"商品名称","min-width":"120"}),a(l,{prop:"productsId",label:"商品编号",width:"120",align:"center"}),a(l,{prop:"price",label:"价格",width:"100",align:"right"},{default:n(({row:e})=>{var s;return[x("span",L,"¥"+u(((s=e.price)==null?void 0:s.toFixed(2))||"0.00"),1)]}),_:1}),a(l,{label:"是否首充",width:"90",align:"center"},{default:n(({row:e})=>[a(V,{type:e.isFirst===1?"success":"info",size:"small"},{default:n(()=>[c(u(e.isFirst===1?"是":"否"),1)]),_:2},1032,["type"])]),_:1}),a(l,{label:"展示图",width:"100",align:"center"},{default:n(({row:e})=>[h(e)?(g(),C(F,{key:0,src:h(e),"preview-src-list":[h(e)],fit:"cover",style:{width:"50px",height:"50px","border-radius":"4px"},"preview-teleported":""},{error:n(()=>[x("div",O,[a(B,null,{default:n(()=>[a(j(G))]),_:1})])]),_:1},8,["src","preview-src-list"])):(g(),z("span",q,"-"))]),_:1}),a(l,{prop:"sortOrder",label:"排序",width:"80",align:"center"}),a(l,{label:"状态",width:"90",align:"center"},{default:n(({row:e})=>[a(P,{modelValue:e.status,"onUpdate:modelValue":s=>e.status=s,"active-value":1,"inactive-value":0,onChange:s=>I(e,s)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1}),a(l,{label:"创建时间",width:"160",align:"center"},{default:n(({row:e})=>[c(u(e.createdAt||"-"),1)]),_:1}),a(l,{label:"更新时间",width:"160",align:"center"},{default:n(({row:e})=>[c(u(e.updatedAt||"-"),1)]),_:1}),a(l,{label:"操作",width:"150",align:"center",fixed:"right"},{default:n(({row:e})=>[a(f,{type:"primary",link:"",size:"small",onClick:s=>S(e)},{default:n(()=>[...i[2]||(i[2]=[c(" 编辑 ",-1)])]),_:1},8,["onClick"]),a(f,{type:"danger",link:"",size:"small",onClick:s=>D(e)},{default:n(()=>[...i[3]||(i[3]=[c(" 删除 ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1},8,["data"])),[[T,d.loading]]),a(N,{"current-page":_.value,"onUpdate:currentPage":i[0]||(i[0]=e=>_.value=e),"page-size":m.value,"onUpdate:pageSize":i[1]||(i[1]=e=>m.value=e),"page-sizes":[10,20,50,100],total:d.total,layout:"total, sizes, prev, pager, next, jumper",onSizeChange:w,onCurrentChange:k,class:"pagination"},null,8,["current-page","page-size","total"])])}}}),Q=J(H,[["__scopeId","data-v-8e189c08"]]);export{Q as default};
