import{k as ce,C as X,D as Y,w as ee,F as le,M as oe,b as ue,N as te,O as ae,G as be,H as Ce,J as ve,K as he,L as we,I as De}from"./element-plus.a63a26dd.js";import{_ as re}from"./index.vue_vue_type_script_setup_true_lang.ecb80feb.js";import{d as K,Z as ne,r as v,o as y,c as L,U as e,L as o,u as t,aa as H,R as d,M as pe,a as F,j as P,i as Fe,K as q,T as G,a9 as W}from"./@vue.18505fe0.js";import{u as de}from"./usePaging.6a6670f9.js";import{b as ie,a as ye,e as Be}from"./purchase_product_offer.4a63cc5a.js";import{a as Ee}from"./supplier.f9619dea.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.4884cfc2.js";import"./axios.932d3f8a.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./index.8a627db9.js";import"./lodash.2473fc51.js";import"./vue-router.101084e3.js";import"./pinia.a969beab.js";import"./css-color-function.9f6a56f3.js";import"./color.d1bc3784.js";import"./clone.83700f2e.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.fcc9be76.js";import"./vue-clipboard3.9e751565.js";import"./clipboard.dda64e67.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.b0c09b66.js";const Ve={class:"mt-4"},ge={class:"flex mt-4 justify-end"},ke=K({name:"systemStoreLists"}),xe=K({...ke,emits:["onBindStore"],setup(se,{emit:h}){const s=ne({buyer_confirm:0}),m=v([]),n=w=>{m.value=w.map(({id:i})=>i)},E=()=>{g()},{pager:C,getLists:g,resetParams:O,resetPage:R}=de({fetchFun:ie,params:s});g();const B=h,k=()=>{const w=C.lists.filter(i=>m.value.includes(i.id));if(!w.length)return ce.error("\u8BF7\u5148\u9009\u62E9\u5546\u54C1");B("onBindStore",w)};return(w,i)=>{const D=X,S=Y,x=ee,$=le,p=oe,V=ue,T=te,U=re,r=ae;return y(),L("div",null,[e($,{class:"mb-[-16px]",model:t(s),inline:""},{default:o(()=>[e(S,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:o(()=>[e(D,{class:"w-[200px]",modelValue:t(s).store_name,"onUpdate:modelValue":i[0]||(i[0]=u=>t(s).store_name=u),onKeydown:i[1]||(i[1]=H(u=>E(),["enter"])),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1}),e(S,null,{default:o(()=>[e(x,{type:"primary",onClick:t(R)},{default:o(()=>[d("\u67E5\u8BE2")]),_:1},8,["onClick"]),e(x,{onClick:t(O)},{default:o(()=>[d("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"]),pe((y(),L("div",Ve,[e(T,{data:t(C).lists,onSelectionChange:n,height:300},{default:o(()=>[e(p,{type:"selection",width:"55"}),e(p,{label:"id",prop:"id","show-overflow-tooltip":""}),e(p,{label:"\u8BA2\u5355id",prop:"order_id","show-overflow-tooltip":""}),e(p,{label:"\u5546\u54C1ID",prop:"product_id","show-overflow-tooltip":""}),e(p,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:o(({row:u})=>[e(V,{style:{width:"50px",height:"50px"},src:u.image,"preview-teleported":!0},null,8,["src"])]),_:1}),e(p,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","show-overflow-tooltip":""}),e(p,{label:"\u5206\u7C7B",prop:"cate_name","show-overflow-tooltip":""}),e(p,{label:"\u5355\u4F4D",prop:"unit_name","show-overflow-tooltip":""}),e(p,{label:"\u4F9B\u5E94\u5546",prop:"supplier_name","show-overflow-tooltip":""}),e(p,{label:"\u9700\u6C42\u6570\u91CF",prop:"need_num","show-overflow-tooltip":""}),e(p,{label:"\u91C7\u8D2D\u6570\u91CF",prop:"buyer_nums","show-overflow-tooltip":""}),e(p,{label:"\u91C7\u8D2D\u4EF7",prop:"price","show-overflow-tooltip":""}),e(p,{label:"\u91C7\u8D2D\u603B\u4EF7",prop:"total_price","show-overflow-tooltip":""}),e(p,{label:"\u91C7\u8D2D\u4EBA\u5458",prop:"buyer_name","show-overflow-tooltip":""}),e(p,{label:"\u91C7\u8D2D\u72B6\u6001",prop:"buyer_confirm_name","show-overflow-tooltip":""})]),_:1},8,["data"])])),[[r,t(C).loading]]),F("div",ge,[e(U,{modelValue:t(C),"onUpdate:modelValue":i[2]||(i[2]=u=>P(C)?C.value=u:null),onChange:t(g)},null,8,["modelValue","onChange"])]),e(x,{class:"w-full mt-4",type:"primary",onClick:k},{default:o(()=>[d("\u6DFB\u52A0\u5546\u54C1")]),_:1})])}}}),Ue={class:"mt-4"},Pe={class:"flex mt-4 justify-end"},Le={class:"dialog-footer"},Se={class:"flex-1 w-full"},$e={class:"mb-2"},Ae={class:"dialog-footer"},Ie=K({name:"storeProductLists"}),vl=K({...Ie,setup(se){const h=v(!1),s=v(!1),m=ne({order_id:"",store_name:"",buyer_confirm:""}),n=v({id:"",bhoid:0,supplier_id:"",purchase:0,outbound_price:0,total_price:0,buyer_nums:0,pay_type:1}),E=v({supplier_id:""}),C=()=>{n.value.total_price=(n.value.buyer_nums*n.value.purchase).toFixed(2)},g=r=>{n.value.id=r.id,n.value.bhoid=r.order_id,n.value.buyer_nums=r.need_num,n.value.purchase=r.price,n.value.total_price=r.total_price,h.value=!0},O=()=>{ye(n.value).then(r=>{h.value=!1,V()})},R=()=>{const r=D.value.map(u=>({id:u.id,buyer_nums:u.buyer_nums,purchase:u.purchase,total_price:u.total_price,pay_type:u.pay_type}));Be({supplier_id:E.value.supplier_id,product_arr:r}).then(u=>{s.value=!1,V()})},B=v(!1),k=v([]),w=(r="")=>{B.value=!0,Ee({mer_name:r}).then(u=>{k.value=u.lists,setTimeout(()=>{B.value=!1},300)}).catch(u=>{setTimeout(()=>{B.value=!1},300)})},i=v(!1),D=v([]),S=r=>{D.value=D.value.filter(u=>u.id!==r)},x=r=>{r.forEach(u=>{D.value.find(c=>c.id==u.id)||D.value.push(u)}),i.value=!1};function $(r){r.buyer_nums>0&&r.purchase>0&&(r.total_price=(r.buyer_nums*r.purchase).toFixed(2))}const{pager:p,getLists:V,resetParams:T,resetPage:U}=de({fetchFun:ie,params:m});return Fe(()=>{V()}),(r,u)=>{const c=X,_=Y,A=ve,M=he,b=ee,N=le,J=we,a=oe,Z=ue,z=te,me=re,I=be,Q=Ce,j=De,_e=xe,fe=ae;return y(),L(G,null,[F("div",null,[e(J,{class:"!border-none mb-4",shadow:"never"},{default:o(()=>[e(N,{class:"mb-[-16px]",model:t(m),inline:""},{default:o(()=>[e(_,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:o(()=>[e(c,{class:"w-[280px]",modelValue:t(m).store_name,"onUpdate:modelValue":u[0]||(u[0]=l=>t(m).store_name=l),onKeydown:H(t(U),["enter"]),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0"},null,8,["modelValue","onKeydown"])]),_:1}),e(_,{label:"\u8BA2\u5355id",prop:"order_id"},{default:o(()=>[e(c,{class:"w-[280px]",modelValue:t(m).order_id,"onUpdate:modelValue":u[1]||(u[1]=l=>t(m).order_id=l),onKeydown:H(t(U),["enter"]),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u8BA2\u5355id"},null,8,["modelValue","onKeydown"])]),_:1}),e(_,{label:"\u91C7\u8D2D\u72B6\u6001"},{default:o(()=>[e(M,{modelValue:t(m).buyer_confirm,"onUpdate:modelValue":u[2]||(u[2]=l=>t(m).buyer_confirm=l),placeholder:"\u8BF7\u9009\u62E9\u91C7\u8D2D\u72B6\u6001",style:{width:"240px"}},{default:o(()=>[e(A,{label:"\u91C7\u8D2D\u5B8C\u6210",value:"1"}),e(A,{label:"\u672A\u5B8C\u6210",value:"0"})]),_:1},8,["modelValue"])]),_:1}),e(_,null,{default:o(()=>[e(b,{type:"primary",onClick:t(U)},{default:o(()=>[d("\u67E5\u8BE2")]),_:1},8,["onClick"]),e(b,{onClick:t(T)},{default:o(()=>[d("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"])]),_:1}),pe((y(),q(J,{class:"!border-none",shadow:"never"},{default:o(()=>[e(b,{type:"primary",onClick:u[3]||(u[3]=l=>s.value=!0)},{default:o(()=>[d(" \u6279\u91CF\u91C7\u8D2D\u4FE1\u606F\u8BBE\u7F6E ")]),_:1}),F("div",Ue,[e(z,{data:t(p).lists},{default:o(()=>[e(a,{type:"selection",width:"55"}),e(a,{label:"id",prop:"id","show-overflow-tooltip":""}),e(a,{label:"\u8BA2\u5355id",prop:"order_id","show-overflow-tooltip":""}),e(a,{label:"\u5546\u54C1ID",prop:"product_id","show-overflow-tooltip":""}),e(a,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:o(({row:l})=>[e(Z,{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","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","show-overflow-tooltip":""}),e(a,{label:"\u4F9B\u5E94\u5546",prop:"supplier_name","show-overflow-tooltip":""}),e(a,{label:"\u9700\u6C42\u6570\u91CF",prop:"need_num","show-overflow-tooltip":""}),e(a,{label:"\u91C7\u8D2D\u6570\u91CF",prop:"buyer_nums","show-overflow-tooltip":""}),e(a,{label:"\u91C7\u8D2D\u4EF7",prop:"price","show-overflow-tooltip":""}),e(a,{label:"\u91C7\u8D2D\u603B\u4EF7",prop:"total_price","show-overflow-tooltip":""}),e(a,{label:"\u91C7\u8D2D\u4EBA\u5458",prop:"buyer_name","show-overflow-tooltip":""}),e(a,{label:"\u91C7\u8D2D\u72B6\u6001",prop:"buyer_confirm_name","show-overflow-tooltip":""}),e(a,{label:"\u662F\u5426\u5165\u5E93",prop:"is_storage_name","show-overflow-tooltip":""}),e(a,{label:"\u64CD\u4F5C",fixed:"right"},{default:o(({row:l})=>[e(b,{type:"primary",link:"",onClick:f=>g(l)},{default:o(()=>[d("\u8BBE\u7F6E\u91C7\u8D2D\u4FE1\u606F")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),F("div",Pe,[e(me,{modelValue:t(p),"onUpdate:modelValue":u[4]||(u[4]=l=>P(p)?p.value=l:null),onChange:t(V)},null,8,["modelValue","onChange"])])]),_:1})),[[fe,t(p).loading]])]),e(j,{modelValue:t(h),"onUpdate:modelValue":u[11]||(u[11]=l=>P(h)?h.value=l:null),title:"\u91C7\u8D2D\u4FE1\u606F\u8BBE\u7F6E",width:"600"},{footer:o(()=>[F("div",Le,[e(b,{onClick:u[10]||(u[10]=l=>h.value=!1)},{default:o(()=>[d("\u53D6\u6D88")]),_:1}),e(b,{type:"primary",onClick:O},{default:o(()=>[d(" \u786E\u8BA4 ")]),_:1})])]),default:o(()=>[e(N,{ref:"formRef",model:t(n),"label-width":"90px"},{default:o(()=>[e(_,{label:"\u4F9B\u5E94\u5546"},{default:o(()=>[e(M,{modelValue:t(n).supplier_id,"onUpdate:modelValue":u[5]||(u[5]=l=>t(n).supplier_id=l),filterable:"",remote:"","reserve-keyword":"",placeholder:"\u8F93\u5165\u4F9B\u5E94\u5546\u540D\u79F0\u641C\u7D22","remote-show-suffix":"","remote-method":w,loading:t(B),style:{width:"240px"}},{default:o(()=>[(y(!0),L(G,null,W(t(k),l=>(y(),q(A,{key:l.id,label:l.mer_name,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1}),e(_,{label:"\u6570\u91CF",prop:"buyer_nums"},{default:o(()=>[e(c,{modelValue:t(n).buyer_nums,"onUpdate:modelValue":u[6]||(u[6]=l=>t(n).buyer_nums=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u91C7\u8D2D\u6570\u91CF",readonly:!1,onChange:C},null,8,["modelValue"])]),_:1}),e(_,{label:"\u91C7\u8D2D\u4EF7",prop:"purchase"},{default:o(()=>[e(c,{modelValue:t(n).purchase,"onUpdate:modelValue":u[7]||(u[7]=l=>t(n).purchase=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u91C7\u8D2D\u4EF7",readonly:!1,onChange:C},null,8,["modelValue"])]),_:1}),e(_,{label:"\u91C7\u8D2D\u603B\u4EF7",prop:"total_price"},{default:o(()=>[e(c,{modelValue:t(n).total_price,"onUpdate:modelValue":u[8]||(u[8]=l=>t(n).total_price=l),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u91C7\u8D2D\u603B\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),e(_,{label:"\u4ED8\u6B3E\u65B9\u5F0F",prop:"pay_type"},{default:o(()=>[e(Q,{modelValue:t(n).pay_type,"onUpdate:modelValue":u[9]||(u[9]=l=>t(n).pay_type=l)},{default:o(()=>[e(I,{label:1},{default:o(()=>[d("\u8D4A\u8D26")]),_:1}),e(I,{label:2},{default:o(()=>[d("\u73B0\u91D1")]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"]),e(j,{modelValue:t(s),"onUpdate:modelValue":u[15]||(u[15]=l=>P(s)?s.value=l:null),title:"\u6279\u91CF\u91C7\u8D2D\u4FE1\u606F\u8BBE\u7F6E",width:"1200"},{footer:o(()=>[F("div",Ae,[e(b,{onClick:u[14]||(u[14]=l=>s.value=!1)},{default:o(()=>[d("\u53D6\u6D88")]),_:1}),e(b,{type:"primary",onClick:R},{default:o(()=>[d(" \u786E\u8BA4 ")]),_:1})])]),default:o(()=>[e(N,{ref:"formRef",model:t(E)},{default:o(()=>[e(_,{label:"\u4F9B\u5E94\u5546"},{default:o(()=>[e(M,{modelValue:t(E).supplier_id,"onUpdate:modelValue":u[12]||(u[12]=l=>t(E).supplier_id=l),filterable:"",remote:"","reserve-keyword":"",placeholder:"\u8F93\u5165\u4F9B\u5E94\u5546\u540D\u79F0\u641C\u7D22","remote-show-suffix":"","remote-method":w,loading:t(B),style:{width:"240px"}},{default:o(()=>[(y(!0),L(G,null,W(t(k),l=>(y(),q(A,{key:l.id,label:l.mer_name,value:l.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","loading"])]),_:1}),e(_,{label:"\u5546\u54C1",prop:"store_id"},{default:o(()=>[F("div",Se,[F("div",$e,[e(b,{type:"primary",onClick:u[13]||(u[13]=l=>i.value=!0)},{default:o(()=>[d("\u6DFB\u52A0\u5546\u54C1")]),_:1})]),e(z,{data:t(D)},{default:o(()=>[e(a,{label:"id",prop:"id","show-overflow-tooltip":""}),e(a,{label:"\u5546\u54C1ID",prop:"product_id","show-overflow-tooltip":""}),e(a,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:o(({row:l})=>[e(Z,{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","show-overflow-tooltip":""}),e(a,{label:"\u6570\u91CF"},{default:o(({row:l})=>[e(c,{modelValue:l.buyer_nums,"onUpdate:modelValue":f=>l.buyer_nums=f,onChange:f=>$(l)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1}),e(a,{label:"\u91C7\u8D2D\u4EF7"},{default:o(({row:l})=>[e(c,{modelValue:l.purchase,"onUpdate:modelValue":f=>l.purchase=f,onChange:f=>$(l)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:1}),e(a,{label:"\u91C7\u8D2D\u603B\u4EF7"},{default:o(({row:l})=>[e(c,{modelValue:l.total_price,"onUpdate:modelValue":f=>l.total_price=f},null,8,["modelValue","onUpdate:modelValue"])]),_:1}),e(a,{label:"\u652F\u4ED8\u7C7B\u578B",width:"180"},{default:o(({row:l})=>[e(Q,{modelValue:l.pay_type,"onUpdate:modelValue":f=>l.pay_type=f},{default:o(()=>[e(I,{label:1},{default:o(()=>[d("\u8D4A\u8D26")]),_:1}),e(I,{label:2},{default:o(()=>[d("\u73B0\u91D1")]),_:1})]),_:2},1032,["modelValue","onUpdate:modelValue"])]),_:1}),e(a,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:o(({row:l})=>[e(b,{type:"danger",link:"",onClick:f=>S(l.id)},{default:o(()=>[d(" \u5220\u9664 ")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"]),e(j,{modelValue:t(i),"onUpdate:modelValue":u[16]||(u[16]=l=>P(i)?i.value=l:null),title:"\u9009\u62E9\u5546\u54C1",width:"70%"},{default:o(()=>[e(_e,{onOnBindStore:x})]),_:1},8,["modelValue"])],64)}}});export{vl as default};