import{G as X,H as Y,a8 as h,k as ee,D as ue,C as le,v as te,w as oe,M as ae,b as re,N as se,F as ie,I as de,L as pe}from"./element-plus.91c68cc0.js";import{_ as ne}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.85ada49c.js";import{_ as me}from"./picker.bb96af0c.js";import{k as _e}from"./index.d12b3af4.js";import{b as fe,d as be,e as Fe}from"./store_product.9ae93a40.js";import{d as R,s as Ee,r as F,Z as S,i as ge,ap as ce,o as E,K as g,L as t,a as B,S as L,u as o,U as u,R as i,Q as x,M as Ce,j as Be}from"./@vue.76ce7aa3.js";import"./lodash.4e6d2a38.js";import{a as Ve,u as ve}from"./vue-router.10bd5b90.js";import{a as ye}from"./store_category.b8c1e5ac.js";import{a as we}from"./store_product_unit.dc1a8ac4.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.9ffef7f8.js";import"./@element-plus.73235148.js";import"./dayjs.0112e2c7.js";import"./@babel.80d29b7b.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./index.vue_vue_type_script_setup_true_lang.863ae816.js";import"./usePaging.f8c888e4.js";import"./useDictOptions.1f11cf62.js";import"./system_store.de1a4364.js";import"./index.e03c2e5b.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.cf0d972e.js";import"./index.f2e66d1e.js";import"./index.839c505b.js";import"./vuedraggable.c04c7c0c.js";import"./vue.3299ef77.js";import"./sortablejs.c62bcaf8.js";import"./axios.cffda5ac.js";import"./jspdf.6c61b9d3.js";import"./fflate.0418c72f.js";import"./pinia.f3529286.js";import"./css-color-function.bb8c34b2.js";import"./color.fbd63fe8.js";import"./clone.31a3aa2c.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./ms.564e106c.js";import"./nprogress.b502f541.js";import"./vue-clipboard3.e775fc74.js";import"./clipboard.6417898a.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.8d65305c.js";const De={class:"mb-4 text-lg font-bold"},xe={class:"mb-2"},Ae=R({name:"storeProductEdit"}),Uu=R({...Ae,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(Ue,{emit:ke}){const A=Ee();_e();const m=F("add"),l=S({id:"",image:"",store_name:"",bar_code:"",store_info:"",product_type:0,cate_arr:[],cate_id:"",price:"",vip_price:"",unit:"",stock:"",swap:"",cost:"",purchase:"",batch:1,store_batch:1,manufacturer_information:"",rose:"0",is_return:1,is_store_all:1,is_show:1}),b=F(!1),f=F([]),N=r=>{f.value=f.value.filter(e=>e.id!==r)},I=r=>{r.forEach(e=>{f.value.find(n=>n.id==e.id)||f.value.push(e)}),b.value=!1};let V,v;const y=F(!1);let w;ge(()=>{});const P=r=>(w=r,y.value=!0,U.lazyLoad(v,V),!1),U={value:"id",label:"name",lazy:!0,lazyLoad(r,e){V||(V=e),v||(v=r);const n=r.value||0;let s={};y.value?(s={name:w},w||(s={pid:n,page_size:1e4})):s={pid:n,page_size:1e4},ye({...s}).then(p=>{e(p.lists.map(d=>(d.leaf=d.is_children==0,y.value=!1,d)))})}},k=F([]);(()=>{we({}).then(r=>{k.value=r.lists})})();const z=S({store_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",trigger:["blur"]}],cate_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u5206\u7C7B",trigger:["blur","change"]}],cate_arr:[{required:!0,message:"\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B",trigger:["blur","change"]}],price:[{required:!0,message:"\u8BF7\u8F93\u5165\u7EC8\u7AEF\u96F6\u552E\u4EF7",trigger:["blur"]}],vip_price:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F1A\u5458\u4EF7",trigger:["blur"]}],unit:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u5355\u4F4D",trigger:["blur","change"]}],stock:[{required:!0,message:"\u8BF7\u8F93\u5165\u552E\u5356\u5E93\u5B58",trigger:["blur"]}],swap:[{required:!0,message:"\u8BF7\u8F93\u5165\u5151\u6362\u5E93\u5B58",trigger:["blur"]}],cost:[{required:!0,message:"\u8BF7\u8F93\u5165\u95E8\u5E97\u96F6\u552E",trigger:["blur"]}],purchase:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F9B\u8D27\u4EF7",trigger:["blur"]}],batch:[{required:!0,message:"\u8BF7\u8F93\u5165\u8D77\u6279\u91CF",trigger:["blur"]}],image:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u56FE\u7247",trigger:["blur","change"]}]}),M=async r=>{for(const e in l)r[e]!=null&&r[e]!=null&&(l[e]=r[e]);l.cate_arr[0]&&(l.cate_arr=l.cate_arr.map(e=>Number(e))),console.log(l.cate_arr)},T=async r=>{const e=await fe({id:r.id});M(e)},$=Ve(),c=ve(),j=async()=>{var e;await((e=A.value)==null?void 0:e.validate());const r={...l};if(l.is_store_all==0&&m.value=="add"?r.store_arr=f.value.map(n=>n.id):m.value=="edit"&&(r.is_store_all=0),!r.cate_arr.length)return ee.error("\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B");r.cate_id=r.cate_arr[r.cate_arr.length-1],m.value=="edit"?await be(r):await Fe(r),$.push({path:"/store/store_product?=",query:{page_no:c.query.page}})};return c.query.id&&c.query.mode=="edit"&&(m.value="edit",T({id:c.query.id})),(r,e)=>{const n=me,s=ue,p=le,d=X,C=Y,q=h,G=te,D=oe,_=ae,O=re,H=se,K=ie,Q=ne,Z=de,J=pe,W=ce("perms");return E(),g(J,null,{default:t(()=>[B("div",De,L(o(m)=="add"?"\u6DFB\u52A0\u5546\u54C1":"\u7F16\u8F91\u5546\u54C1"),1),B("div",null,[u(K,{ref_key:"formRef",ref:A,model:o(l),"label-width":"120px",rules:o(z)},{default:t(()=>[u(s,{label:"\u5546\u54C1\u56FE\u7247",prop:"image"},{default:t(()=>[u(n,{modelValue:o(l).image,"onUpdate:modelValue":e[0]||(e[0]=a=>o(l).image=a),limit:1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:t(()=>[u(p,{modelValue:o(l).store_name,"onUpdate:modelValue":e[1]||(e[1]=a=>o(l).store_name=a),class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u6761\u7801",prop:"bar_code"},{default:t(()=>[u(p,{modelValue:o(l).bar_code,"onUpdate:modelValue":e[2]||(e[2]=a=>o(l).bar_code=a),class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u6761\u7801",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u89C4\u683C",prop:"store_info"},{default:t(()=>[u(p,{modelValue:o(l).store_info,"onUpdate:modelValue":e[3]||(e[3]=a=>o(l).store_info=a),class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u89C4\u683C",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u7C7B\u578B",prop:"product_type"},{default:t(()=>[u(C,{modelValue:o(l).product_type,"onUpdate:modelValue":e[4]||(e[4]=a=>o(l).product_type=a),disabled:o(m)!="add"},{default:t(()=>[u(d,{label:0},{default:t(()=>e[18]||(e[18]=[i("\u666E\u901A\u4EA7\u54C1")])),_:1}),u(d,{label:4},{default:t(()=>e[19]||(e[19]=[i("\u6D3B\u52A8\u4EA7\u54C1")])),_:1}),u(d,{label:5},{default:t(()=>e[20]||(e[20]=[i("\u6279\u53D1\u4EA7\u54C1")])),_:1}),u(d,{label:2},{default:t(()=>e[21]||(e[21]=[i("\u5151\u6362\u4EA7\u54C1")])),_:1}),u(d,{label:3},{default:t(()=>e[22]||(e[22]=[i("\u8D60\u54C1")])),_:1})]),_:1},8,["modelValue","disabled"])]),_:1}),u(s,{label:"\u5546\u54C1\u5206\u7C7B",prop:"cate_arr"},{default:t(()=>[u(q,{class:"w-[500px]",modelValue:o(l).cate_arr,"onUpdate:modelValue":e[5]||(e[5]=a=>o(l).cate_arr=a),filterable:"",clearable:"","before-filter":P,props:U,placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B"},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u5355\u4F4D",prop:"unit"},{default:t(()=>[u(q,{class:"w-[500px]",modelValue:o(l).unit,"onUpdate:modelValue":e[6]||(e[6]=a=>o(l).unit=a),options:o(k),props:{value:"id",label:"name",emitPath:!1},placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5355\u4F4D"},null,8,["modelValue","options"])]),_:1}),u(s,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase"},{default:t(()=>[u(p,{modelValue:o(l).purchase,"onUpdate:modelValue":e[7]||(e[7]=a=>o(l).purchase=a),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4F9B\u8D27\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u6237\u4EF7",prop:"cost"},{default:t(()=>[u(p,{modelValue:o(l).cost,"onUpdate:modelValue":e[8]||(e[8]=a=>o(l).cost=a),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u6237\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u4F1A\u5458\u4EF7",prop:"vip_price"},{default:t(()=>[u(p,{modelValue:o(l).vip_price,"onUpdate:modelValue":e[9]||(e[9]=a=>o(l).vip_price=a),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4F1A\u5458\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u7EC8\u7AEF\u96F6\u552E\u4EF7",prop:"price"},{default:t(()=>[u(p,{modelValue:o(l).price,"onUpdate:modelValue":e[10]||(e[10]=a=>o(l).price=a),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u7EC8\u7AEF\u96F6\u552E\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u8D77\u6279\u91CF",prop:"batch"},{default:t(()=>[u(p,{modelValue:o(l).batch,"onUpdate:modelValue":e[11]||(e[11]=a=>o(l).batch=a),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u96F6\u552E\u8D77\u6279\u91CF",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u6BDB\u5229\u7387",prop:"rose"},{default:t(()=>[u(G,{modelValue:o(l).rose,"onUpdate:modelValue":e[12]||(e[12]=a=>o(l).rose=a),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u6BDB\u5229\u7387",readonly:!1},{suffix:t(()=>e[23]||(e[23]=[i("%")])),_:1},8,["modelValue"])]),_:1}),u(s,{label:"\u9000\u8D27",prop:"is_return"},{default:t(()=>[u(C,{modelValue:o(l).is_return,"onUpdate:modelValue":e[13]||(e[13]=a=>o(l).is_return=a)},{default:t(()=>[u(d,{label:1},{default:t(()=>e[24]||(e[24]=[i("\u652F\u6301")])),_:1}),u(d,{label:0},{default:t(()=>e[25]||(e[25]=[i("\u4E0D\u652F\u6301")])),_:1})]),_:1},8,["modelValue"])]),_:1}),u(s,{label:"\u72B6\u6001",prop:"is_show"},{default:t(()=>[u(C,{modelValue:o(l).is_show,"onUpdate:modelValue":e[14]||(e[14]=a=>o(l).is_show=a)},{default:t(()=>[u(d,{label:1},{default:t(()=>e[26]||(e[26]=[i("\u4E0A\u67B6")])),_:1}),u(d,{label:0},{default:t(()=>e[27]||(e[27]=[i("\u4E0B\u67B6")])),_:1})]),_:1},8,["modelValue"])]),_:1}),o(m)=="add"?(E(),g(s,{key:0,label:"\u6240\u5C5E\u95E8\u5E97",prop:"store_id"},{default:t(()=>[u(C,{modelValue:o(l).is_store_all,"onUpdate:modelValue":e[15]||(e[15]=a=>o(l).is_store_all=a)},{default:t(()=>[u(d,{label:1},{default:t(()=>e[28]||(e[28]=[i("\u5168\u90E8\u95E8\u5E97")])),_:1}),u(d,{label:0},{default:t(()=>e[29]||(e[29]=[i("\u90E8\u5206\u95E8\u5E97")])),_:1})]),_:1},8,["modelValue"]),e[32]||(e[32]=B("div",{class:"w-full",style:{color:"#64748b"}},"\u53EF\u9009\u62E9\u5C06\u5546\u54C1\u540C\u6B65\u5230\u54EA\u4E9B\u95E8\u5E97\u4F7F\u7528",-1)),B("div",xe,[o(l).is_store_all==0?(E(),g(D,{key:0,type:"primary",onClick:e[16]||(e[16]=a=>b.value=!0)},{default:t(()=>e[30]||(e[30]=[i("\u6DFB\u52A0\u95E8\u5E97")])),_:1})):x("",!0)]),o(l).is_store_all==0?(E(),g(H,{key:0,data:o(f)},{default:t(()=>[u(_,{label:"ID",prop:"id","show-overflow-tooltip":""}),u(_,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),u(_,{label:"\u624B\u673A\u53F7\u7801",prop:"phone","show-overflow-tooltip":""}),u(_,{label:"\u8BE6\u7EC6\u5730\u5740",prop:"detailed_address","show-overflow-tooltip":""}),u(_,{label:"\u95E8\u5E97logo",prop:"image","show-overflow-tooltip":""},{default:t(({row:a})=>[u(O,{src:a.image,class:"w-[50px] h-[50px]","preview-teleported":!0},null,8,["src"])]),_:1}),u(_,{label:"\u8425\u4E1A\u72B6\u6001",prop:"is_show","show-overflow-tooltip":""},{default:t(({row:a})=>[i(L(a.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),u(_,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:t(({row:a})=>[Ce((E(),g(D,{type:"danger",link:"",onClick:Se=>N(a.id)},{default:t(()=>e[31]||(e[31]=[i(" \u5220\u9664 ")])),_:2},1032,["onClick"])),[[W,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])):x("",!0)]),_:1})):x("",!0),u(s,{label:""},{default:t(()=>[u(D,{onClick:j,type:"primary",class:"w-40"},{default:t(()=>e[33]||(e[33]=[i("\u63D0\u4EA4")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),u(Z,{modelValue:o(b),"onUpdate:modelValue":e[17]||(e[17]=a=>Be(b)?b.value=a:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:t(()=>[u(Q,{onOnBindStore:I})]),_:1},8,["modelValue"])]),_:1})}}});export{Uu as default};