2 lines
7.3 KiB
JavaScript
2 lines
7.3 KiB
JavaScript
import{G as Z,H as z,k as h,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.4a7d92a3.js";import{_ as ae}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.2f5acd23.js";import{_ as se}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.ad88061a.js";import{w as re}from"./index.61122cf1.js";import{d as ie}from"./store_product.5b7083db.js";import{d as U,s as ne,r,Z as pe,ap as de,o as v,K as b,L as u,a as m,U as e,u as d,R as i,S as me,M as R,Q as ce,j as D}from"./@vue.18505fe0.js";import"./lodash.9dc701ad.js";import{u as _e,a as fe}from"./vue-router.101084e3.js";import{a as Ee}from"./store_product_unit.e18e246f.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.vue_vue_type_script_setup_true_lang.5d4e738c.js";import"./usePaging.6a6670f9.js";import"./useDictOptions.44e45292.js";import"./warehouse_product_storege.193cf6dc.js";import"./system_store.e4bc79d0.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=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=U({name:"storeProductEdit"}),_o=U({...Ce,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(De,{emit:ge}){const g=_e(),I=ne(),{removeTab:y}=re();r("add");const f=r("");r(0);const L=pe({store_id:""});g.query.warehouse_id&&(f.value=parseInt(g.query.warehouse_id));const c=r(!1),n=r([]),N=s=>{n.value=n.value.filter(t=>t.id!==s)},P=s=>{s.forEach(t=>{n.value.find(o=>o.id==t.id)||n.value.push(t)}),k(),c.value=!1},_=r(!1),p=r([]),T=s=>{p.value=p.value.filter(t=>t.id!==s)},$=s=>{s.forEach(t=>{p.value.find(o=>o.id==t.id)||p.value.push(t)}),_.value=!1},M=r([]);(()=>{Ee({}).then(s=>{M.value=s.lists})})();const E=r(1),B=r(!0),k=()=>{const s=p.value.map(o=>({id:o.product_id,stock:o.new_stock||0,stocks:o.stock||0})),t=n.value.length;if(t>0&&s.length>0)try{s.forEach(o=>{if(o.stock*t>o.stocks)throw B.value=!1,new Error("\u8D85\u51FA\u4ED3\u5E93\u5E93\u5B58,\u8BF7\u91CD\u65B0\u8BBE\u7F6E")})}catch{h.error("\u8D85\u51FA\u4ED3\u5E93\u5E93\u5B58,\u8BF7\u91CD\u65B0\u8BBE\u7F6E");return}B.value=!0};fe();const O=async()=>{if(f.value==""){h.error("\u8BF7\u9009\u62E9\u4ED3\u5E93");return}if(k(),B.value==!1)return;const s=p.value.map(o=>({id:o.product_id,stock:o.new_stock||0,batch:o.batch||0})),t=n.value.map(o=>o.id);ie({product_arr:s,store_arr:t,stock_type:E.value,warehouse_id:f.value}).then(o=>{y(),o.code==1?(h.success(o.msg),setTimeout(()=>{y()},2e3)):h.error(o.msg)})};return(s,t)=>{const o=J,a=W,F=X,x=Y,w=ee,j=oe,V=Z,q=z,G=te,H=se,A=ue,K=ae,Q=le,S=de("perms");return v(),b(Q,null,{default:u(()=>[we,m("div",null,[e(G,{ref_key:"formRef",ref:I,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(o,{type:"primary",onClick:t[0]||(t[0]=l=>c.value=!0)},{default:u(()=>[i("\u6DFB\u52A0\u95E8\u5E97")]),_:1})]),e(x,{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(F,{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})=>[R((v(),b(o,{type:"danger",link:"",onClick:C=>N(l.id)},{default:u(()=>[i(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[S,["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(o,{type:"primary",onClick:t[1]||(t[1]=l=>_.value=!0)},{default:u(()=>[i("\u6DFB\u52A0\u5546\u54C1")]),_:1})]),e(x,{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(F,{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?(v(),b(j,{key:0,modelValue:l.new_stock,"onUpdate:modelValue":C=>l.new_stock=C,min:1,max:l.stock,onChange:k},null,8,["modelValue","onUpdate:modelValue","max"])):ce("",!0)]),_:1}),e(a,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:u(({row:l})=>[R((v(),b(o,{type:"danger",link:"",onClick:C=>T(l.id)},{default:u(()=>[i(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[S,["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":t[2]||(t[2]=l=>D(E)?E.value=l:null),class:"ml-6"},{default:u(()=>[e(V,{value:1,label:1},{default:u(()=>[i("\u5206\u914D\u552E\u5356\u5E93\u5B58")]),_:1}),e(V,{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(o,{onClick:O,type:"primary",class:"w-40"},{default:u(()=>[i("\u63D0\u4EA4")]),_:1})]),_:1})]),_:1},8,["model"])]),e(A,{modelValue:d(c),"onUpdate:modelValue":t[3]||(t[3]=l=>D(c)?c.value=l:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:u(()=>[e(H,{onOnBindStore:P})]),_:1},8,["modelValue"]),e(A,{modelValue:d(_),"onUpdate:modelValue":t[4]||(t[4]=l=>D(_)?_.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};
|