import{d as x,r as s,a as b,o as k,g as r,c as B,k as M,e as n,w as d,b as g,t as N,l as F,C as R,D as T,E as f,_ as q}from"./index-CUnFTKV2.js";import A from"./DiamondSearchForm-_674MvdS.js";import I from"./DiamondTable-HYUHUJXE.js";import{D as L,g as U,d as $,u as j}from"./DiamondFormDialog-7b8plTxm.js";import"./RewardConfigInput-DA9agGnL.js";const G={class:"page-container"},H={class:"card-header"},J=x({__name:"list",setup(K){const c=s(!1),p=s([]),m=s(0),a=b({page:1,pageSize:20}),l=s(!1),u=s(!1),i=s(null),t=async()=>{c.value=!0;try{const e=await U(a);p.value=e.data.list,m.value=e.data.total}finally{c.value=!1}},v=e=>{a.name=e.name,a.status=e.status,a.page=1,t()},_=()=>{a.name=void 0,a.status=void 0,a.page=1,t()},h=e=>{a.page=e,t()},D=e=>{a.pageSize=e,a.page=1,t()},S=()=>{u.value=!1,i.value=null,l.value=!0},y=e=>{u.value=!0,i.value={...e},l.value=!0},C=async e=>{try{await T.confirm(`确定要删除商品 "${e.name}" 吗？删除后不可恢复！`,"删除确认",{type:"warning"}),await $(e.id),f.success("删除成功"),t()}catch{}},z=async(e,o)=>{try{await j(e.id,o),f.success("状态更新成功"),t()}catch{t()}};return k(()=>{t()}),(e,o)=>{const E=r("el-icon"),P=r("el-button"),V=r("el-card");return M(),B("div",G,[n(V,null,{header:d(()=>[g("div",H,[o[2]||(o[2]=g("span",null,"钻石商品管理",-1)),n(P,{type:"primary",onClick:S},{default:d(()=>[n(E,null,{default:d(()=>[n(F(R))]),_:1}),o[1]||(o[1]=N("新增商品 ",-1))]),_:1})])]),default:d(()=>[n(A,{onSearch:v,onReset:_}),n(I,{data:p.value,loading:c.value,total:m.value,page:a.page,"page-size":a.pageSize,onPageChange:h,onSizeChange:D,onEdit:y,onDelete:C,onStatusChange:z},null,8,["data","loading","total","page","page-size"])]),_:1}),n(L,{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=w=>l.value=w),product:i.value,"is-edit":u.value,onSuccess:t},null,8,["modelValue","product","is-edit"])])}}}),Z=q(J,[["__scopeId","data-v-8fa6f389"]]);export{Z as default};
