category.332e95bb.js 6.8 KB

1
  1. import{P as J}from"./page.3b4d44cb.js";import{d as K,b7 as O,b as A,c as d,at as Q,e as c,f as p,h as a,i as l,w as W,u as m,k as V,A as k,t as F,F as D,j as x,dy as X,aT as Y,aV as Z,g as E,m as g,E as y,N as ee,_ as te}from"./index.0308b213.js";import{b as ae,c as ue,e as le,d as oe,f as ne}from"./category.d6885772.js";const se={class:"container"},ie=g("\u6DFB\u52A0\u5206\u7C7B"),re=g("\u6279\u91CF\u6DFB\u52A0\u5206\u7C7B"),de={key:0,class:"wrap"},ce={key:0},_e={key:1},pe=g("\u6DFB\u52A0\u5B50\u5206\u7C7B"),me=g("\u4FEE\u6539\u5206\u7C7B"),ge={class:"footer"},fe={class:"footer-left"},he={class:"footer-right"},Ce=g("\u63D0\u4EA4\u4FEE\u6539"),ye=g("\u6DFB\u52A0\u5206\u7C7B"),we=g("\u63D0\u4EA4"),Be=g("\u53D6\u6D88"),be=K({setup(ke){const U=O(),n=A({total:0,loading:!1,tableData:[],openDialog:!1,categoryList:[]}),f=(o,t)=>{console.log(o,t);let u="",r={};switch(console.log(o),o){case"\u6DFB\u52A0\u5206\u7C7B":{u="editCategory",r={id:0};break}case"\u6DFB\u52A0\u5B50\u5206\u7C7B":{u="addSubCategory",r={id:t};break}case"\u4FEE\u6539\u5206\u7C7B":{u="editCategory",r={id:t};break}case"\u67E5\u770B\u5546\u54C1":{u="index",r={cid:t};break}case"\u6DFB\u52A0\u5546\u54C1":{u="editGoods",r={id:0};break}}u&&U.push({path:u,query:r})},w=A({page:1,limit:10}),$=o=>{n.openDialog=!0},L=()=>{n.categoryList.push({name:""})},B=()=>{n.openDialog=!1,n.categoryList=[]},S=()=>{ae({categoryList:n.categoryList}).then(o=>{y.success(o.msg),B(),h()})},h=()=>{n.loading=!0,ue(w).then(o=>{console.log("\u8BF7\u6C42\u7ED3\u679C:",o),n.total=o.count,n.tableData=o.lists}).finally(()=>{n.loading=!1})};h();const P=()=>{n.loading=!0;let o=[],t=[],u=[],r=[];for(let s of n.tableData)if(o.push(s.id),t.push(s.min_fee),u.push(s.displayorder),r.push(s.title),s.child&&s.child.length)for(let _ of s.child)o.push(_.id),t.push(_.min_fee),u.push(_.displayorder),r.push(_.title);le({ids:o,min_fees:t,displayorders:u,titles:r}).then(s=>{y.success("\u63D0\u4EA4\u6210\u529F"),h()},s=>{n.loading=!1})},N=o=>{ee.prompt("\u786E\u5B9A\u8981\u5220\u9664\u8BE5\u5206\u7C7B\u5417\uFF1F","\u63D0\u793A",{showInput:!1}).then(t=>{oe({ids:o}).then(u=>{y.success("\u5220\u9664\u6210\u529F"),h()})}).catch(t=>{})},T=(o,t)=>{ne({id:o,status:t}).then(u=>{y.success("\u5207\u6362\u6210\u529F")})},j=o=>{let t="\u661F\u671F";switch(o){case"1":t+="\u4E00";break;case"2":t+="\u4E8C";break;case"3":t+="\u4E09";break;case"4":t+="\u56DB";break;case"5":t+="\u4E94";break;case"6":t+="\u516D";break;case"7":t+="\u4E03";break;default:t=o}return t},v=(o,t)=>{o=="page"?w.page=t:w.limit=t,h()};return(o,t)=>{const u=d("el-button"),r=d("el-image"),s=d("el-table-column"),_=d("el-input"),z=d("el-switch"),b=d("el-tooltip"),I=d("el-table"),M=d("el-pagination"),q=d("el-form-item"),G=d("el-form"),R=d("el-dialog"),H=Q("loading");return c(),p(D,null,[a(J,{showBorder:!1},{main:l(()=>[W((c(),p("div",se,[a(u,{class:"add-btn",type:"primary",onClick:t[0]||(t[0]=e=>f("\u6DFB\u52A0\u5206\u7C7B"))},{default:l(()=>[ie]),_:1}),a(u,{class:"add-btn",type:"primary",onClick:$},{default:l(()=>[re]),_:1}),a(I,{data:m(n).tableData,border:"",style:{width:"100%"},"row-key":"id","tree-props":{children:"child",hasChildren:!0},"default-expand-all":!0},{default:l(()=>[a(s,{align:"center","class-name":"pic",label:"\u56FE\u6807",width:"120"},{default:l(e=>[a(r,{style:{width:"50px",height:"50px"},src:e.row.thumb,fit:"contain"},null,8,["src"])]),_:1}),a(s,{align:"center",label:"\u5206\u7C7B\u540D\u79F0"},{default:l(e=>[a(_,{modelValue:e.row.title,"onUpdate:modelValue":i=>e.row.title=i},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),a(s,{align:"center",label:"\u6700\u4F4E\u6D88\u8D39\u91D1\u989D(\u5143)"},{default:l(e=>[e.row.parentid?k("",!0):(c(),V(_,{key:0,type:"number",min:0,modelValue:e.row.min_fee,"onUpdate:modelValue":i=>e.row.min_fee=i},null,8,["modelValue","onUpdate:modelValue"]))]),_:1}),a(s,{align:"center",label:"\u6392\u5E8F"},{default:l(e=>[a(_,{type:"number",min:0,modelValue:e.row.displayorder,"onUpdate:modelValue":i=>e.row.displayorder=i},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),a(s,{align:"center",label:"\u663E\u793A\u65F6\u95F4\u6BB5"},{default:l(e=>[e.row.parentid?k("",!0):(c(),p("div",de,[e.row.is_showtime==0||e.row.is_showtime==1&&!e.row.start_time?(c(),p("span",ce,"\u4E0D\u9650")):(c(),p("span",_e,F(e.row.start_time)+" \u5230 "+F(e.row.end_time),1))]))]),_:1}),a(s,{align:"center",label:"\u661F\u671F\u51E0\u663E\u793A",prop:"week"},{default:l(e=>[(c(!0),p(D,null,x(e.row.week,(i,C)=>(c(),p("span",{key:C},F(j(i)+(e.row.week.length-1!=C?"\u3001":"\u4E0D\u9650")),1))),128))]),_:1}),a(s,{align:"center",label:"\u662F\u5426\u663E\u793A"},{default:l(e=>[a(z,{modelValue:e.row.status,"onUpdate:modelValue":i=>e.row.status=i,"active-value":1,"inactive-value":0,"inline-prompt":"","active-text":"\u662F","inactive-text":"\u5426",onChange:i=>T(e.row.id,e.row.status)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1}),a(s,{"header-align":"center",align:"right",label:"\u64CD\u4F5C",width:"390"},{default:l(e=>[e.row.parentid?k("",!0):(c(),V(u,{key:0,onClick:i=>f("\u6DFB\u52A0\u5B50\u5206\u7C7B",e.row.id)},{default:l(()=>[pe]),_:2},1032,["onClick"])),a(u,{onClick:i=>f("\u4FEE\u6539\u5206\u7C7B",e.row.id)},{default:l(()=>[me]),_:2},1032,["onClick"]),a(b,{effect:"dark",content:"\u67E5\u770B\u5546\u54C1",placement:"top"},{default:l(()=>[a(u,{icon:m(X),onClick:i=>f("\u67E5\u770B\u5546\u54C1",e.row.id)},null,8,["icon","onClick"])]),_:2},1024),a(b,{effect:"dark",content:"\u6DFB\u52A0\u5546\u54C1",placement:"top"},{default:l(()=>[a(u,{icon:m(Y),onClick:t[1]||(t[1]=i=>f("\u6DFB\u52A0\u5546\u54C1"))},null,8,["icon"])]),_:1}),a(b,{effect:"dark",content:"\u5220\u9664",placement:"top"},{default:l(()=>[a(u,{icon:m(Z),onClick:i=>N([e.row.id])},null,8,["icon","onClick"])]),_:2},1024)]),_:1})]),_:1},8,["data"])])),[[H,m(n).loading]])]),footer:l(()=>[E("div",ge,[E("div",fe,[a(M,{layout:"total, sizes, prev, pager, next, jumper",total:m(n).total,onSizeChange:t[2]||(t[2]=e=>v("limit",e)),onCurrentChange:t[3]||(t[3]=e=>v("page",e))},null,8,["total"])]),E("div",he,[a(u,{class:"submit-btn",type:"primary",onClick:t[4]||(t[4]=e=>P())},{default:l(()=>[Ce]),_:1})])])]),_:1}),a(R,{modelValue:m(n).openDialog,"onUpdate:modelValue":t[5]||(t[5]=e=>m(n).openDialog=e),title:"\u6279\u91CF\u6DFB\u52A0\u5206\u7C7B",width:"20%",onClose:B},{default:l(()=>[a(G,{"label-width":"120px"},{default:l(()=>[a(u,{onClick:L,type:"primary"},{default:l(()=>[ye]),_:1}),(c(!0),p(D,null,x(m(n).categoryList,(e,i)=>(c(),p("div",{style:{"margin-top":"10px"},key:i},[a(_,{style:{width:"300px"},modelValue:e.name,"onUpdate:modelValue":C=>e.name=C,placeholder:"\u8BF7\u8F93\u5165\u5206\u7C7B\u540D\u79F0"},null,8,["modelValue","onUpdate:modelValue"])]))),128)),a(q,{style:{"margin-left":"0","margin-top":"10px"}},{default:l(()=>[a(u,{type:"primary",onClick:S},{default:l(()=>[we]),_:1}),a(u,{onClick:B},{default:l(()=>[Be]),_:1})]),_:1})]),_:1})]),_:1},8,["modelValue"])],64)}}});const ve=te(be,[["__scopeId","data-v-6b0ac6c2"]]);export{ve as default};