2 lines
7.2 KiB
JavaScript
2 lines
7.2 KiB
JavaScript
import{G as Z,H as z,k as A,w as J,M as W,b as X,N as Y,D as ee,v as oe,F as te,I as ue,L as le}from"./element-plus.ebe4edc1.js";import{_ as ae}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.a165a37a.js";import{_ as se}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.e0682abe.js";import{w as re}from"./index.27b9164f.js";import{d as ie}from"./store_product.fd3d6ac5.js";import{d as R,s as ne,r,Z as pe,ap as de,o as h,K as v,L as u,a as m,U as e,u as d,R as i,S as me,M as S,Q as ce,j as C}from"./@vue.18505fe0.js";import"./lodash.9da25972.js";import{u as _e,a as fe}from"./vue-router.101084e3.js";import{a as Ee}from"./store_product_unit.2a287cea.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.2abc406c.js";import"./axios.9e25675c.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./index.vue_vue_type_script_setup_true_lang.311652af.js";import"./usePaging.6a6670f9.js";import"./useDictOptions.a1e55eb5.js";import"./warehouse_product_storege.5d2e6215.js";import"./system_store.be21441e.js";import"./pinia.a969beab.js";import"./css-color-function.ae040c61.js";import"./color.130f7952.js";import"./clone.4a149bdb.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.e75c9f38.js";import"./vue-clipboard3.cacf014a.js";import"./clipboard.1f8f6543.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.b0c09b66.js";const we=m("div",{class:"mb-4 text-lg font-bold"},"\u5BFC\u5165\u5546\u54C1\u5230\u95E8\u5E97",-1),he={class:"flex-1 w-full"},ve={class:"mb-2"},be={class:"flex-1 w-full"},Be={class:"mb-2"},ke=m("span",{class:"text-info text-xs ml-6"},"\u9ED8\u8BA4\u4E3A\u5206\u914D\u552E\u5356\u5E93\u5B58, \u5982\u9700\u5206\u914D\u5151\u6362\u5E93\u5B58\u8BF7\u9009\u62E9\u5206\u914D\u5151\u6362\u5E93\u5B58",-1),Ce=R({name:"storeProductEdit"}),_o=R({...Ce,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(De,{emit:ye}){const D=_e(),U=ne(),{removeTab:I}=re();r("add");const f=r("");r(0);const L=pe({store_id:""});D.query.warehouse_id&&(f.value=parseInt(D.query.warehouse_id));const c=r(!1),n=r([]),N=s=>{n.value=n.value.filter(o=>o.id!==s)},P=s=>{s.forEach(o=>{n.value.find(t=>t.id==o.id)||n.value.push(o)}),B(),c.value=!1},_=r(!1),p=r([]),T=s=>{p.value=p.value.filter(o=>o.id!==s)},$=s=>{s.forEach(o=>{p.value.find(t=>t.id==o.id)||p.value.push(o)}),_.value=!1},M=r([]);(()=>{Ee({}).then(s=>{M.value=s.lists})})();const E=r(1),b=r(!0),B=()=>{const s=p.value.map(t=>({id:t.product_id,stock:t.new_stock||0,stocks:t.stock||0})),o=n.value.length;if(o>0&&s.length>0)try{s.forEach(t=>{if(t.stock*o>t.stocks)throw b.value=!1,new Error("\u8D85\u51FA\u4ED3\u5E93\u5E93\u5B58,\u8BF7\u91CD\u65B0\u8BBE\u7F6E")})}catch{A.error("\u8D85\u51FA\u4ED3\u5E93\u5E93\u5B58,\u8BF7\u91CD\u65B0\u8BBE\u7F6E");return}b.value=!0};fe();const O=async()=>{if(f.value==""){A.error("\u8BF7\u9009\u62E9\u4ED3\u5E93");return}if(B(),b.value==!1)return;const s=p.value.map(t=>({id:t.product_id,stock:t.new_stock||0,batch:t.batch||0})),o=n.value.map(t=>t.id);ie({product_arr:s,store_arr:o,stock_type:E.value,warehouse_id:f.value}).then(t=>{setTimeout(()=>{I()},2e3)})};return(s,o)=>{const t=J,a=W,y=X,g=Y,w=ee,j=oe,F=Z,q=z,G=te,H=se,x=ue,K=ae,Q=le,V=de("perms");return h(),v(Q,null,{default:u(()=>[we,m("div",null,[e(G,{ref_key:"formRef",ref:U,model:d(L),"label-width":"90px"},{default:u(()=>[e(w,{label:"\u95E8\u5E97",prop:"store_id"},{default:u(()=>[m("div",he,[m("div",ve,[e(t,{type:"primary",onClick:o[0]||(o[0]=l=>c.value=!0)},{default:u(()=>[i("\u6DFB\u52A0\u95E8\u5E97")]),_:1})]),e(g,{data:d(n)},{default:u(()=>[e(a,{label:"ID",prop:"id","show-overflow-tooltip":""}),e(a,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),e(a,{label:"\u624B\u673A\u53F7\u7801",prop:"phone","show-overflow-tooltip":""}),e(a,{label:"\u8BE6\u7EC6\u5730\u5740",prop:"detailed_address","show-overflow-tooltip":""}),e(a,{label:"\u95E8\u5E97logo",prop:"image","show-overflow-tooltip":""},{default:u(({row:l})=>[e(y,{src:l.image,class:"w-[40px] h-[40px]","preview-teleported":!0},null,8,["src"])]),_:1}),e(a,{label:"\u8425\u4E1A\u72B6\u6001",prop:"is_show","show-overflow-tooltip":""},{default:u(({row:l})=>[i(me(l.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),e(a,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:u(({row:l})=>[S((h(),v(t,{type:"danger",link:"",onClick:k=>N(l.id)},{default:u(()=>[i(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[V,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])])]),_:1}),e(w,{label:"\u5546\u54C1",prop:"store_id"},{default:u(()=>[m("div",be,[m("div",Be,[e(t,{type:"primary",onClick:o[1]||(o[1]=l=>_.value=!0)},{default:u(()=>[i("\u6DFB\u52A0\u5546\u54C1")]),_:1})]),e(g,{data:d(p)},{default:u(()=>[e(a,{label:"\u5546\u54C1ID",prop:"id","show-overflow-tooltip":""}),e(a,{label:"\u5546\u54C1\u56FE\u7247",prop:"image","min-width":"80"},{default:u(({row:l})=>[e(y,{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","min-width":"200","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","min-width":"80","show-overflow-tooltip":""}),e(a,{label:"\u5546\u54C1\u4EF7\u683C",prop:"price","min-width":"100","show-overflow-tooltip":""}),e(a,{label:"\u5E93\u5B58",prop:"stock","min-width":"100","show-overflow-tooltip":""}),e(a,{label:"\u5206\u914D\u5E93\u5B58","min-width":"150"},{default:u(({row:l})=>[l.stock>0?(h(),v(j,{key:0,modelValue:l.new_stock,"onUpdate:modelValue":k=>l.new_stock=k,min:1,max:l.stock,onChange:B},null,8,["modelValue","onUpdate:modelValue","max"])):ce("",!0)]),_:1}),e(a,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:u(({row:l})=>[S((h(),v(t,{type:"danger",link:"",onClick:k=>T(l.id)},{default:u(()=>[i(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[V,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])])]),_:1}),e(w,{label:"\u5E93\u5B58\u7C7B\u578B",prop:"stock_type"},{default:u(()=>[e(q,{modelValue:d(E),"onUpdate:modelValue":o[2]||(o[2]=l=>C(E)?E.value=l:null),class:"ml-6"},{default:u(()=>[e(F,{value:1,label:1},{default:u(()=>[i("\u5206\u914D\u552E\u5356\u5E93\u5B58")]),_:1}),e(F,{value:2,label:2},{default:u(()=>[i("\u5206\u914D\u5151\u6362\u5E93\u5B58")]),_:1})]),_:1},8,["modelValue"]),ke]),_:1}),e(w,{label:""},{default:u(()=>[e(t,{onClick:O,type:"primary",class:"w-40"},{default:u(()=>[i("\u63D0\u4EA4")]),_:1})]),_:1})]),_:1},8,["model"])]),e(x,{modelValue:d(c),"onUpdate:modelValue":o[3]||(o[3]=l=>C(c)?c.value=l:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:u(()=>[e(H,{onOnBindStore:P})]),_:1},8,["modelValue"]),e(x,{modelValue:d(_),"onUpdate:modelValue":o[4]||(o[4]=l=>C(_)?_.value=l:null),title:"\u9009\u62E9\u5546\u54C1",width:"70%"},{default:u(()=>[e(K,{onOnBindStore:$,is_warehouse:"1",warehouse_id:d(f)},null,8,["warehouse_id"])]),_:1},8,["modelValue"])]),_:1})}}});export{_o as default};
|