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