moreShopAdmin/build/admin/assets/edit11.3304e42f.js

4 lines
14 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 ge,K as Be,M as ve,N as De,b as he,F as ke,I as Ue,L as xe}from"./element-plus.4a7d92a3.js";import{_ as Ae}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.a130c88e.js";import{_ as Re}from"./picker.b29ccc60.js";import{k as Le}from"./index.e2348f6b.js";import{b as qe}from"./store_product.8be38f0f.js";import{d as G,s as Se,r as F,Z as $,i as Te,ap as ze,o as i,K as c,L as a,a as h,S as T,u as t,U as e,j as O,R as p,c as D,T as z,Q as V,a9 as j,M as Ie}from"./@vue.18505fe0.js";import"./lodash.9dc701ad.js";import{a as Ne,u as Me}from"./vue-router.101084e3.js";import{a as Pe}from"./store_category.68323416.js";import{a as $e}from"./store_product_unit.1209b8a7.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.c2e674dc.js";import"./system_store.f26016bb.js";import"./index.08cec107.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.d9a16ced.js";import"./index.ba4db380.js";import"./index.79b9c6fb.js";import"./vuedraggable.1648e3a8.js";import"./vue.393dceb0.js";import"./sortablejs.382fadba.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 Oe={class:"mb-4 text-lg font-bold"},je={key:1},Ge=h("div",{class:"w-full",style:{color:"#64748b"}}," \u53EF\u9009\u62E9\u5C06\u5546\u54C1\u540C\u6B65\u5230\u54EA\u4E9B\u95E8\u5E97\u4F7F\u7528 ",-1),Ke={class:"mb-2"},Ze=G({name:"storeProductEdit"}),ju=G({...Ze,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(He,{emit:Je}){const I=Se(),k=F("info");Le();const E=F("add"),K=(s,u)=>{console.log(s,u)},g=F([]),d=F([]),Z=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"}]),H=()=>{g.value.push({sku_name:"",purchase:0,cost:0,price:0,editable:!0})},J=s=>{g.value.splice(s,1)},o=$({id:"",image:"",store_name:"",bar_code:"",store_info:"",product_type:0,cate_arr:[],cate_id:"",price:"",vip_price:"",unit:"",stock:"",swap:"",cost:"",purchase:"",batch:1,store_batch:1,manufacturer_information:"",rose:"0",is_return:1,is_store_all:1,spec_type:0}),Q=()=>{const u=o.bar_code.replace(/[^a-zA-Z0-9]/g,"");o.bar_code=u},y=F(!1),C=F([]),W=s=>{C.value=C.value.filter(u=>u.id!==s)},X=s=>{s.forEach(u=>{C.value.find(f=>f.id==u.id)||C.value.push(u)}),y.value=!1};let U,x;const A=F(!1);let R;Te(()=>{});const Y=s=>(R=s,A.value=!0,N.lazyLoad(x,U),!1),N={value:"id",label:"name",lazy:!0,lazyLoad(s,u){U||(U=u),x||(x=s);const f=s.value||0;let r={};A.value?(r={name:R},R||(r={pid:f,page_size:1e4})):r={pid:f,page_size:1e4},Pe({...r}).then(m=>{u(m.lists.map(n=>(n.leaf=n.is_children==0,A.value=!1,n)))})}},L=F([]);(()=>{$e({}).then(s=>{L.value=s.lists})})();const ee=$({store_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",trigger:["blur"]}],bar_code:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u6761\u7801",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"]}],swap:[{required:!0,message:"\u8BF7\u8F93\u5165\u5151\u6362\u5E93\u5B58",trigger:["blur"]}],image:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u56FE\u7247",trigger:["blur","change"]}]}),ue=async s=>{for(const u in o)s[u]!=null&&s[u]!=null&&(o[u]=s[u]);o.cate_arr[0]&&(o.cate_arr=o.cate_arr.map(u=>Number(u)))},le=async s=>{const u=await qe({id:s.id});ue(u)};Ne();const q=Me(),ae=async()=>{var f;await((f=I.value)==null?void 0:f.validate());const s={...o};if(o.is_store_all==0&&E.value=="add"?s.store_arr=C.value.map(r=>r.id):E.value=="edit"&&(s.is_store_all=0),!s.cate_arr.length)return Ce.error("\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B");s.cate_id=s.cate_arr[s.cate_arr.length-1],delete s.cate_arr;const u=g.value.map(r=>({sku_name:r.sku_name,unit:r.unit,purchase:r.purchase,cost:r.cost,price:r.price}));console.log(s),console.log("asdads",u),console.log("asdads",d.value)};return q.query.id&&q.query.mode=="edit"&&(E.value="edit",le({id:q.query.id})),(s,u)=>{const f=Re,r=Ve,m=ye,n=ce,B=fe,M=be,S=Fe,w=we,te=ge,oe=Be,_=ve,P=De,re=he,se=Ee,de=ke,pe=Ae,ne=Ue,ie=xe,me=ze("perms");return i(),c(ie,null,{default:a(()=>[h("div",Oe,T(t(E)=="add"?"\u6DFB\u52A0\u5546\u54C1":"\u7F16\u8F91\u5546\u54C1"),1),h("div",null,[e(de,{ref_key:"formRef",ref:I,model:t(o),"label-width":"120px",rules:t(ee)},{default:a(()=>[e(se,{modelValue:t(k),"onUpdate:modelValue":u[18]||(u[18]=l=>O(k)?k.value=l:null),class:"demo-tabs",onTabClick:K},{default:a(()=>[e(S,{label:"\u57FA\u7840\u4FE1\u606F",name:"info"},{default:a(()=>[e(r,{label:"\u5546\u54C1\u56FE\u7247",prop:"image"},{default:a(()=>[e(f,{modelValue:t(o).image,"onUpdate:modelValue":u[0]||(u[0]=l=>t(o).image=l),limit:1},null,8,["modelValue"])]),_:1}),e(r,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:a(()=>[e(m,{modelValue:t(o).store_name,"onUpdate:modelValue":u[1]||(u[1]=l=>t(o).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\u6761\u7801",prop:"bar_code"},{default:a(()=>[e(m,{modelValue:t(o).bar_code,"onUpdate:modelValue":u[2]||(u[2]=l=>t(o).bar_code=l),class:"w-[500px]",onInput:Q,clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u6761\u7801",readonly:!1},null,8,["modelValue"])]),_:1}),e(r,{label:"\u5546\u54C1\u7C7B\u578B",prop:"product_type"},{default:a(()=>[e(B,{modelValue:t(o).product_type,"onUpdate:modelValue":u[3]||(u[3]=l=>t(o).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(M,{class:"w-[500px]",modelValue:t(o).cate_arr,"onUpdate:modelValue":u[4]||(u[4]=l=>t(o).cate_arr=l),filterable:"",clearable:"","before-filter":Y,props:N,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(o).manufacturer_information,"onUpdate:modelValue":u[5]||(u[5]=l=>t(o).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(B,{modelValue:t(o).is_return,"onUpdate:modelValue":u[6]||(u[6]=l=>t(o).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(S,{label:"\u5546\u54C1\u89C4\u683C",name:"spec"},{default:a(()=>[e(r,{label:"\u89C4\u683C\u7C7B\u578B"},{default:a(()=>[e(B,{modelValue:t(o).spec_type,"onUpdate:modelValue":u[7]||(u[7]=l=>t(o).spec_type=l)},{default:a(()=>[e(n,{label:0},{default:a(()=>[p("\u7EDF\u4E00\u89C4\u683C")]),_:1}),e(n,{label:1},{default:a(()=>[p("\u591A\u89C4\u683C")]),_:1})]),_:1},8,["modelValue"])]),_:1}),t(o).spec_type==0?(i(),D(z,{key:0},[e(r,{label:"\u89C4\u683C\u540D\u79F0",prop:"sku_name"},{default:a(()=>[e(m,{modelValue:t(d).sku_name,"onUpdate:modelValue":u[8]||(u[8]=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(M,{class:"w-[500px]",modelValue:t(d).unit,"onUpdate:modelValue":u[9]||(u[9]=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[10]||(u[10]=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[11]||(u[11]=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[12]||(u[12]=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[13]||(u[13]=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[14]||(u[14]=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[15]||(u[15]=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(o).spec_type==1?(i(),c(r,{key:1},{default:a(()=>[e(w,{onClick:H,class:"mb-2"},{default:a(()=>[p("\u6DFB\u52A0\u89C4\u683C")]),_:1}),e(P,{data:t(g),style:{width:"100%"}},{default:a(()=>[e(_,{label:"\u5355\u4F4D",width:"180"},{default:a(l=>[l.row.editable?(i(),c(oe,{key:0,modelValue:l.row.unit,"onUpdate:modelValue":b=>l.row.unit=b,placeholder:"\u8BF7\u9009\u62E9\u5355\u4F4D"},{default:a(()=>[(i(!0),D(z,null,j(t(L),b=>(i(),c(te,{key:b.id,label:b.name,value:b.id},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue"])):V("",!0)]),_:1}),(i(!0),D(z,null,j(t(Z),(l,b)=>(i(),c(_,{key:b,prop:l.prop,label:l.label,width:l.width},{default:a(v=>[v.row.editable?(i(),c(m,{key:0,modelValue:v.row[l.prop],"onUpdate:modelValue":_e=>v.row[l.prop]=_e},null,8,["modelValue","onUpdate:modelValue"])):(i(),D("span",je,T(v.row[l.prop]),1))]),_:2},1032,["prop","label","width"]))),128)),e(_,{label:"\u64CD\u4F5C",width:"100"},{default:a(l=>[e(w,{type:"text",onClick:b=>J(l.$index)},{default:a(()=>[p("\u5220\u9664")]),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])]),_:1})):V("",!0)]),_:1}),e(S,{label:"\u9002\u7528\u95E8\u5E97",name:"store"},{default:a(()=>[t(E)=="add"?(i(),c(r,{key:0,label:"\u6240\u5C5E\u95E8\u5E97",prop:"store_id"},{default:a(()=>[e(B,{modelValue:t(o).is_store_all,"onUpdate:modelValue":u[16]||(u[16]=l=>t(o).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"]),Ge,h("div",Ke,[t(o).is_store_all==0?(i(),c(w,{key:0,type:"primary",onClick:u[17]||(u[17]=l=>y.value=!0)},{default:a(()=>[p("\u6DFB\u52A0\u95E8\u5E97")]),_:1})):V("",!0)]),t(o).is_store_all==0?(i(),c(P,{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(),c(w,{type:"danger",link:"",onClick:b=>W(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[19]||(u[19]=l=>O(y)?y.value=l:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:a(()=>[e(pe,{onOnBindStore:X})]),_:1},8,["modelValue"])]),_:1})}}});export{ju as default};