import{a0 as P,C as S,D as T,Q as O,R as j,F as N}from"./element-plus.9cae3cb1.js";import{_ as Q}from"./picker.b9386bc9.js";import{P as z}from"./index.b375235f.js";import{a as H}from"./goods.da5748c3.js";import{r as n,t as w}from"./index.7f83e315.js";import{d as V,s as B,r as F,b as J,_ as y,o as _,c as b,V as a,M as r,u as t,U as K,aa as W,L as X}from"./@vue.96c135a1.js";function de(s){return n.get({url:"/reviews.goods_reviews/lists",params:s})}function Y(s){return n.post({url:"/reviews.goods_reviews/add",params:s})}function Z(s){return n.post({url:"/reviews.goods_reviews/edit",params:s})}function ne(s){return n.post({url:"/reviews.goods_reviews/delete",params:s})}function $(s){return n.get({url:"/reviews.goods_reviews/detail",params:s})}const ee={class:"edit-popup"},oe=V({name:"goodsReviewsEdit"}),me=V({...oe,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(s,{expose:C,emit:D}){const c=D,g=B(),m=B(),p=F("add"),E=J(()=>p.value=="edit"?"\u7F16\u8F91\u670D\u52A1\u8BC4\u8BBA":"\u65B0\u589E\u670D\u52A1\u8BC4\u8BBA"),o=y({id:"",goods_id:"",goods_category_id:0,user_id:"",rating:"",comment:"",review_image:"",review_status:""}),R=y({goods_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1ID",trigger:["blur"]}],goods_category_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u5206\u7C7BID",trigger:["blur"]}],user_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u7528\u6237ID",trigger:["blur"]}],rating:[{required:!0,message:"\u8BF7\u8F93\u5165\u8BC4\u4EF7",trigger:["blur"]}]}),f=async l=>{for(const e in o)l[e]!=null&&l[e]!=null&&(o[e]=l[e]);o.create_time=w(o.create_time,"yyyy-mm-dd hh:MM:ss"),o.update_time=w(o.update_time,"yyyy-mm-dd hh:MM:ss")},x=async l=>{const e=await $({id:l.id});f(e)},I=async()=>{var e,i;await((e=g.value)==null?void 0:e.validate());const l={...o};console.log("handleSubmit",l),p.value=="edit"?await Z(l):await Y(l),(i=m.value)==null||i.close(),c("success")},k=(l="add")=>{var e;p.value=l,(e=m.value)==null||e.open()},M=()=>{c("close")},v=F([]);return(async()=>{const l=await H({});v.value=l,console.log("getMenu",l)})(),C({open:k,setFormData:f,getDetail:x}),(l,e)=>{const i=S,d=T,U=P,A=Q,G=O,h=j,q=N;return _(),b("div",ee,[a(z,{ref_key:"popupRef",ref:m,title:t(E),async:!0,width:"550px",onConfirm:I,onClose:M},{default:r(()=>[a(q,{ref_key:"formRef",ref:g,model:t(o),"label-width":"90px",rules:t(R)},{default:r(()=>[a(d,{label:"\u5546\u54C1ID",prop:"goods_id"},{default:r(()=>[a(i,{modelValue:t(o).goods_id,"onUpdate:modelValue":e[0]||(e[0]=u=>t(o).goods_id=u),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1ID"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u5546\u54C1\u5206\u7C7B"},{default:r(()=>[a(U,{modelValue:t(o).goods_category_id,"onUpdate:modelValue":e[1]||(e[1]=u=>t(o).goods_category_id=u),options:t(v),props:{expandTrigger:"hover",emitPath:!1}},null,8,["modelValue","options"])]),_:1}),a(d,{label:"\u7528\u6237ID",prop:"user_id"},{default:r(()=>[a(i,{modelValue:t(o).user_id,"onUpdate:modelValue":e[2]||(e[2]=u=>t(o).user_id=u),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u7528\u6237ID"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u8BC4\u4EF7",prop:"rating"},{default:r(()=>[a(i,{modelValue:t(o).rating,"onUpdate:modelValue":e[3]||(e[3]=u=>t(o).rating=u),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8BC4\u4EF7"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u5185\u5BB9",prop:"comment"},{default:r(()=>[a(i,{class:"flex-1",modelValue:t(o).comment,"onUpdate:modelValue":e[4]||(e[4]=u=>t(o).comment=u),type:"textarea",rows:"4",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u56FE\u7247",prop:"review_image"},{default:r(()=>[a(A,{modelValue:t(o).review_image,"onUpdate:modelValue":e[5]||(e[5]=u=>t(o).review_image=u),limit:"3"},null,8,["modelValue"])]),_:1}),a(d,{label:"\u5BA1\u6838\u72B6\u6001",prop:"review_status"},{default:r(()=>[a(h,{class:"flex-1",modelValue:t(o).review_status,"onUpdate:modelValue":e[6]||(e[6]=u=>t(o).review_status=u),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u5BA1\u6838\u72B6\u6001"},{default:r(()=>[(_(!0),b(K,null,W(s.dictData.review_status,(u,L)=>(_(),X(G,{key:L,label:u.name,value:parseInt(u.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{me as _,ne as a,de as b};
