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{S as a,A as l,U as t,e as o,s,E as n}from"./vendor-element-B74pkaZM.js";import{_ as u}from"./index-C0spxJBI.js";import{a as r}from"./index-n5dZU89t.js";import{t as d,r as i,a2 as p,U as c,E as m,F as v,O as f,B as y,L as _,K as h,x}from"./vendor-core-k7kcNcJz.js";import"./index.vue_vue_type_script_setup_true_lang-Dnj11IW3.js";import"./vendor-icons-CkMBQOzK.js";const g={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=d({__name:"ReportModal",props:{modelValue:{type:Boolean},shop:{}},emits:["update:modelValue","success"],setup(d,{emit:j}){const k=d,U=j,C=i(),P=i(!1),q=i(!1),B=i(""),E=p({content:""}),M={content:[{required:!0,message:"请输入举报原因",trigger:"blur"}]};c(()=>k.modelValue,e=>{e||(q.value=!1,B.value="",E.content="")});const R=()=>{q.value=!0,B.value="verified_"+Date.now()},S=()=>e(null,null,function*(){C.value&&(q.value?yield C.value.validate(a=>e(null,null,function*(){if(a){P.value=!0;try{yield(e={shop_id:k.shop.id,content:E.content,verify_code:B.value},r.post({url:"/api/shop/report",data:e,showSuccessMessage:!0})),U("success"),U("update:modelValue",!1)}catch(l){}finally{P.value=!1}}var e})):n.warning("请先完成滑动验证"))});return(e,n)=>{const r=l,i=a,p=u,c=t,j=o,k=s;return x(),m(k,{"model-value":d.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:v(()=>[y("div",w,[f(j,{onClick:n[2]||(n[2]=a=>e.$emit("update:modelValue",!1))},{default:v(()=>[...n[5]||(n[5]=[h("取消",-1)])]),_:1}),f(j,{type:"primary",loading:P.value,onClick:S},{default:v(()=>[...n[6]||(n[6]=[h(" 提交举报 ",-1)])]),_:1},8,["loading"])])]),default:v(()=>[f(c,{ref_key:"formRef",ref:C,model:E,rules:M,"label-width":"80px","label-position":"top"},{default:v(()=>{var e;return[y("div",g,[y("div",b,[n[4]||(n[4]=y("span",null,"店铺名称：",-1)),y("span",V,_(null==(e=d.shop)?void 0:e.name),1)])]),f(i,{label:"举报原因",prop:"content"},{default:v(()=>[f(r,{modelValue:E.content,"onUpdate:modelValue":n[0]||(n[0]=e=>E.content=e),type:"textarea",rows:4,placeholder:"请详细描述您举报的原因（如：欺诈、违禁品等）"},null,8,["modelValue"])]),_:1}),f(i,{label:"验证",required:""},{default:v(()=>[f(p,{value:q.value,"onUpdate:value":n[1]||(n[1]=e=>q.value=e),width:"100%",height:40,text:"请按住滑块拖动验证","success-text":"验证通过",onPassCallback:R},null,8,["value"])]),_:1})]}),_:1},8,["model"])]),_:1},8,["model-value"])}}});export{j as default};
