2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
import{k as me,C as Q,D as W,w as X,F as $,M as ee,b as le,N as oe,O as _e,S as fe,T as ce,G as he,H as Ve,U as ge,J as be,K as we,v as ye,I as Ce,L as ve}from"./element-plus.4a7d92a3.js";import{_ as Ee}from"./index.vue_vue_type_script_setup_true_lang.5d4e738c.js";import{d as I,Z as M,r as C,o as K,c as P,U as e,L as u,u as a,aa as O,R as g,M as De,a as D,j as Y,s as Fe,T as Z,a9 as Ue,K as Be,S as ke,n as S}from"./@vue.18505fe0.js";import{u as Ke}from"./usePaging.6a6670f9.js";import{u as Ae}from"./useDictOptions.a0f95660.js";import{a as te,b as Se}from"./store_product.287da381.js";import{a as Pe}from"./vue-router.101084e3.js";import{a as Ie}from"./beforehand_order.fe6ada9b.js";import{a as Le}from"./system_store.388b00e0.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.c7609165.js";import"./lodash.9dc701ad.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 qe={class:"mt-4"},Re={class:"flex mt-4 justify-end"},Te=I({name:"systemStoreLists"}),Ne=I({...Te,emits:["onBindStore"],setup(ue,{emit:j}){const F=M({store_name:"",product_type:0,is_warehouse:1}),p=C([]);C();const L=v=>{p.value=v.map(({id:h})=>h)};Ae("");const U=()=>{c()},{pager:V,getLists:c,resetParams:q,resetPage:R}=Ke({fetchFun:te,params:F});c();const A=j,T=()=>{const v=V.lists.filter(h=>p.value.includes(h.id));if(!v.length)return me.error("\u8BF7\u5148\u9009\u62E9\u5546\u54C1");A("onBindStore",v)};return(v,h)=>{const B=Q,y=W,E=X,N=$,b=ee,i=le,f=oe,n=Ee,l=_e;return K(),P("div",null,[e(N,{class:"mb-[-16px]",model:a(F),inline:""},{default:u(()=>[e(y,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:u(()=>[e(B,{class:"w-[200px]",modelValue:a(F).store_name,"onUpdate:modelValue":h[0]||(h[0]=s=>a(F).store_name=s),onKeydown:h[1]||(h[1]=O(s=>U(),["enter"])),clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0"},null,8,["modelValue"])]),_:1}),e(y,null,{default:u(()=>[e(E,{type:"primary",onClick:a(R)},{default:u(()=>[g("\u67E5\u8BE2")]),_:1},8,["onClick"]),e(E,{onClick:a(q)},{default:u(()=>[g("\u91CD\u7F6E")]),_:1},8,["onClick"])]),_:1})]),_:1},8,["model"]),De((K(),P("div",qe,[e(f,{data:a(V).lists,onSelectionChange:L,height:300},{default:u(()=>[e(b,{type:"selection",width:"55"}),e(b,{label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""}),e(b,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:u(({row:s})=>[e(i,{style:{width:"50px",height:"50px"},src:s.image,"preview-teleported":!0},null,8,["src"])]),_:1}),e(b,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","min-width":"200","show-overflow-tooltip":""}),e(b,{label:"\u5206\u7C7B",prop:"cate_name","min-width":"120","show-overflow-tooltip":""}),e(b,{label:"\u5355\u4F4D",prop:"unit_name","min-width":"80","show-overflow-tooltip":""}),e(b,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price","min-width":"100","show-overflow-tooltip":""}),e(b,{label:"\u4ED3\u5E93\u5E93\u5B58",prop:"stock","min-width":"100","show-overflow-tooltip":""})]),_:1},8,["data"])])),[[l,a(V).loading]]),D("div",Re,[e(n,{modelValue:a(V),"onUpdate:modelValue":h[2]||(h[2]=s=>Y(V)?V.value=s:null),onChange:a(c)},null,8,["modelValue","onChange"])]),e(E,{class:"w-full mt-4",type:"primary",onClick:T},{default:u(()=>[g("\u6DFB\u52A0\u5546\u54C1")]),_:1})])}}}),xe=D("div",{class:"mb-4 text-lg font-bold"},"\u9884\u5B9A\u5355\u6DFB\u52A0",-1),Me={class:"flex-1 w-full"},Oe={class:"mb-2"},Ye=D("span",{class:"ml-4"},"\u8BE5\u91D1\u989D\u53EA\u505A\u524D\u53F0\u5C55\u793A,\u540E\u53F0\u4F1A\u4ECE\u65B0\u8BA1\u7B97",-1),je=I({name:"storeProductEdit"}),Bl=I({...je,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(ue,{emit:j}){const F=Fe(),p=M({warehouse_id:"",supplier_id:"",code:"",total_price:0,order_type:1,store_id:"",nickname:"",phone:"",address:"",arrival_time:"",purpose:"",tables:0,days:0,chef:"",chef_phone:"",mark:""}),L=async n=>{const l=await Se({id:n.id});U(n,l)},U=(n,l)=>{console.log(n),console.log(l),n.id=l.id,n.image=l.image,n.marques=l.marques,n.store_info=l.store_info,n.price=l.price,n.purchase=l.purchase,n.after_sales=l.after_sales,n.loss=l.loss,n.mark=l.mark,n.unit=l.unit,n.store_name=l.store_name,n.unit_name=l.unit_name,n.gross_weight=l.gross_weight,n.net_weight=l.net_weight,n.package=l.package;const s=[];c.value.forEach(d=>{s.push(d.id)}),s.includes(0)==!1&&c.value.push({id:0})},V=C(!1),c=C([{id:0}]),q=n=>{c.value=c.value.filter(l=>l.id!==n)},R=n=>{n.forEach(l=>{c.value.find(s=>s.id==l.id)||c.value.push(l)}),V.value=!1};function A(n){n.total_price=(n.nums*n.price).toFixed(2),n.total_price>0&&(p.total_price=(parseFloat(p.total_price)+parseFloat(n.total_price)).toFixed(2))}const T=Pe(),v=async()=>{const n=c.value.map(l=>({product_id:l.id,nums:l.nums,price:l.price||0,purchase:l.purchase||0,total_price:l.total_price||0,marques:l.marques,store_info:l.store_info,after_sales:l.after_sales,loss:l.loss,unit:l.unit,gross_weight:l.gross_weight,net_weight:l.net_weight,package:l.package,mark:l.mark}));Ie({product_arr:n,...p}).then(l=>{setTimeout(()=>{T.push({path:"/order/beforehand_order"})},2e3)})},h=C([]);Le({page_no:1,page_size:100}).then(n=>{h.value=n.lists});const B=C([]),y=C(!1),E=C(),N=n=>{te({store_name:n.store_name,product_type:0}).then(l=>{if(l.count==1){const s=l.lists[0];U(n,s)}l.count>1&&(B.value=l.lists,y.value=!0,E.value=n)})},b=n=>{n!=null&&(U(E.value,n),y.value=!1,B.value=[],E.value=[])},i=M({}),f=(n,l,s)=>{const d=["id","store_name","nums","price","total_price","marques","gross_weight","net_weight","store_info","after_sales","loss","package","mark"];if(n.keyCode===38){if(l===0)return;i[l+s].blur(),S(()=>{i[l-1+s].focus()})}if(n.keyCode===40){if(l===c.value.length-1)return;i[l+s].blur(),S(()=>{i[l+1+s].focus()})}if(n.keyCode===37){if(l===0&&s===d[0])return;if(i[l+s].blur(),s===d[0])i[l-1+d[d.length-1]].focus();else{const _=d.findIndex(w=>w===s)-1;S(()=>{i[l+d[_]].focus()})}}if(n.keyCode===39){if(l===c.value.length-1&&s===d[d.length-1])return;if(i[l+s].blur(),s===d[d.length-1])i[l+1+d[0]].focus();else{const _=d.findIndex(w=>w===s)+1;S(()=>{i[l+d[_]].focus()})}}};return(n,l)=>{const s=Q,d=W,_=fe,w=ce,k=he,ae=Ve,ne=be,se=we,re=ge,H=ye,x=X,m=ee,z=le,G=oe,pe=$,de=Ne,J=Ce,ie=ve;return K(),P(Z,null,[e(ie,null,{default:u(()=>[xe,D("div",null,[e(pe,{ref_key:"formRef",ref:F,model:a(p),"label-width":"90px",inline:!0},{default:u(()=>[e(w,null,{default:u(()=>[e(_,{span:4},{default:u(()=>[e(d,{label:"\u7528\u6237"},{default:u(()=>[e(s,{modelValue:a(p).nickname,"onUpdate:modelValue":l[0]||(l[0]=o=>a(p).nickname=o),type:"input"},null,8,["modelValue"])]),_:1})]),_:1}),e(_,{span:4},{default:u(()=>[e(d,{label:"\u7535\u8BDD"},{default:u(()=>[e(s,{modelValue:a(p).phone,"onUpdate:modelValue":l[1]||(l[1]=o=>a(p).phone=o),type:"input"},null,8,["modelValue"])]),_:1})]),_:1}),e(_,{span:16},{default:u(()=>[e(d,{label:"\u5730\u5740"},{default:u(()=>[e(s,{modelValue:a(p).address,"onUpdate:modelValue":l[2]||(l[2]=o=>a(p).address=o),type:"input",style:{width:"400px"}},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(w,null,{default:u(()=>[e(_,{span:12},{default:u(()=>[e(d,{label:"\u8BA2\u5355\u7C7B\u578B",prop:"order_type"},{default:u(()=>[e(ae,{modelValue:a(p).order_type,"onUpdate:modelValue":l[3]||(l[3]=o=>a(p).order_type=o)},{default:u(()=>[e(k,{label:1},{default:u(()=>[g("\u94FA\u8D27\u8BA2\u5355")]),_:1}),e(k,{label:2},{default:u(()=>[g("\u644A\u8D29\u8BA2\u5355")]),_:1}),e(k,{label:3},{default:u(()=>[g("\u4E00\u6761\u9F99\u8BA2\u5355")]),_:1}),e(k,{label:5},{default:u(()=>[g("\u4ED3\u5E93\u8865\u8D27")]),_:1}),e(k,{label:6},{default:u(()=>[g("\u5F80\u671F\u8865\u5355")]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(_,{span:12},{default:u(()=>[e(d,{label:"\u95E8\u5E97",prop:"store_id",style:{width:"300px"}},{default:u(()=>[e(se,{modelValue:a(p).store_id,"onUpdate:modelValue":l[4]||(l[4]=o=>a(p).store_id=o),placeholder:"\u8BF7\u9009\u62E9\u95E8\u5E97",size:"large"},{default:u(()=>[(K(!0),P(Z,null,Ue(a(h),o=>(K(),Be(ne,{key:o.id,label:o.name,value:o.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(w,null,{default:u(()=>[e(_,{span:4},{default:u(()=>[e(d,{label:"\u5230\u8D27\u65F6\u95F4"},{default:u(()=>[e(re,{modelValue:a(p).arrival_time,"onUpdate:modelValue":l[5]||(l[5]=o=>a(p).arrival_time=o),type:"datetime",readonly:!1,clearable:"","value-format":"YYYY-MM-DD HH:mm:ss",placeholder:"\u8BF7\u9009\u62E9\u5230\u8D27\u65F6\u95F4",style:{width:"180px"}},null,8,["modelValue"])]),_:1})]),_:1}),e(_,{span:4},{default:u(()=>[e(d,{label:"\u684C\u6570"},{default:u(()=>[e(H,{modelValue:a(p).tables,"onUpdate:modelValue":l[6]||(l[6]=o=>a(p).tables=o),type:"input"},null,8,["modelValue"])]),_:1})]),_:1}),e(_,{span:4},{default:u(()=>[e(d,{label:"\u529E\u4E8B\u5929\u6570"},{default:u(()=>[e(H,{modelValue:a(p).days,"onUpdate:modelValue":l[7]||(l[7]=o=>a(p).days=o),type:"input"},null,8,["modelValue"])]),_:1})]),_:1}),e(_,{span:4},{default:u(()=>[e(d,{label:"\u53A8\u5E08"},{default:u(()=>[e(s,{modelValue:a(p).chef,"onUpdate:modelValue":l[8]||(l[8]=o=>a(p).chef=o),type:"input"},null,8,["modelValue"])]),_:1})]),_:1}),e(_,{span:4},{default:u(()=>[e(d,{label:"\u7535\u8BDD"},{default:u(()=>[e(s,{modelValue:a(p).chef_phone,"onUpdate:modelValue":l[9]||(l[9]=o=>a(p).chef_phone=o),type:"input"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(w,null,{default:u(()=>[e(_,{span:12},{default:u(()=>[e(d,{label:"\u91C7\u8D2D\u4E8B\u7531"},{default:u(()=>[e(s,{modelValue:a(p).purpose,"onUpdate:modelValue":l[10]||(l[10]=o=>a(p).purpose=o),type:"input",style:{width:"480px"}},null,8,["modelValue"])]),_:1})]),_:1}),e(_,{span:12},{default:u(()=>[e(d,{label:"\u5907\u6CE8"},{default:u(()=>[e(s,{modelValue:a(p).mark,"onUpdate:modelValue":l[11]||(l[11]=o=>a(p).mark=o),type:"input",style:{width:"480px"}},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),e(d,{label:"\u5546\u54C1",prop:"product_id",class:"w-full"},{default:u(()=>[D("div",Me,[D("div",Oe,[e(x,{type:"primary",onClick:l[12]||(l[12]=o=>V.value=!0)},{default:u(()=>[g("\u6DFB\u52A0\u5546\u54C1")]),_:1})]),e(G,{data:a(c)},{default:u(()=>[e(m,{label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.id,"onUpdate:modelValue":t=>o.id=t,onKeydown:O(t=>L(o),["enter"]),ref:t=>a(i)[r+"id"]=t,onKeyup:t=>f(t,r,"id")},null,8,["modelValue","onUpdate:modelValue","onKeydown","onKeyup"])]),_:1}),e(m,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:u(({row:o})=>[e(z,{style:{width:"50px",height:"50px"},src:o.image,"preview-teleported":!0},null,8,["src"])]),_:1}),e(m,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","show-overflow-tooltip":""},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.store_name,"onUpdate:modelValue":t=>o.store_name=t,onKeydown:O(t=>N(o),["enter"]),ref:t=>a(i)[r+"store_name"]=t,onKeyup:t=>f(t,r,"store_name")},null,8,["modelValue","onUpdate:modelValue","onKeydown","onKeyup"])]),_:1}),e(m,{label:"\u6570\u91CF"},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.nums,"onUpdate:modelValue":t=>o.nums=t,onChange:t=>A(o),ref:t=>a(i)[r+"nums"]=t,onKeyup:t=>f(t,r,"nums")},null,8,["modelValue","onUpdate:modelValue","onChange","onKeyup"])]),_:1}),e(m,{label:"\u4EF7\u683C"},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.price,"onUpdate:modelValue":t=>o.price=t,onChange:t=>A(o),ref:t=>a(i)[r+"price"]=t,onKeyup:t=>f(t,r,"price")},null,8,["modelValue","onUpdate:modelValue","onChange","onKeyup"])]),_:1}),e(m,{label:"\u603B\u4EF7"},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.total_price,"onUpdate:modelValue":t=>o.total_price=t,ref:t=>a(i)[r+"total_price"]=t,onKeyup:t=>f(t,r,"total_price")},null,8,["modelValue","onUpdate:modelValue","onKeyup"])]),_:1}),e(m,{label:"\u578B\u53F7"},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.marques,"onUpdate:modelValue":t=>o.marques=t,ref:t=>a(i)[r+"marques"]=t,onKeyup:t=>f(t,r,"marques")},null,8,["modelValue","onUpdate:modelValue","onKeyup"])]),_:1}),e(m,{label:"\u5305\u88C5"},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.package,"onUpdate:modelValue":t=>o.package=t,ref:t=>a(i)[r+"package"]=t,onKeyup:t=>f(t,r,"package")},null,8,["modelValue","onUpdate:modelValue","onKeyup"])]),_:1}),e(m,{label:"\u5355\u4F4D",prop:"unit_name","min-width":"80","show-overflow-tooltip":""}),e(m,{label:"\u6BDB\u91CD"},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.gross_weight,"onUpdate:modelValue":t=>o.gross_weight=t,ref:t=>a(i)[r+"gross_weight"]=t,onKeyup:t=>f(t,r,"gross_weight")},null,8,["modelValue","onUpdate:modelValue","onKeyup"])]),_:1}),e(m,{label:"\u51C0\u91CD"},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.net_weight,"onUpdate:modelValue":t=>o.net_weight=t,ref:t=>a(i)[r+"net_weight"]=t,onKeyup:t=>f(t,r,"net_weight")},null,8,["modelValue","onUpdate:modelValue","onKeyup"])]),_:1}),e(m,{label:"\u89C4\u683C"},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.store_info,"onUpdate:modelValue":t=>o.store_info=t,ref:t=>a(i)[r+"store_info"]=t,onKeyup:t=>f(t,r,"store_info")},null,8,["modelValue","onUpdate:modelValue","onKeyup"])]),_:1}),e(m,{label:"\u552E\u540E"},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.after_sales,"onUpdate:modelValue":t=>o.after_sales=t,ref:t=>a(i)[r+"after_sales"]=t,onKeyup:t=>f(t,r,"after_sales")},null,8,["modelValue","onUpdate:modelValue","onKeyup"])]),_:1}),e(m,{label:"\u635F\u8017"},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.loss,"onUpdate:modelValue":t=>o.loss=t,ref:t=>a(i)[r+"loss"]=t,onKeyup:t=>f(t,r,"loss")},null,8,["modelValue","onUpdate:modelValue","onKeyup"])]),_:1}),e(m,{label:"\u5907\u6CE8"},{default:u(({row:o,$index:r})=>[e(s,{modelValue:o.mark,"onUpdate:modelValue":t=>o.mark=t,ref:t=>a(i)[r+"mark"]=t,onKeyup:t=>f(t,r,"mark")},null,8,["modelValue","onUpdate:modelValue","onKeyup"])]),_:1}),e(m,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:u(({row:o})=>[e(x,{type:"danger",link:"",onClick:r=>q(o.id)},{default:u(()=>[g(" \u5220\u9664 ")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])])]),_:1}),e(w,null,{default:u(()=>[e(x,{onClick:v,type:"primary",class:"w-40 ml-20"},{default:u(()=>[g("\u63D0\u4EA4")]),_:1}),e(d,{label:"\u603B\u4EF7",prop:"total_price"},{default:u(()=>[D("div",null,[g(ke(a(p).total_price)+" ",1),Ye])]),_:1})]),_:1})]),_:1},8,["model"])]),e(J,{modelValue:a(V),"onUpdate:modelValue":l[13]||(l[13]=o=>Y(V)?V.value=o:null),title:"\u9009\u62E9\u5546\u54C1",width:"70%"},{default:u(()=>[e(de,{onOnBindStore:R})]),_:1},8,["modelValue"])]),_:1}),e(J,{modelValue:a(y),"onUpdate:modelValue":l[14]||(l[14]=o=>Y(y)?y.value=o:null),title:"\u9009\u62E9\u5546\u54C1",width:"1200"},{default:u(()=>[e(G,{data:a(B),onCurrentChange:b,height:300},{default:u(()=>[e(m,{label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""}),e(m,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:u(({row:o})=>[e(z,{style:{width:"50px",height:"50px"},src:o.image,"preview-teleported":!0},null,8,["src"])]),_:1}),e(m,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name","min-width":"200","show-overflow-tooltip":""}),e(m,{label:"\u5206\u7C7B",prop:"cate_name","min-width":"120","show-overflow-tooltip":""}),e(m,{label:"\u5355\u4F4D",prop:"unit_name","min-width":"80","show-overflow-tooltip":""}),e(m,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price","min-width":"100","show-overflow-tooltip":""}),e(m,{label:"\u4ED3\u5E93\u5E93\u5B58",prop:"stock","min-width":"100","show-overflow-tooltip":""})]),_:1},8,["data"])]),_:1},8,["modelValue"])],64)}}});export{Bl as default};
|