moreShopAdmin/build/admin/assets/add.b7c33ebb.js

2 lines
13 KiB
JavaScript

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