import{a0 as j,Q as z,R as Q,D as $,w as H,L as J,C as K,M as X,F as Y}from"./element-plus.9cae3cb1.js";import{P as Z}from"./index.b375235f.js";import{r as l}from"./index.7f83e315.js";import"./lodash.fc1b942f.js";import"./dayjs.37feae28.js";import{a as ee}from"./master_worker.fd9db8a6.js";import{a as oe}from"./goods.da5748c3.js";import{d as A,s as B,r as c,b as te,_ as F,o as g,c as h,V as s,M as u,u as i,U as ae,aa as se,L as re,a as ue,S as v}from"./@vue.96c135a1.js";function we(t){return l.get({url:"/master_commission.master_worker_commission_config/lists",params:t})}function ie(t){return l.post({url:"/master_commission.master_worker_commission_config/add",params:t})}function ne(t){return l.post({url:"/master_commission.master_worker_commission_config/edit",params:t})}function De(t){return l.post({url:"/master_commission.master_worker_commission_config/delete",params:t})}function le(t){return l.get({url:"/master_commission.master_worker_commission_config/detail",params:t})}function Be(t){return l.post({url:"/master_commission.master_worker_commission_config/examine",params:t})}function Fe(t){return l.post({url:"/master_commission.master_worker_commission_config/offCommission",params:t})}const me={class:"edit-popup"},ce={class:"flex-1 min-w-0"},de=A({name:"masterWorkerCommissionConfigEdit"}),he=A({...de,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(t,{expose:x,emit:V}){const k=V,C=B(),d=B(),_=c("add"),b=c(),M=te(()=>_.value=="edit"?"\u7F16\u8F91\u5DE5\u7A0B\u5E08\u63D0\u6210\u914D\u7F6E\u8868":"\u65B0\u589E\u5DE5\u7A0B\u5E08\u63D0\u6210\u914D\u7F6E\u8868"),r=F({id:"",master_worker_id:"",submit_admin_id:"",examine_admin_id:"",voucher_status:"",notice_rule:"",block_data:[]}),I=F({master_worker_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u5DE5\u7A0B\u5E08ID",trigger:["blur"]}],submit_admin_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u63D0\u4EA4\u4EBAID",trigger:["blur"]}],examine_admin_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u5BA1\u6838\u4EBAID",trigger:["blur"]}],voucher_status:[{required:!0,message:"\u8BF7\u8F93\u5165\u72B6\u6001\uFF1A1=\u5173\u95ED\uFF0C2=\u542F\u7528",trigger:["blur"]}]}),E=async o=>{for(const e in r)o[e]!=null&&o[e]!=null&&(r[e]=o[e]);r.block_data.map(e=>{let n=[];n=e.category_ids.split(","),e.category_ids=n.map(p=>parseInt(p,10))}),console.log(r)},W=async o=>{const e=await le({id:o.id});E(e)},R=async()=>{var e,n;await((e=C.value)==null?void 0:e.validate());const o={...r};_.value=="edit"?await ne(o):await ie(o),(n=d.value)==null||n.close(),k("success")},T=async(o="add")=>{var e;_.value=o,b.value=await ee({}),(e=d.value)==null||e.open()},U=()=>{k("close")},q=c(0),L=()=>{r.block_data.push({block_key:q.value++,category_ids:[],ratio:0})},S=o=>{r.block_data.splice(o,1)},y=c([]);return(async()=>{const o=await oe({});y.value=o})(),x({open:T,setFormData:E,getDetail:W}),(o,e)=>{const n=z,p=Q,w=$,D=H,N=j,f=J,O=K,P=X,G=Y;return g(),h("div",me,[s(Z,{ref_key:"popupRef",ref:d,title:i(M),async:!0,width:"80%",onConfirm:R,onClose:U},{default:u(()=>[s(G,{ref_key:"formRef",ref:C,model:i(r),"label-width":"90px",rules:i(I)},{default:u(()=>[s(w,{label:"\u5DE5\u7A0B\u5E08",prop:"worker_id"},{default:u(()=>[s(p,{class:"flex-1",modelValue:i(r).master_worker_id,"onUpdate:modelValue":e[0]||(e[0]=a=>i(r).master_worker_id=a),clearable:"",placeholder:"\u8BF7\u9009\u62E9\u5173\u8054\u5DE5\u7A0B\u5E08",filterable:""},{default:u(()=>[(g(!0),h(ae,null,se(i(b),(a,m)=>(g(),re(n,{key:m,label:a.name+"\u3010"+a.mobile+"\u3011",value:parseInt(a.value)},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),s(w,{label:"\u5206\u7C7B\u89C4\u5219"},{default:u(()=>[ue("div",ce,[s(D,{type:"primary",class:"mb-4",onClick:L},{default:u(()=>[v("\u6DFB\u52A0\u5206\u7C7B\u89C4\u5219")]),_:1}),s(P,{size:"large",data:i(r).block_data},{default:u(()=>[s(f,{label:"\u670D\u52A1\u5206\u7C7B","min-width":"60"},{default:u(({row:a})=>[s(N,{style:{width:"100%"},modelValue:a.category_ids,"onUpdate:modelValue":m=>a.category_ids=m,options:i(y),props:{expandTrigger:"hover",checkStrictly:!1,multiple:!0,emitPath:!0},clearable:"",filterable:""},null,8,["modelValue","onUpdate:modelValue","options"])]),_:1}),s(f,{label:"\u6BD4\u4F8B(0-1)","min-width":"60"},{default:u(({row:a})=>[s(O,{modelValue:a.ratio,"onUpdate:modelValue":m=>a.ratio=m,type:"number",min:"0",max:"1"},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),s(f,{label:"\u64CD\u4F5C","min-width":"80",fixed:"right"},{default:u(({$index:a})=>[s(D,{type:"danger",link:"",onClick:m=>S(a)},{default:u(()=>[v(" \u5220\u9664 ")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title"])])}}});export{he as _,De as a,Fe as b,Be as c,we as d};
