moreShopAdmin/build/admin/assets/add.1ff96de2.js

2 lines
8.3 KiB
JavaScript

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