import{F as J,G as Z,h as S}from"./elementPlus.CqHltQSO.js";import{D as $}from"./index.DoJnwA7v.js";import{u as w}from"./useResponse.DqThFJSa.js";import{a as H}from"./api.BL2QhlFZ.js";import{d as P,aJ as q,r as x,aK as Q,aI as W,Z as C,ai as d,o as m,c as b,U as s,O as u,B as X,u as t,S as p,a as f,F,a8 as K,M as B}from"./vue.1RczIYhx.js";import{_ as Y}from"./_plugin-vue_export-helper.DlAUqK2U.js";const h={class:"drawer-container"},D={class:"flex flex-1 justify-end"},ee=P({__name:"EditDrawer",props:q({rowData:Object},{modelValue:{default:!1},modelModifiers:{}}),emits:q(["refresh"],["update:modelValue"]),setup(V,{emit:O}){const M=X("groupOptions"),{data:R}=$(),k=x(!1),c=Q(V,"modelValue"),v=W("editDrawer"),j=V,{rowData:e}=j,E=O,y=x(),a=C({asin:e==null?void 0:e.asin,sku:e==null?void 0:e.goods.sku,country_code:e==null?void 0:e.country_code,shop:e==null?void 0:e.shop_name,shop_id:e==null?void 0:e.shop_id,tag:e==null?void 0:e.goods.tag,status:e==null?void 0:e.status.toString(),freq:e==null?void 0:e.freq}),N=C({sku:[{required:!0,message:"请输入SKU",trigger:"blur"}],shop:[{required:!0,message:"请输入店铺",trigger:"blur"}],tag:[{required:!0,message:"请输入分组",trigger:"blur"}]});a.sku=[e.goods.sku,e.goods.sku2,e.goods.sku3].filter(Boolean).join(",");const I=async _=>{if(!_)return;if(a.sku.split(",").length>3){S.warning("SKU 输入不能超过三个，请检查 SKU");return}await _.validate(async(i,n)=>{if(i)try{const r=await w(H,{id:e==null?void 0:e.id,...a},k);r&&r.code==2e3&&(c.value=!1,S.success({message:"编辑成功",plain:!0,icon:"Operation"}),E("refresh"))}catch(r){console.error("Error==>",r)}else console.log("error submit!",n)})};function L(){v.value.handleClose()}return(_,l)=>{const i=d("el-input"),n=d("el-form-item"),r=d("el-option"),g=d("el-select"),T=d("el-input-number"),z=d("el-divider"),U=d("el-button"),A=d("el-form"),G=d("el-drawer");return m(),b("div",h,[s(G,{ref_key:"editDrawer",ref:v,modelValue:c.value,"onUpdate:modelValue":l[8]||(l[8]=o=>c.value=o),"close-on-click-modal":!1,"close-on-press-escape":!1,title:"商品监控 - 编辑 ",size:"25%"},{default:u(()=>[s(A,{ref_key:"ruleFormRef",ref:y,model:t(a),rules:t(N),class:"mx-2.5 mt-7","label-position":"top","label-width":"auto","status-icon":""},{default:u(()=>[s(n,{class:"font-medium",label:"ASIN",prop:"asin"},{default:u(()=>[s(i,{modelValue:t(a).asin,"onUpdate:modelValue":l[0]||(l[0]=o=>t(a).asin=o),disabled:!0},null,8,["modelValue"])]),_:1}),s(n,{class:"font-medium",label:"SKU",prop:"sku"},{label:u(()=>l[9]||(l[9]=[p(" SKU "),f("span",{class:"ml-4",style:{color:"#909399"}},[f("i",{class:"bi bi-info-circle"}),p(' 多个sku用逗号","连接 '),f("span",{class:"italic ml-2"}," e.g. sku1,sku2,sku3 ")],-1)])),default:u(()=>[s(i,{modelValue:t(a).sku,"onUpdate:modelValue":l[1]||(l[1]=o=>t(a).sku=o),placeholder:"请输入SKU"},null,8,["modelValue"])]),_:1}),s(n,{class:"font-medium",label:"店 铺",prop:"shop"},{default:u(()=>[s(i,{modelValue:t(a).shop,"onUpdate:modelValue":l[2]||(l[2]=o=>t(a).shop=o)},null,8,["modelValue"])]),_:1}),s(n,{class:"font-medium",label:"分 组",prop:"tag"},{default:u(()=>[s(g,{modelValue:t(a).tag,"onUpdate:modelValue":l[3]||(l[3]=o=>t(a).tag=o),"allow-create":"",filterable:"",placeholder:"请选择分组"},{default:u(()=>[(m(!0),b(F,null,K(t(M),o=>(m(),B(r,{label:o.tag,value:o.tag},null,8,["label","value"]))),256))]),_:1},8,["modelValue"])]),_:1}),s(n,{class:"font-medium",label:"状 态",prop:"status"},{default:u(()=>[s(g,{modelValue:t(a).status,"onUpdate:modelValue":l[4]||(l[4]=o=>t(a).status=o),disabled:!0},{default:u(()=>[s(r,{label:"启用",value:"1"}),s(r,{label:"暂停",value:"2"})]),_:1},8,["modelValue"])]),_:1}),s(n,{class:"font-medium",label:"国 家",prop:"country_code"},{default:u(()=>[s(g,{modelValue:t(a).country_code,"onUpdate:modelValue":l[5]||(l[5]=o=>t(a).country_code=o),disabled:!0,placeholder:"请选择国家"},{default:u(()=>[(m(!0),b(F,null,K(t(R).country_code,o=>(m(),B(r,{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),s(n,{class:"font-medium",label:"更新频率",prop:"freq"},{default:u(()=>[s(T,{modelValue:t(a).freq,"onUpdate:modelValue":l[6]||(l[6]=o=>t(a).freq=o)},null,8,["modelValue"])]),_:1}),s(n,null,{default:u(()=>[s(z),f("div",D,[s(U,{icon:t(J),onClick:L},{default:u(()=>l[10]||(l[10]=[p("取 消")])),_:1},8,["icon"]),s(U,{icon:t(Z),loading:t(k),type:"primary",onClick:l[7]||(l[7]=o=>I(t(y)))},{default:u(()=>l[11]||(l[11]=[p(" 确 定 ")])),_:1},8,["icon","loading"])])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["modelValue"])])}}}),ne=Y(ee,[["__scopeId","data-v-9dcb424d"]]);export{ne as default};
