import{k as oe,C as te,D as M,w as O,F as j,M as G,b as q,N as H,O as le,G as ue,H as ae,v as se,I as ie,L as ne}from"./element-plus.7b9d0c0d.js";import{_ as re}from"./index.vue_vue_type_script_setup_true_lang.8b9de773.js";import{d as F,Z,r as w,o as C,c as K,U as e,L as o,u as s,aa as pe,R as p,M as A,a as h,j as y,s as de,ap as me,K as U,S as _e}from"./@vue.18505fe0.js";import{u as ce}from"./usePaging.6a6670f9.js";import{u as fe}from"./useDictOptions.1e75c240.js";import{d as we,e as he,_ as ve}from"./store_product.5324b61b.js";import"./lodash.9dc701ad.js";import{w as Ee}from"./index.887947f5.js";import{a as be}from"./vue-router.101084e3.js";import{a as Ce}from"./store_product_unit.007a344d.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.7347fedc.js";import"./axios.4607972f.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./system_store.5adf4f9f.js";import"./pinia.a969beab.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.0d2736b7.js";import"./vue-clipboard3.7d5a7a5d.js";import"./clipboard.860a1cea.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.b0c09b66.js";const ge={class:"mt-4"},Be={class:"flex mt-4 justify-end"},De=F({name:"systemStoreLists"}),ye=F({...De,emits:["onBindStore"],setup(z,{emit:$}){const b=Z({store_name:""}),g=w([]),k=E=>{g.value=E.map(({id:d})=>d)};fe("");const{pager:r,getLists:m,resetParams:x,resetPage:B}=ce({fetchFun:we,params:b});m();const v=$,_=()=>{let E=r.lists.filter(d=>g.value.includes(d.id));if(!E.length)return oe.error("\u8BF7\u5148\u9009\u62E9\u95E8\u5E97");v("onBindStore",E)};return(E,d)=>{const V=te,S=M,c=O,L=j,n=G,i=q,t=H,u=re,a=le;return C(),K("div",null,[e(L,{class:"mb-[-16px]",model:s(b),inline:""},{default:o(()=>[e(S,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:o(()=>[e(V,{class:"w-[200px]",modelValue:s(b).store_name,"onUpdate:modelValue":d[0]||(d[0]=f=>s(b).store_name=f),onKeydown:pe(s(B),["enter"]),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0"},null,8,["modelValue","onKeydown"])]),_:1}),e(S,null,{default:o(()=>[e(c,{type:"primary",onClick:s(B)},{default:o(()=>[p("\u67E5\u8BE2")]),_:1},8,["onClick"]),e(c,{onClick:s(x)},{default:o(()=>[p("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"]),A((C(),K("div",ge,[e(t,{data:s(r).lists,onSelectionChange:k,height:300},{default:o(()=>[e(n,{type:"selection",width:"55"}),e(n,{label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""}),e(n,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:o(({row:f})=>[e(i,{style:{width:"50px",height:"50px"},src:f.image,"preview-teleported":!0},null,8,["src"])]),_:1}),e(n,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","min-width":"200","show-overflow-tooltip":""}),e(n,{label:"\u5206\u7C7B",prop:"cate_name","min-width":"120","show-overflow-tooltip":""}),e(n,{label:"\u5355\u4F4D",prop:"unit_name","min-width":"80","show-overflow-tooltip":""}),e(n,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price","min-width":"100","show-overflow-tooltip":""}),e(n,{label:"\u6210\u672C\u4EF7",prop:"cost","min-width":"100","show-overflow-tooltip":""}),e(n,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase","min-width":"100","show-overflow-tooltip":""}),e(n,{label:"\u552E\u5356\u5E93\u5B58",prop:"stock","min-width":"100","show-overflow-tooltip":""}),e(n,{label:"\u5151\u6362\u5E93\u5B58",prop:"swap","min-width":"100","show-overflow-tooltip":""}),e(n,{label:"\u9500\u91CF",prop:"sales","min-width":"100","show-overflow-tooltip":""})]),_:1},8,["data"])])),[[a,s(r).loading]]),h("div",Be,[e(u,{modelValue:s(r),"onUpdate:modelValue":d[1]||(d[1]=f=>y(r)?r.value=f:null),onChange:s(m)},null,8,["modelValue","onChange"])]),e(c,{class:"w-full mt-4",type:"primary",onClick:_},{default:o(()=>[p("\u6DFB\u52A0\u5546\u54C1")]),_:1})])}}}),Fe=h("div",{class:"mb-4 text-lg font-bold"}," \u5BFC\u5165\u5546\u54C1\u5230\u95E8\u5E97 ",-1),ke={class:"flex-1 w-full"},xe={class:"mb-2"},Ve={class:"flex-1 w-full"},Se={class:"mb-2"},Le=h("span",{class:"text-info text-xs ml-6"},"\u9ED8\u8BA4\u4E3A\u5206\u914D\u552E\u5356\u5E93\u5B58, \u5982\u9700\u5206\u914D\u5151\u6362\u5E93\u5B58\u8BF7\u9009\u62E9\u5206\u914D\u5151\u6362\u5E93\u5B58",-1),Pe=F({name:"storeProductEdit"}),ho=F({...Pe,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(z,{emit:$}){const b=de(),{removeTab:g}=Ee();w("add");const k=Z({store_id:""}),r=w(!1),m=w([]),x=i=>{m.value=m.value.filter(t=>t.id!==i)},B=i=>{i.forEach(t=>{m.value.find(u=>u.id==t.id)||m.value.push(t)}),r.value=!1},v=w(!1),_=w([]),E=i=>{_.value=_.value.filter(t=>t.id!==i)},d=i=>{i.forEach(t=>{_.value.find(u=>u.id==t.id)||_.value.push(t)}),v.value=!1},V=w([]);(()=>{Ce({}).then(i=>{V.value=i.lists})})();const c=w(1),L=be(),n=async()=>{const i=_.value.map(u=>({id:u.id,stock:u.new_stock||0})),t=m.value.map(u=>u.id);console.log(i,t),he({product_arr:i,store_arr:t,stock_type:c.value}).then(u=>{g(),L.push({path:"/store/store_product"})})};return(i,t)=>{const u=O,a=G,f=q,I=H,D=M,J=se,R=ue,Q=ae,W=j,X=ve,N=ie,Y=ye,ee=ne,T=me("perms");return C(),U(ee,null,{default:o(()=>[Fe,h("div",null,[e(W,{ref_key:"formRef",ref:b,model:s(k),"label-width":"90px"},{default:o(()=>[e(D,{label:"\u95E8\u5E97",prop:"store_id"},{default:o(()=>[h("div",ke,[h("div",xe,[e(u,{type:"primary",onClick:t[0]||(t[0]=l=>r.value=!0)},{default:o(()=>[p("\u6DFB\u52A0\u95E8\u5E97")]),_:1})]),e(I,{data:s(m)},{default:o(()=>[e(a,{label:"ID",prop:"id","show-overflow-tooltip":""}),e(a,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),e(a,{label:"\u624B\u673A\u53F7\u7801",prop:"phone","show-overflow-tooltip":""}),e(a,{label:"\u8BE6\u7EC6\u5730\u5740",prop:"detailed_address","show-overflow-tooltip":""}),e(a,{label:"\u95E8\u5E97logo",prop:"image","show-overflow-tooltip":""},{default:o(({row:l})=>[e(f,{src:l.image,class:"w-[40px] h-[40px]","preview-teleported":!0},null,8,["src"])]),_:1}),e(a,{label:"\u8425\u4E1A\u72B6\u6001",prop:"is_show","show-overflow-tooltip":""},{default:o(({row:l})=>[p(_e(l.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),e(a,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:o(({row:l})=>[A((C(),U(u,{type:"danger",link:"",onClick:P=>x(l.id)},{default:o(()=>[p(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[T,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])])]),_:1}),e(D,{label:"\u5546\u54C1",prop:"store_id"},{default:o(()=>[h("div",Ve,[h("div",Se,[e(u,{type:"primary",onClick:t[1]||(t[1]=l=>v.value=!0)},{default:o(()=>[p("\u6DFB\u52A0\u5546\u54C1")]),_:1})]),e(I,{data:s(_)},{default:o(()=>[e(a,{label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""}),e(a,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:o(({row:l})=>[e(f,{style:{width:"50px",height:"50px"},src:l.image,"preview-teleported":!0},null,8,["src"])]),_:1}),e(a,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","min-width":"200","show-overflow-tooltip":""}),e(a,{label:"\u5206\u7C7B",prop:"cate_name","min-width":"120","show-overflow-tooltip":""}),e(a,{label:"\u5355\u4F4D",prop:"unit_name","min-width":"80","show-overflow-tooltip":""}),e(a,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price","min-width":"100","show-overflow-tooltip":""}),e(a,{label:"\u5206\u914D\u5E93\u5B58","min-width":"150"},{default:o(({row:l})=>[e(J,{modelValue:l.new_stock,"onUpdate:modelValue":P=>l.new_stock=P,min:1},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(a,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:o(({row:l})=>[A((C(),U(u,{type:"danger",link:"",onClick:P=>E(l.id)},{default:o(()=>[p(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[T,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])])]),_:1}),e(D,{label:"\u5E93\u5B58\u7C7B\u578B",prop:"stock_type"},{default:o(()=>[e(Q,{modelValue:s(c),"onUpdate:modelValue":t[2]||(t[2]=l=>y(c)?c.value=l:null),class:"ml-6"},{default:o(()=>[e(R,{value:1,label:1},{default:o(()=>[p("\u5206\u914D\u552E\u5356\u5E93\u5B58")]),_:1}),e(R,{value:2,label:2},{default:o(()=>[p("\u5206\u914D\u5151\u6362\u5E93\u5B58")]),_:1})]),_:1},8,["modelValue"]),Le]),_:1}),e(D,{label:""},{default:o(()=>[e(u,{onClick:n,type:"primary",class:"w-40"},{default:o(()=>[p("\u63D0\u4EA4")]),_:1})]),_:1})]),_:1},8,["model"])]),e(N,{modelValue:s(r),"onUpdate:modelValue":t[3]||(t[3]=l=>y(r)?r.value=l:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:o(()=>[e(X,{onOnBindStore:B})]),_:1},8,["modelValue"]),e(N,{modelValue:s(v),"onUpdate:modelValue":t[4]||(t[4]=l=>y(v)?v.value=l:null),title:"\u9009\u62E9\u5546\u54C1",width:"70%"},{default:o(()=>[e(Y,{onOnBindStore:d})]),_:1},8,["modelValue"])]),_:1})}}});export{ho as default};