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