4 lines
13 KiB
JavaScript
4 lines
13 KiB
JavaScript
import{G as ce,H as fe,a6 as be,x as Fe,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 he,F as ke,I as Ue,L as xe}from"./element-plus.a63a26dd.js";import{_ as Ae}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.3565b593.js";import{_ as Re}from"./picker.b3a6671e.js";import{k as Se}from"./index.914e16f9.js";import{b as Le,d as qe,e as Te}from"./store_product.22e2a1b2.js";import{d as G,s as Ne,r as c,Z as $,i as Pe,ap as ze,o as i,K as f,L as a,a as k,S as T,u as t,U as e,j as O,R as p,c as h,T as N,Q as V,a9 as j,M as Ie}from"./@vue.18505fe0.js";import"./lodash.2473fc51.js";import{a as Me,u as $e}from"./vue-router.101084e3.js";import{a as Oe}from"./store_category.f9164b79.js";import{a as je}from"./store_product_unit.b4bcebf8.js";import"./lodash-es.f52bd8b1.js";import"./async-validator.fb49d0f5.js";import"./@vueuse.fbc6a400.js";import"./@element-plus.edbd5a83.js";import"./dayjs.4884cfc2.js";import"./axios.932d3f8a.js";import"./@ctrl.b082b0c1.js";import"./normalize-wheel-es.8aeb3683.js";import"./@popperjs.36402333.js";import"./index.vue_vue_type_script_setup_true_lang.ecb80feb.js";import"./usePaging.6a6670f9.js";import"./useDictOptions.f757f46e.js";import"./system_store.0a321149.js";import"./index.da3823b2.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.d9a16ced.js";import"./index.dfc6038b.js";import"./index.640585d8.js";import"./vuedraggable.ac9cc40f.js";import"./vue.7b0b04ca.js";import"./sortablejs.82ef1d94.js";import"./pinia.a969beab.js";import"./css-color-function.9f6a56f3.js";import"./color.d1bc3784.js";import"./clone.83700f2e.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.fcc9be76.js";import"./vue-clipboard3.9e751565.js";import"./clipboard.dda64e67.js";import"./echarts.5016c48c.js";import"./zrender.58d022a1.js";import"./tslib.60310f1a.js";import"./highlight.js.31cd7941.js";import"./@highlightjs.b0c09b66.js";const Ge={class:"mb-4 text-lg font-bold"},Ke={key:1},He=k("div",{class:"w-full",style:{color:"#64748b"}}," \u53EF\u9009\u62E9\u5C06\u5546\u54C1\u540C\u6B65\u5230\u54EA\u4E9B\u95E8\u5E97\u4F7F\u7528 ",-1),Je={class:"mb-2"},Qe=G({name:"storeProductEdit"}),Ku=G({...Qe,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(Ze,{emit:We}){const P=Ne(),U=c("info");Se();const E=c("add"),K=(o,u)=>{console.log(o,u)},v=c([]),d=c([]),H=c([{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=c(!1),C=c([]),Z=o=>{C.value=C.value.filter(u=>u.id!==o)},W=o=>{o.forEach(u=>{C.value.find(b=>b.id==u.id)||C.value.push(u)}),y.value=!1};let x,A;const R=c(!1);let S;Pe(()=>{});const X=o=>(S=o,R.value=!0,z.lazyLoad(A,x),!1),z={value:"id",label:"name",lazy:!0,lazyLoad(o,u){x||(x=u),A||(A=o);const b=o.value||0;let r={};R.value?(r={name:S},S||(r={pid:b,page_size:1e4})):r={pid:b,page_size:1e4},Oe({...r}).then(m=>{u(m.lists.map(n=>(n.leaf=n.is_children==0,R.value=!1,n)))})}},L=c([]);(()=>{je({}).then(o=>{L.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 u in s)o[u]!=null&&o[u]!=null&&(s[u]=o[u]);s.cate_arr[0]&&(s.cate_arr=s.cate_arr.map(u=>Number(u)))},ue=async o=>{const u=await Le({id:o.id});ee(u)},le=Me(),B=$e(),ae=async()=>{var b;await((b=P.value)==null?void 0:b.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 u=c([]);s.spec_type==0?u.value=d.value:u.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=u.value,E.value=="edit"?await qe(o):await Te(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,u)=>{const b=Re,r=Ve,m=ye,n=ce,g=fe,I=be,q=Fe,w=we,te=ve,oe=Be,_=ge,M=De,re=he,se=Ee,de=ke,pe=Ae,ne=Ue,ie=xe,me=ze("perms");return i(),f(ie,null,{default:a(()=>[k("div",Ge,T(t(E)=="add"?"\u6DFB\u52A0\u5546\u54C1":"\u7F16\u8F91\u5546\u54C1"),1),k("div",null,[e(de,{ref_key:"formRef",ref:P,model:t(s),"label-width":"120px",rules:t(Y)},{default:a(()=>[e(se,{modelValue:t(U),"onUpdate:modelValue":u[17]||(u[17]=l=>O(U)?U.value=l:null),class:"demo-tabs",onTabClick:K},{default:a(()=>[e(q,{label:"\u57FA\u7840\u4FE1\u606F",name:"info"},{default:a(()=>[e(r,{label:"\u5546\u54C1\u56FE\u7247",prop:"image"},{default:a(()=>[e(b,{modelValue:t(s).image,"onUpdate:modelValue":u[0]||(u[0]=l=>t(s).image=l),limit:1},null,8,["modelValue"])]),_:1}),e(r,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:a(()=>[e(m,{modelValue:t(s).store_name,"onUpdate:modelValue":u[1]||(u[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}),e(r,{label:"\u5546\u54C1\u7C7B\u578B",prop:"product_type"},{default:a(()=>[e(g,{modelValue:t(s).product_type,"onUpdate:modelValue":u[2]||(u[2]=l=>t(s).product_type=l),disabled:t(E)!="add"},{default:a(()=>[e(n,{label:0},{default:a(()=>[p("\u666E\u901A\u4EA7\u54C1")]),_:1}),e(n,{label:1},{default:a(()=>[p("\u4F9B\u9500\u7CFB\u5217\u4EA7\u54C1")]),_:1}),e(n,{label:2},{default:a(()=>[p("\u5151\u6362\u4EA7\u54C1")]),_:1}),e(n,{label:3},{default:a(()=>[p("\u8D60\u54C1")]),_:1})]),_:1},8,["modelValue","disabled"])]),_:1}),e(r,{label:"\u5546\u54C1\u5206\u7C7B",prop:"cate_arr"},{default:a(()=>[e(I,{class:"w-[500px]",modelValue:t(s).cate_arr,"onUpdate:modelValue":u[3]||(u[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}),e(r,{label:"\u5382\u5BB6\u5907\u6CE8",prop:"manufacturer_information"},{default:a(()=>[e(m,{modelValue:t(s).manufacturer_information,"onUpdate:modelValue":u[4]||(u[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}),e(r,{label:"\u9000\u8D27",prop:"is_return"},{default:a(()=>[e(g,{modelValue:t(s).is_return,"onUpdate:modelValue":u[5]||(u[5]=l=>t(s).is_return=l)},{default:a(()=>[e(n,{label:1},{default:a(()=>[p("\u652F\u6301")]),_:1}),e(n,{label:0},{default:a(()=>[p("\u4E0D\u652F\u6301")]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1}),e(q,{label:"\u5546\u54C1\u89C4\u683C",name:"spec"},{default:a(()=>[e(r,{label:"\u89C4\u683C\u7C7B\u578B"},{default:a(()=>[e(g,{modelValue:t(s).spec_type,"onUpdate:modelValue":u[6]||(u[6]=l=>t(s).spec_type=l)},{default:a(()=>[e(n,{label:0},{default:a(()=>[p("\u5355\u89C4\u683C")]),_:1}),e(n,{label:1},{default:a(()=>[p("\u591A\u89C4\u683C")]),_:1})]),_:1},8,["modelValue"])]),_:1}),t(s).spec_type==0?(i(),h(N,{key:0},[e(r,{label:"\u89C4\u683C\u540D\u79F0",prop:"sku_name"},{default:a(()=>[e(m,{modelValue:t(d).sku_name,"onUpdate:modelValue":u[7]||(u[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}),e(r,{label:"\u5546\u54C1\u5355\u4F4D",prop:"unit"},{default:a(()=>[e(I,{class:"w-[500px]",modelValue:t(d).unit,"onUpdate:modelValue":u[8]||(u[8]=l=>t(d).unit=l),options:t(L),props:{value:"id",label:"name",emitPath:!1},placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5355\u4F4D"},null,8,["modelValue","options"])]),_:1}),e(r,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase"},{default:a(()=>[e(m,{modelValue:t(d).purchase,"onUpdate:modelValue":u[9]||(u[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}),e(r,{label:"\u5546\u6237\u4EF7",prop:"cost"},{default:a(()=>[e(m,{modelValue:t(d).cost,"onUpdate:modelValue":u[10]||(u[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}),e(r,{label:"\u4F1A\u5458\u4EF7",prop:"vip_price"},{default:a(()=>[e(m,{modelValue:t(d).vip_price,"onUpdate:modelValue":u[11]||(u[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}),e(r,{label:"\u7EC8\u7AEF\u96F6\u552E\u4EF7",prop:"price"},{default:a(()=>[e(m,{modelValue:t(d).price,"onUpdate:modelValue":u[12]||(u[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}),e(r,{label:"\u96F6\u552E\u8D77\u6279\u91CF",prop:"batch"},{default:a(()=>[e(m,{modelValue:t(d).batch,"onUpdate:modelValue":u[13]||(u[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}),e(r,{label:"\u95E8\u5E97\u8D77\u6279\u91CF",prop:"store_batch"},{default:a(()=>[e(m,{modelValue:t(d).store_batch,"onUpdate:modelValue":u[14]||(u[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(),f(r,{key:1},{default:a(()=>[e(w,{onClick:J,class:"mb-2"},{default:a(()=>[p("\u6DFB\u52A0\u89C4\u683C")]),_:1}),e(M,{data:t(v),style:{width:"100%"}},{default:a(()=>[e(_,{label:"\u5355\u4F4D",width:"180"},{default:a(l=>[l.row.editable?(i(),f(oe,{key:0,modelValue:l.row.unit,"onUpdate:modelValue":F=>l.row.unit=F,placeholder:"\u8BF7\u9009\u62E9\u5355\u4F4D"},{default:a(()=>[(i(!0),h(N,null,j(t(L),F=>(i(),f(te,{key:F.id,label:F.name,value:F.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):V("",!0)]),_:1}),(i(!0),h(N,null,j(t(H),(l,F)=>(i(),f(_,{key:F,prop:l.prop,label:l.label,width:l.width},{default:a(D=>[D.row.editable?(i(),f(m,{key:0,modelValue:D.row[l.prop],"onUpdate:modelValue":_e=>D.row[l.prop]=_e},null,8,["modelValue","onUpdate:modelValue"])):(i(),h("span",Ke,T(D.row[l.prop]),1))]),_:2},1032,["prop","label","width"]))),128)),e(_,{label:"\u64CD\u4F5C",width:"100"},{default:a(l=>[e(w,{type:"text",onClick:F=>Q(l.$index)},{default:a(()=>[p("\u5220\u9664")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),_:1})):V("",!0)]),_:1}),e(q,{label:"\u9002\u7528\u95E8\u5E97",name:"store"},{default:a(()=>[t(E)=="add"?(i(),f(r,{key:0,label:"\u6240\u5C5E\u95E8\u5E97",prop:"store_id"},{default:a(()=>[e(g,{modelValue:t(s).is_store_all,"onUpdate:modelValue":u[15]||(u[15]=l=>t(s).is_store_all=l)},{default:a(()=>[e(n,{label:1},{default:a(()=>[p("\u5168\u90E8\u95E8\u5E97")]),_:1}),e(n,{label:0},{default:a(()=>[p("\u90E8\u5206\u95E8\u5E97")]),_:1})]),_:1},8,["modelValue"]),He,k("div",Je,[t(s).is_store_all==0?(i(),f(w,{key:0,type:"primary",onClick:u[16]||(u[16]=l=>y.value=!0)},{default:a(()=>[p("\u6DFB\u52A0\u95E8\u5E97")]),_:1})):V("",!0)]),t(s).is_store_all==0?(i(),f(M,{key:0,data:t(C)},{default:a(()=>[e(_,{label:"ID",prop:"id","show-overflow-tooltip":""}),e(_,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),e(_,{label:"\u624B\u673A\u53F7\u7801",prop:"phone","show-overflow-tooltip":""}),e(_,{label:"\u8BE6\u7EC6\u5730\u5740",prop:"detailed_address","show-overflow-tooltip":""}),e(_,{label:"\u95E8\u5E97logo",prop:"image","show-overflow-tooltip":""},{default:a(({row:l})=>[e(re,{src:l.image,class:"w-[50px] h-[50px]","preview-teleported":!0},null,8,["src"])]),_:1}),e(_,{label:"\u8425\u4E1A\u72B6\u6001",prop:"is_show","show-overflow-tooltip":""},{default:a(({row:l})=>[p(T(l.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),e(_,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:a(({row:l})=>[Ie((i(),f(w,{type:"danger",link:"",onClick:F=>Z(l.id)},{default:a(()=>[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"]),e(r,{label:""},{default:a(()=>[e(w,{onClick:ae,type:"primary",class:"w-40"},{default:a(()=>[p("\u63D0\u4EA4")]),_:1})]),_:1})]),_:1},8,["model","rules"])]),e(ne,{modelValue:t(y),"onUpdate:modelValue":u[18]||(u[18]=l=>O(y)?y.value=l:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:a(()=>[e(pe,{onOnBindStore:W})]),_:1},8,["modelValue"])]),_:1})}}});export{Ku as default};
|