import{F as J,G as Z,h as S}from"./elementPlus.CSBdF9Zt.js";import{D as $}from"./index.K_MFulpu.js";import{u as w}from"./useResponse.DqThFJSa.js";import{a as H}from"./api.SqjU0NMY.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 g,U as o,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,r)=>{if(i)try{const n=await w(H,{id:e==null?void 0:e.id,...a},k);n&&n.code==2e3&&(c.value=!1,S.success({message:"编辑成功",plain:!0,icon:"Operation"}),E("refresh"))}catch(n){console.error("Error==>",n)}else console.log("error submit!",r)})};function L(){v.value.handleClose()}return(_,l)=>{const i=d("el-input"),r=d("el-form-item"),n=d("el-option"),b=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(),g("div",h,[o(G,{ref_key:"editDrawer",ref:v,modelValue:c.value,"onUpdate:modelValue":l[8]||(l[8]=s=>c.value=s),"close-on-click-modal":!1,"close-on-press-escape":!1,title:"商品监控 - 编辑 ",size:"25%"},{default:u(()=>[o(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(()=>[o(r,{class:"font-medium",label:"ASIN",prop:"asin"},{default:u(()=>[o(i,{modelValue:t(a).asin,"onUpdate:modelValue":l[0]||(l[0]=s=>t(a).asin=s),disabled:!0},null,8,["modelValue"])]),_:1}),o(r,{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(()=>[o(i,{modelValue:t(a).sku,"onUpdate:modelValue":l[1]||(l[1]=s=>t(a).sku=s),placeholder:"请输入SKU"},null,8,["modelValue"])]),_:1}),o(r,{class:"font-medium",label:"店 铺",prop:"shop"},{default:u(()=>[o(i,{modelValue:t(a).shop,"onUpdate:modelValue":l[2]||(l[2]=s=>t(a).shop=s)},null,8,["modelValue"])]),_:1}),o(r,{class:"font-medium",label:"分 组",prop:"tag"},{default:u(()=>[o(b,{modelValue:t(a).tag,"onUpdate:modelValue":l[3]||(l[3]=s=>t(a).tag=s),"allow-create":"",filterable:"",placeholder:"请选择分组"},{default:u(()=>[(m(!0),g(F,null,K(t(M),s=>(m(),B(n,{label:s.tag,value:s.tag},null,8,["label","value"]))),256))]),_:1},8,["modelValue"])]),_:1}),o(r,{class:"font-medium",label:"状 态",prop:"status"},{default:u(()=>[o(b,{modelValue:t(a).status,"onUpdate:modelValue":l[4]||(l[4]=s=>t(a).status=s),disabled:!0},{default:u(()=>[o(n,{label:"正常",value:"1"}),o(n,{label:"失败",value:"2"}),o(n,{label:"暂停",value:"3"}),o(n,{label:"下架",value:"10"})]),_:1},8,["modelValue"])]),_:1}),o(r,{class:"font-medium",label:"国 家",prop:"country_code"},{default:u(()=>[o(b,{modelValue:t(a).country_code,"onUpdate:modelValue":l[5]||(l[5]=s=>t(a).country_code=s),disabled:!0,placeholder:"请选择国家"},{default:u(()=>[(m(!0),g(F,null,K(t(R).country_code,s=>(m(),B(n,{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),o(r,{class:"font-medium",label:"更新频率",prop:"freq"},{default:u(()=>[o(T,{modelValue:t(a).freq,"onUpdate:modelValue":l[6]||(l[6]=s=>t(a).freq=s)},null,8,["modelValue"])]),_:1}),o(r,null,{default:u(()=>[o(z),f("div",D,[o(U,{icon:t(J),onClick:L},{default:u(()=>l[10]||(l[10]=[p("取 消")])),_:1},8,["icon"]),o(U,{icon:t(Z),loading:t(k),type:"primary",onClick:l[7]||(l[7]=s=>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-46f17530"]]);export{ne as default};
