var e=(e,a,l)=>new Promise((t,o)=>{var s=e=>{try{u(l.next(e))}catch(a){o(a)}},n=e=>{try{u(l.throw(e))}catch(a){o(a)}},u=e=>e.done?t(e.value):Promise.resolve(e.value).then(s,n);u((l=l.apply(e,a)).next())});import{N as a,O as l,k as t,h as o,f as s,E as n}from"./vendor-element-DeUXcxiO.js";import{_ as u}from"./index-BOtePF9O.js";import{a as d}from"./index-u3-3P71T.js";import{t as r,r as i,a1 as p,F as c,S as m,x as v,T as f,a0 as y,B as h,W as x,ag as g}from"./vendor-core-DYzzIYU8.js";import"./vendor-icons-C-muqgtW.js";const _={class:"bg-gray-50 p-3 rounded mb-4 text-sm text-gray-600"},b={class:"flex justify-between mb-1"},V={class:"font-medium text-gray-900"},w={class:"flex justify-end gap-2"},j=r({__name:"ReportModal",props:{modelValue:{type:Boolean},shop:{}},emits:["update:modelValue","success"],setup(r,{emit:j}){const k=r,C=j,P=i(),U=i(!1),q=i(!1),B=i(""),M=p({content:""}),R={content:[{required:!0,message:"请输入举报原因",trigger:"blur"}]};c(()=>k.modelValue,e=>{e||(q.value=!1,B.value="",M.content="")});const S=()=>{q.value=!0,B.value="verified_"+Date.now()},$=()=>e(null,null,function*(){P.value&&(q.value?yield P.value.validate(a=>e(null,null,function*(){if(a){U.value=!0;try{yield(e={shop_id:k.shop.id,content:M.content,verify_code:B.value},d.post({url:"/api/shop/report",data:e,showSuccessMessage:!0})),C("success"),C("update:modelValue",!1)}catch(l){}finally{U.value=!1}}var e})):n.warning("请先完成滑动验证"))});return(e,n)=>{const d=t,i=l,p=u,c=a,j=o,k=s;return v(),m(k,{"model-value":r.modelValue,title:"举报店铺",width:"500px","close-on-click-modal":!1,"append-to-body":"","onUpdate:modelValue":n[3]||(n[3]=a=>e.$emit("update:modelValue",a))},{footer:f(()=>[h("div",w,[y(j,{onClick:n[2]||(n[2]=a=>e.$emit("update:modelValue",!1))},{default:f(()=>[...n[5]||(n[5]=[g("取消",-1)])]),_:1}),y(j,{type:"primary",loading:U.value,onClick:$},{default:f(()=>[...n[6]||(n[6]=[g(" 提交举报 ",-1)])]),_:1},8,["loading"])])]),default:f(()=>[y(c,{ref_key:"formRef",ref:P,model:M,rules:R,"label-width":"80px","label-position":"top"},{default:f(()=>{var e;return[h("div",_,[h("div",b,[n[4]||(n[4]=h("span",null,"店铺名称：",-1)),h("span",V,x(null==(e=r.shop)?void 0:e.name),1)])]),y(i,{label:"举报原因",prop:"content"},{default:f(()=>[y(d,{modelValue:M.content,"onUpdate:modelValue":n[0]||(n[0]=e=>M.content=e),type:"textarea",rows:4,placeholder:"请详细描述您举报的原因（如：欺诈、违禁品等）"},null,8,["modelValue"])]),_:1}),y(i,{label:"验证",required:""},{default:f(()=>[y(p,{value:q.value,"onUpdate:value":n[1]||(n[1]=e=>q.value=e),width:"100%",height:40,text:"请按住滑块拖动验证","success-text":"验证通过",onPassCallback:S},null,8,["value"])]),_:1})]}),_:1},8,["model"])]),_:1},8,["model-value"])}}});export{j as default};
