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