4 lines
14 KiB
JavaScript
4 lines
14 KiB
JavaScript
import{G as fe,H as be,a8 as Fe,x as ce,y as Ee,k as Ce,D as Ve,C as ye,w as we,J as ve,K as Be,M as ge,N as De,b as ke,F as Ue,I as xe,L as Ae}from"./element-plus.91c68cc0.js";import{_ as Re}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.377dcf90.js";import{_ as Se}from"./picker.84cf425d.js";import{k as Le}from"./index.45e3c1f0.js";import{b as qe,d as Te,e as he}from"./store_product.4b77192d.js";import{d as G,s as Ne,r as f,Z as $,i as Pe,ap as ze,o as i,K as b,L as a,a as k,S as h,u as t,U as u,j as O,R as p,c as U,T as N,Q as V,a9 as j,M as Ie}from"./@vue.76ce7aa3.js";import"./lodash.4e6d2a38.js";import{a as Me,u as $e}from"./vue-router.10bd5b90.js";import{a as Oe}from"./store_category.75408c54.js";import{a as je}from"./store_product_unit.c9cbc701.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.9ffef7f8.js";import"./@element-plus.73235148.js";import"./dayjs.0112e2c7.js";import"./@babel.80d29b7b.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./index.vue_vue_type_script_setup_true_lang.863ae816.js";import"./usePaging.f8c888e4.js";import"./useDictOptions.55a5f7ca.js";import"./system_store.7a4ecbcf.js";import"./index.b0600572.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.cf0d972e.js";import"./index.8c0a1124.js";import"./index.99dd3ece.js";import"./vuedraggable.c04c7c0c.js";import"./vue.3299ef77.js";import"./sortablejs.c62bcaf8.js";import"./axios.cffda5ac.js";import"./jspdf.6c61b9d3.js";import"./fflate.0418c72f.js";import"./pinia.f3529286.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.b502f541.js";import"./vue-clipboard3.e775fc74.js";import"./clipboard.6417898a.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.8d65305c.js";const Ge={class:"mb-4 text-lg font-bold"},Ke={key:1},He={class:"mb-2"},Je=G({name:"storeProductEdit"}),Ju=G({...Je,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(Qe,{emit:Ze}){const P=Ne(),x=f("info");Le();const E=f("add"),K=(o,e)=>{console.log(o,e)},v=f([]),d=f([]),H=f([{label:"\u89C4\u683C\u540D\u79F0",prop:"sku_name",width:"180"},{label:"\u4F9B\u8D27\u4EF7",prop:"purchase",width:"180"},{label:"\u5546\u6237\u4EF7",prop:"cost",width:"180"},{label:"\u96F6\u552E\u4EF7",prop:"price",width:"180"},{label:"\u6761\u7801",prop:"bar_code",width:"180"}]),J=()=>{v.value.push({sku_name:"",purchase:0,cost:0,price:0,bar_code:"",editable:!0})},Q=o=>{v.value.splice(o,1)},s=$({id:"",image:"",store_name:"",store_info:"",product_type:0,cate_arr:[],cate_id:"",swap:"",batch:1,store_batch:1,manufacturer_information:"",rose:"0",is_return:1,is_store_all:1,spec_type:0}),y=f(!1),C=f([]),Z=o=>{C.value=C.value.filter(e=>e.id!==o)},W=o=>{o.forEach(e=>{C.value.find(F=>F.id==e.id)||C.value.push(e)}),y.value=!1};let A,R;const S=f(!1);let L;Pe(()=>{});const X=o=>(L=o,S.value=!0,z.lazyLoad(R,A),!1),z={value:"id",label:"name",lazy:!0,lazyLoad(o,e){A||(A=e),R||(R=o);const F=o.value||0;let r={};S.value?(r={name:L},L||(r={pid:F,page_size:1e4})):r={pid:F,page_size:1e4},Oe({...r}).then(m=>{e(m.lists.map(n=>(n.leaf=n.is_children==0,S.value=!1,n)))})}},q=f([]);(()=>{je({}).then(o=>{q.value=o.lists})})();const Y=$({store_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",trigger:["blur"]}],store_info:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u89C4\u683C",trigger:["blur"]}],cate_id:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u5206\u7C7B",trigger:["blur","change"]}],cate_arr:[{required:!0,message:"\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B",trigger:["blur","change"]}],image:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u56FE\u7247",trigger:["blur","change"]}]}),ee=async o=>{for(const e in s)o[e]!=null&&o[e]!=null&&(s[e]=o[e]);s.cate_arr[0]&&(s.cate_arr=s.cate_arr.map(e=>Number(e)))},ue=async o=>{const e=await qe({id:o.id});ee(e)},le=Me(),B=$e(),ae=async()=>{var F;await((F=P.value)==null?void 0:F.validate());const o={...s};if(s.is_store_all==0&&E.value=="add"?o.store_arr=C.value.map(r=>r.id):E.value=="edit"&&(o.is_store_all=0),!o.cate_arr.length)return Ce.error("\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B");o.cate_id=o.cate_arr[o.cate_arr.length-1],delete o.cate_arr;const e=f([]);s.spec_type==0?e.value=d.value:e.value=v.value.map(r=>({sku_name:r.sku_name,unit:r.unit,purchase:r.purchase,cost:r.cost,price:r.price,bar_code:r.bar_code})),o.product_arr=e.value,E.value=="edit"?await Te(o):await he(o),le.push({path:"/store/store_product?=",query:{page_no:B.query.page}})};return B.query.id&&B.query.mode=="edit"&&(E.value="edit",ue({id:B.query.id})),(o,e)=>{const F=Se,r=Ve,m=ye,n=fe,g=be,I=Fe,T=ce,w=we,te=ve,oe=Be,_=ge,M=De,re=ke,se=Ee,de=Ue,pe=Re,ne=xe,ie=Ae,me=ze("perms");return i(),b(ie,null,{default:a(()=>[k("div",Ge,h(t(E)=="add"?"\u6DFB\u52A0\u5546\u54C1":"\u7F16\u8F91\u5546\u54C1"),1),k("div",null,[u(de,{ref_key:"formRef",ref:P,model:t(s),"label-width":"120px",rules:t(Y)},{default:a(()=>[u(se,{modelValue:t(x),"onUpdate:modelValue":e[17]||(e[17]=l=>O(x)?x.value=l:null),class:"demo-tabs",onTabClick:K},{default:a(()=>[u(T,{label:"\u57FA\u7840\u4FE1\u606F",name:"info"},{default:a(()=>[u(r,{label:"\u5546\u54C1\u56FE\u7247",prop:"image"},{default:a(()=>[u(F,{modelValue:t(s).image,"onUpdate:modelValue":e[0]||(e[0]=l=>t(s).image=l),limit:1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:a(()=>[u(m,{modelValue:t(s).store_name,"onUpdate:modelValue":e[1]||(e[1]=l=>t(s).store_name=l),class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u5546\u54C1\u7C7B\u578B",prop:"product_type"},{default:a(()=>[u(g,{modelValue:t(s).product_type,"onUpdate:modelValue":e[2]||(e[2]=l=>t(s).product_type=l),disabled:t(E)!="add"},{default:a(()=>[u(n,{label:0},{default:a(()=>e[19]||(e[19]=[p("\u666E\u901A\u4EA7\u54C1")])),_:1}),u(n,{label:1},{default:a(()=>e[20]||(e[20]=[p("\u4F9B\u9500\u7CFB\u5217\u4EA7\u54C1")])),_:1}),u(n,{label:2},{default:a(()=>e[21]||(e[21]=[p("\u5151\u6362\u4EA7\u54C1")])),_:1}),u(n,{label:3},{default:a(()=>e[22]||(e[22]=[p("\u8D60\u54C1")])),_:1})]),_:1},8,["modelValue","disabled"])]),_:1}),u(r,{label:"\u5546\u54C1\u5206\u7C7B",prop:"cate_arr"},{default:a(()=>[u(I,{class:"w-[500px]",modelValue:t(s).cate_arr,"onUpdate:modelValue":e[3]||(e[3]=l=>t(s).cate_arr=l),filterable:"",clearable:"","before-filter":X,props:z,placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B"},null,8,["modelValue"])]),_:1}),u(r,{label:"\u5382\u5BB6\u5907\u6CE8",prop:"manufacturer_information"},{default:a(()=>[u(m,{modelValue:t(s).manufacturer_information,"onUpdate:modelValue":e[4]||(e[4]=l=>t(s).manufacturer_information=l),type:"textarea",autosize:"",class:"w-[500px]",clearable:"",placeholder:`\u5382\u5BB6\u540D\u79F0
|
|
\u8054\u7CFB\u4EBA\u59D3\u540D
|
|
\u8054\u7CFB\u7535\u8BDD`,readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u9000\u8D27",prop:"is_return"},{default:a(()=>[u(g,{modelValue:t(s).is_return,"onUpdate:modelValue":e[5]||(e[5]=l=>t(s).is_return=l)},{default:a(()=>[u(n,{label:1},{default:a(()=>e[23]||(e[23]=[p("\u652F\u6301")])),_:1}),u(n,{label:0},{default:a(()=>e[24]||(e[24]=[p("\u4E0D\u652F\u6301")])),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1}),u(T,{label:"\u5546\u54C1\u89C4\u683C",name:"spec"},{default:a(()=>[u(r,{label:"\u89C4\u683C\u7C7B\u578B"},{default:a(()=>[u(g,{modelValue:t(s).spec_type,"onUpdate:modelValue":e[6]||(e[6]=l=>t(s).spec_type=l)},{default:a(()=>[u(n,{label:0},{default:a(()=>e[25]||(e[25]=[p("\u5355\u89C4\u683C")])),_:1}),u(n,{label:1},{default:a(()=>e[26]||(e[26]=[p("\u591A\u89C4\u683C")])),_:1})]),_:1},8,["modelValue"])]),_:1}),t(s).spec_type==0?(i(),U(N,{key:0},[u(r,{label:"\u89C4\u683C\u540D\u79F0",prop:"sku_name"},{default:a(()=>[u(m,{modelValue:t(d).sku_name,"onUpdate:modelValue":e[7]||(e[7]=l=>t(d).sku_name=l),class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u89C4\u683C\u540D\u79F0",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u5546\u54C1\u5355\u4F4D",prop:"unit"},{default:a(()=>[u(I,{class:"w-[500px]",modelValue:t(d).unit,"onUpdate:modelValue":e[8]||(e[8]=l=>t(d).unit=l),options:t(q),props:{value:"id",label:"name",emitPath:!1},placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5355\u4F4D"},null,8,["modelValue","options"])]),_:1}),u(r,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase"},{default:a(()=>[u(m,{modelValue:t(d).purchase,"onUpdate:modelValue":e[9]||(e[9]=l=>t(d).purchase=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4F9B\u8D27\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u5546\u6237\u4EF7",prop:"cost"},{default:a(()=>[u(m,{modelValue:t(d).cost,"onUpdate:modelValue":e[10]||(e[10]=l=>t(d).cost=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u6237\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u4F1A\u5458\u4EF7",prop:"vip_price"},{default:a(()=>[u(m,{modelValue:t(d).vip_price,"onUpdate:modelValue":e[11]||(e[11]=l=>t(d).vip_price=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4F1A\u5458\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u7EC8\u7AEF\u96F6\u552E\u4EF7",prop:"price"},{default:a(()=>[u(m,{modelValue:t(d).price,"onUpdate:modelValue":e[12]||(e[12]=l=>t(d).price=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u7EC8\u7AEF\u96F6\u552E\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u96F6\u552E\u8D77\u6279\u91CF",prop:"batch"},{default:a(()=>[u(m,{modelValue:t(d).batch,"onUpdate:modelValue":e[13]||(e[13]=l=>t(d).batch=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u96F6\u552E\u8D77\u6279\u91CF",readonly:!1},null,8,["modelValue"])]),_:1}),u(r,{label:"\u95E8\u5E97\u8D77\u6279\u91CF",prop:"store_batch"},{default:a(()=>[u(m,{modelValue:t(d).store_batch,"onUpdate:modelValue":e[14]||(e[14]=l=>t(d).store_batch=l),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u95E8\u5E97\u8D77\u6279\u91CF",readonly:!1},null,8,["modelValue"])]),_:1})],64)):V("",!0),t(s).spec_type==1?(i(),b(r,{key:1},{default:a(()=>[u(w,{onClick:J,class:"mb-2"},{default:a(()=>e[27]||(e[27]=[p("\u6DFB\u52A0\u89C4\u683C")])),_:1}),u(M,{data:t(v),style:{width:"100%"}},{default:a(()=>[u(_,{label:"\u5355\u4F4D",width:"180"},{default:a(l=>[l.row.editable?(i(),b(oe,{key:0,modelValue:l.row.unit,"onUpdate:modelValue":c=>l.row.unit=c,placeholder:"\u8BF7\u9009\u62E9\u5355\u4F4D"},{default:a(()=>[(i(!0),U(N,null,j(t(q),c=>(i(),b(te,{key:c.id,label:c.name,value:c.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):V("",!0)]),_:1}),(i(!0),U(N,null,j(t(H),(l,c)=>(i(),b(_,{key:c,prop:l.prop,label:l.label,width:l.width},{default:a(D=>[D.row.editable?(i(),b(m,{key:0,modelValue:D.row[l.prop],"onUpdate:modelValue":_e=>D.row[l.prop]=_e},null,8,["modelValue","onUpdate:modelValue"])):(i(),U("span",Ke,h(D.row[l.prop]),1))]),_:2},1032,["prop","label","width"]))),128)),u(_,{label:"\u64CD\u4F5C",width:"100"},{default:a(l=>[u(w,{type:"text",onClick:c=>Q(l.$index)},{default:a(()=>e[28]||(e[28]=[p("\u5220\u9664")])),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),_:1})):V("",!0)]),_:1}),u(T,{label:"\u9002\u7528\u95E8\u5E97",name:"store"},{default:a(()=>[t(E)=="add"?(i(),b(r,{key:0,label:"\u6240\u5C5E\u95E8\u5E97",prop:"store_id"},{default:a(()=>[u(g,{modelValue:t(s).is_store_all,"onUpdate:modelValue":e[15]||(e[15]=l=>t(s).is_store_all=l)},{default:a(()=>[u(n,{label:1},{default:a(()=>e[29]||(e[29]=[p("\u5168\u90E8\u95E8\u5E97")])),_:1}),u(n,{label:0},{default:a(()=>e[30]||(e[30]=[p("\u90E8\u5206\u95E8\u5E97")])),_:1})]),_:1},8,["modelValue"]),e[33]||(e[33]=k("div",{class:"w-full",style:{color:"#64748b"}}," \u53EF\u9009\u62E9\u5C06\u5546\u54C1\u540C\u6B65\u5230\u54EA\u4E9B\u95E8\u5E97\u4F7F\u7528 ",-1)),k("div",He,[t(s).is_store_all==0?(i(),b(w,{key:0,type:"primary",onClick:e[16]||(e[16]=l=>y.value=!0)},{default:a(()=>e[31]||(e[31]=[p("\u6DFB\u52A0\u95E8\u5E97")])),_:1})):V("",!0)]),t(s).is_store_all==0?(i(),b(M,{key:0,data:t(C)},{default:a(()=>[u(_,{label:"ID",prop:"id","show-overflow-tooltip":""}),u(_,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),u(_,{label:"\u624B\u673A\u53F7\u7801",prop:"phone","show-overflow-tooltip":""}),u(_,{label:"\u8BE6\u7EC6\u5730\u5740",prop:"detailed_address","show-overflow-tooltip":""}),u(_,{label:"\u95E8\u5E97logo",prop:"image","show-overflow-tooltip":""},{default:a(({row:l})=>[u(re,{src:l.image,class:"w-[50px] h-[50px]","preview-teleported":!0},null,8,["src"])]),_:1}),u(_,{label:"\u8425\u4E1A\u72B6\u6001",prop:"is_show","show-overflow-tooltip":""},{default:a(({row:l})=>[p(h(l.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),u(_,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:a(({row:l})=>[Ie((i(),b(w,{type:"danger",link:"",onClick:c=>Z(l.id)},{default:a(()=>e[32]||(e[32]=[p(" \u5220\u9664 ")])),_:2},1032,["onClick"])),[[me,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])):V("",!0)]),_:1})):V("",!0)]),_:1})]),_:1},8,["modelValue"]),u(r,{label:""},{default:a(()=>[u(w,{onClick:ae,type:"primary",class:"w-40"},{default:a(()=>e[34]||(e[34]=[p("\u63D0\u4EA4")])),_:1})]),_:1})]),_:1},8,["model","rules"])]),u(ne,{modelValue:t(y),"onUpdate:modelValue":e[18]||(e[18]=l=>O(y)?y.value=l:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:a(()=>[u(pe,{onOnBindStore:W})]),_:1},8,["modelValue"])]),_:1})}}});export{Ju as default};
|