import{U as Q,G as X,H as ee,k as L,J as oe,K as te,D as ue,C as le,w as ae,M as re,b as se,N as ie,F as ne,I as pe,L as de}from"./element-plus.4a7d92a3.js";import{_ as me}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.a4b18d9a.js";import{_ as _e}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.0d133002.js";import{k as ce}from"./index.c7609165.js";import{c as fe}from"./warehouse_order.bbf587ca.js";import{d as S,s as Ee,r as s,Z as we,ap as ve,o as b,K as B,L as t,a as c,U as e,u as r,j as k,c as he,T as be,a9 as ke,R as n,S as De,M as Ce}from"./@vue.18505fe0.js";import"./lodash.9dc701ad.js";import{u as Be,a as ye}from"./vue-router.101084e3.js";import{a as Ve}from"./store_product_unit.16f7e2ce.js";import{a as ge}from"./warehouse.9ba28c8b.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"./index.vue_vue_type_script_setup_true_lang.5d4e738c.js";import"./usePaging.6a6670f9.js";import"./useDictOptions.a0f95660.js";import"./store_product.287da381.js";import"./store_branch_product.113cacf1.js";import"./warehouse_product_storege.b4f4f39b.js";import"./system_store.388b00e0.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 Fe=c("div",{class:"mb-4 text-lg font-bold"},"\u51FA\u5E93\u5546\u54C1\u5230\u95E8\u5E97",-1),xe={class:"flex-1 w-full"},Ue={class:"mb-2"},Ae={class:"flex-1 w-full"},Le={class:"mb-2"},Se=c("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),Re=S({name:"storeProductEdit"}),Fo=S({...Re,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(Ie,{emit:Me}){const y=Be(),R=Ee();ce(),s("add");const p=s(""),V=s([]);s(0);const d=we({store_id:"",manufacture:"",remark:""});y.query.warehouse_id&&(p.value=parseInt(y.query.warehouse_id));const I=()=>{ge({}).then(l=>{V.value=l.lists})},E=s(!1),f=s([]),M=l=>{f.value=f.value.filter(u=>u.id!==l)},O=l=>{f.value=[],f.value.push(l),D(),E.value=!1},w=s(!1),m=s([]),P=l=>{m.value=m.value.filter(u=>u.id!==l)},T=l=>{l.forEach(u=>{m.value.find(i=>i.id==u.id)||m.value.push(u)}),w.value=!1},$=s([]);(()=>{Ve({}).then(l=>{$.value=l.lists})})();const h=s(1),N=s(!0),D=()=>{m.value.map(l=>({id:l.product_id,stock:l.new_stock||0,stocks:l.stock||0}))},Y=ye(),j=async()=>{if(p.value==""){L.error("\u8BF7\u9009\u62E9\u4ED3\u5E93");return}if(D(),N.value==!1)return;const l=m.value.map(i=>({id:i.product_id,stock:i.new_stock||0,batch:i.batch||0})),u=f.value.map(i=>i.id);if(u.length>1){L.error("\u95E8\u5E97\u4E0D\u80FD\u8D85\u8FC7\u4E00\u4E2A");return}fe({product_arr:l,store_arr:u,stock_type:h.value,warehouse_id:p.value,delivery_time:d.manufacture,mark:d.remark}).then(i=>{setTimeout(()=>{Y.push({path:"/warehouse/outbound_order"})},2e3)})};return I(),(l,u)=>{const i=oe,q=te,_=ue,G=Q,g=le,v=ae,a=re,F=se,x=ie,U=X,K=ee,W=ne,H=_e,A=pe,J=me,Z=de,z=ve("perms");return b(),B(Z,null,{default:t(()=>[Fe,c("div",null,[e(W,{ref_key:"formRef",ref:R,model:r(d),"label-width":"90px"},{default:t(()=>[e(_,{label:"\u4ED3\u5E93",prop:"uid"},{default:t(()=>[e(q,{modelValue:r(p),"onUpdate:modelValue":u[0]||(u[0]=o=>k(p)?p.value=o:null),style:{width:"240px"}},{default:t(()=>[(b(!0),he(be,null,ke(r(V),o=>(b(),B(i,{key:o.id,label:o.name,value:o.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),e(_,{label:"\u9001\u8D27\u65F6\u95F4"},{default:t(()=>[e(G,{readonly:!1,class:"flex-1 !flex",modelValue:r(d).manufacture,"onUpdate:modelValue":u[1]||(u[1]=o=>r(d).manufacture=o),clearable:"",type:"date","value-format":"YYYY-MM-DD",placeholder:"\u9009\u62E9\u751F\u4EA7\u65E5\u671F"},null,8,["modelValue"])]),_:1}),e(_,{label:"\u5907\u6CE8"},{default:t(()=>[e(g,{modelValue:r(d).remark,"onUpdate:modelValue":u[2]||(u[2]=o=>r(d).remark=o),type:"input",rows:"4"},null,8,["modelValue"])]),_:1}),e(_,{label:"\u95E8\u5E97",prop:"store_id"},{default:t(()=>[c("div",xe,[c("div",Ue,[e(v,{type:"primary",onClick:u[3]||(u[3]=o=>E.value=!0)},{default:t(()=>[n("\u6DFB\u52A0\u95E8\u5E97")]),_:1})]),e(x,{data:r(f)},{default:t(()=>[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:t(({row:o})=>[e(F,{src:o.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:t(({row:o})=>[n(De(o.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),e(a,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:t(({row:o})=>[Ce((b(),B(v,{type:"danger",link:"",onClick:C=>M(o.id)},{default:t(()=>[n(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[z,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])])]),_:1}),e(_,{label:"\u5546\u54C1",prop:"store_id"},{default:t(()=>[c("div",Ae,[c("div",Le,[e(v,{type:"primary",onClick:u[4]||(u[4]=o=>w.value=!0)},{default:t(()=>[n("\u6DFB\u52A0\u5546\u54C1")]),_:1})]),e(x,{data:r(m)},{default:t(()=>[e(a,{label:"\u5546\u54C1ID",prop:"product_id","show-overflow-tooltip":""}),e(a,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:t(({row:o})=>[e(F,{style:{width:"50px",height:"50px"},src:o.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:"\u5E93\u5B58",prop:"stock","min-width":"100","show-overflow-tooltip":""}),e(a,{label:"\u5206\u914D\u5E93\u5B58","min-width":"150"},{default:t(({row:o})=>[e(g,{modelValue:o.new_stock,"onUpdate:modelValue":C=>o.new_stock=C,onChange:D},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(a,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:t(({row:o})=>[e(v,{type:"danger",link:"",onClick:C=>P(o.id)},{default:t(()=>[n(" \u5220\u9664 ")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])])]),_:1}),e(_,{label:"\u5E93\u5B58\u7C7B\u578B",prop:"stock_type"},{default:t(()=>[e(K,{modelValue:r(h),"onUpdate:modelValue":u[5]||(u[5]=o=>k(h)?h.value=o:null),class:"ml-6"},{default:t(()=>[e(U,{value:1,label:1},{default:t(()=>[n("\u5206\u914D\u552E\u5356\u5E93\u5B58")]),_:1}),e(U,{value:2,label:2},{default:t(()=>[n("\u5206\u914D\u5151\u6362\u5E93\u5B58")]),_:1})]),_:1},8,["modelValue"]),Se]),_:1}),e(_,{label:""},{default:t(()=>[e(v,{onClick:j,type:"primary",class:"w-40"},{default:t(()=>[n("\u63D0\u4EA4")]),_:1})]),_:1})]),_:1},8,["model"])]),e(A,{modelValue:r(E),"onUpdate:modelValue":u[6]||(u[6]=o=>k(E)?E.value=o:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:t(()=>[e(H,{onOnBindStore:O,is_selection:0})]),_:1},8,["modelValue"]),e(A,{modelValue:r(w),"onUpdate:modelValue":u[7]||(u[7]=o=>k(w)?w.value=o:null),title:"\u9009\u62E9\u5546\u54C1",width:"70%"},{default:t(()=>[e(J,{onOnBindStore:T,is_warehouse:"1",warehouse_id:r(p)},null,8,["warehouse_id"])]),_:1},8,["modelValue"])]),_:1})}}});export{Fo as default};