moreShopAdmin/build/admin/assets/edit11.19a02188.js

4 lines
12 KiB
JavaScript

import{G as ue,H as le,a6 as ae,x as te,y as oe,k as re,D as se,C as ie,w as de,M as pe,b as ne,N as me,F as _e,I as ce,L as fe}from"./element-plus.4a7d92a3.js";import{_ as be}from"./index.vue_vue_type_script_setup_true_name_systemStoreLists_lang.fc6c8022.js";import{_ as Fe}from"./picker.f7b19c1d.js";import{k as Ee}from"./index.ea66144a.js";import{b as ge}from"./store_product.c39d9d12.js";import{d as z,s as Ce,r as f,Z as R,i as Be,ap as Ve,o as b,K as E,L as a,a as B,S,u as t,U as u,j as T,R as d,c as ye,T as ve,Q as C,M as we}from"./@vue.18505fe0.js";import"./lodash.9dc701ad.js";import{a as De,u as he}from"./vue-router.101084e3.js";import{a as xe}from"./store_category.4e7efb7f.js";import{a as Ae}from"./store_product_unit.0838b4b3.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.359e8a2b.js";import"./system_store.0c2f50d1.js";import"./index.912c44f1.js";import"./index.vue_vue_type_style_index_0_scoped_d380c88d_lang.d9a16ced.js";import"./index.66b0d686.js";import"./index.a424cf09.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 Ue={class:"mb-4 text-lg font-bold"},ke=B("div",{class:"w-full",style:{color:"#64748b"}}," \u53EF\u9009\u62E9\u5C06\u5546\u54C1\u540C\u6B65\u5230\u54EA\u4E9B\u95E8\u5E97\u4F7F\u7528 ",-1),qe={class:"mb-2"},Le=z({name:"storeProductEdit"}),ku=z({...Le,props:{dictData:{type:Object,default:()=>({})}},emits:["success","close"],setup(Re,{emit:Se}){const U=Ce(),V=f("info");Ee();const _=f("add"),I=(r,e)=>{console.log(r,e)},l=R({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}),N=()=>{const e=l.bar_code.replace(/[^a-zA-Z0-9]/g,"");l.bar_code=e},F=f(!1),c=f([]),M=r=>{c.value=c.value.filter(e=>e.id!==r)},P=r=>{r.forEach(e=>{c.value.find(n=>n.id==e.id)||c.value.push(e)}),F.value=!1};let y,v;const w=f(!1);let D;Be(()=>{});const $=r=>(D=r,w.value=!0,k.lazyLoad(v,y),!1),k={value:"id",label:"name",lazy:!0,lazyLoad(r,e){y||(y=e),v||(v=r);const n=r.value||0;let s={};w.value?(s={name:D},D||(s={pid:n,page_size:1e4})):s={pid:n,page_size:1e4},xe({...s}).then(p=>{e(p.lists.map(i=>(i.leaf=i.is_children==0,w.value=!1,i)))})}},q=f([]);(()=>{Ae({}).then(r=>{q.value=r.lists})})();const j=R({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"]}],price:[{required:!0,message:"\u8BF7\u8F93\u5165\u7EC8\u7AEF\u96F6\u552E\u4EF7",trigger:["blur"]}],vip_price:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F1A\u5458\u4EF7",trigger:["blur"]}],unit:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u5355\u4F4D",trigger:["blur","change"]}],stock:[{required:!0,message:"\u8BF7\u8F93\u5165\u552E\u5356\u5E93\u5B58",trigger:["blur"]}],swap:[{required:!0,message:"\u8BF7\u8F93\u5165\u5151\u6362\u5E93\u5B58",trigger:["blur"]}],cost:[{required:!0,message:"\u8BF7\u8F93\u5165\u95E8\u5E97\u96F6\u552E",trigger:["blur"]}],purchase:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F9B\u8D27\u4EF7",trigger:["blur"]}],batch:[{required:!0,message:"\u8BF7\u8F93\u5165\u8D77\u6279\u91CF",trigger:["blur"]}],image:[{required:!0,message:"\u8BF7\u8F93\u5165\u5546\u54C1\u56FE\u7247",trigger:["blur","change"]}]}),G=async r=>{for(const e in l)r[e]!=null&&r[e]!=null&&(l[e]=r[e]);l.cate_arr[0]&&(l.cate_arr=l.cate_arr.map(e=>Number(e)))},O=async r=>{const e=await ge({id:r.id});G(e)};De();const h=he(),Z=async()=>{var e;await((e=U.value)==null?void 0:e.validate());const r={...l};if(l.is_store_all==0&&_.value=="add"?r.store_arr=c.value.map(n=>n.id):_.value=="edit"&&(r.is_store_all=0),!r.cate_arr.length)return re.error("\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B");r.cate_id=r.cate_arr[r.cate_arr.length-1],delete r.cate_arr,console.log(r)};return h.query.id&&h.query.mode=="edit"&&(_.value="edit",O({id:h.query.id})),(r,e)=>{const n=Fe,s=se,p=ie,i=ue,g=le,L=ae,x=te,A=de,m=pe,H=ne,K=me,Q=oe,J=_e,W=be,X=ce,Y=fe,ee=Ve("perms");return b(),E(Y,null,{default:a(()=>[B("div",Ue,S(t(_)=="add"?"\u6DFB\u52A0\u5546\u54C1":"\u7F16\u8F91\u5546\u54C1"),1),B("div",null,[u(J,{ref_key:"formRef",ref:U,model:t(l),"label-width":"120px",rules:t(j)},{default:a(()=>[u(Q,{modelValue:t(V),"onUpdate:modelValue":e[17]||(e[17]=o=>T(V)?V.value=o:null),class:"demo-tabs",onTabClick:I},{default:a(()=>[u(x,{label:"\u57FA\u7840\u4FE1\u606F",name:"info"},{default:a(()=>[u(s,{label:"\u5546\u54C1\u56FE\u7247",prop:"image"},{default:a(()=>[u(n,{modelValue:t(l).image,"onUpdate:modelValue":e[0]||(e[0]=o=>t(l).image=o),limit:1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u540D\u79F0",prop:"store_name"},{default:a(()=>[u(p,{modelValue:t(l).store_name,"onUpdate:modelValue":e[1]||(e[1]=o=>t(l).store_name=o),class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u540D\u79F0",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u6761\u7801",prop:"bar_code"},{default:a(()=>[u(p,{modelValue:t(l).bar_code,"onUpdate:modelValue":e[2]||(e[2]=o=>t(l).bar_code=o),class:"w-[500px]",onInput:N,clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u54C1\u6761\u7801",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u7C7B\u578B",prop:"product_type"},{default:a(()=>[u(g,{modelValue:t(l).product_type,"onUpdate:modelValue":e[3]||(e[3]=o=>t(l).product_type=o),disabled:t(_)!="add"},{default:a(()=>[u(i,{label:0},{default:a(()=>[d("\u666E\u901A\u4EA7\u54C1")]),_:1}),u(i,{label:1},{default:a(()=>[d("\u4F9B\u9500\u7CFB\u5217\u4EA7\u54C1")]),_:1}),u(i,{label:2},{default:a(()=>[d("\u5151\u6362\u4EA7\u54C1")]),_:1}),u(i,{label:3},{default:a(()=>[d("\u8D60\u54C1")]),_:1})]),_:1},8,["modelValue","disabled"])]),_:1}),u(s,{label:"\u5546\u54C1\u5206\u7C7B",prop:"cate_arr"},{default:a(()=>[u(L,{class:"w-[500px]",modelValue:t(l).cate_arr,"onUpdate:modelValue":e[4]||(e[4]=o=>t(l).cate_arr=o),filterable:"",clearable:"","before-filter":$,props:k,placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5206\u7C7B"},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u54C1\u5355\u4F4D",prop:"unit"},{default:a(()=>[u(L,{class:"w-[500px]",modelValue:t(l).unit,"onUpdate:modelValue":e[5]||(e[5]=o=>t(l).unit=o),options:t(q),props:{value:"id",label:"name",emitPath:!1},placeholder:"\u8BF7\u9009\u62E9\u5546\u54C1\u5355\u4F4D"},null,8,["modelValue","options"])]),_:1}),u(s,{label:"\u5382\u5BB6\u5907\u6CE8",prop:"manufacturer_information"},{default:a(()=>[u(p,{modelValue:t(l).manufacturer_information,"onUpdate:modelValue":e[6]||(e[6]=o=>t(l).manufacturer_information=o),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(s,{label:"\u9000\u8D27",prop:"is_return"},{default:a(()=>[u(g,{modelValue:t(l).is_return,"onUpdate:modelValue":e[7]||(e[7]=o=>t(l).is_return=o)},{default:a(()=>[u(i,{label:1},{default:a(()=>[d("\u652F\u6301")]),_:1}),u(i,{label:0},{default:a(()=>[d("\u4E0D\u652F\u6301")]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1}),u(x,{label:"\u5546\u54C1\u89C4\u683C",name:"spec"},{default:a(()=>[u(s,{label:"\u89C4\u683C\u7C7B\u578B"},{default:a(()=>[u(g,{modelValue:t(l).spec_type,"onUpdate:modelValue":e[8]||(e[8]=o=>t(l).spec_type=o)},{default:a(()=>[u(i,{label:0},{default:a(()=>[d("\u7EDF\u4E00\u89C4\u683C")]),_:1}),u(i,{label:1},{default:a(()=>[d("\u591A\u89C4\u683C")]),_:1})]),_:1},8,["modelValue"])]),_:1}),t(l).spec_type==0?(b(),ye(ve,{key:0},[u(s,{label:"\u4F9B\u8D27\u4EF7",prop:"purchase"},{default:a(()=>[u(p,{modelValue:t(l).purchase,"onUpdate:modelValue":e[9]||(e[9]=o=>t(l).purchase=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4F9B\u8D27\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u5546\u6237\u4EF7",prop:"cost"},{default:a(()=>[u(p,{modelValue:t(l).cost,"onUpdate:modelValue":e[10]||(e[10]=o=>t(l).cost=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u5546\u6237\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u4F1A\u5458\u4EF7",prop:"vip_price"},{default:a(()=>[u(p,{modelValue:t(l).vip_price,"onUpdate:modelValue":e[11]||(e[11]=o=>t(l).vip_price=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u4F1A\u5458\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u7EC8\u7AEF\u96F6\u552E\u4EF7",prop:"price"},{default:a(()=>[u(p,{modelValue:t(l).price,"onUpdate:modelValue":e[12]||(e[12]=o=>t(l).price=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u7EC8\u7AEF\u96F6\u552E\u4EF7",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u96F6\u552E\u8D77\u6279\u91CF",prop:"batch"},{default:a(()=>[u(p,{modelValue:t(l).batch,"onUpdate:modelValue":e[13]||(e[13]=o=>t(l).batch=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u96F6\u552E\u8D77\u6279\u91CF",readonly:!1},null,8,["modelValue"])]),_:1}),u(s,{label:"\u95E8\u5E97\u8D77\u6279\u91CF",prop:"store_batch"},{default:a(()=>[u(p,{modelValue:t(l).store_batch,"onUpdate:modelValue":e[14]||(e[14]=o=>t(l).store_batch=o),type:"number",class:"w-[500px]",clearable:"",placeholder:"\u8BF7\u8F93\u5165\u95E8\u5E97\u8D77\u6279\u91CF",readonly:!1},null,8,["modelValue"])]),_:1})],64)):C("",!0)]),_:1}),u(x,{label:"\u9002\u7528\u95E8\u5E97",name:"store"},{default:a(()=>[t(_)=="add"?(b(),E(s,{key:0,label:"\u6240\u5C5E\u95E8\u5E97",prop:"store_id"},{default:a(()=>[u(g,{modelValue:t(l).is_store_all,"onUpdate:modelValue":e[15]||(e[15]=o=>t(l).is_store_all=o)},{default:a(()=>[u(i,{label:1},{default:a(()=>[d("\u5168\u90E8\u95E8\u5E97")]),_:1}),u(i,{label:0},{default:a(()=>[d("\u90E8\u5206\u95E8\u5E97")]),_:1})]),_:1},8,["modelValue"]),ke,B("div",qe,[t(l).is_store_all==0?(b(),E(A,{key:0,type:"primary",onClick:e[16]||(e[16]=o=>F.value=!0)},{default:a(()=>[d("\u6DFB\u52A0\u95E8\u5E97")]),_:1})):C("",!0)]),t(l).is_store_all==0?(b(),E(K,{key:0,data:t(c)},{default:a(()=>[u(m,{label:"ID",prop:"id","show-overflow-tooltip":""}),u(m,{label:"\u95E8\u5E97\u540D\u79F0",prop:"name","show-overflow-tooltip":""}),u(m,{label:"\u624B\u673A\u53F7\u7801",prop:"phone","show-overflow-tooltip":""}),u(m,{label:"\u8BE6\u7EC6\u5730\u5740",prop:"detailed_address","show-overflow-tooltip":""}),u(m,{label:"\u95E8\u5E97logo",prop:"image","show-overflow-tooltip":""},{default:a(({row:o})=>[u(H,{src:o.image,class:"w-[50px] h-[50px]","preview-teleported":!0},null,8,["src"])]),_:1}),u(m,{label:"\u8425\u4E1A\u72B6\u6001",prop:"is_show","show-overflow-tooltip":""},{default:a(({row:o})=>[d(S(o.is_show?"\u8425\u4E1A":"\u6253\u70CA"),1)]),_:1}),u(m,{label:"\u64CD\u4F5C",width:"120",fixed:"right"},{default:a(({row:o})=>[we((b(),E(A,{type:"danger",link:"",onClick:ze=>M(o.id)},{default:a(()=>[d(" \u5220\u9664 ")]),_:2},1032,["onClick"])),[[ee,["system_store.system_store/delete"]]])]),_:1})]),_:1},8,["data"])):C("",!0)]),_:1})):C("",!0)]),_:1})]),_:1},8,["modelValue"]),u(s,{label:""},{default:a(()=>[u(A,{onClick:Z,type:"primary",class:"w-40"},{default:a(()=>[d("\u63D0\u4EA4")]),_:1})]),_:1})]),_:1},8,["model","rules"])]),u(X,{modelValue:t(F),"onUpdate:modelValue":e[18]||(e[18]=o=>T(F)?F.value=o:null),title:"\u9009\u62E9\u95E8\u5E97",width:"70%"},{default:a(()=>[u(W,{onOnBindStore:P})]),_:1},8,["modelValue"])]),_:1})}}});export{ku as default};