import{d as O,r as p,o as W,g as d,J as $,c as D,k as u,e as l,w as t,K as I,z as r,b as V,H as y,t as s,x as _,l as K,C as A,D as H,E as x,_ as J}from"./index-CUnFTKV2.js";import L from"./TypeFormDialog-CHc0-buv.js";import{o as j,t as q,v as P,l as Q}from"./goods-CWDKnOy3.js";const R={class:"page-container"},X={class:"card-header"},Y={class:"pay-methods"},Z={key:1,class:"text-muted"},ee=O({__name:"type",setup(ae){const g=p(!1),N=p([]),f=p({balanceName:"余额",currency1Name:"吧唧币",currency2Name:"哈尼券"}),v=p(!1),h=p(!1),C=p(null),m=async()=>{g.value=!0;try{const e=await j();N.value=e.data.list,f.value=e.data.currencyNames}finally{g.value=!1}},T=()=>{h.value=!1,C.value=null,v.value=!0},z=e=>{h.value=!0,C.value={...e},v.value=!0},S=async e=>{try{await H.confirm(`确定要删除类型 "${e.name}" 吗？删除后不可恢复！`,"删除确认",{type:"warning"}),await q(e.id),x.success("删除成功"),m()}catch{}},B=async(e,n,b)=>{try{await P(e.id,{type:n,value:b}),x.success("操作成功")}catch{m()}},E=async(e,n)=>{try{await Q(e.id,{name:e.name,value:e.value,sortOrder:n,isShow:e.isShow,isFenlei:e.isFenlei,flName:e.flName,cornerText:e.cornerText||void 0,payWechat:e.payWechat,payBalance:e.payBalance,payCurrency:e.payCurrency,payCurrency2:e.payCurrency2,payCoupon:e.payCoupon,isDeduction:e.isDeduction,remark:e.remark||void 0}),x.success("排序更新成功")}catch{m()}};return W(()=>{m()}),(e,n)=>{const b=d("el-icon"),k=d("el-button"),o=d("el-table-column"),U=d("el-input-number"),G=d("el-switch"),c=d("el-tag"),w=d("el-table"),F=d("el-card"),M=$("loading");return u(),D("div",R,[l(F,null,{header:t(()=>[V("div",X,[n[2]||(n[2]=V("span",null,"盒子类型管理",-1)),l(k,{type:"primary",onClick:T},{default:t(()=>[l(b,null,{default:t(()=>[l(K(A))]),_:1}),n[1]||(n[1]=s("新增类型 ",-1))]),_:1})])]),default:t(()=>[I((u(),r(w,{data:N.value,border:"",stripe:"",style:{width:"100%"}},{default:t(()=>[l(o,{prop:"id",label:"ID",width:"80",align:"center"}),l(o,{prop:"name",label:"类型名称","min-width":"120"}),l(o,{prop:"value",label:"类型Key",width:"100",align:"center"}),l(o,{prop:"sortOrder",label:"排序",width:"100",align:"center"},{default:t(({row:a})=>[l(U,{modelValue:a.sortOrder,"onUpdate:modelValue":i=>a.sortOrder=i,min:0,max:9999,size:"small","controls-position":"right",onChange:i=>E(a,i)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1}),l(o,{label:"首页显示",width:"100",align:"center"},{default:t(({row:a})=>[l(G,{modelValue:a.isShow,"onUpdate:modelValue":i=>a.isShow=i,"active-value":1,"inactive-value":0,onChange:i=>B(a,"is_show",i)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1}),l(o,{label:"支付方式","min-width":"200"},{default:t(({row:a})=>[V("div",Y,[a.payWechat===1?(u(),r(c,{key:0,type:"success",size:"small"},{default:t(()=>[...n[3]||(n[3]=[s("微信",-1)])]),_:1})):y("",!0),a.payBalance===1?(u(),r(c,{key:1,type:"warning",size:"small"},{default:t(()=>[s(_(f.value.balanceName),1)]),_:1})):y("",!0),a.payCurrency===1?(u(),r(c,{key:2,type:"info",size:"small"},{default:t(()=>[s(_(f.value.currency1Name),1)]),_:1})):y("",!0),a.payCurrency2===1?(u(),r(c,{key:3,type:"danger",size:"small"},{default:t(()=>[s(_(f.value.currency2Name),1)]),_:1})):y("",!0),a.payCoupon===1?(u(),r(c,{key:4,size:"small"},{default:t(()=>[...n[4]||(n[4]=[s("优惠券",-1)])]),_:1})):y("",!0)])]),_:1}),l(o,{label:"支付类型",width:"100",align:"center"},{default:t(({row:a})=>[l(c,{type:a.isDeduction===1?"warning":"primary",size:"small"},{default:t(()=>[s(_(a.isDeduction===1?"抵扣":"支付"),1)]),_:2},1032,["type"])]),_:1}),l(o,{prop:"cornerText",label:"角标文字",width:"100",align:"center"},{default:t(({row:a})=>[a.cornerText?(u(),r(c,{key:0,type:"danger",size:"small"},{default:t(()=>[s(_(a.cornerText),1)]),_:2},1024)):(u(),D("span",Z,"-"))]),_:1}),l(o,{label:"操作",width:"150",align:"center",fixed:"right"},{default:t(({row:a})=>[l(k,{type:"primary",link:"",size:"small",onClick:i=>z(a)},{default:t(()=>[...n[5]||(n[5]=[s(" 编辑 ",-1)])]),_:1},8,["onClick"]),l(k,{type:"danger",link:"",size:"small",onClick:i=>S(a)},{default:t(()=>[...n[6]||(n[6]=[s(" 删除 ",-1)])]),_:1},8,["onClick"])]),_:1})]),_:1},8,["data"])),[[M,g.value]])]),_:1}),l(L,{modelValue:v.value,"onUpdate:modelValue":n[0]||(n[0]=a=>v.value=a),"type-data":C.value,"is-edit":h.value,onSuccess:m},null,8,["modelValue","type-data","is-edit"])])}}}),se=J(ee,[["__scopeId","data-v-6b459774"]]);export{se as default};
