var e=Object.defineProperty,a=Object.getOwnPropertySymbols,l=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,r=(a,l,o)=>l in a?e(a,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[l]=o;import{U as t,S as s,ao as d,ap as u,A as n,e as p,s as c,E as m}from"./vendor-element-B74pkaZM.js";import{c as i}from"./complaint-CSxxDbfa.js";import{t as f,r as y,a2 as v,U as b,E as g,x as w,F as V,O as _,B as h,L as x,K as j}from"./vendor-core-k7kcNcJz.js";import"./index-n5dZU89t.js";const O={class:"bg-gray-50 p-3 rounded mb-4 text-sm text-gray-600"},U={class:"flex justify-between mb-1"},P={class:"font-medium text-gray-900"},k={class:"flex justify-between"},q={class:"font-medium text-gray-900"},C={class:"flex justify-end gap-2"},E=f({__name:"ComplaintModal",props:{modelValue:{type:Boolean},order:{}},emits:["update:modelValue","success"],setup(e,{emit:f}){const E=e,B=f,Q=y(),S=y(!1),$=v({type:"",contact:"",password:"",reason:""}),A={type:[{required:!0,message:"请选择投诉类型",trigger:"change"}],contact:[{required:!0,message:"请输入联系方式",trigger:"blur"}],password:[{required:!0,message:"请设置查询密码",trigger:"blur"}],reason:[{required:!0,message:"请输入详细说明",trigger:"blur"}]};b(()=>E.modelValue,e=>{e&&E.order&&($.contact=E.order.contact||"",$.password=E.order.contact||"",$.type="",$.reason="")});const F=()=>{return e=null,t=null,s=function*(){if(Q.value){try{yield Q.value.validate()}catch(e){return}S.value=!0;try{yield i(((e,t)=>{for(var s in t||(t={}))l.call(t,s)&&r(e,s,t[s]);if(a)for(var s of a(t))o.call(t,s)&&r(e,s,t[s]);return e})({trade_no:E.order.trade_no},$)),m.success("投诉提交成功"),B("update:modelValue",!1),B("success")}catch(t){m.error(t.message||"提交失败，请稍后重试")}finally{S.value=!1}}},new Promise((a,l)=>{var o=e=>{try{d(s.next(e))}catch(a){l(a)}},r=e=>{try{d(s.throw(e))}catch(a){l(a)}},d=e=>e.done?a(e.value):Promise.resolve(e.value).then(o,r);d((s=s.apply(e,t)).next())});var e,t,s};return(a,l)=>{const o=u,r=d,m=s,i=n,f=t,y=p,v=c;return w(),g(v,{"model-value":e.modelValue,title:"申请售后",width:"500px","close-on-click-modal":!1,"append-to-body":"","onUpdate:modelValue":l[5]||(l[5]=e=>a.$emit("update:modelValue",e))},{footer:V(()=>[h("div",C,[_(y,{onClick:l[4]||(l[4]=e=>a.$emit("update:modelValue",!1))},{default:V(()=>[...l[8]||(l[8]=[j("取消",-1)])]),_:1}),_(y,{type:"primary",loading:S.value,onClick:F},{default:V(()=>[...l[9]||(l[9]=[j(" 提交投诉 ",-1)])]),_:1},8,["loading"])])]),default:V(()=>[_(f,{ref_key:"formRef",ref:Q,model:$,rules:A,"label-width":"80px","label-position":"top"},{default:V(()=>{var a,t;return[h("div",O,[h("div",U,[l[6]||(l[6]=h("span",null,"订单号：",-1)),h("span",P,x(null==(a=e.order)?void 0:a.trade_no),1)]),h("div",k,[l[7]||(l[7]=h("span",null,"商品名称：",-1)),h("span",q,x(null==(t=e.order)?void 0:t.product_name),1)])]),_(m,{label:"投诉类型",prop:"type"},{default:V(()=>[_(r,{modelValue:$.type,"onUpdate:modelValue":l[0]||(l[0]=e=>$.type=e),placeholder:"请选择投诉类型",class:"w-full"},{default:V(()=>[_(o,{label:"卡密错误/无效",value:"卡密错误/无效"}),_(o,{label:"商品与描述不符",value:"商品与描述不符"}),_(o,{label:"未收到货",value:"未收到货"}),_(o,{label:"其他问题",value:"其他问题"})]),_:1},8,["modelValue"])]),_:1}),_(m,{label:"联系方式",prop:"contact"},{default:V(()=>[_(i,{modelValue:$.contact,"onUpdate:modelValue":l[1]||(l[1]=e=>$.contact=e),placeholder:"请输入QQ或手机号，方便客服联系"},null,8,["modelValue"])]),_:1}),_(m,{label:"查询密码",prop:"password"},{default:V(()=>[_(i,{modelValue:$.password,"onUpdate:modelValue":l[2]||(l[2]=e=>$.password=e),placeholder:"用于查询投诉进度，建议与联系方式一致",type:"password","show-password":""},null,8,["modelValue"])]),_:1}),_(m,{label:"详细说明",prop:"reason"},{default:V(()=>[_(i,{modelValue:$.reason,"onUpdate:modelValue":l[3]||(l[3]=e=>$.reason=e),type:"textarea",rows:4,placeholder:"请详细描述您遇到的问题，以便我们快速处理"},null,8,["modelValue"])]),_:1})]}),_:1},8,["model"])]),_:1},8,["model-value"])}}});export{E as default};
